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-stylesheets/html/chunked.xsl |   76 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

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>

--
Gitblit v1.10.0