[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get the inner html of a href link.
- From: netawater <standin-000@xxxxxxxxx>
- Date: Wed, 11 Mar 2009 22:03:05 +0800
- X-ml-name: emacs-w3m
- X-mail-count: 10759
- References: <87ocw9mrfa.fsf@xxxxxxxxxxxxxx> <b4mwsaw4zuv.fsf@xxxxxxx>
Katsumi Yamaoka <yamaoka@xxxxxxx> writes:
>>>>>> In [emacs-w3m : No.10757] netawater wrote:
>> I can use w3m-anchor to get anchor value, but how about the inner
>> html?
>> for example,
>> <a
> href="http://www.wuala.com/blog/2009/02/effective-wuala-usage-part-5-speeding.html">Effective
>> Wuala Usage: Speeding up file search in Wuala </a>
>> I want to get the content between <a> and </a>.
>
>> I have check w3m-anchor, it calls (w3m-get-text-property-around
>> 'w3m-href-anchor), I guess I need use 'w3m-href-text, but it does't
>> not work.
>
>> Thank you very much!
>
> Does this function satisfy your purpose? It returns text that
> is just displayed in the w3m-mode buffer:
>
> (defun my-w3m-href-text (&optional position)
> "Return text linked up with the href anchor at the given POSITION.
> NOTE: If POSITION is omitted, it searches for the property in one
> character before and behind the current position, and point will move
> to the position where the property exists."
> (when (if position
> (get-text-property position 'w3m-href-anchor)
> (w3m-get-text-property-around 'w3m-href-anchor))
> (w3m-replace-in-string
> (buffer-substring-no-properties
> (if (or (bobp)
> (not (get-text-property (1- (point)) 'w3m-href-anchor)))
> (point)
> (previous-single-property-change (point) 'w3m-href-anchor))
> (next-single-property-change (point) 'w3m-href-anchor))
> " +\\'" "")))
Thank you very much! It works well.
however it seems it is not easy to get html attribute in w3m which
does not implement DOM, is it?