Lisp syntax highlighting
Fri Jun 5 16:17:33 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Lisp syntax highlighting
hunk ./Makefile 3
-# xmllint xsltproc docbook
+# - xmllint
+# - saxon
+# - docbook
+# - xslthl
hunk ./Makefile 8
+# Debian: download the xslthl jar into the doc/ directory; install the remaining dependancies with apt.
+#
+
+SAXON_JAR := /usr/share/java/saxon.jar
+XSLTHL_JAR := $(firstword $(wildcard xslthl*.jar))
+CLASSPATH := "$(SAXON_JAR):$(XSLTHL_JAR)"
+SAXON := java -classpath $(CLASSPATH) \
+ -Dxslthl.config="file://$(realpath xslthl-config.xml)" \
+ com.icl.saxon.StyleSheet
hunk ./Makefile 22
-manual.html: $(DEPENDANCIES)
- xmllint --xinclude --postvalid manual.xml > /dev/null
- xsltproc --xinclude -o $@ manual.xsl manual.xml
+# validate & process xincludes
+manual.tmp: $(DEPENDANCIES)
+ xmllint --xinclude --postvalid manual.xml > manual.tmp
+
+
+manual.html: manual.tmp
+ $(SAXON) -o manual.html manual.tmp manual.xsl
hunk ./Makefile 30
-index.html: $(DEPENDANCIES)
-# xsltproc --xinclude --stringparam base.dir "manual/" chunk.xsl manual.xml
- xsltproc --xinclude chunk.xsl manual.xml
hunk ./Makefile 31
-[_^I_][_$_]
+index.html: manual.tmp
+ $(SAXON) manual.tmp chunk.xsl
hunk ./Makefile 36
- rm -f -- *.html
+ rm -f -- *.html *.tmp
hunk ./chunk.xsl 8
+<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/highlight.xsl"/>
+<xsl:param name="highlight.source" select="1"/>
+
hunk ./kde.xml 15
-<programlisting>
+<programlisting language="lisp">
hunk ./kde.xml 19
-<programlisting>
+<programlisting language="lisp">
addfile ./lisp-hl.xml
hunk ./lisp-hl.xml 1
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Common Lisp highlighter for xslthl -->
+<highlighters>
+ <highlighter type="keywords">
+ <keyword>defun</keyword>
+ <keyword>defgeneric</keyword>
+ <keyword>defmethod</keyword>
+ <keyword>lambda</keyword>
+
+ <keyword>if</keyword>
+ <keyword>when</keyword>
+ <keyword>unless</keyword>
+
+ <keyword>let</keyword>
+ <keyword>let*</keyword>
+
+ <keyword>defvar</keyword>
+ <keyword>defparameter</keyword>
+ <keyword>defpackage</keyword>
+
+ <keyword>defclass</keyword>
+ <keyword>defstruct</keyword>
+
+ <keyword>declare</keyword>
+ <keyword>declaim</keyword>
+ <keyword>proclaim</keyword>
+ <ignoreCase />
+ </highlighter>
+ <highlighter type="word">
+ <word>in-package</word>
+ <style>keyword</style>
+ </highlighter>
+
+ <!-- comments -->
+ <highlighter type="multiline-comment">
+ <start>#|</start>
+ <end>|#</end>
+ <style>comment</style>
+ </highlighter>
+ <highlighter type="oneline-comment">
+ ;
+ </highlighter>
+
+ <!-- string -->
+ <highlighter type="string">
+ <string>"</string>
+ <spanNewLines/>
+ </highlighter>
+
+ <!-- keyword package -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=[ \(])(:[^\s\)]+)</pattern>
+ <style>attribute</style>
+ </highlighter>
+
+ <!-- defined symbols -->
+ <!-- defclass -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defclass\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defun -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defun\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defgeneric -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defgeneric\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defmethod -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defmethod\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defvar -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defvar\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defparameter -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defparameter\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+ <!-- defstruct -->
+ <highlighter type="regex">
+ <pattern>(?&lt;=defstruct\s)(\S+)</pattern>
+ <style>directive</style>
+ </highlighter>
+
+ <!-- numbers [_$_]
+ TODO does not work? -->
+ <highlighter type="number">
+ <point>.</point>
+ <exponent>d</exponent> <!-- double-float -->
+ <exponent>e</exponent> <!-- float -->
+ <exponent>f</exponent> <!-- single-float -->
+ <exponent>l</exponent> <!-- long-float -->
+ <exponent>s</exponent> <!-- short-float -->
+ <ignoreCase />
+ </highlighter>
+ <!-- numbers -->
+ <highlighter type="hexnumber">
+ <prefix>#x</prefix>
+ <ignoreCase />
+ </highlighter>
+</highlighters>
hunk ./manual.xsl 8
+<xsl:import href="/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/highlight.xsl"/>
+<xsl:param name="highlight.source" select="1"/>
+
hunk ./qt.xml 76
-<programlisting>
+<programlisting language="lisp">
hunk ./qt.xml 100
-<programlisting>
+<programlisting language="lisp">
hunk ./qt.xml 131
-<programlisting language="po">
+<programlisting language="lisp">
hunk ./qt.xml 157
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 25
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 31
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 40
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 56
-<programlisting>(frob my-instance 1)</programlisting>
+<programlisting language="lisp">(frob my-instance 1)</programlisting>
hunk ./smoke.xml 63
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 69
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 84
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 90
-<programlisting>
+<programlisting language="lisp">
hunk ./smoke.xml 104
-<programlisting>(defclass the-object-does-nothing (<classname>qt:object</classname>)
+<programlisting language="lisp">(defclass the-object-does-nothing (<classname>qt:object</classname>)
hunk ./smoke.xml 177
-<programlisting>(<methodname>qt:byte-array.number</methodname> 37)</programlisting>
+<programlisting language="lisp">(<methodname>qt:byte-array.number</methodname> 37)</programlisting>
hunk ./smoke.xml 182
-<programlisting>(<genericfunction>cxx:number</genericfunction> (find-class '<classname>qt:byte-array</classname>) 37)</programlisting>
+<programlisting language="lisp">(<genericfunction>cxx:number</genericfunction> (find-class '<classname>qt:byte-array</classname>) 37)</programlisting>
hunk ./smoke.xml 186
-<programlisting>(<genericfunction>cxx:number</genericfunction> (make-instance '<classname>qt:byte-array</classname>) 37)</programlisting>
+<programlisting language="lisp">(<genericfunction>cxx:number</genericfunction> (make-instance '<classname>qt:byte-array</classname>) 37)</programlisting>
hunk ./smoke.xml 213
-<programlisting>
+<programlisting language="lisp">
addfile ./xslthl-config.xml
hunk ./xslthl-config.xml 1
+<?xml version="1.0" encoding="UTF-8"?>
+<xslthl-config>
+ <highlighter id="lisp" file="lisp-hl.xml" />
+ <namespace prefix="xslthl" uri="http://xslthl.sf.net" />
+</xslthl-config>