mizuho 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +20 -0
- data/README.markdown +61 -0
- data/Rakefile +41 -0
- data/asciidoc/BUGS +39 -0
- data/asciidoc/BUGS.txt +32 -0
- data/asciidoc/CHANGELOG +1796 -0
- data/asciidoc/CHANGELOG.txt +1810 -0
- data/asciidoc/COPYING +339 -0
- data/asciidoc/COPYRIGHT +18 -0
- data/asciidoc/INSTALL +76 -0
- data/asciidoc/INSTALL.txt +71 -0
- data/asciidoc/Makefile.in +161 -0
- data/asciidoc/README +46 -0
- data/asciidoc/README.txt +36 -0
- data/asciidoc/a2x +674 -0
- data/asciidoc/asciidoc.conf +455 -0
- data/asciidoc/asciidoc.py +4998 -0
- data/asciidoc/common.aap +9 -0
- data/asciidoc/configure +2840 -0
- data/asciidoc/configure.ac +11 -0
- data/asciidoc/dblatex/asciidoc-dblatex.sty +20 -0
- data/asciidoc/dblatex/asciidoc-dblatex.xsl +32 -0
- data/asciidoc/dblatex/dblatex-readme.txt +39 -0
- data/asciidoc/doc/a2x.1 +257 -0
- data/asciidoc/doc/a2x.1.txt +204 -0
- data/asciidoc/doc/article.css-embedded.html +602 -0
- data/asciidoc/doc/article.html +46 -0
- data/asciidoc/doc/article.pdf +0 -0
- data/asciidoc/doc/article.txt +122 -0
- data/asciidoc/doc/asciidoc-revhistory.xml +27 -0
- data/asciidoc/doc/asciidoc.1 +155 -0
- data/asciidoc/doc/asciidoc.1.css-embedded.html +598 -0
- data/asciidoc/doc/asciidoc.1.css.html +212 -0
- data/asciidoc/doc/asciidoc.1.html +190 -0
- data/asciidoc/doc/asciidoc.1.txt +118 -0
- data/asciidoc/doc/asciidoc.conf +8 -0
- data/asciidoc/doc/asciidoc.css-embedded.html +7853 -0
- data/asciidoc/doc/asciidoc.css.html +7416 -0
- data/asciidoc/doc/asciidoc.dict +733 -0
- data/asciidoc/doc/asciidoc.html +3339 -0
- data/asciidoc/doc/asciidoc.txt +4979 -0
- data/asciidoc/doc/asciimathml.txt +64 -0
- data/asciidoc/doc/book-multi.css-embedded.html +575 -0
- data/asciidoc/doc/book-multi.html +55 -0
- data/asciidoc/doc/book-multi.txt +155 -0
- data/asciidoc/doc/book.css-embedded.html +607 -0
- data/asciidoc/doc/book.html +43 -0
- data/asciidoc/doc/book.txt +131 -0
- data/asciidoc/doc/customers.csv +18 -0
- data/asciidoc/doc/docbook-xsl.css +272 -0
- data/asciidoc/doc/faq.txt +547 -0
- data/asciidoc/doc/latex-backend.html +117 -0
- data/asciidoc/doc/latex-backend.txt +191 -0
- data/asciidoc/doc/latexmath.txt +244 -0
- data/asciidoc/doc/latexmathml.txt +41 -0
- data/asciidoc/doc/main.aap +297 -0
- data/asciidoc/doc/music-filter.html +566 -0
- data/asciidoc/doc/music-filter.pdf +0 -0
- data/asciidoc/doc/music-filter.txt +158 -0
- data/asciidoc/doc/source-highlight-filter.html +214 -0
- data/asciidoc/doc/source-highlight-filter.pdf +0 -0
- data/asciidoc/doc/source-highlight-filter.txt +203 -0
- data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +43 -0
- data/asciidoc/docbook-xsl/chunked.xsl +19 -0
- data/asciidoc/docbook-xsl/common.xsl +67 -0
- data/asciidoc/docbook-xsl/fo.xsl +149 -0
- data/asciidoc/docbook-xsl/htmlhelp.xsl +17 -0
- data/asciidoc/docbook-xsl/manpage.xsl +31 -0
- data/asciidoc/docbook-xsl/text.xsl +50 -0
- data/asciidoc/docbook-xsl/xhtml.xsl +14 -0
- data/asciidoc/docbook.conf +721 -0
- data/asciidoc/examples/website/ASCIIMathML.js +938 -0
- data/asciidoc/examples/website/CHANGELOG.html +4389 -0
- data/asciidoc/examples/website/CHANGELOG.txt +1810 -0
- data/asciidoc/examples/website/INSTALL.html +161 -0
- data/asciidoc/examples/website/INSTALL.txt +71 -0
- data/asciidoc/examples/website/LaTeXMathML.js +1223 -0
- data/asciidoc/examples/website/README-website.html +118 -0
- data/asciidoc/examples/website/README-website.txt +29 -0
- data/asciidoc/examples/website/README.html +125 -0
- data/asciidoc/examples/website/README.txt +36 -0
- data/asciidoc/examples/website/a2x.1.html +419 -0
- data/asciidoc/examples/website/a2x.1.txt +204 -0
- data/asciidoc/examples/website/asciidoc-docbook-xsl.html +130 -0
- data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +43 -0
- data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +130 -0
- data/asciidoc/examples/website/asciimathml.txt +64 -0
- data/asciidoc/examples/website/build-website.sh +25 -0
- data/asciidoc/examples/website/customers.csv +18 -0
- data/asciidoc/examples/website/downloads.html +257 -0
- data/asciidoc/examples/website/downloads.txt +121 -0
- data/asciidoc/examples/website/faq.html +673 -0
- data/asciidoc/examples/website/faq.txt +547 -0
- data/asciidoc/examples/website/index.html +419 -0
- data/asciidoc/examples/website/index.txt +245 -0
- data/asciidoc/examples/website/latex-backend.html +535 -0
- data/asciidoc/examples/website/latex-backend.txt +191 -0
- data/asciidoc/examples/website/latexmathml.txt +41 -0
- data/asciidoc/examples/website/layout1.conf +161 -0
- data/asciidoc/examples/website/layout1.css +65 -0
- data/asciidoc/examples/website/layout2.conf +158 -0
- data/asciidoc/examples/website/layout2.css +93 -0
- data/asciidoc/examples/website/manpage.html +266 -0
- data/asciidoc/examples/website/manpage.txt +118 -0
- data/asciidoc/examples/website/music-filter.html +242 -0
- data/asciidoc/examples/website/music-filter.txt +158 -0
- data/asciidoc/examples/website/music1.abc +12 -0
- data/asciidoc/examples/website/music1.png +0 -0
- data/asciidoc/examples/website/music2.ly +9 -0
- data/asciidoc/examples/website/music2.png +0 -0
- data/asciidoc/examples/website/newlists.txt +40 -0
- data/asciidoc/examples/website/newtables.txt +397 -0
- data/asciidoc/examples/website/sample1.png +0 -0
- data/asciidoc/examples/website/sample3.png +0 -0
- data/asciidoc/examples/website/sample4.png +0 -0
- data/asciidoc/examples/website/source-highlight-filter.html +286 -0
- data/asciidoc/examples/website/source-highlight-filter.txt +203 -0
- data/asciidoc/examples/website/support.html +78 -0
- data/asciidoc/examples/website/support.txt +5 -0
- data/asciidoc/examples/website/toc.js +69 -0
- data/asciidoc/examples/website/userguide.html +7460 -0
- data/asciidoc/examples/website/userguide.txt +4979 -0
- data/asciidoc/examples/website/version83.txt +37 -0
- data/asciidoc/examples/website/version9.html +143 -0
- data/asciidoc/examples/website/version9.txt +48 -0
- data/asciidoc/examples/website/xhtml11-manpage.css +18 -0
- data/asciidoc/examples/website/xhtml11-quirks.css +41 -0
- data/asciidoc/examples/website/xhtml11.css +328 -0
- data/asciidoc/filters/code/code-filter-readme.txt +37 -0
- data/asciidoc/filters/code/code-filter-test.txt +15 -0
- data/asciidoc/filters/code/code-filter.conf +8 -0
- data/asciidoc/filters/code/code-filter.py +239 -0
- data/asciidoc/filters/graphviz/asciidoc-graphviz-sample.txt +130 -0
- data/asciidoc/filters/graphviz/graphviz-filter.conf +39 -0
- data/asciidoc/filters/graphviz/graphviz2png.py +154 -0
- data/asciidoc/filters/music/music-filter-test.txt +40 -0
- data/asciidoc/filters/music/music-filter.conf +40 -0
- data/asciidoc/filters/music/music2png.py +189 -0
- data/asciidoc/filters/source/source-highlight-filter-test.txt +19 -0
- data/asciidoc/filters/source/source-highlight-filter.conf +108 -0
- data/asciidoc/help.conf +213 -0
- data/asciidoc/html4.conf +460 -0
- data/asciidoc/images/highlighter.png +0 -0
- data/asciidoc/images/icons/README +5 -0
- data/asciidoc/images/icons/callouts/1.png +0 -0
- data/asciidoc/images/icons/callouts/10.png +0 -0
- data/asciidoc/images/icons/callouts/11.png +0 -0
- data/asciidoc/images/icons/callouts/12.png +0 -0
- data/asciidoc/images/icons/callouts/13.png +0 -0
- data/asciidoc/images/icons/callouts/14.png +0 -0
- data/asciidoc/images/icons/callouts/15.png +0 -0
- data/asciidoc/images/icons/callouts/2.png +0 -0
- data/asciidoc/images/icons/callouts/3.png +0 -0
- data/asciidoc/images/icons/callouts/4.png +0 -0
- data/asciidoc/images/icons/callouts/5.png +0 -0
- data/asciidoc/images/icons/callouts/6.png +0 -0
- data/asciidoc/images/icons/callouts/7.png +0 -0
- data/asciidoc/images/icons/callouts/8.png +0 -0
- data/asciidoc/images/icons/callouts/9.png +0 -0
- data/asciidoc/images/icons/caution.png +0 -0
- data/asciidoc/images/icons/example.png +0 -0
- data/asciidoc/images/icons/home.png +0 -0
- data/asciidoc/images/icons/important.png +0 -0
- data/asciidoc/images/icons/next.png +0 -0
- data/asciidoc/images/icons/note.png +0 -0
- data/asciidoc/images/icons/prev.png +0 -0
- data/asciidoc/images/icons/tip.png +0 -0
- data/asciidoc/images/icons/up.png +0 -0
- data/asciidoc/images/icons/warning.png +0 -0
- data/asciidoc/images/smallnew.png +0 -0
- data/asciidoc/images/tiger.png +0 -0
- data/asciidoc/install-sh +201 -0
- data/asciidoc/javascripts/ASCIIMathML.js +938 -0
- data/asciidoc/javascripts/LaTeXMathML.js +1223 -0
- data/asciidoc/javascripts/toc.js +69 -0
- data/asciidoc/lang-es.conf +15 -0
- data/asciidoc/latex.conf +663 -0
- data/asciidoc/stylesheets/docbook-xsl.css +272 -0
- data/asciidoc/stylesheets/xhtml11-manpage.css +18 -0
- data/asciidoc/stylesheets/xhtml11-quirks.css +41 -0
- data/asciidoc/stylesheets/xhtml11.css +328 -0
- data/asciidoc/text.conf +16 -0
- data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +53 -0
- data/asciidoc/vim/syntax/asciidoc.vim +165 -0
- data/asciidoc/wordpress.conf +48 -0
- data/asciidoc/xhtml11-quirks.conf +57 -0
- data/asciidoc/xhtml11.conf +645 -0
- data/bin/mizuho +47 -0
- data/bin/mizuho-asciidoc +4 -0
- data/lib/mizuho.rb +10 -0
- data/lib/mizuho/chapter.rb +54 -0
- data/lib/mizuho/generator.rb +134 -0
- data/lib/mizuho/heading.rb +46 -0
- data/lib/mizuho/parser.rb +103 -0
- data/lib/mizuho/source_highlight.rb +2 -0
- data/lib/mizuho/template.rb +50 -0
- data/source-highlight/ada.lang +38 -0
- data/source-highlight/bib.lang +6 -0
- data/source-highlight/bison.lang +3 -0
- data/source-highlight/c.lang +41 -0
- data/source-highlight/c_comment.lang +27 -0
- data/source-highlight/c_string.lang +9 -0
- data/source-highlight/caml.lang +16 -0
- data/source-highlight/changelog.lang +8 -0
- data/source-highlight/clike_vardeclaration.lang +4 -0
- data/source-highlight/cpp.lang +15 -0
- data/source-highlight/csharp.lang +36 -0
- data/source-highlight/css.lang +14 -0
- data/source-highlight/css_common.outlang +26 -0
- data/source-highlight/darwin/source-highlight +0 -0
- data/source-highlight/default.css +51 -0
- data/source-highlight/default.lang +8 -0
- data/source-highlight/default.style +57 -0
- data/source-highlight/desktop.lang +7 -0
- data/source-highlight/diff.lang +32 -0
- data/source-highlight/docbook.outlang +36 -0
- data/source-highlight/esc.outlang +46 -0
- data/source-highlight/esc.style +35 -0
- data/source-highlight/extreme_comment.lang +5 -0
- data/source-highlight/extreme_comment2.lang +5 -0
- data/source-highlight/extreme_comment3.lang +15 -0
- data/source-highlight/fixed-fortran.lang +5 -0
- data/source-highlight/flex.lang +37 -0
- data/source-highlight/fortran.lang +57 -0
- data/source-highlight/function.lang +2 -0
- data/source-highlight/glsl.lang +86 -0
- data/source-highlight/haxe.lang +7 -0
- data/source-highlight/html.lang +7 -0
- data/source-highlight/html.outlang +25 -0
- data/source-highlight/html_common.outlang +35 -0
- data/source-highlight/html_notfixed.outlang +22 -0
- data/source-highlight/html_ref.outlang +6 -0
- data/source-highlight/htmlcss.outlang +28 -0
- data/source-highlight/htmltable.outlang +14 -0
- data/source-highlight/htmltablelinenum.outlang +26 -0
- data/source-highlight/java.lang +26 -0
- data/source-highlight/javadoc.outlang +24 -0
- data/source-highlight/javascript.lang +27 -0
- data/source-highlight/key_string.lang +4 -0
- data/source-highlight/lang.map +108 -0
- data/source-highlight/langdef.lang +21 -0
- data/source-highlight/latex.lang +52 -0
- data/source-highlight/latex.outlang +59 -0
- data/source-highlight/latexcolor.outlang +44 -0
- data/source-highlight/ldap.lang +10 -0
- data/source-highlight/log.lang +53 -0
- data/source-highlight/logtalk.lang +85 -0
- data/source-highlight/lsm.lang +7 -0
- data/source-highlight/lua.lang +27 -0
- data/source-highlight/m4.lang +27 -0
- data/source-highlight/makefile.lang +42 -0
- data/source-highlight/nohilite.lang +2 -0
- data/source-highlight/number.lang +3 -0
- data/source-highlight/outlang.lang +16 -0
- data/source-highlight/outlang.map +12 -0
- data/source-highlight/pascal.lang +20 -0
- data/source-highlight/perl.lang +134 -0
- data/source-highlight/php.lang +25 -0
- data/source-highlight/postscript.lang +42 -0
- data/source-highlight/prolog.lang +37 -0
- data/source-highlight/properties.lang +7 -0
- data/source-highlight/python.lang +26 -0
- data/source-highlight/ruby.lang +32 -0
- data/source-highlight/scala.lang +31 -0
- data/source-highlight/script_comment.lang +3 -0
- data/source-highlight/sh.lang +38 -0
- data/source-highlight/slang.lang +25 -0
- data/source-highlight/sml.lang +5 -0
- data/source-highlight/source-highlight +24 -0
- data/source-highlight/spec.lang +12 -0
- data/source-highlight/sql.lang +46 -0
- data/source-highlight/style.defaults +15 -0
- data/source-highlight/style.lang +16 -0
- data/source-highlight/style2.style +10 -0
- data/source-highlight/style3.style +10 -0
- data/source-highlight/symbols.lang +2 -0
- data/source-highlight/tcl.lang +35 -0
- data/source-highlight/texinfo.outlang +34 -0
- data/source-highlight/texinfo.style +20 -0
- data/source-highlight/url.lang +3 -0
- data/source-highlight/xhtml.outlang +25 -0
- data/source-highlight/xhtml_common.outlang +8 -0
- data/source-highlight/xhtml_notfixed.outlang +16 -0
- data/source-highlight/xhtmlcss.outlang +19 -0
- data/source-highlight/xhtmltable.outlang +7 -0
- data/source-highlight/xml.lang +17 -0
- data/source-highlight/xorg.lang +10 -0
- data/templates/asciidoc.css +358 -0
- data/templates/asciidoc.html.erb +86 -0
- data/templates/manualsonrails.css +165 -0
- data/templates/manualsonrails.html.erb +97 -0
- data/test/generator_spec.rb +60 -0
- data/test/parser_spec.rb +239 -0
- data/test/spec_helper.rb +51 -0
- metadata +358 -0
Binary file
|
@@ -0,0 +1,158 @@
|
|
1
|
+
Music Filter
|
2
|
+
============
|
3
|
+
|
4
|
+
The AsciiDoc distribution includes a Music Block filter that
|
5
|
+
translates music in http://lilypond.org/[LilyPond] or
|
6
|
+
http://abcnotation.org.uk/[ABC] notation to standard classical
|
7
|
+
notation in the form of a trimmed PNG image which is automatically
|
8
|
+
inserted into the AsciiDoc output document (see the <<X1,examples
|
9
|
+
below>>).
|
10
|
+
|
11
|
+
Actually the filter (`./filters/music2png.py`) can be used outside
|
12
|
+
AsciiDoc to convert LilyPond or ABC music files to PNG images.
|
13
|
+
Execute the following command to see how to use it:
|
14
|
+
|
15
|
+
$ ./filters/music2png.py --help
|
16
|
+
|
17
|
+
The Music Filter can be used as a model for filters that convert a
|
18
|
+
block of text into a file that is linked or embedded into the AsciiDoc
|
19
|
+
output document.
|
20
|
+
|
21
|
+
[[X1]]
|
22
|
+
[caption="Example 1: "]
|
23
|
+
.Music Block containing ABC notation
|
24
|
+
=====================================================================
|
25
|
+
|
26
|
+
This Music Block:
|
27
|
+
|
28
|
+
---------------------------------------------------------------------
|
29
|
+
["music","music1.png",scaledwidth="100%"]
|
30
|
+
---------------------------------------------------------------------
|
31
|
+
T:The Butterfly
|
32
|
+
R:slip jig
|
33
|
+
C:Tommy Potts
|
34
|
+
H:Fiddle player Tommy Potts made this tune from two older slip jigs,
|
35
|
+
H:one of which is called "Skin the Peelers" in Roche's collection.
|
36
|
+
H:This version by Peter Cooper.
|
37
|
+
D:Bothy Band: 1975.
|
38
|
+
M:9/8
|
39
|
+
K:Em
|
40
|
+
vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
|
41
|
+
|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
|
42
|
+
|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
|
43
|
+
---------------------------------------------------------------------
|
44
|
+
---------------------------------------------------------------------
|
45
|
+
|
46
|
+
Renders:
|
47
|
+
|
48
|
+
["music","music1.png",scaledwidth="100%"]
|
49
|
+
---------------------------------------------------------------------
|
50
|
+
T:The Butterfly
|
51
|
+
R:slip jig
|
52
|
+
C:Tommy Potts
|
53
|
+
H:Fiddle player Tommy Potts made this tune from two older slip jigs,
|
54
|
+
H:one of which is called "Skin the Peelers" in Roche's collection.
|
55
|
+
H:This version by Peter Cooper.
|
56
|
+
D:Bothy Band: 1975.
|
57
|
+
M:9/8
|
58
|
+
K:Em
|
59
|
+
vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
|
60
|
+
|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
|
61
|
+
|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
|
62
|
+
---------------------------------------------------------------------
|
63
|
+
=====================================================================
|
64
|
+
|
65
|
+
|
66
|
+
[[X2]]
|
67
|
+
[caption="Example 2: "]
|
68
|
+
.Music Block containing LilyPond notation
|
69
|
+
=====================================================================
|
70
|
+
This example contains LilyPond musical markup, it uses the 'link'
|
71
|
+
attribute so you can click on the music image to display the source
|
72
|
+
notation. The `music2.ly` source file is automatically created and
|
73
|
+
retained by the `music2png.py` filter when the `-m` option is used.
|
74
|
+
|
75
|
+
---------------------------------------------------------------------
|
76
|
+
["music", "music2.png", "ly", link="music2.ly"]
|
77
|
+
---------------------------------------------------------------------
|
78
|
+
\version "2.10.0"
|
79
|
+
\paper {
|
80
|
+
ragged-right = ##t
|
81
|
+
}
|
82
|
+
{
|
83
|
+
\time 3/4
|
84
|
+
\clef bass
|
85
|
+
c2 e4 g2. f4 e d c2 r4
|
86
|
+
}
|
87
|
+
---------------------------------------------------------------------
|
88
|
+
---------------------------------------------------------------------
|
89
|
+
|
90
|
+
Renders:
|
91
|
+
|
92
|
+
["music", "music2.png", "ly", link="music2.ly"]
|
93
|
+
---------------------------------------------------------------------
|
94
|
+
\version "2.10.0"
|
95
|
+
\paper {
|
96
|
+
ragged-right = ##t
|
97
|
+
}
|
98
|
+
{
|
99
|
+
\time 3/4
|
100
|
+
\clef bass
|
101
|
+
c2 e4 g2. f4 e d c2 r4
|
102
|
+
}
|
103
|
+
---------------------------------------------------------------------
|
104
|
+
=====================================================================
|
105
|
+
|
106
|
+
NOTE: If you get an error processing the above example it may be that
|
107
|
+
it is not compatible with your version of LilyPond. Use the LilyPond
|
108
|
+
`convert-ly(1)` utility to update the source to the version that you
|
109
|
+
are using.
|
110
|
+
|
111
|
+
|
112
|
+
Using the Filter
|
113
|
+
----------------
|
114
|
+
Insert a delimited Music Block containing valid ABC notation into your
|
115
|
+
AsciiDoc document:
|
116
|
+
|
117
|
+
- The Music Block delimiter is the word `music` followed by four or
|
118
|
+
more tilde characters.
|
119
|
+
- The Music Block attribute list must contain a file name for the PNG
|
120
|
+
output image file followed by the input format (either 'abc' for ABC
|
121
|
+
or 'ly' for LilyPond). If the format is omitted ABC notation is
|
122
|
+
assumed.
|
123
|
+
- The filter invokes `music2png` with the `-m` option so that music
|
124
|
+
images will only be regenerated if the block content has changed.
|
125
|
+
- The optional named block attributes 'link', 'width' and 'height' are
|
126
|
+
also available (see link:userguide.html#X55[Image macro attributes]
|
127
|
+
in the AsciiDoc User Guide).
|
128
|
+
|
129
|
+
|
130
|
+
Limitations
|
131
|
+
-----------
|
132
|
+
- The `asciidoc(1)` output file cannot be `-` (stdout), you must
|
133
|
+
output to a named file.
|
134
|
+
- If the music image file is linked to the output document then the
|
135
|
+
image file name in the Music Block attribute list should be a
|
136
|
+
relative path name relative to the AsciiDoc output file.
|
137
|
+
|
138
|
+
|
139
|
+
Installation
|
140
|
+
------------
|
141
|
+
In addition to AsciiDoc you will need to have installed:
|
142
|
+
|
143
|
+
- http://lilypond.org/web/[LilyPond] (most Linux distributions include
|
144
|
+
this package).
|
145
|
+
- http://www.imagemagick.org[ImageMagick] (most Linux distributions
|
146
|
+
include this package).
|
147
|
+
|
148
|
+
Test the music filter it by converting the test file to HTML with AsciiDoc:
|
149
|
+
|
150
|
+
$ asciidoc -v ./filters/music-filter-test.txt
|
151
|
+
$ firefox ./filters/music-filter-test.html &
|
152
|
+
|
153
|
+
The filter was developed and tested on Xubuntu Linux using LilyPond
|
154
|
+
2.10.5 and ImageMagick 6.2.4.
|
155
|
+
|
156
|
+
NOTE: The filter does not work with LilyPond 2.2.6 because it did not
|
157
|
+
generate the requested output file name correctly (2.6.3 does not have
|
158
|
+
a problem).
|
@@ -0,0 +1,214 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
|
+
<meta name="generator" content="AsciiDoc 8.3.2">
|
6
|
+
<title>Source Code Highlight Filter</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<h1>Source Code Highlight Filter</h1>
|
10
|
+
<p>
|
11
|
+
</p>
|
12
|
+
<p>The <em>AsciiDoc</em> distribution includes a source code syntax highlight
|
13
|
+
filter (<tt>source-highlight-filter.conf</tt>). It uses
|
14
|
+
<a href="http://www.gnu.org/software/src-highlite/">GNU source-highlight</a> to
|
15
|
+
highlight HTML outputs; DocBook outputs are highlighted by toolchains
|
16
|
+
that have <tt>programlisting</tt> element highlight support, for example
|
17
|
+
<em>dblatex</em>.</p>
|
18
|
+
<p><b>Tip:</b> If the source <em>language</em> attribute has been set (using an
|
19
|
+
<em>AttributeEntry</em> or from the command-line) you don’t have to specify
|
20
|
+
it in each source code block.</p>
|
21
|
+
<hr />
|
22
|
+
<h2><a name="_examples"></a>Examples</h2>
|
23
|
+
<h3><a name="_source_code_paragraphs"></a>Source code paragraphs</h3>
|
24
|
+
<p>The <tt>source</tt> paragraph style will highlight a paragraph of source
|
25
|
+
code. These three code paragraphs:</p>
|
26
|
+
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
|
27
|
+
<pre>[source,python]
|
28
|
+
if n < 0: print 'Hello World!'
|
29
|
+
|
30
|
+
:language: python
|
31
|
+
|
32
|
+
[source]
|
33
|
+
if n < 0: print 'Hello World!'
|
34
|
+
|
35
|
+
[source,ruby,numbered]
|
36
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
37
|
+
puts "#{a.inspect} => #{b.inspect}"</pre>
|
38
|
+
</td></tr></table>
|
39
|
+
<p>Render this highlighted source code:</p>
|
40
|
+
<!-- Generator: GNU source-highlight 2.4
|
41
|
+
by Lorenzo Bettini
|
42
|
+
http://www.lorenzobettini.it
|
43
|
+
http://www.gnu.org/software/src-highlite -->
|
44
|
+
<pre><tt><b><font color="#0000FF">if</font></b> n <font color="#990000"><</font> <font color="#993399">0</font><font color="#990000">:</font> <b><font color="#0000FF">print</font></b> <font color="#FF0000">'Hello World!'</font></tt></pre>
|
45
|
+
<!-- Generator: GNU source-highlight 2.4
|
46
|
+
by Lorenzo Bettini
|
47
|
+
http://www.lorenzobettini.it
|
48
|
+
http://www.gnu.org/software/src-highlite -->
|
49
|
+
<pre><tt><b><font color="#0000FF">if</font></b> n <font color="#990000"><</font> <font color="#993399">0</font><font color="#990000">:</font> <b><font color="#0000FF">print</font></b> <font color="#FF0000">'Hello World!'</font></tt></pre>
|
50
|
+
<!-- Generator: GNU source-highlight 2.4
|
51
|
+
by Lorenzo Bettini
|
52
|
+
http://www.lorenzobettini.it
|
53
|
+
http://www.gnu.org/software/src-highlite -->
|
54
|
+
<pre><tt><font color="#000000">00001:</font> <font color="#990000">[</font><b><font color="#0000FF">true</font></b><font color="#990000">,</font> <b><font color="#0000FF">false</font></b><font color="#990000">].</font><b><font color="#000000">cycle</font></b><font color="#990000">([</font><font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">4</font><font color="#990000">])</font> <b><font color="#0000FF">do</font></b> <font color="#990000">|</font>a<font color="#990000">,</font> b<font color="#990000">|</font>
|
55
|
+
<font color="#000000">00002:</font> puts <font color="#FF0000">"#{a.inspect} => #{b.inspect}"</font></tt></pre>
|
56
|
+
<h3><a name="_unnumbered_source_code_listing"></a>Unnumbered source code listing</h3>
|
57
|
+
<p>This source-highlight filtered block:</p>
|
58
|
+
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
|
59
|
+
<pre> [source,python]
|
60
|
+
---------------------------------------------------------------------
|
61
|
+
''' A multi-line
|
62
|
+
comment.'''
|
63
|
+
def sub_word(mo):
|
64
|
+
''' Single line comment.'''
|
65
|
+
word = mo.group('word') # Inline comment
|
66
|
+
if word in keywords[language]:
|
67
|
+
return quote + word + quote
|
68
|
+
else:
|
69
|
+
return word
|
70
|
+
---------------------------------------------------------------------</pre>
|
71
|
+
</td></tr></table>
|
72
|
+
<p>Renders this highlighted source code:</p>
|
73
|
+
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 2.4
|
74
|
+
by Lorenzo Bettini
|
75
|
+
http://www.lorenzobettini.it
|
76
|
+
http://www.gnu.org/software/src-highlite -->
|
77
|
+
<pre><tt><i><font color="#9A1900">''' A multi-line</font></i>
|
78
|
+
<i><font color="#9A1900"> comment.'''</font></i>
|
79
|
+
<b><font color="#0000FF">def</font></b> <b><font color="#000000">sub_word</font></b><font color="#990000">(</font>mo<font color="#990000">):</font>
|
80
|
+
<i><font color="#9A1900"> ''' Single line comment.'''</font></i>
|
81
|
+
word <font color="#990000">=</font> mo<font color="#990000">.</font><b><font color="#000000">group</font></b><font color="#990000">(</font><font color="#FF0000">'word'</font><font color="#990000">)</font> <i><font color="#9A1900"># Inline comment</font></i>
|
82
|
+
<b><font color="#0000FF">if</font></b> word <b><font color="#0000FF">in</font></b> keywords<font color="#990000">[</font>language<font color="#990000">]:</font>
|
83
|
+
<b><font color="#0000FF">return</font></b> quote <font color="#990000">+</font> word <font color="#990000">+</font> quote
|
84
|
+
<b><font color="#0000FF">else</font></b><font color="#990000">:</font>
|
85
|
+
<b><font color="#0000FF">return</font></b> word</tt></pre></td></tr></table>
|
86
|
+
<h3><a name="_numbered_source_code_listing_with_callouts"></a>Numbered source code listing with callouts</h3>
|
87
|
+
<p>This source-highlight filtered block:</p>
|
88
|
+
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
|
89
|
+
<pre> [source,ruby,numbered]
|
90
|
+
---------------------------------------------------------------------
|
91
|
+
#
|
92
|
+
# Useful Ruby base class extensions.
|
93
|
+
#
|
94
|
+
|
95
|
+
class Array
|
96
|
+
|
97
|
+
# Execute a block passing it corresponding items in
|
98
|
+
# +self+ and +other_array+.
|
99
|
+
# If self has less items than other_array it is repeated.
|
100
|
+
|
101
|
+
def cycle(other_array) # :yields: item, other_item
|
102
|
+
other_array.each_with_index do |item, index|
|
103
|
+
yield(self[index % self.length], item)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
if $0 == __FILE__ <1>
|
110
|
+
# Array#cycle test
|
111
|
+
# true => 0
|
112
|
+
# false => 1
|
113
|
+
# true => 2
|
114
|
+
# false => 3
|
115
|
+
# true => 4
|
116
|
+
puts 'Array#cycle test' <2>
|
117
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
118
|
+
puts "#{a.inspect} => #{b.inspect}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
---------------------------------------------------------------------
|
122
|
+
|
123
|
+
<1> First callout.
|
124
|
+
<2> Second callout.</pre>
|
125
|
+
</td></tr></table>
|
126
|
+
<p>Renders this highlighted source code:</p>
|
127
|
+
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 2.4
|
128
|
+
by Lorenzo Bettini
|
129
|
+
http://www.lorenzobettini.it
|
130
|
+
http://www.gnu.org/software/src-highlite -->
|
131
|
+
<pre><tt><font color="#000000">00001:</font> <i><font color="#9A1900">#</font></i>
|
132
|
+
<font color="#000000">00002:</font> <i><font color="#9A1900"># Useful Ruby base class extensions.</font></i>
|
133
|
+
<font color="#000000">00003:</font> <i><font color="#9A1900">#</font></i>
|
134
|
+
<font color="#000000">00004:</font>
|
135
|
+
<font color="#000000">00005:</font> <b><font color="#0000FF">class</font></b> Array
|
136
|
+
<font color="#000000">00006:</font>
|
137
|
+
<font color="#000000">00007:</font> <i><font color="#9A1900"># Execute a block passing it corresponding items in</font></i>
|
138
|
+
<font color="#000000">00008:</font> <i><font color="#9A1900"># +self+ and +other_array+.</font></i>
|
139
|
+
<font color="#000000">00009:</font> <i><font color="#9A1900"># If self has less items than other_array it is repeated.</font></i>
|
140
|
+
<font color="#000000">00010:</font>
|
141
|
+
<font color="#000000">00011:</font> <b><font color="#0000FF">def</font></b> <b><font color="#000000">cycle</font></b><font color="#990000">(</font>other_array<font color="#990000">)</font> <i><font color="#9A1900"># :yields: item, other_item</font></i>
|
142
|
+
<font color="#000000">00012:</font> other_array<font color="#990000">.</font>each_with_index <b><font color="#0000FF">do</font></b> <font color="#990000">|</font>item<font color="#990000">,</font> index<font color="#990000">|</font>
|
143
|
+
<font color="#000000">00013:</font> <b><font color="#0000FF">yield</font></b><font color="#990000">(</font><b><font color="#0000FF">self</font></b><font color="#990000">[</font>index <font color="#990000">%</font> <b><font color="#0000FF">self</font></b><font color="#990000">.</font>length<font color="#990000">],</font> item<font color="#990000">)</font>
|
144
|
+
<font color="#000000">00014:</font> <b><font color="#0000FF">end</font></b>
|
145
|
+
<font color="#000000">00015:</font> <b><font color="#0000FF">end</font></b>
|
146
|
+
<font color="#000000">00016:</font>
|
147
|
+
<font color="#000000">00017:</font> <b><font color="#0000FF">end</font></b>
|
148
|
+
<font color="#000000">00018:</font>
|
149
|
+
<font color="#000000">00019:</font> <b><font color="#0000FF">if</font></b> <font color="#009900">$0</font> <font color="#990000">==</font> <b><font color="#0000FF">__FILE__</font></b> <font color="#FF0000"><b><1></b></font>
|
150
|
+
<font color="#000000">00020:</font> <i><font color="#9A1900"># Array#cycle test</font></i>
|
151
|
+
<font color="#000000">00021:</font> <i><font color="#9A1900"># true => 0</font></i>
|
152
|
+
<font color="#000000">00022:</font> <i><font color="#9A1900"># false => 1</font></i>
|
153
|
+
<font color="#000000">00023:</font> <i><font color="#9A1900"># true => 2</font></i>
|
154
|
+
<font color="#000000">00024:</font> <i><font color="#9A1900"># false => 3</font></i>
|
155
|
+
<font color="#000000">00025:</font> <i><font color="#9A1900"># true => 4</font></i>
|
156
|
+
<font color="#000000">00026:</font> puts <font color="#FF0000">'Array#cycle test'</font> <font color="#FF0000"><b><2></b></font>
|
157
|
+
<font color="#000000">00027:</font> <font color="#990000">[</font><b><font color="#0000FF">true</font></b><font color="#990000">,</font> <b><font color="#0000FF">false</font></b><font color="#990000">].</font><b><font color="#000000">cycle</font></b><font color="#990000">([</font><font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">3</font><font color="#990000">,</font> <font color="#993399">4</font><font color="#990000">])</font> <b><font color="#0000FF">do</font></b> <font color="#990000">|</font>a<font color="#990000">,</font> b<font color="#990000">|</font>
|
158
|
+
<font color="#000000">00028:</font> puts <font color="#FF0000">"#{a.inspect} => #{b.inspect}"</font>
|
159
|
+
<font color="#000000">00029:</font> <b><font color="#0000FF">end</font></b>
|
160
|
+
<font color="#000000">00030:</font> <b><font color="#0000FF">end</font></b></tt></pre></td></tr></table>
|
161
|
+
<ol>
|
162
|
+
<li>
|
163
|
+
<p>
|
164
|
+
First callout.
|
165
|
+
</p>
|
166
|
+
</li>
|
167
|
+
<li>
|
168
|
+
<p>
|
169
|
+
Second callout.
|
170
|
+
</p>
|
171
|
+
</li>
|
172
|
+
</ol>
|
173
|
+
<hr />
|
174
|
+
<h2><a name="_installation"></a>Installation</h2>
|
175
|
+
<h3><a name="_html"></a>HTML</h3>
|
176
|
+
<p>If you want to syntax highlight <em>AsciiDoc</em> HTML outputs (<tt>html4</tt> and
|
177
|
+
<tt>xhtml11</tt> backends) you need to
|
178
|
+
install <a href="http://www.gnu.org/software/src-highlite/">GNU
|
179
|
+
source-highlight</a> (most distributions have this package).</p>
|
180
|
+
<h3><a name="_docbook"></a>DocBook</h3>
|
181
|
+
<p><em>AsciiDoc</em> encloses the source code in a DocBook <em>programlisting</em>
|
182
|
+
element and leaves source code highlighting to the DocBook toolchain
|
183
|
+
(dblatex has a particularly nice programlisting highlighter). The
|
184
|
+
DocBook programlisting element is assigned two attributes:</p>
|
185
|
+
<ol type="1">
|
186
|
+
<li>
|
187
|
+
<p>
|
188
|
+
The <em>language</em> attribute is set to the <em>AsciiDoc</em> <em>language</em>
|
189
|
+
attribute.
|
190
|
+
</p>
|
191
|
+
</li>
|
192
|
+
<li>
|
193
|
+
<p>
|
194
|
+
The <em>linenumbering</em> attribute is set to the <em>AsciiDoc</em> <em>src_numbered</em>
|
195
|
+
attribute (<em>numbered</em> or <em>unnumbered</em>).
|
196
|
+
</p>
|
197
|
+
</li>
|
198
|
+
</ol>
|
199
|
+
<p>If you use <tt><tt>a2x(1)</tt></tt> to generate PDF you need to include the
|
200
|
+
<tt>--no-xmllint</tt> option to suppress <tt>xmllint(1)</tt> checking — the
|
201
|
+
programlisting <em>language</em> attribute (required by the dblatex source
|
202
|
+
highlighter) is not part of the DocBook 4 specification (but it is in
|
203
|
+
the newer DocBook 5 specification).</p>
|
204
|
+
<h3><a name="_testing"></a>Testing</h3>
|
205
|
+
<p>Test the filter by converting the test file to HTML with <em>AsciiDoc</em>:</p>
|
206
|
+
<pre>$ asciidoc -v ./filters/source-highlight-filter-test.txt
|
207
|
+
$ firefox ./filters/source-highlight-filter-test.html &</pre>
|
208
|
+
<p></p>
|
209
|
+
<p></p>
|
210
|
+
<hr /><p><small>
|
211
|
+
Last updated 2009-01-01 12:22:58 NZDT
|
212
|
+
</small></p>
|
213
|
+
</body>
|
214
|
+
</html>
|
Binary file
|
@@ -0,0 +1,203 @@
|
|
1
|
+
Source Code Highlight Filter
|
2
|
+
============================
|
3
|
+
|
4
|
+
The AsciiDoc distribution includes a source code syntax highlight
|
5
|
+
filter (`source-highlight-filter.conf`). It uses
|
6
|
+
http://www.gnu.org/software/src-highlite/[GNU source-highlight] to
|
7
|
+
highlight HTML outputs; DocBook outputs are highlighted by toolchains
|
8
|
+
that have `programlisting` element highlight support, for example
|
9
|
+
'dblatex'.
|
10
|
+
|
11
|
+
TIP: If the source 'language' attribute has been set (using an
|
12
|
+
'AttributeEntry' or from the command-line) you don't have to specify
|
13
|
+
it in each source code block.
|
14
|
+
|
15
|
+
|
16
|
+
Examples
|
17
|
+
--------
|
18
|
+
Source code paragraphs
|
19
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
20
|
+
The `source` paragraph style will highlight a paragraph of source
|
21
|
+
code. These three code paragraphs:
|
22
|
+
|
23
|
+
---------------------------------------------------------------------
|
24
|
+
[source,python]
|
25
|
+
if n < 0: print 'Hello World!'
|
26
|
+
|
27
|
+
:language: python
|
28
|
+
|
29
|
+
[source]
|
30
|
+
if n < 0: print 'Hello World!'
|
31
|
+
|
32
|
+
[source,ruby,numbered]
|
33
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
34
|
+
puts "#{a.inspect} => #{b.inspect}"
|
35
|
+
---------------------------------------------------------------------
|
36
|
+
|
37
|
+
Render this highlighted source code:
|
38
|
+
|
39
|
+
[source,python]
|
40
|
+
if n < 0: print 'Hello World!'
|
41
|
+
|
42
|
+
:language: python
|
43
|
+
|
44
|
+
[source]
|
45
|
+
if n < 0: print 'Hello World!'
|
46
|
+
|
47
|
+
[source,ruby,numbered]
|
48
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
49
|
+
puts "#{a.inspect} => #{b.inspect}"
|
50
|
+
|
51
|
+
|
52
|
+
Unnumbered source code listing
|
53
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
54
|
+
This source-highlight filtered block:
|
55
|
+
|
56
|
+
---------------------------------------------------------------------
|
57
|
+
[source,python]
|
58
|
+
---------------------------------------------------------------------
|
59
|
+
''' A multi-line
|
60
|
+
comment.'''
|
61
|
+
def sub_word(mo):
|
62
|
+
''' Single line comment.'''
|
63
|
+
word = mo.group('word') # Inline comment
|
64
|
+
if word in keywords[language]:
|
65
|
+
return quote + word + quote
|
66
|
+
else:
|
67
|
+
return word
|
68
|
+
---------------------------------------------------------------------
|
69
|
+
---------------------------------------------------------------------
|
70
|
+
|
71
|
+
Renders this highlighted source code:
|
72
|
+
|
73
|
+
[source,python]
|
74
|
+
---------------------------------------------------------------------
|
75
|
+
''' A multi-line
|
76
|
+
comment.'''
|
77
|
+
def sub_word(mo):
|
78
|
+
''' Single line comment.'''
|
79
|
+
word = mo.group('word') # Inline comment
|
80
|
+
if word in keywords[language]:
|
81
|
+
return quote + word + quote
|
82
|
+
else:
|
83
|
+
return word
|
84
|
+
---------------------------------------------------------------------
|
85
|
+
|
86
|
+
Numbered source code listing with callouts
|
87
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
88
|
+
This source-highlight filtered block:
|
89
|
+
|
90
|
+
---------------------------------------------------------------------
|
91
|
+
[source,ruby,numbered]
|
92
|
+
---------------------------------------------------------------------
|
93
|
+
#
|
94
|
+
# Useful Ruby base class extensions.
|
95
|
+
#
|
96
|
+
|
97
|
+
class Array
|
98
|
+
|
99
|
+
# Execute a block passing it corresponding items in
|
100
|
+
# +self+ and +other_array+.
|
101
|
+
# If self has less items than other_array it is repeated.
|
102
|
+
|
103
|
+
def cycle(other_array) # :yields: item, other_item
|
104
|
+
other_array.each_with_index do |item, index|
|
105
|
+
yield(self[index % self.length], item)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
if $0 == __FILE__ \<1>
|
112
|
+
# Array#cycle test
|
113
|
+
# true => 0
|
114
|
+
# false => 1
|
115
|
+
# true => 2
|
116
|
+
# false => 3
|
117
|
+
# true => 4
|
118
|
+
puts 'Array#cycle test' \<2>
|
119
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
120
|
+
puts "#{a.inspect} => #{b.inspect}"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
---------------------------------------------------------------------
|
124
|
+
|
125
|
+
\<1> First callout.
|
126
|
+
\<2> Second callout.
|
127
|
+
|
128
|
+
---------------------------------------------------------------------
|
129
|
+
|
130
|
+
Renders this highlighted source code:
|
131
|
+
|
132
|
+
[source,ruby,numbered]
|
133
|
+
---------------------------------------------------------------------
|
134
|
+
#
|
135
|
+
# Useful Ruby base class extensions.
|
136
|
+
#
|
137
|
+
|
138
|
+
class Array
|
139
|
+
|
140
|
+
# Execute a block passing it corresponding items in
|
141
|
+
# +self+ and +other_array+.
|
142
|
+
# If self has less items than other_array it is repeated.
|
143
|
+
|
144
|
+
def cycle(other_array) # :yields: item, other_item
|
145
|
+
other_array.each_with_index do |item, index|
|
146
|
+
yield(self[index % self.length], item)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
if $0 == __FILE__ <1>
|
153
|
+
# Array#cycle test
|
154
|
+
# true => 0
|
155
|
+
# false => 1
|
156
|
+
# true => 2
|
157
|
+
# false => 3
|
158
|
+
# true => 4
|
159
|
+
puts 'Array#cycle test' <2>
|
160
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
161
|
+
puts "#{a.inspect} => #{b.inspect}"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
---------------------------------------------------------------------
|
165
|
+
|
166
|
+
<1> First callout.
|
167
|
+
<2> Second callout.
|
168
|
+
|
169
|
+
|
170
|
+
Installation
|
171
|
+
------------
|
172
|
+
HTML
|
173
|
+
~~~~
|
174
|
+
If you want to syntax highlight AsciiDoc HTML outputs (`html4` and
|
175
|
+
`xhtml11` backends) you need to
|
176
|
+
install http://www.gnu.org/software/src-highlite/[GNU
|
177
|
+
source-highlight] (most distributions have this package).
|
178
|
+
|
179
|
+
DocBook
|
180
|
+
~~~~~~~
|
181
|
+
AsciiDoc encloses the source code in a DocBook 'programlisting'
|
182
|
+
element and leaves source code highlighting to the DocBook toolchain
|
183
|
+
(dblatex has a particularly nice programlisting highlighter). The
|
184
|
+
DocBook programlisting element is assigned two attributes:
|
185
|
+
|
186
|
+
. The 'language' attribute is set to the AsciiDoc 'language'
|
187
|
+
attribute.
|
188
|
+
. The 'linenumbering' attribute is set to the AsciiDoc 'src_numbered'
|
189
|
+
attribute ('numbered' or 'unnumbered').
|
190
|
+
|
191
|
+
If you use `a2x(1)` to generate PDF you need to include the
|
192
|
+
`--no-xmllint` option to suppress `xmllint(1)` checking -- the
|
193
|
+
programlisting 'language' attribute (required by the dblatex source
|
194
|
+
highlighter) is not part of the DocBook 4 specification (but it is in
|
195
|
+
the newer DocBook 5 specification).
|
196
|
+
|
197
|
+
|
198
|
+
Testing
|
199
|
+
~~~~~~~
|
200
|
+
Test the filter by converting the test file to HTML with AsciiDoc:
|
201
|
+
|
202
|
+
$ asciidoc -v ./filters/source-highlight-filter-test.txt
|
203
|
+
$ firefox ./filters/source-highlight-filter-test.html &
|