From: Jirka Kosek Date: Fri, 18 Jul 2008 21:26:36 +0000 (+0000) Subject: Upgraded to support the latest version of XSLTHL 2.0 X-Git-Tag: release/1.79.1~6^2~1282 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d63a7f1492cf2e8b7b122bd889a18ce077ec956;p=docbook-dsssl Upgraded to support the latest version of XSLTHL 2.0 -- nested markup in highlited code is now processed -- it is no longer needed to specify path XSLTHL configuration file using Java property -- support for new languages, including Perl, Python and Ruby was added --- diff --git a/xsl/fo/highlight.xsl b/xsl/fo/highlight.xsl index 829aad844..ae9c71fda 100644 --- a/xsl/fo/highlight.xsl +++ b/xsl/fo/highlight.xsl @@ -15,28 +15,28 @@ ******************************************************************** --> - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + diff --git a/xsl/fo/param.ent b/xsl/fo/param.ent index 77a5d4a37..61454fd5b 100644 --- a/xsl/fo/param.ent +++ b/xsl/fo/param.ent @@ -89,6 +89,7 @@ + diff --git a/xsl/fo/param.xweb b/xsl/fo/param.xweb index 36b481efe..d89b07d5c 100644 --- a/xsl/fo/param.xweb +++ b/xsl/fo/param.xweb @@ -256,6 +256,7 @@ generate.section.toc.level; &subscript.properties; &pgwide.properties; &highlight.source; +&highlight.xslthl.config; &highlight.default.language; &email.delimiters.enabled; §ion.container.element; @@ -649,6 +650,7 @@ around all these parameters. + diff --git a/xsl/highlighting/c-hl.xml b/xsl/highlighting/c-hl.xml index ad86bb3fd..1503dd1d9 100644 --- a/xsl/highlighting/c-hl.xml +++ b/xsl/highlighting/c-hl.xml @@ -1,105 +1,101 @@ - - - - - /* - */ - - - - // - - - - # - - - - " - \ - - - - ' - \ - - - - <<< - - - - and - auto - break - case - char - class - __CLASS__ - const - continue - declare - default - do - double - else - enum - exit - extern - __FILE__ - float - for - global - goto - if - include - int - __LINE__ - long - new - or - private - protected - public - register - return - short - signed - sizeof - static - struct - switch - typedef - union - unsigned - void - volatile - while - - - - - \ No newline at end of file + + + + + /** + */ + + + + /// + + + + /* + */ + + // + + + # + \ + + + + " + \ + + + ' + \ + + + 0x + ul + lu + u + l + + + + . + + e + ul + lu + u + f + l + + + + auto + _Bool + break + case + char + _Complex + const + continue + default + do + double + else + enum + extern + float + for + goto + if + _Imaginary + inline + int + long + register + restrict + return + short + signed + sizeof + static + struct + switch + typedef + union + unsigned + void + volatile + while + + \ No newline at end of file diff --git a/xsl/highlighting/common.xsl b/xsl/highlighting/common.xsl index 198cd3408..604074380 100644 --- a/xsl/highlighting/common.xsl +++ b/xsl/highlighting/common.xsl @@ -1,9 +1,18 @@ + xmlns:d="http://docbook.org/ns/docbook" + + xmlns:s6hl="http://net.sf.xslthl/ConnectorSaxon6" + xmlns:sbhl="http://net.sf.xslthl/ConnectorSaxonB" + xmlns:xhl="http://net.sf.xslthl/ConnectorXalan" + xmlns:saxon6="http://icl.com/saxon" + xmlns:saxonb="http://saxon.sf.net/" + xmlns:xalan="http://xml.apache.org/xalan" + + xmlns:exsl="http://exslt.org/common" + xmlns:xslthl="http://xslthl.sf.net" + exclude-result-prefixes="exsl d xslthl s6hl sbhl xhl" + version='1.0'> + + + + + + + + + + + + @@ -33,7 +54,7 @@ - + @@ -44,7 +65,23 @@ - + + + + + + + + + + + + + + @@ -58,5 +95,27 @@ - + + + + unprocessed xslthl style: + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xsl/highlighting/cpp-hl.xml b/xsl/highlighting/cpp-hl.xml new file mode 100644 index 000000000..db57d5e76 --- /dev/null +++ b/xsl/highlighting/cpp-hl.xml @@ -0,0 +1,150 @@ + + + + + /** + */ + + + + /// + + + + /* + */ + + // + + + # + \ + + + + " + \ + + + ' + \ + + + 0x + ul + lu + u + l + + + + . + + e + ul + lu + u + f + l + + + + + auto + _Bool + break + case + char + _Complex + const + continue + default + do + double + else + enum + extern + float + for + goto + if + _Imaginary + inline + int + long + register + restrict + return + short + signed + sizeof + static + struct + switch + typedef + union + unsigned + void + volatile + while + + asm + dynamic_cast + namespace + reinterpret_cast + try + bool + explicit + new + static_cast + typeid + catch + false + operator + template + typename + class + friend + private + this + using + const_cast + inline + public + throw + virtual + delete + mutable + protected + true + wchar_t + + \ No newline at end of file diff --git a/xsl/highlighting/csharp-hl.xml b/xsl/highlighting/csharp-hl.xml new file mode 100644 index 000000000..99c2e3e66 --- /dev/null +++ b/xsl/highlighting/csharp-hl.xml @@ -0,0 +1,187 @@ + + + + + /** + */ + + + + /// + + + + /* + */ + + // + + + [ + ] + ( + ) + + + + # + \ + + + + + @" + " + \ + + + + " + \ + + + ' + \ + + + 0x + ul + lu + u + l + + + + . + + e + ul + lu + u + f + d + m + l + + + + abstract + as + base + bool + break + byte + case + catch + char + checked + class + const + continue + decimal + default + delegate + do + double + else + enum + event + explicit + extern + false + finally + fixed + float + for + foreach + goto + if + implicit + in + int + interface + internal + is + lock + long + namespace + new + null + object + operator + out + override + params + private + protected + public + readonly + ref + return + sbyte + sealed + short + sizeof + stackalloc + static + string + struct + switch + this + throw + true + try + typeof + uint + ulong + unchecked + unsafe + ushort + using + virtual + void + volatile + while + + + + add + alias + get + global + partial + remove + set + value + where + yield + + \ No newline at end of file diff --git a/xsl/highlighting/delphi-hl.xml b/xsl/highlighting/delphi-hl.xml index 3fab5c2ed..d5b4d1a04 100644 --- a/xsl/highlighting/delphi-hl.xml +++ b/xsl/highlighting/delphi-hl.xml @@ -1,174 +1,200 @@ - - - - - { - } - - - - (* - *) - - - - // - - - - ' - - - - - - - and - else - inherited - packed - then - array - end - initialization - procedure - threadvar - as - except - inline - program - to - asm - exports - interface - property - try - begin - file - is - raise - type - case - final - label - record - unit - class - finalization - library - repeat - unsafe - const - finally - mod - resourcestring - until - constructor - for - nil - sealed - uses - destructor - function - not - set - var - dispinterface - goto - object - shl - while - div - if - of - shr - with - do - implementation - or - static - xor - downto - in - out - string - - - at - on - - - absolute - dynamic - local - platform - requires - abstract - export - message - private - resident - assembler - external - name - protected - safecall - automated - far - near - public - stdcall - cdecl - forward - nodefault - published - stored - contains - implements - overload - read - varargs - default - index - override - readonly - virtual - deprecated - inline - package - register - write - dispid - library - pascal - reintroduce - writeonly - - - - - - + + + + + + {$ + } + + + + + (*$ + ) + + + + { + } + + + (* + *) + + // + + ' + + + + #$ + + + + + # + + + + + $ + + + + . + e + + + + + and + else + inherited + packed + then + array + end + initialization + procedure + threadvar + as + except + inline + program + to + asm + exports + interface + property + try + begin + file + is + raise + type + case + final + label + record + unit + class + finalization + library + repeat + unsafe + const + finally + mod + resourcestring + until + constructor + for + nil + sealed + uses + destructor + function + not + set + var + dispinterface + goto + object + shl + while + div + if + of + shr + with + do + implementation + or + static + xor + downto + in + out + string + + + at + on + + + absolute + dynamic + local + platform + requires + abstract + export + message + private + resident + assembler + external + name + protected + safecall + automated + far + near + public + stdcall + cdecl + forward + nodefault + published + stored + contains + implements + overload + read + varargs + default + index + override + readonly + virtual + deprecated + inline + package + register + write + dispid + library + pascal + reintroduce + writeonly + + + \ No newline at end of file diff --git a/xsl/highlighting/ini-hl.xml b/xsl/highlighting/ini-hl.xml index dbebfa7de..8a938f306 100644 --- a/xsl/highlighting/ini-hl.xml +++ b/xsl/highlighting/ini-hl.xml @@ -1,43 +1,45 @@ - - - - - (?m)(;.*)$ - - - - - (?m)^(\[.+\]\s*)$ - - - - - (?m)^(.+=) - - - - - + + + + ; + + + ^(\[.+\]\s*)$ + + MULTILINE + + + + ^(.+)(?==) + + MULTILINE + + \ No newline at end of file diff --git a/xsl/highlighting/java-hl.xml b/xsl/highlighting/java-hl.xml index 419b7cb86..672d518b4 100644 --- a/xsl/highlighting/java-hl.xml +++ b/xsl/highlighting/java-hl.xml @@ -1,98 +1,117 @@ - - - - - /* - */ - - - - // - - - - " - \ - - - - ' - \ - - - - abstract - boolean - break - byte - case - catch - char - class - const - continue - default - do - double - else - extends - final - finally - float - for - goto - if - implements - import - instanceof - int - interface - long - native - new - package - private - protected - public - return - short - static - strictfp - super - switch - synchronized - this - throw - throws - transient - try - void - volatile - while - - - - + + + + + /** + */ + + + + /* + */ + + // + + " + \ + + + ' + \ + + + @ + ( + ) + + + 0x + + + + . + e + f + d + l + + + + abstract + boolean + break + byte + case + catch + char + class + const + continue + default + do + double + else + extends + final + finally + float + for + goto + if + implements + import + instanceof + int + interface + long + native + new + package + private + protected + public + return + short + static + strictfp + super + switch + synchronized + this + throw + throws + transient + try + void + volatile + while + + \ No newline at end of file diff --git a/xsl/highlighting/javascript-hl.xml b/xsl/highlighting/javascript-hl.xml new file mode 100644 index 000000000..08c90ba52 --- /dev/null +++ b/xsl/highlighting/javascript-hl.xml @@ -0,0 +1,147 @@ + + + + + /* + */ + + // + + " + \ + + + ' + \ + + + 0x + + + + . + e + + + + break + case + catch + continue + default + delete + do + else + finally + for + function + if + in + instanceof + new + return + switch + this + throw + try + typeof + var + void + while + with + + abstract + boolean + byte + char + class + const + debugger + double + enum + export + extends + final + float + goto + implements + import + int + interface + long + native + package + private + protected + public + short + static + super + synchronized + throws + transient + volatile + + + prototype + + Array + Boolean + Date + Error + EvalError + Function + Math + Number + Object + RangeError + ReferenceError + RegExp + String + SyntaxError + TypeError + URIError + + decodeURI + decodeURIComponent + encodeURI + encodeURIComponent + eval + isFinite + isNaN + parseFloat + parseInt + + Infinity + NaN + undefined + + \ No newline at end of file diff --git a/xsl/highlighting/m2-hl.xml b/xsl/highlighting/m2-hl.xml index 2d2c7693b..b145f7444 100644 --- a/xsl/highlighting/m2-hl.xml +++ b/xsl/highlighting/m2-hl.xml @@ -1,86 +1,90 @@ - - - - - (* - *) - - - - " - - - - ' - - - - and - array - begin - by - case - const - definition - div - do - else - elsif - end - exit - export - for - from - if - implementation - import - in - loop - mod - module - not - of - or - pointer - procedure - qualified - record - repeat - return - set - then - to - type - until - var - while - with - - - - - - + + + + + (* + *) + + + " + + + ' + + + . + e + + + + and + array + begin + by + case + const + definition + div + do + else + elsif + end + exit + export + for + from + if + implementation + import + in + loop + mod + module + not + of + or + pointer + procedure + qualified + record + repeat + return + set + then + to + type + until + var + while + with + + + \ No newline at end of file diff --git a/xsl/highlighting/myxml-hl.xml b/xsl/highlighting/myxml-hl.xml index 495d4e875..afa4be712 100644 --- a/xsl/highlighting/myxml-hl.xml +++ b/xsl/highlighting/myxml-hl.xml @@ -1,131 +1,116 @@ - - - - - - - A - ABBR - ACRONYM - ADDRESS - APPLET - AREA - B - BASE - BASEFONT - BDO - BIG - BLOCKQUOTE - BODY - BR - BUTTON - CAPTION - CENTER - CITE - CODE - COL - COLGROUP - DD - DEL - DFN - DIR - DIV - DL - DT - EM - FIELDSET - FONT - FORM - FRAME - FRAMESET - H1 - H2 - H3 - H4 - H5 - H6 - HEAD - HR - HTML - I - IFRAME - IMG - INPUT - INS - ISINDEX - KBD - LABEL - LEGEND - LI - LINK - MAP - MENU - META - NOFRAMES - NOSCRIPT - OBJECT - OL - OPTGROUP - OPTION - P - PARAM - PRE - Q - S - SAMP - SCRIPT - SELECT - SMALL - SPAN - STRIKE - STRONG - STYLE - SUB - SUP - TABLE - TBODY - TD - TEXTAREA - TFOOT - TH - THEAD - TITLE - TR - TT - U - UL - VAR - XMP - - - - - xsl: - - - - - + + + + + + + + A + ABBR + ACRONYM + ADDRESS + APPLET + AREA + B + BASE + BASEFONT + BDO + BIG + BLOCKQUOTE + BODY + BR + BUTTON + CAPTION + CENTER + CITE + CODE + COL + COLGROUP + DD + DEL + DFN + DIR + DIV + DL + DT + EM + FIELDSET + FONT + FORM + FRAME + FRAMESET + H1 + H2 + H3 + H4 + H5 + H6 + HEAD + HR + HTML + I + IFRAME + IMG + INPUT + INS + ISINDEX + KBD + LABEL + LEGEND + LI + LINK + MAP + MENU + META + NOFRAMES + NOSCRIPT + OBJECT + OL + OPTGROUP + OPTION + P + PARAM + PRE + Q + S + SAMP + SCRIPT + SELECT + SMALL + SPAN + STRIKE + STRONG + STYLE + SUB + SUP + TABLE + TBODY + TD + TEXTAREA + TFOOT + TH + THEAD + TITLE + TR + TT + U + UL + VAR + XMP + + + + + xsl: + + + + \ No newline at end of file diff --git a/xsl/highlighting/perl-hl.xml b/xsl/highlighting/perl-hl.xml new file mode 100644 index 000000000..da1924aeb --- /dev/null +++ b/xsl/highlighting/perl-hl.xml @@ -0,0 +1,120 @@ + + + + # + + << + ' + " + + + + " + \ + + + ' + \ + + + + 0x + + + + . + + + + + if + unless + while + until + foreach + else + elsif + for + when + default + given + + caller + continue + die + do + dump + eval + exit + goto + last + next + redo + return + sub + wantarray + + caller + import + local + my + package + use + + do + import + no + package + require + use + + bless + dbmclose + dbmopen + package + ref + tie + tied + untie + use + + and + or + not + eq + ne + lt + gt + le + ge + cmp + + \ No newline at end of file diff --git a/xsl/highlighting/php-hl.xml b/xsl/highlighting/php-hl.xml index 7cd0d6a72..4a7022520 100644 --- a/xsl/highlighting/php-hl.xml +++ b/xsl/highlighting/php-hl.xml @@ -1,127 +1,149 @@ - - - - - /* - */ - - - - // - - - - # - - - - " - \ - - - - ' - \ - - - - <<< - - - - and - or - xor - __FILE__ - exception - __LINE__ - array - as - break - case - class - const - continue - declare - default - die - do - echo - else - elseif - empty - enddeclare - endfor - endforeach - endif - endswitch - endwhile - eval - exit - extends - for - foreach - function - global - if - include - include_once - isset - list - new - print - require - require_once - return - static - switch - unset - use - var - while - __FUNCTION__ - __CLASS__ - __METHOD__ - final - php_user_filter - interface - implements - extends - public - private - protected - abstract - clone - try - catch - throw - cfunction - old_function - - - - - + + + + + /** + */ + + + + /// + + + + /* + */ + + // + # + + " + \ + + + + ' + \ + + + + <<< + + + 0x + + + + . + e + + + + and + or + xor + __FILE__ + exception + __LINE__ + array + as + break + case + class + const + continue + declare + default + die + do + echo + else + elseif + empty + enddeclare + endfor + endforeach + endif + endswitch + endwhile + eval + exit + extends + for + foreach + function + global + if + include + include_once + isset + list + new + print + require + require_once + return + static + switch + unset + use + var + while + __FUNCTION__ + __CLASS__ + __METHOD__ + final + php_user_filter + interface + implements + extends + public + private + protected + abstract + clone + try + catch + throw + cfunction + old_function + true + false + + + + + ?> + <?php + <?= + + + \ No newline at end of file diff --git a/xsl/highlighting/python-hl.xml b/xsl/highlighting/python-hl.xml new file mode 100644 index 000000000..791bc7a0e --- /dev/null +++ b/xsl/highlighting/python-hl.xml @@ -0,0 +1,100 @@ + + + + + + @ + ( + ) + + # + + """ + + + + ''' + + + + " + \ + + + ' + \ + + + 0x + l + + + + . + + e + l + + + + and + del + from + not + while + as + elif + global + or + with + assert + else + if + pass + yield + break + except + import + print + class + exec + in + raise + continue + finally + is + return + def + for + lambda + try + + \ No newline at end of file diff --git a/xsl/highlighting/ruby-hl.xml b/xsl/highlighting/ruby-hl.xml new file mode 100644 index 000000000..78189b0ad --- /dev/null +++ b/xsl/highlighting/ruby-hl.xml @@ -0,0 +1,109 @@ + + + + # + + << + + + + " + \ + + + %Q{ + } + \ + + + %/ + / + \ + + + ' + \ + + + %q{ + } + \ + + + 0x + + + + . + e + + + + alias + and + BEGIN + begin + break + case + class + def + defined + do + else + elsif + END + end + ensure + false + for + if + in + module + next + nil + not + or + redo + rescue + retry + return + self + super + then + true + undef + unless + until + when + while + yield + + \ No newline at end of file diff --git a/xsl/highlighting/tcl-hl.xml b/xsl/highlighting/tcl-hl.xml new file mode 100644 index 000000000..7a8fa9fbd --- /dev/null +++ b/xsl/highlighting/tcl-hl.xml @@ -0,0 +1,180 @@ + + + + # + + " + \ + + + -[\p{javaJavaIdentifierStart}][\p{javaJavaIdentifierPart}]+ + + + + + . + + + + + if + then + else + elseif + for + foreach + break + continue + while + eval + case + in + switch + default + exit + error + proc + rename + exec + return + uplevel + upvar + constructor + destructor + itcl_class + loop + for_array_keys + for_recursive_glob + for_file + method + body + configbody + catch + namespace + class + array + set + unset + package + source + + + subst + list + format + lappend + option + expr + puts + winfo + lindex + string + + + + verified + seteach + fixme + debug + rtl::debug + rtl::verified + rtl::template + rtl::seteach + + + mkProc + getCreator + properties + lappendunique + rtl::lappendunique + + + place + pack + grid + + + + image + font + focus + tk + bind + after + + + toplevel + frame + entry + listbox + button + radiobutton + checkbutton + canvas + menu + menubutton + text + label + message + + + + zinc + + + tkpath::gradient + + + rtl_combobox + rtl_tree + rtl_tabset + rtl_mlistbox + rtl_gridwin + rtlysizer + rtlxsizer + + + + goolbar + gstripes + zoolbar + gistbox + gooleditor + galette + + + \ No newline at end of file diff --git a/xsl/highlighting/xslthl-config.xml b/xsl/highlighting/xslthl-config.xml index 7c77f6fc6..b24e4690b 100644 --- a/xsl/highlighting/xslthl-config.xml +++ b/xsl/highlighting/xslthl-config.xml @@ -1,11 +1,46 @@ - + + - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xsl/html/highlight.xsl b/xsl/html/highlight.xsl index cf7a413a8..4d786aeec 100644 --- a/xsl/html/highlight.xsl +++ b/xsl/html/highlight.xsl @@ -14,41 +14,58 @@ ******************************************************************** --> - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/xsl/html/param.ent b/xsl/html/param.ent index c345f3053..49c4125ff 100644 --- a/xsl/html/param.ent +++ b/xsl/html/param.ent @@ -73,6 +73,7 @@ + diff --git a/xsl/html/param.xweb b/xsl/html/param.xweb index 3b33f5013..315d9cc7a 100644 --- a/xsl/html/param.xweb +++ b/xsl/html/param.xweb @@ -261,6 +261,7 @@ $Id$ &footnote.number.symbols; &table.footnote.number.symbols; &highlight.source; +&highlight.xslthl.config; &highlight.default.language; &email.delimiters.enabled; @@ -521,6 +522,7 @@ around all these parameters. + diff --git a/xsl/params/highlight.source.xml b/xsl/params/highlight.source.xml index 430821159..994508422 100644 --- a/xsl/params/highlight.source.xml +++ b/xsl/params/highlight.source.xml @@ -27,17 +27,17 @@ syntax highlighting of the content of the programlisting element. The XSLTHL extension module. This is an external Java library which is not part of the DocBook XSL distribution. In order to use this extension, you must add -xslthl.jar to your Java classpath. You can +xslthl-2.0.0.jar to your Java classpath. You can download this software from the XSLT syntax highlighting project at SourceForge. The configuration of syntax highlighting is stored in highlighting/xslthl-config.xml. The Java -property xslthl.config must point to this +property xslthl.config or parameter highlight.xslthl.config must point to this file (using URL syntax). -This extension is known to work with Saxon 6.5.x. Here is an example of a modified Saxon command: +This extension is known to work with Saxon 6.5.x, Saxon 8.5+ and Xalan-J. Here is an example of a modified Saxon command: -java -cp c:\batch\;…;c:\path\to\xslthl.jar -Dxslthl.config=file:///c:/docbook-xsl/highlighting/xslthl-config.xml … com.icl.saxon.StyleSheet … +java -cp c:\batch\;…;c:\path\to\xslthl-2.0.0.jar -Dxslthl.config=file:///c:/docbook-xsl/highlighting/xslthl-config.xml … com.icl.saxon.StyleSheet … You can specify the language for each programlisting by using the language attribute. The highlighting.default.language parameter can be used for specifying the diff --git a/xsl/params/highlight.xslthl.config.xml b/xsl/params/highlight.xslthl.config.xml new file mode 100644 index 000000000..3ef8e49ab --- /dev/null +++ b/xsl/params/highlight.xslthl.config.xml @@ -0,0 +1,27 @@ + + +highlight.xslthl.config +uri + + +highlight.xslthl.config +Location of XSLTHL configuration file + + + + + + + + +Description + +This location has precedence over the corresponding Java property. + + +