forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicola Ken Barozzi <nicola...@apache.org>
Subject Re: [PATCH] for <source> elements that are too wide
Date Wed, 22 Oct 2003 12:43:38 GMT
Conal Tuohy wrote:

> Some of the pages in the Cocoon HTML-format documentation are too wide to
> display on screen, or print in portrait-orientation on paper, because of
> <source> elements with very long lines.
...
> The patched stylesheet includes an extra template (and a couple of helper
> templates) to render simple <source> elements (i.e. those which contain only
> text content) as a <div> containing a sequence of <p> elements. The font
> name itself is not specified, so it will generally be a proportional font.
> The font size is reduced ("smaller"). The template uses CSS "style"
> attributes to retain the original indentation while still allowing for
> line-wrapping. A single space of indentation is rendered as a 4pt indent.
> Where a line of source wraps, the wrapped part of the line is further
> indented by 8pt (i.e. equivalent to 2 spaces). The template also attempts to
> keep quoted string literals together on one line, by converting spaces
> inside quotes into non-breaking spaces.

At some point, we already had a stylesheed that broke the source tag in 
many, but it used too much memory so we disabled it.

The fact is that wrapping is dependant on the language used, so it 
should really be done by a real parser. This means that IMHO it's 
correct to keep <pre> as is for default.

What should instead be done, is that this kind of source, for example:

  <source type="java">
    import...
    class...
  </source>

gets transformed in highlighted java code. If someone does a patch for 
this, I'll insert it in Forrest in no time :-)

For a hint, there is a highlighter example in Cocoon CVS already IIRC, 
with Chaperon (that Forrest already uses for the Wiki Format).

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------



Mime
View raw message