svn commit: r44109 - in head/share: misc xml
Gabor Kovesdan
gabor at FreeBSD.org
Mon Mar 3 16:16:58 UTC 2014
Author: gabor
Date: Mon Mar 3 16:16:57 2014
New Revision: 44109
URL: http://svnweb.freebsd.org/changeset/doc/44109
Log:
- Add line number indicators to programlisting and screen in the HTML
version. This makes linewrap indicators unnecessary since the
line numbers suggest where the line is wrapped.
No objection from: doc
Modified:
head/share/misc/docbook.css
head/share/xml/freebsd-xhtml-common.xsl
Modified: head/share/misc/docbook.css
==============================================================================
--- head/share/misc/docbook.css Mon Mar 3 15:11:19 2014 (r44108)
+++ head/share/misc/docbook.css Mon Mar 3 16:16:57 2014 (r44109)
@@ -265,26 +265,47 @@ html {
text-decoration: underline;
}
-pre.screen {
- white-space: pre;
- overflow: auto;
+.screen {
+ white-space: pre-wrap;
font-family: monospace;
padding: 1ex;
background-color: #edc;
- border: 1px solid #ccc;
+ border-style: solid;
+ border-color: #EEB985;
+ border-width: 0 0 0 24px;
border-radius: 6px;
line-height: 1.1;
+ counter-reset: code;
}
-pre.programlisting {
- white-space: pre;
- overflow: auto;
+.programlisting {
+ white-space: pre-wrap;
font-family: monospace;
padding: 1ex;
background-color: #eee;
- border: 1px solid #ccc;
+ border-style: solid;
+ border-color: #BABABA;
+ border-width: 0 0 0 24px;
border-radius: 6px;
line-height: 1.1;
+ counter-reset: code;
+}
+
+span.verbatim {
+ counter-increment: code;
+ display: block;
+ padding: 0 13px 0 29px;
+ position: relative;
+ margin: 0 -8px 0 -24px;
+ overflow: hidden;
+}
+
+span.verbatim:before {
+ width: 24px;
+ text-align: right;
+ content: counter(code) " ";
+ position: absolute;
+ left: -10px;
}
@media screen { /* hide from IE3 */
@@ -378,7 +399,7 @@ pre.programlisting {
font-weight: bold;
}
-pre.screen strong {
+.screen strong {
font-weight: normal;
}
Modified: head/share/xml/freebsd-xhtml-common.xsl
==============================================================================
--- head/share/xml/freebsd-xhtml-common.xsl Mon Mar 3 15:11:19 2014 (r44108)
+++ head/share/xml/freebsd-xhtml-common.xsl Mon Mar 3 16:16:57 2014 (r44109)
@@ -7,6 +7,7 @@
version='1.0'
xmlns:str="http://exslt.org/strings"
xmlns:db="http://docbook.org/ns/docbook"
+ xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="db"
extension-element-prefixes="str">
@@ -31,6 +32,7 @@
<xsl:param name="generate.manifest" select="1"/>
<xsl:param name="generate.meta.abstract" select="1"/>
<xsl:param name="html.longdesc" select="0"/>
+ <xsl:param name="hyphenate.verbatim" select="1"/>
<xsl:param name="make.valid.html" select="1"/>
<xsl:param name="html.cleanup" select="1"/>
@@ -292,4 +294,43 @@
<hr/>
</xsl:template>
+
+ <xsl:template name="wrap.text">
+ <xsl:param name="content"/>
+
+ <xsl:for-each select="str:tokenize($content, '
')">
+ <span class="verbatim"><xsl:value-of select="."/>
</span>
+ </xsl:for-each>
+ </xsl:template>
+
+ <!-- XXX: breaks line numbering and syntax highlighting that we do not use
+ anyway -->
+ <xsl:template match="db:programlisting|db:screen|db:synopsis">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:call-template name="anchor"/>
+
+ <xsl:variable name="div.element">
+ <xsl:choose>
+ <xsl:when test="$make.clean.html != 0">div</xsl:when>
+ <xsl:otherwise>pre</xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
+ <xsl:apply-templates select="." mode="common.html.attributes"/>
+ <xsl:if test="@width != ''">
+ <xsl:attribute name="width">
+ <xsl:value-of select="@width"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:call-template name="wrap.text">
+ <xsl:with-param name="content">
+ <xsl:apply-templates/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:element>
+ </xsl:template>
</xsl:stylesheet>
More information about the svn-doc-head
mailing list