From f2d1302b1ba5567d243610d31cc7d8cd0df7b8b1 Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Mon, 28 Nov 2011 16:26:40 +0000
Subject: [PATCH] Implement basic syntax highlighting for HTML and PDF
---
opendj3/src/main/docbkx/shared/man-ldapsearch.xml | 2
opendj3/src/main/docbkx-stylesheets/html/chunked.xsl | 76 +++++++++++++++++++
opendj3/src/main/docbkx/shared/man-ldappasswordmodify.xml | 2
opendj3/src/main/docbkx/shared/man-ldapmodify.xml | 2
opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl | 80 +++++++++++++++++++
opendj3/src/main/docbkx-stylesheets/fo/coredoc.xsl | 16 +--
opendj3/src/main/docbkx/dev-guide/chap-get-sdk.xml | 2
opendj3/src/main/docbkx/admin-guide/chap-ldap-operations.xml | 2
opendj3/src/main/docbkx/shared/man-ldapdelete.xml | 2
opendj3/src/main/docbkx/shared/man-ldapcompare.xml | 2
opendj3/pom.xml | 8 ++
11 files changed, 176 insertions(+), 18 deletions(-)
diff --git a/opendj3/pom.xml b/opendj3/pom.xml
index ba6e750..1424c85 100644
--- a/opendj3/pom.xml
+++ b/opendj3/pom.xml
@@ -142,6 +142,8 @@
<draftMode>yes</draftMode>
<draftWatermarkImage>http://docbook.sourceforge.net/release/images/draft.png</draftWatermarkImage>
+ <highlightSource>1</highlightSource>
+
<includes>*/OpenDJ-*.xml</includes>
<xincludeSupported>true</xincludeSupported>
@@ -555,6 +557,12 @@
<version>1.2</version> <!-- Should use 2.0, but it doesn't exist? -->
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>net.sf.xslthl</groupId>
+ <artifactId>xslthl</artifactId>
+ <version>2.0.2</version>
+ <scope>runtime</scope>
+ </dependency>
</dependencies>
</plugin>
<plugin>
diff --git a/opendj3/src/main/docbkx-stylesheets/fo/coredoc.xsl b/opendj3/src/main/docbkx-stylesheets/fo/coredoc.xsl
index 7d2f4cc..88e3d2a 100644
--- a/opendj3/src/main/docbkx-stylesheets/fo/coredoc.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/fo/coredoc.xsl
@@ -10,7 +10,7 @@
! Suite 900, Mountain View, California, 94041, USA.
!
! You can also obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
+ ! src/main/resources/legal-notices/CC-BY-NC-ND.txt.
! See the License for the specific language governing permissions
! and limitations under the License.
!
@@ -24,22 +24,22 @@
!
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
<xsl:import href="urn:docbkx:stylesheet"/>
<xsl:import href="titlepages.xsl"/>
-
+ <xsl:import href="urn:docbkx:stylesheet/highlight.xsl" />
+
<xsl:param name="page.height.portrait">9in</xsl:param>
<xsl:param name="page.width.portrait">7.5in</xsl:param>
<xsl:param name="double.sided" select="1"></xsl:param>
<xsl:param name="fop1.extensions" select="1" />
-
+
<xsl:param name="body.font.master">9</xsl:param>
<xsl:param name="body.font.family">DejaVuSerif</xsl:param>
<xsl:param name="dingbat.font.family">DejaVuSerif</xsl:param>
<xsl:param name="monospace.font.family">DejaVuSansMono</xsl:param>
<xsl:param name="sans.font.family">DejaVuSans</xsl:param>
<xsl:param name="title.font.family">DejaVuSans</xsl:param>
-
+
<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="font-size">14pt</xsl:attribute>
</xsl:attribute-set>
@@ -58,7 +58,6 @@
<xsl:attribute name="font-style">italic</xsl:attribute>
</xsl:attribute-set>
-
<xsl:param name="generate.toc">
appendix nop
article/appendix nop
@@ -99,7 +98,6 @@
<xsl:attribute name="wrap-option">no-wrap</xsl:attribute>
<xsl:attribute name="font-size">0.75em</xsl:attribute>
</xsl:attribute-set>
-
- <xsl:param name="ulink.footnotes" select="1" />
-</xsl:stylesheet>
+ <xsl:param name="ulink.footnotes" select="1" />
+</xsl:stylesheet>
\ No newline at end of file
diff --git a/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
index 07cfeb1..9e567ba 100644
--- a/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/html/chunked.xsl
@@ -24,8 +24,10 @@
!
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xslthl="http://xslthl.sf.net" exclude-result-prefixes="xslthl"
version="1.0">
<xsl:import href="urn:docbkx:stylesheet" />
+ <xsl:import href="urn:docbkx:stylesheet/highlight.xsl" />
<xsl:param name="html.stylesheet">css/coredoc.css</xsl:param>
<xsl:param name="chunk.section.depth" select="0" />
@@ -56,4 +58,78 @@
<xsl:param name="toc.section.depth" select="1" />
<xsl:param name="toc.max.depth" select="1" />
<xsl:param name="generate.meta.abstract" select="1" />
+
+ <xsl:template match="xslthl:keyword" mode="xslthl">
+ <strong class="hl-keyword">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:string" mode="xslthl">
+ <strong class="hl-string">
+ <em style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:comment" mode="xslthl">
+ <em class="hl-comment" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </xsl:template>
+ <xsl:template match="xslthl:directive" mode="xslthl">
+ <span class="hl-directive" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:tag" mode="xslthl">
+ <strong class="hl-tag" style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:attribute" mode="xslthl">
+ <span class="hl-attribute" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:value" mode="xslthl">
+ <span class="hl-value" style="color: #333">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:html" mode="xslthl">
+ <strong>
+ <em style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:xslt" mode="xslthl">
+ <strong style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <!-- Not emitted since XSLTHL 2.0 -->
+ <xsl:template match="xslthl:section" mode="xslthl">
+ <strong>
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:number" mode="xslthl">
+ <span class="hl-number">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:annotation" mode="xslthl">
+ <em>
+ <span class="hl-annotation" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </em>
+ </xsl:template>
+ <!-- Not sure which element will be in final XSLTHL 2.0 -->
+ <xsl:template match="xslthl:doccomment|xslthl:doctype" mode="xslthl">
+ <strong class="hl-tag" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
</xsl:stylesheet>
diff --git a/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl b/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
index 1dddbd0..13edc7e 100644
--- a/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
+++ b/opendj3/src/main/docbkx-stylesheets/html/coredoc.xsl
@@ -10,7 +10,7 @@
! Suite 900, Mountain View, California, 94041, USA.
!
! You can also obtain a copy of the license at
- ! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
+ ! src/main/resources/legal-notices/CC-BY-NC-ND.txt.
! See the License for the specific language governing permissions
! and limitations under the License.
!
@@ -24,8 +24,10 @@
!
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0">
+xmlns:xslthl="http://xslthl.sf.net" exclude-result-prefixes="xslthl"
+version="1.0">
<xsl:import href="urn:docbkx:stylesheet" />
+ <xsl:import href="urn:docbkx:stylesheet/highlight.xsl" />
<xsl:param name="html.stylesheet">css/coredoc.css</xsl:param>
<xsl:param name="generate.legalnotice.link" select="1" />
@@ -53,4 +55,78 @@
<xsl:param name="toc.section.depth" select="1" />
<xsl:param name="toc.max.depth" select="1" />
<xsl:param name="generate.meta.abstract" select="1" />
+
+ <xsl:template match="xslthl:keyword" mode="xslthl">
+ <strong class="hl-keyword">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:string" mode="xslthl">
+ <strong class="hl-string">
+ <em style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:comment" mode="xslthl">
+ <em class="hl-comment" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </xsl:template>
+ <xsl:template match="xslthl:directive" mode="xslthl">
+ <span class="hl-directive" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:tag" mode="xslthl">
+ <strong class="hl-tag" style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:attribute" mode="xslthl">
+ <span class="hl-attribute" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:value" mode="xslthl">
+ <span class="hl-value" style="color: #333">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:html" mode="xslthl">
+ <strong>
+ <em style="color: #f58220">
+ <xsl:apply-templates mode="xslthl"/>
+ </em>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:xslt" mode="xslthl">
+ <strong style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <!-- Not emitted since XSLTHL 2.0 -->
+ <xsl:template match="xslthl:section" mode="xslthl">
+ <strong>
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
+ <xsl:template match="xslthl:number" mode="xslthl">
+ <span class="hl-number">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </xsl:template>
+ <xsl:template match="xslthl:annotation" mode="xslthl">
+ <em>
+ <span class="hl-annotation" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </span>
+ </em>
+ </xsl:template>
+ <!-- Not sure which element will be in final XSLTHL 2.0 -->
+ <xsl:template match="xslthl:doccomment|xslthl:doctype" mode="xslthl">
+ <strong class="hl-tag" style="color: #868686">
+ <xsl:apply-templates mode="xslthl"/>
+ </strong>
+ </xsl:template>
</xsl:stylesheet>
diff --git a/opendj3/src/main/docbkx/admin-guide/chap-ldap-operations.xml b/opendj3/src/main/docbkx/admin-guide/chap-ldap-operations.xml
index 3635284..45c2056 100644
--- a/opendj3/src/main/docbkx/admin-guide/chap-ldap-operations.xml
+++ b/opendj3/src/main/docbkx/admin-guide/chap-ldap-operations.xml
@@ -774,7 +774,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
diff --git a/opendj3/src/main/docbkx/dev-guide/chap-get-sdk.xml b/opendj3/src/main/docbkx/dev-guide/chap-get-sdk.xml
index 3723c2f..6573377 100644
--- a/opendj3/src/main/docbkx/dev-guide/chap-get-sdk.xml
+++ b/opendj3/src/main/docbkx/dev-guide/chap-get-sdk.xml
@@ -207,7 +207,7 @@
described, if you have a directory server running import sample data,
and test your configuration with a sample client application.</para>
- <programlisting>// Test.java:
+ <programlisting language="java">// Test.java:
// Kick the SDK tires, reading Babs Jensen's entry and displaying LDIF.
// If your LDAP server is not listening on localhost:1389, or if your
// data are different change the appropriate lines below.
diff --git a/opendj3/src/main/docbkx/shared/man-ldapcompare.xml b/opendj3/src/main/docbkx/shared/man-ldapcompare.xml
index e67b03c..4c8c917 100644
--- a/opendj3/src/main/docbkx/shared/man-ldapcompare.xml
+++ b/opendj3/src/main/docbkx/shared/man-ldapcompare.xml
@@ -298,7 +298,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
diff --git a/opendj3/src/main/docbkx/shared/man-ldapdelete.xml b/opendj3/src/main/docbkx/shared/man-ldapdelete.xml
index 4664f35..e79d891 100644
--- a/opendj3/src/main/docbkx/shared/man-ldapdelete.xml
+++ b/opendj3/src/main/docbkx/shared/man-ldapdelete.xml
@@ -301,7 +301,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
diff --git a/opendj3/src/main/docbkx/shared/man-ldapmodify.xml b/opendj3/src/main/docbkx/shared/man-ldapmodify.xml
index 5d678e5..7edbab4 100644
--- a/opendj3/src/main/docbkx/shared/man-ldapmodify.xml
+++ b/opendj3/src/main/docbkx/shared/man-ldapmodify.xml
@@ -316,7 +316,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
diff --git a/opendj3/src/main/docbkx/shared/man-ldappasswordmodify.xml b/opendj3/src/main/docbkx/shared/man-ldappasswordmodify.xml
index abba9c2..6f9e680 100644
--- a/opendj3/src/main/docbkx/shared/man-ldappasswordmodify.xml
+++ b/opendj3/src/main/docbkx/shared/man-ldappasswordmodify.xml
@@ -297,7 +297,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
diff --git a/opendj3/src/main/docbkx/shared/man-ldapsearch.xml b/opendj3/src/main/docbkx/shared/man-ldapsearch.xml
index b194dba..d740244 100644
--- a/opendj3/src/main/docbkx/shared/man-ldapsearch.xml
+++ b/opendj3/src/main/docbkx/shared/man-ldapsearch.xml
@@ -399,7 +399,7 @@
<para>You can use <filename>~/.opendj/tools.properties</filename> to set
the defaults for bind DN, host name, and port number as in the following
example.</para>
- <programlisting language="java">hostname=directory.example.com
+ <programlisting language="ini">hostname=directory.example.com
port=1389
bindDN=uid=kvaughan,ou=People,dc=example,dc=com
--
Gitblit v1.10.0