[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: How to get the inner html of a href link.



>>>>> In [emacs-w3m : No.10770] netawater wrote:
>> (with-temp-buffer
>>   (insert "<a href=\"http://www.example.com\"\
>>  fOo=\"FoO-vAlUe\"\
>>  BaR=\"bAr-VaLuE\">\n")
>>   (goto-char 2)
>>   (w3m-parse-attributes (foo (bar :case-ignore))
>>     (list foo bar)))
>>  => ("FoO-vAlUe" "bar-value")
>>
>> The point has to be within the tag, and only attributes that follow
>> the point will be extracted.

> Thank you for your reply but I tried run these function, it returns
> (nil nil). I use GNU emacs 22.2.1 and w3m-0.5.2.

I guess you've set the default value of `case-fold-search'
variable to nil intentionally.  Supposing it's right, I think
setting it to nil is not a good idea, since programmers likely
assume that it remains the default, i.e. t, or easily forget to
bind it to t locally.  This should work:

(with-temp-buffer
  (insert "<a href=\"http://www.example.com\"\
  fOo=\"FoO-vAlUe\"\
  BaR=\"bAr-VaLuE\">\n")
  (goto-char 2)
  (let ((case-fold-search t))
    (w3m-parse-attributes (foo (bar :case-ignore))
      (list foo bar))))