forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Baramov" <Stefan.Bara...@trx.com>
Subject RE: Appling CSS class to the source tag in apache doc
Date Mon, 14 Feb 2005 16:09:39 GMT

| -----Original Message-----
| From: Ross Gardler [mailto:rgardler@apache.org] 
| Sent: Friday, February 11, 2005 6:44 PM
| To: user@forrest.apache.org
| Subject: Re: Appling CSS class to the source tag in apache doc
| 
| 
| The source tag has a specific meaning hence the class="code" 
| attribute. 
| However, the skin should really allow the user to pass class 
| information 
|   in the way you illustrate in order to allow custom styling. I would 
| consider this a bug, please file a bug report.
| 
| I think a solution is to change the following in 
| main/webapp/skins/common/html/document2html.xsl:
| 
|    <xsl:template match="source">
|      <xsl:apply-templates select="@id"/>
|      <pre class="code">
| 
| to:
| 
|    <xsl:template match="source">
|      <xsl:apply-templates select="@id"/>
|      <pre>
| 	<xsl:attribute name="class">
| 		<xsl:apply-templates select="@class"/>, code
| 	</xsl:attribute>
| 
| Please test it and let us know if this works.
| 

I've tested and it works just fine. I will try to file a bug report. 

However, let me explained my original issue and why I did want to apply
a style to <pre> tag.
The problem with the <pre> tag is that it does not wrap long lines. So
if you have a log file dump or any thing else with very long the line,
the final document looks very ugly. So I found a solution to apply a
CSS: 

    .myskin {
      font-size: 95%;
      white-space: pre-wrap;       /* css-3 */
      white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
      white-space: -pre-wrap;      /* Opera 4-6 */
      white-space: -o-pre-wrap;    /* Opera 7 */
      word-wrap: break-word;       /* Internet Explorer 5.5+ */
word-wrap:break-word;
    }

( I have not invented this one, found it through google )

It worked fine both in Firefox and IE6 for <pre> tags. However, it does
not work so well for <p> tags in IE6 since IE6 does not really support
white-space: pre-wrap;. But hey who is using this old browser anyway ;) 

I am documenting this because in the 

Forrest-0.6\src\core\context\skins\common\xslt\html\document2html.xsl

I found this for the <pre> tag:  

<!-- Temporarily removed long-line-splitter ... gives out-of-memory
problems -->
      <xsl:apply-templates/>
<!--
    <xsl:call-template name="format">
    <xsl:with-param select="." name="txt" /> 
     <xsl:with-param name="width">80</xsl:with-param> 
     </xsl:call-template>
-->

And if this is causing out-of-memory errors, then may be a CSS can be
applied (only for the <pre> tags) instead of XSL. Just a suggestion

- Stefan

Mime
View raw message