[Laszlo-reviews] For Review: Change 20100605-bargull-iBh Summary: improve appearance of leading white-space in <programlisting>

P T Withington ptw at pobox.com
Mon Jun 7 07:42:06 PDT 2010


I'm pretty sure the 1.08 is me, because I find that the tty font looks too small visually otherwise.  I wasn't worried about the indenting, since it's a fixed-width font.

If that is really of concern, I can only think of two other ways:

1) adjust the tracking:  letter-spacing: -0.08em

2) create a nested div for each level of indentation give those divs the same padding as the single line code

On 2010-06-05, at 12:07, André Bargull wrote:

> Do you know of a better way to handle this bug? IMO, this patch is a bit clumsy.
> 
> - André
> 
> 
> Change 20100605-bargull-iBh by bargull at Bargull02 on 2010-06-05 17:37:38
> in /home/anba/src/svn/openlaszlo/trunk
> for http://svn.openlaszlo.org/openlaszlo/trunk
> 
> Summary: improve appearance of leading white-space in <programlisting>
> 
> Bugs Fixed: LPP-5990 (xslt for <programlisting> formats code blocks poorly)
> 
> Technical Reviewer: ptw
> QA Reviewer: (pending)
> 
> Details:
> The programlisting's code font-size is set to 1.08em to improve readability (see styles.css). But there arises one disadvantage:
> increasing the font-size also increases the width of the leading white-space in each line. This is clearly not intended. So we'd like to tell the css to increase the font-size only after the leading white-space, but unfortunately this isn't possible (at least I don't know how to do this). This is how I worked around this problem:
> - when the code is processed in lzx-pretty-print.xsl, I annotate all leading white-space with a <leading-space> element
> - and in common-html.xsl, the <leading-space> element gets transformed to a simple <span> element with the "leading-space" css-class set
> - the "leading-space" css-class has got a font-size of 0.926em, which is the reciprocal of 1.08, so it effectively reverts the increased font-size of code blocks
> 
> styles.css also adds padding for code blocks, but this is actually only useful for single-line code. Multi-line code are now marked with a "multiline" attribute, so it's possible to attach a different css-class to those elements (see common-html.xsl).
> 
> 
> Tests:
> ant developers
> open dguide chapters with programlisting
> 
> Files:
> M docs/includes/styles.css
> M docs/src/xsl/common-html.xsl
> M docs/src/xsl/lzx-pretty-print.xsl
> 
> Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20100605-bargull-iBh.tar
> 




More information about the Laszlo-reviews mailing list