Gnus development mailing list
 help / color / mirror / Atom feed
* w3 rendering
@ 1999-11-09  6:47 Lars Magne Ingebrigtsen
  1999-11-09 10:39 ` Eric Marsden
  1999-11-09 12:12 ` William M. Perry
  0 siblings, 2 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-09  6:47 UTC (permalink / raw)


So -- nnultimate has the parsed html in a variable, and I would like
to insert html from that parse tree into a buffer.  So that I can let
w3 parse it and render it later.  :-)

Like this:

1. nnultimate calls w3-parse-buffer
2. nnultimate finds the <td> cell in the parsed tree
3. nnultimate wants to insert that HTML into the article bufffer so that
4. Gnus can let the text/html handler (i.e., w3) render it

I can't find a way to do 3).  I've grepped through the w3 sources
some, but I don't really know what to grep for...

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09  6:47 w3 rendering Lars Magne Ingebrigtsen
@ 1999-11-09 10:39 ` Eric Marsden
  1999-11-09 14:21   ` Lars Magne Ingebrigtsen
  1999-11-09 12:12 ` William M. Perry
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Marsden @ 1999-11-09 10:39 UTC (permalink / raw)


>>>>> "lmi" == Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

  lmi> 1. nnultimate calls w3-parse-buffer
  lmi> 2. nnultimate finds the <td> cell in the parsed tree
  lmi> 3. nnultimate wants to insert that HTML into the article bufffer so that
  lmi> 4. Gnus can let the text/html handler (i.e., w3) render it

I don't know if this helps ... see also `w3-display-parse-tree'.
  
   (defun nnultimate-w3-subtree (tree)
     (when (listp tree)
       (cond ((eq 'td (car tree))
              ;; it's (td nil ((p nil ("data"))))
              (insert (format "%s\n" (caaddr (caaddr tree)))))
             ((listp (cdr tree))
              (mapcar #'nnultimate-w3-subtree tree)))))
   
   (defun nnultimate-w3-test ()
     (let ((source (get-buffer-create " *nnultimate-w3*"))
           (parsed (get-buffer-create " *nnultimate-parse*"))
           parse-tree)
       (switch-to-buffer source)
       (erase-buffer)
       (url-insert-file-contents "http://www.laas.fr/~emarsden/td-test.html")
       (setq parse-tree (w3-parse-buffer source))
       (switch-to-buffer parsed)
       (erase-buffer)
       (while parse-tree
         (nnultimate-w3-subtree (car parse-tree))
         (setq parse-tree (cdr parse-tree)))))

-- 
Eric Marsden
It's elephants all the way down


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09  6:47 w3 rendering Lars Magne Ingebrigtsen
  1999-11-09 10:39 ` Eric Marsden
@ 1999-11-09 12:12 ` William M. Perry
  1999-11-09 14:21   ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 9+ messages in thread
From: William M. Perry @ 1999-11-09 12:12 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> So -- nnultimate has the parsed html in a variable, and I would like
> to insert html from that parse tree into a buffer.  So that I can let
> w3 parse it and render it later.  :-)
> 
> Like this:
> 
> 1. nnultimate calls w3-parse-buffer
> 2. nnultimate finds the <td> cell in the parsed tree
> 3. nnultimate wants to insert that HTML into the article bufffer so that
> 4. Gnus can let the text/html handler (i.e., w3) render it
> 
> I can't find a way to do 3).  I've grepped through the w3 sources
> some, but I don't really know what to grep for...

You mean you want to insert it as raw HTML, or just directly draw what
you've already filtered out?  The display engine relies on certain pieces
of the parse tree being there at the beginning.  Most notably the special
'*document' tag make sit set up the local drawing variables and create a
special buffer.  You could do something like:

(defun nnultimate-draw-content (content)
  (w3-draw-tree (list (list '*document nil content)))
  (w3-finish-drawing))

-bp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09 10:39 ` Eric Marsden
@ 1999-11-09 14:21   ` Lars Magne Ingebrigtsen
  1999-11-09 15:13     ` William M. Perry
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-09 14:21 UTC (permalink / raw)


Eric Marsden <emarsden@mail.dotcom.fr> writes:

> I don't know if this helps ... see also `w3-display-parse-tree'.
> 
>    (defun nnultimate-w3-subtree (tree)
>      (when (listp tree)
>        (cond ((eq 'td (car tree))
>               ;; it's (td nil ((p nil ("data"))))
>               (insert (format "%s\n" (caaddr (caaddr tree)))))

Yeah, but I want

<p>
People talking and probably <a href="thing">linking</a> and stuff...

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09 12:12 ` William M. Perry
@ 1999-11-09 14:21   ` Lars Magne Ingebrigtsen
  1999-11-14 19:51     ` Greg Stark
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-09 14:21 UTC (permalink / raw)


wmperry@aventail.com (William M. Perry) writes:

> You mean you want to insert it as raw HTML, or just directly draw what
> you've already filtered out?

Insert it as raw HTML.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09 14:21   ` Lars Magne Ingebrigtsen
@ 1999-11-09 15:13     ` William M. Perry
  1999-11-10  4:15       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: William M. Perry @ 1999-11-09 15:13 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Eric Marsden <emarsden@mail.dotcom.fr> writes:
> 
> > I don't know if this helps ... see also `w3-display-parse-tree'.
> > 
> >    (defun nnultimate-w3-subtree (tree)
> >      (when (listp tree)
> >        (cond ((eq 'td (car tree))
> >               ;; it's (td nil ((p nil ("data"))))
> >               (insert (format "%s\n" (caaddr (caaddr tree)))))
> 
> Yeah, but I want
> 
> <p>
> People talking and probably <a href="thing">linking</a> and stuff...

Well, you could convert it back to HTML, but that would entail re-parsing
it again, which can be slow.  What if you defined a new MIME type
application/x-emacsw3-parsed-html and just 'princ' it into the buffer?

-bp


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09 15:13     ` William M. Perry
@ 1999-11-10  4:15       ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-10  4:15 UTC (permalink / raw)


wmperry@aventail.com (William M. Perry) writes:

> Well, you could convert it back to HTML, but that would entail re-parsing
> it again, which can be slow.  What if you defined a new MIME type
> application/x-emacsw3-parsed-html and just 'princ' it into the buffer?

I could do that, but that would mean "polluting" mm* with something
that's rather Gnus-specific.

And these articles are rather small, so re-parsing them will be quite
fast.

Anyway, writing a parsed-tree-to-html function is quite easy since the 
parsed-tree structure is so eminently sane, so I'll just do that.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-09 14:21   ` Lars Magne Ingebrigtsen
@ 1999-11-14 19:51     ` Greg Stark
  1999-11-15 19:53       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Stark @ 1999-11-14 19:51 UTC (permalink / raw)



Why not pass the parsed structure to W3 directly and have it render it right
away instead of putting text into a buffer and having W3 read that text? Even
if the text is lisp it's still unnecessary overhead. 

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> wmperry@aventail.com (William M. Perry) writes:
> 
> > You mean you want to insert it as raw HTML, or just directly draw what
> > you've already filtered out?
> 
> Insert it as raw HTML.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    larsi@gnus.org * Lars Magne Ingebrigtsen
> 

-- 
greg



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: w3 rendering
  1999-11-14 19:51     ` Greg Stark
@ 1999-11-15 19:53       ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-15 19:53 UTC (permalink / raw)


Greg Stark <gsstark@mit.edu> writes:

> Why not pass the parsed structure to W3 directly and have it render
> it right away instead of putting text into a buffer and having W3
> read that text? Even if the text is lisp it's still unnecessary
> overhead.

The backend has to give Gnus a buffer filled with something.  Gnus
will then decide how to render whatever it is.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-11-15 19:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-09  6:47 w3 rendering Lars Magne Ingebrigtsen
1999-11-09 10:39 ` Eric Marsden
1999-11-09 14:21   ` Lars Magne Ingebrigtsen
1999-11-09 15:13     ` William M. Perry
1999-11-10  4:15       ` Lars Magne Ingebrigtsen
1999-11-09 12:12 ` William M. Perry
1999-11-09 14:21   ` Lars Magne Ingebrigtsen
1999-11-14 19:51     ` Greg Stark
1999-11-15 19:53       ` Lars Magne Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).