[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.10757] netawater wrote:
> I can use w3m-anchor to get anchor value, but how about the inner
> html?
> for example,
> <a
> 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))
      (if (or (bobp)
	      (not (get-text-property (1- (point)) 'w3m-href-anchor)))
	(previous-single-property-change (point) 'w3m-href-anchor))
      (next-single-property-change (point) 'w3m-href-anchor))
     " +\\'" "")))