all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Rendering HTML
@ 2010-09-18 20:06 Lars Magne Ingebrigtsen
  2010-09-18 20:12 ` Benjamin Hawkes-Lewis
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-18 20:06 UTC (permalink / raw)
  To: emacs-devel

The next think I thought I'd tackle (after a couple more weeks of
polishing up the recent changes to Gnus) is writing a very simple HTML
renderer for Emacs.

I'm not very ambitious here at all -- just something that will make
simple, non-CSS-ey HTML (like what you find in emails and RSS entries)
look OK.

Since we have the HTML parser in Emacs, most of the HTML rendering is
trivial (I mean, doing stuff like <a href>, <img>, <br>, etc).  The one
challenging (well, challenging to me) thing is actually how to do
tables.

You have stuff like

<table>
<tr>
<td width=30%>
<table>
<tr>
<td width=40px rowspan=2>
...

So you have all these boxes inside of boxes, with some constraints that
are absolute, and others that are relative (% and getting the width of a
box depending on what it contains and how you break the text in the
box), and so on.

So before I give my brain a strain trying to think about this, has
anybody else done something like this?  Either code that can be included
in Emacs, or other Lisp code that I can peek at, or, failing all that,
just somebody who has written something about how to approach this?

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




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

* Re: Rendering HTML
  2010-09-18 20:06 Rendering HTML Lars Magne Ingebrigtsen
@ 2010-09-18 20:12 ` Benjamin Hawkes-Lewis
  2010-09-22 13:54   ` Mario Lang
  2010-09-19 12:14 ` joakim
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Benjamin Hawkes-Lewis @ 2010-09-18 20:12 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: emacs-devel

On 18 Sep 2010, at 21:06, Lars Magne Ingebrigtsen wrote:
> So before I give my brain a strain trying to think about this, has
> anybody else done something like this?  Either code that can be included
> in Emacs, or other Lisp code that I can peek at, or, failing all that,
> just somebody who has written something about how to approach this?

You're aware of http://www.gnu.org/software/w3/ right?

--
Benjamin Hawkes-Lewis





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

* Re: Rendering HTML
  2010-09-18 20:06 Rendering HTML Lars Magne Ingebrigtsen
  2010-09-18 20:12 ` Benjamin Hawkes-Lewis
@ 2010-09-19 12:14 ` joakim
  2010-09-19 12:15 ` joakim
  2010-09-20 16:14 ` Chong Yidong
  3 siblings, 0 replies; 11+ messages in thread
From: joakim @ 2010-09-19 12:14 UTC (permalink / raw)
  To: emacs-devel

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

> The next think I thought I'd tackle (after a couple more weeks of
> polishing up the recent changes to Gnus) is writing a very simple HTML
> renderer for Emacs.
>
> I'm not very ambitious here at all -- just something that will make
> simple, non-CSS-ey HTML (like what you find in emails and RSS entries)
> look OK.
>
> Since we have the HTML parser in Emacs, most of the HTML rendering is
> trivial (I mean, doing stuff like <a href>, <img>, <br>, etc).  The one
> challenging (well, challenging to me) thing is actually how to do
> tables.
>
> You have stuff like
>
> <table>
> <tr>
> <td width=30%>
> <table>
> <tr>
> <td width=40px rowspan=2>
> ...
>
> So you have all these boxes inside of boxes, with some constraints that
> are absolute, and others that are relative (% and getting the width of a
> box depending on what it contains and how you break the text in the
> box), and so on.
>
> So before I give my brain a strain trying to think about this, has
> anybody else done something like this?  Either code that can be included
> in Emacs, or other Lisp code that I can peek at, or, failing all that,
> just somebody who has written something about how to approach this?

FWIW I have given it some slight thought.  Having some form of table
rendering in Emacs would make it possible to have greater readability
for a great deal of web-pages in Emacs, so its worthwile IMHO.

The thing I thought of, was to re-use the window rendering code, so as
to allow rendering of sub-windows inside Emacs windows. There has been
lots of threads about this and two different sets of patches. I wrote
one proposal called "window-groups". I think Martin Rudalics has a newer
and better proposal.

The idea for tables, then, would be to have each cell render as this new
form of sub-window, inside an Emacs window.

-- 
Joakim Verona



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

* Re: Rendering HTML
  2010-09-18 20:06 Rendering HTML Lars Magne Ingebrigtsen
  2010-09-18 20:12 ` Benjamin Hawkes-Lewis
  2010-09-19 12:14 ` joakim
@ 2010-09-19 12:15 ` joakim
  2010-09-19 13:39   ` Chad Brown
  2010-09-20 16:14 ` Chong Yidong
  3 siblings, 1 reply; 11+ messages in thread
From: joakim @ 2010-09-19 12:15 UTC (permalink / raw)
  To: emacs-devel

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

> The next think I thought I'd tackle (after a couple more weeks of
> polishing up the recent changes to Gnus) is writing a very simple HTML
> renderer for Emacs.
>
> I'm not very ambitious here at all -- just something that will make
> simple, non-CSS-ey HTML (like what you find in emails and RSS entries)
> look OK.
>
> Since we have the HTML parser in Emacs, most of the HTML rendering is
> trivial (I mean, doing stuff like <a href>, <img>, <br>, etc).  The one
> challenging (well, challenging to me) thing is actually how to do
> tables.
>
> You have stuff like
>
> <table>
> <tr>
> <td width=30%>
> <table>
> <tr>
> <td width=40px rowspan=2>
> ...
>
> So you have all these boxes inside of boxes, with some constraints that
> are absolute, and others that are relative (% and getting the width of a
> box depending on what it contains and how you break the text in the
> box), and so on.
>
> So before I give my brain a strain trying to think about this, has
> anybody else done something like this?  Either code that can be included
> in Emacs, or other Lisp code that I can peek at, or, failing all that,
> just somebody who has written something about how to approach this?

FWIW I have given it some slight thought.  Having some form of table
rendering in Emacs would make it possible to have greater readability
for a great deal of web-pages in Emacs, so its worthwile IMHO.

The thing I thought of, was to re-use the window rendering code, so as
to allow rendering of sub-windows inside Emacs windows. There has been
lots of threads about this and two different sets of patches. I wrote
one proposal called "window-groups". I think Martin Rudalics has a newer
and better proposal.

The idea for tables, then, would be to have each cell render as this new
form of sub-window, inside an Emacs window.

-- 
Joakim Verona



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

* Re: Rendering HTML
  2010-09-19 12:15 ` joakim
@ 2010-09-19 13:39   ` Chad Brown
  2010-09-19 13:43     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Chad Brown @ 2010-09-19 13:39 UTC (permalink / raw)
  To: Emacs-Devel devel


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

> The next think I thought I'd tackle (after a couple more weeks of
> polishing up the recent changes to Gnus) is writing a very simple HTML
> renderer for Emacs.


Org-mode has a text-based table editor/layout module, as a minor mode:
	
	http://orgmode.org/manual/Tables.html

It looks like orgtbl does character-based spacing, either automatically
resizing or with explicit sizes but no percentage-based reflow.  It might 
be helpful as a starting point.   Alternately, you could get crazy with SVG 
support. 

*Chad




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

* Re: Rendering HTML
  2010-09-19 13:39   ` Chad Brown
@ 2010-09-19 13:43     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-19 13:43 UTC (permalink / raw)
  To: emacs-devel

Chad Brown <yandros@MIT.EDU> writes:

> It looks like orgtbl does character-based spacing, either automatically
> resizing or with explicit sizes but no percentage-based reflow.  It might 
> be helpful as a starting point.

Thanks.

From the manual it looks like it doesn't do nested tables and stuff,
which is what's hairy...

> Alternately, you could get crazy with SVG support.

Heh.  I don't think I want to get that crazy.  :-)

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




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

* Re: Rendering HTML
  2010-09-18 20:06 Rendering HTML Lars Magne Ingebrigtsen
                   ` (2 preceding siblings ...)
  2010-09-19 12:15 ` joakim
@ 2010-09-20 16:14 ` Chong Yidong
  2010-09-21 14:37   ` Lars Magne Ingebrigtsen
  3 siblings, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2010-09-20 16:14 UTC (permalink / raw)
  To: emacs-devel

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

> You have stuff like
>
> <table>
> <tr>
> <td width=30%>
> <table>
> <tr>
> <td width=40px rowspan=2>
> ...
>
> So you have all these boxes inside of boxes, with some constraints that
> are absolute, and others that are relative (% and getting the width of a
> box depending on what it contains and how you break the text in the
> box), and so on.
>
> So before I give my brain a strain trying to think about this, has
> anybody else done something like this?  Either code that can be included
> in Emacs, or other Lisp code that I can peek at, or, failing all that,
> just somebody who has written something about how to approach this?

One thing that comes to mind is ses.el.  I don't know how much of that
code is generally reusable, though.



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

* Re: Rendering HTML
  2010-09-20 16:14 ` Chong Yidong
@ 2010-09-21 14:37   ` Lars Magne Ingebrigtsen
  2010-09-21 22:08     ` Andy Moreton
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-09-21 14:37 UTC (permalink / raw)
  To: emacs-devel

Chong Yidong <cyd@stupidchicken.com> writes:

> One thing that comes to mind is ses.el.  I don't know how much of that
> code is generally reusable, though.

Thanks; I'll have a look.

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




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

* Re: Rendering HTML
  2010-09-21 14:37   ` Lars Magne Ingebrigtsen
@ 2010-09-21 22:08     ` Andy Moreton
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Moreton @ 2010-09-21 22:08 UTC (permalink / raw)
  To: emacs-devel

On Tue 21 Sep 2010, Lars Magne Ingebrigtsen wrote:

> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> One thing that comes to mind is ses.el.  I don't know how much of that
>> code is generally reusable, though.
>
> Thanks; I'll have a look.

You should also take a look at textmodes/table.el for another tables
package (which org-mode interoperates with).

    AndyM




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

* Re: Rendering HTML
  2010-09-18 20:12 ` Benjamin Hawkes-Lewis
@ 2010-09-22 13:54   ` Mario Lang
  2010-09-22 15:56     ` T.V. Raman
  0 siblings, 1 reply; 11+ messages in thread
From: Mario Lang @ 2010-09-22 13:54 UTC (permalink / raw)
  To: emacs-devel

Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com> writes:

> On 18 Sep 2010, at 21:06, Lars Magne Ingebrigtsen wrote:
>> So before I give my brain a strain trying to think about this, has
>> anybody else done something like this?  Either code that can be included
>> in Emacs, or other Lisp code that I can peek at, or, failing all that,
>> just somebody who has written something about how to approach this?
>
> You're aware of http://www.gnu.org/software/w3/ right?

Yeah, I've used Emacs/W3 for years, found it very useful, despite its
slowness.  And yes, it did quite good table rendering actually.

Emacspeak had (perhaps still has) quite extensive support for W3 as
well.
Like, being able to read just a single column of a table, which
was quite an important feature in the non-CSS days.
Or, using HTML markup information to do meaningful voice changes...

-- 
CYa,
  ⡍⠁⠗⠊⠕



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

* Rendering HTML
  2010-09-22 13:54   ` Mario Lang
@ 2010-09-22 15:56     ` T.V. Raman
  0 siblings, 0 replies; 11+ messages in thread
From: T.V. Raman @ 2010-09-22 15:56 UTC (permalink / raw)
  To: emacs-devel, Mario Lang

Additionally emacspeak pre-filters the incoming HTML  via a
configurable set of XSL  stylesheets -- and once you give W3
cleaned-up html, it does pretty well.
-- 

-- 


On 9/22/10, Mario Lang <mlang@delysid.org> wrote:
> Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com> writes:
>
>> On 18 Sep 2010, at 21:06, Lars Magne Ingebrigtsen wrote:
>>> So before I give my brain a strain trying to think about this, has
>>> anybody else done something like this?  Either code that can be included
>>> in Emacs, or other Lisp code that I can peek at, or, failing all that,
>>> just somebody who has written something about how to approach this?
>>
>> You're aware of http://www.gnu.org/software/w3/ right?
>
> Yeah, I've used Emacs/W3 for years, found it very useful, despite its
> slowness.  And yes, it did quite good table rendering actually.
>
> Emacspeak had (perhaps still has) quite extensive support for W3 as
> well.
> Like, being able to read just a single column of a table, which
> was quite an important feature in the non-CSS days.
> Or, using HTML markup information to do meaningful voice changes...
>
> --
> CYa,
>   ⡍⠁⠗⠊⠕
>
>



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

end of thread, other threads:[~2010-09-22 15:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-18 20:06 Rendering HTML Lars Magne Ingebrigtsen
2010-09-18 20:12 ` Benjamin Hawkes-Lewis
2010-09-22 13:54   ` Mario Lang
2010-09-22 15:56     ` T.V. Raman
2010-09-19 12:14 ` joakim
2010-09-19 12:15 ` joakim
2010-09-19 13:39   ` Chad Brown
2010-09-19 13:43     ` Lars Magne Ingebrigtsen
2010-09-20 16:14 ` Chong Yidong
2010-09-21 14:37   ` Lars Magne Ingebrigtsen
2010-09-21 22:08     ` Andy Moreton

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.