Do you know of a better way to handle this bug? IMO, this patch is a bit
clumsy.
- André
Change 20100605-bargull-iBh by barg...@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