mizuho 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.markdown +61 -0
  3. data/Rakefile +41 -0
  4. data/asciidoc/BUGS +39 -0
  5. data/asciidoc/BUGS.txt +32 -0
  6. data/asciidoc/CHANGELOG +1796 -0
  7. data/asciidoc/CHANGELOG.txt +1810 -0
  8. data/asciidoc/COPYING +339 -0
  9. data/asciidoc/COPYRIGHT +18 -0
  10. data/asciidoc/INSTALL +76 -0
  11. data/asciidoc/INSTALL.txt +71 -0
  12. data/asciidoc/Makefile.in +161 -0
  13. data/asciidoc/README +46 -0
  14. data/asciidoc/README.txt +36 -0
  15. data/asciidoc/a2x +674 -0
  16. data/asciidoc/asciidoc.conf +455 -0
  17. data/asciidoc/asciidoc.py +4998 -0
  18. data/asciidoc/common.aap +9 -0
  19. data/asciidoc/configure +2840 -0
  20. data/asciidoc/configure.ac +11 -0
  21. data/asciidoc/dblatex/asciidoc-dblatex.sty +20 -0
  22. data/asciidoc/dblatex/asciidoc-dblatex.xsl +32 -0
  23. data/asciidoc/dblatex/dblatex-readme.txt +39 -0
  24. data/asciidoc/doc/a2x.1 +257 -0
  25. data/asciidoc/doc/a2x.1.txt +204 -0
  26. data/asciidoc/doc/article.css-embedded.html +602 -0
  27. data/asciidoc/doc/article.html +46 -0
  28. data/asciidoc/doc/article.pdf +0 -0
  29. data/asciidoc/doc/article.txt +122 -0
  30. data/asciidoc/doc/asciidoc-revhistory.xml +27 -0
  31. data/asciidoc/doc/asciidoc.1 +155 -0
  32. data/asciidoc/doc/asciidoc.1.css-embedded.html +598 -0
  33. data/asciidoc/doc/asciidoc.1.css.html +212 -0
  34. data/asciidoc/doc/asciidoc.1.html +190 -0
  35. data/asciidoc/doc/asciidoc.1.txt +118 -0
  36. data/asciidoc/doc/asciidoc.conf +8 -0
  37. data/asciidoc/doc/asciidoc.css-embedded.html +7853 -0
  38. data/asciidoc/doc/asciidoc.css.html +7416 -0
  39. data/asciidoc/doc/asciidoc.dict +733 -0
  40. data/asciidoc/doc/asciidoc.html +3339 -0
  41. data/asciidoc/doc/asciidoc.txt +4979 -0
  42. data/asciidoc/doc/asciimathml.txt +64 -0
  43. data/asciidoc/doc/book-multi.css-embedded.html +575 -0
  44. data/asciidoc/doc/book-multi.html +55 -0
  45. data/asciidoc/doc/book-multi.txt +155 -0
  46. data/asciidoc/doc/book.css-embedded.html +607 -0
  47. data/asciidoc/doc/book.html +43 -0
  48. data/asciidoc/doc/book.txt +131 -0
  49. data/asciidoc/doc/customers.csv +18 -0
  50. data/asciidoc/doc/docbook-xsl.css +272 -0
  51. data/asciidoc/doc/faq.txt +547 -0
  52. data/asciidoc/doc/latex-backend.html +117 -0
  53. data/asciidoc/doc/latex-backend.txt +191 -0
  54. data/asciidoc/doc/latexmath.txt +244 -0
  55. data/asciidoc/doc/latexmathml.txt +41 -0
  56. data/asciidoc/doc/main.aap +297 -0
  57. data/asciidoc/doc/music-filter.html +566 -0
  58. data/asciidoc/doc/music-filter.pdf +0 -0
  59. data/asciidoc/doc/music-filter.txt +158 -0
  60. data/asciidoc/doc/source-highlight-filter.html +214 -0
  61. data/asciidoc/doc/source-highlight-filter.pdf +0 -0
  62. data/asciidoc/doc/source-highlight-filter.txt +203 -0
  63. data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +43 -0
  64. data/asciidoc/docbook-xsl/chunked.xsl +19 -0
  65. data/asciidoc/docbook-xsl/common.xsl +67 -0
  66. data/asciidoc/docbook-xsl/fo.xsl +149 -0
  67. data/asciidoc/docbook-xsl/htmlhelp.xsl +17 -0
  68. data/asciidoc/docbook-xsl/manpage.xsl +31 -0
  69. data/asciidoc/docbook-xsl/text.xsl +50 -0
  70. data/asciidoc/docbook-xsl/xhtml.xsl +14 -0
  71. data/asciidoc/docbook.conf +721 -0
  72. data/asciidoc/examples/website/ASCIIMathML.js +938 -0
  73. data/asciidoc/examples/website/CHANGELOG.html +4389 -0
  74. data/asciidoc/examples/website/CHANGELOG.txt +1810 -0
  75. data/asciidoc/examples/website/INSTALL.html +161 -0
  76. data/asciidoc/examples/website/INSTALL.txt +71 -0
  77. data/asciidoc/examples/website/LaTeXMathML.js +1223 -0
  78. data/asciidoc/examples/website/README-website.html +118 -0
  79. data/asciidoc/examples/website/README-website.txt +29 -0
  80. data/asciidoc/examples/website/README.html +125 -0
  81. data/asciidoc/examples/website/README.txt +36 -0
  82. data/asciidoc/examples/website/a2x.1.html +419 -0
  83. data/asciidoc/examples/website/a2x.1.txt +204 -0
  84. data/asciidoc/examples/website/asciidoc-docbook-xsl.html +130 -0
  85. data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +43 -0
  86. data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +130 -0
  87. data/asciidoc/examples/website/asciimathml.txt +64 -0
  88. data/asciidoc/examples/website/build-website.sh +25 -0
  89. data/asciidoc/examples/website/customers.csv +18 -0
  90. data/asciidoc/examples/website/downloads.html +257 -0
  91. data/asciidoc/examples/website/downloads.txt +121 -0
  92. data/asciidoc/examples/website/faq.html +673 -0
  93. data/asciidoc/examples/website/faq.txt +547 -0
  94. data/asciidoc/examples/website/index.html +419 -0
  95. data/asciidoc/examples/website/index.txt +245 -0
  96. data/asciidoc/examples/website/latex-backend.html +535 -0
  97. data/asciidoc/examples/website/latex-backend.txt +191 -0
  98. data/asciidoc/examples/website/latexmathml.txt +41 -0
  99. data/asciidoc/examples/website/layout1.conf +161 -0
  100. data/asciidoc/examples/website/layout1.css +65 -0
  101. data/asciidoc/examples/website/layout2.conf +158 -0
  102. data/asciidoc/examples/website/layout2.css +93 -0
  103. data/asciidoc/examples/website/manpage.html +266 -0
  104. data/asciidoc/examples/website/manpage.txt +118 -0
  105. data/asciidoc/examples/website/music-filter.html +242 -0
  106. data/asciidoc/examples/website/music-filter.txt +158 -0
  107. data/asciidoc/examples/website/music1.abc +12 -0
  108. data/asciidoc/examples/website/music1.png +0 -0
  109. data/asciidoc/examples/website/music2.ly +9 -0
  110. data/asciidoc/examples/website/music2.png +0 -0
  111. data/asciidoc/examples/website/newlists.txt +40 -0
  112. data/asciidoc/examples/website/newtables.txt +397 -0
  113. data/asciidoc/examples/website/sample1.png +0 -0
  114. data/asciidoc/examples/website/sample3.png +0 -0
  115. data/asciidoc/examples/website/sample4.png +0 -0
  116. data/asciidoc/examples/website/source-highlight-filter.html +286 -0
  117. data/asciidoc/examples/website/source-highlight-filter.txt +203 -0
  118. data/asciidoc/examples/website/support.html +78 -0
  119. data/asciidoc/examples/website/support.txt +5 -0
  120. data/asciidoc/examples/website/toc.js +69 -0
  121. data/asciidoc/examples/website/userguide.html +7460 -0
  122. data/asciidoc/examples/website/userguide.txt +4979 -0
  123. data/asciidoc/examples/website/version83.txt +37 -0
  124. data/asciidoc/examples/website/version9.html +143 -0
  125. data/asciidoc/examples/website/version9.txt +48 -0
  126. data/asciidoc/examples/website/xhtml11-manpage.css +18 -0
  127. data/asciidoc/examples/website/xhtml11-quirks.css +41 -0
  128. data/asciidoc/examples/website/xhtml11.css +328 -0
  129. data/asciidoc/filters/code/code-filter-readme.txt +37 -0
  130. data/asciidoc/filters/code/code-filter-test.txt +15 -0
  131. data/asciidoc/filters/code/code-filter.conf +8 -0
  132. data/asciidoc/filters/code/code-filter.py +239 -0
  133. data/asciidoc/filters/graphviz/asciidoc-graphviz-sample.txt +130 -0
  134. data/asciidoc/filters/graphviz/graphviz-filter.conf +39 -0
  135. data/asciidoc/filters/graphviz/graphviz2png.py +154 -0
  136. data/asciidoc/filters/music/music-filter-test.txt +40 -0
  137. data/asciidoc/filters/music/music-filter.conf +40 -0
  138. data/asciidoc/filters/music/music2png.py +189 -0
  139. data/asciidoc/filters/source/source-highlight-filter-test.txt +19 -0
  140. data/asciidoc/filters/source/source-highlight-filter.conf +108 -0
  141. data/asciidoc/help.conf +213 -0
  142. data/asciidoc/html4.conf +460 -0
  143. data/asciidoc/images/highlighter.png +0 -0
  144. data/asciidoc/images/icons/README +5 -0
  145. data/asciidoc/images/icons/callouts/1.png +0 -0
  146. data/asciidoc/images/icons/callouts/10.png +0 -0
  147. data/asciidoc/images/icons/callouts/11.png +0 -0
  148. data/asciidoc/images/icons/callouts/12.png +0 -0
  149. data/asciidoc/images/icons/callouts/13.png +0 -0
  150. data/asciidoc/images/icons/callouts/14.png +0 -0
  151. data/asciidoc/images/icons/callouts/15.png +0 -0
  152. data/asciidoc/images/icons/callouts/2.png +0 -0
  153. data/asciidoc/images/icons/callouts/3.png +0 -0
  154. data/asciidoc/images/icons/callouts/4.png +0 -0
  155. data/asciidoc/images/icons/callouts/5.png +0 -0
  156. data/asciidoc/images/icons/callouts/6.png +0 -0
  157. data/asciidoc/images/icons/callouts/7.png +0 -0
  158. data/asciidoc/images/icons/callouts/8.png +0 -0
  159. data/asciidoc/images/icons/callouts/9.png +0 -0
  160. data/asciidoc/images/icons/caution.png +0 -0
  161. data/asciidoc/images/icons/example.png +0 -0
  162. data/asciidoc/images/icons/home.png +0 -0
  163. data/asciidoc/images/icons/important.png +0 -0
  164. data/asciidoc/images/icons/next.png +0 -0
  165. data/asciidoc/images/icons/note.png +0 -0
  166. data/asciidoc/images/icons/prev.png +0 -0
  167. data/asciidoc/images/icons/tip.png +0 -0
  168. data/asciidoc/images/icons/up.png +0 -0
  169. data/asciidoc/images/icons/warning.png +0 -0
  170. data/asciidoc/images/smallnew.png +0 -0
  171. data/asciidoc/images/tiger.png +0 -0
  172. data/asciidoc/install-sh +201 -0
  173. data/asciidoc/javascripts/ASCIIMathML.js +938 -0
  174. data/asciidoc/javascripts/LaTeXMathML.js +1223 -0
  175. data/asciidoc/javascripts/toc.js +69 -0
  176. data/asciidoc/lang-es.conf +15 -0
  177. data/asciidoc/latex.conf +663 -0
  178. data/asciidoc/stylesheets/docbook-xsl.css +272 -0
  179. data/asciidoc/stylesheets/xhtml11-manpage.css +18 -0
  180. data/asciidoc/stylesheets/xhtml11-quirks.css +41 -0
  181. data/asciidoc/stylesheets/xhtml11.css +328 -0
  182. data/asciidoc/text.conf +16 -0
  183. data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +53 -0
  184. data/asciidoc/vim/syntax/asciidoc.vim +165 -0
  185. data/asciidoc/wordpress.conf +48 -0
  186. data/asciidoc/xhtml11-quirks.conf +57 -0
  187. data/asciidoc/xhtml11.conf +645 -0
  188. data/bin/mizuho +47 -0
  189. data/bin/mizuho-asciidoc +4 -0
  190. data/lib/mizuho.rb +10 -0
  191. data/lib/mizuho/chapter.rb +54 -0
  192. data/lib/mizuho/generator.rb +134 -0
  193. data/lib/mizuho/heading.rb +46 -0
  194. data/lib/mizuho/parser.rb +103 -0
  195. data/lib/mizuho/source_highlight.rb +2 -0
  196. data/lib/mizuho/template.rb +50 -0
  197. data/source-highlight/ada.lang +38 -0
  198. data/source-highlight/bib.lang +6 -0
  199. data/source-highlight/bison.lang +3 -0
  200. data/source-highlight/c.lang +41 -0
  201. data/source-highlight/c_comment.lang +27 -0
  202. data/source-highlight/c_string.lang +9 -0
  203. data/source-highlight/caml.lang +16 -0
  204. data/source-highlight/changelog.lang +8 -0
  205. data/source-highlight/clike_vardeclaration.lang +4 -0
  206. data/source-highlight/cpp.lang +15 -0
  207. data/source-highlight/csharp.lang +36 -0
  208. data/source-highlight/css.lang +14 -0
  209. data/source-highlight/css_common.outlang +26 -0
  210. data/source-highlight/darwin/source-highlight +0 -0
  211. data/source-highlight/default.css +51 -0
  212. data/source-highlight/default.lang +8 -0
  213. data/source-highlight/default.style +57 -0
  214. data/source-highlight/desktop.lang +7 -0
  215. data/source-highlight/diff.lang +32 -0
  216. data/source-highlight/docbook.outlang +36 -0
  217. data/source-highlight/esc.outlang +46 -0
  218. data/source-highlight/esc.style +35 -0
  219. data/source-highlight/extreme_comment.lang +5 -0
  220. data/source-highlight/extreme_comment2.lang +5 -0
  221. data/source-highlight/extreme_comment3.lang +15 -0
  222. data/source-highlight/fixed-fortran.lang +5 -0
  223. data/source-highlight/flex.lang +37 -0
  224. data/source-highlight/fortran.lang +57 -0
  225. data/source-highlight/function.lang +2 -0
  226. data/source-highlight/glsl.lang +86 -0
  227. data/source-highlight/haxe.lang +7 -0
  228. data/source-highlight/html.lang +7 -0
  229. data/source-highlight/html.outlang +25 -0
  230. data/source-highlight/html_common.outlang +35 -0
  231. data/source-highlight/html_notfixed.outlang +22 -0
  232. data/source-highlight/html_ref.outlang +6 -0
  233. data/source-highlight/htmlcss.outlang +28 -0
  234. data/source-highlight/htmltable.outlang +14 -0
  235. data/source-highlight/htmltablelinenum.outlang +26 -0
  236. data/source-highlight/java.lang +26 -0
  237. data/source-highlight/javadoc.outlang +24 -0
  238. data/source-highlight/javascript.lang +27 -0
  239. data/source-highlight/key_string.lang +4 -0
  240. data/source-highlight/lang.map +108 -0
  241. data/source-highlight/langdef.lang +21 -0
  242. data/source-highlight/latex.lang +52 -0
  243. data/source-highlight/latex.outlang +59 -0
  244. data/source-highlight/latexcolor.outlang +44 -0
  245. data/source-highlight/ldap.lang +10 -0
  246. data/source-highlight/log.lang +53 -0
  247. data/source-highlight/logtalk.lang +85 -0
  248. data/source-highlight/lsm.lang +7 -0
  249. data/source-highlight/lua.lang +27 -0
  250. data/source-highlight/m4.lang +27 -0
  251. data/source-highlight/makefile.lang +42 -0
  252. data/source-highlight/nohilite.lang +2 -0
  253. data/source-highlight/number.lang +3 -0
  254. data/source-highlight/outlang.lang +16 -0
  255. data/source-highlight/outlang.map +12 -0
  256. data/source-highlight/pascal.lang +20 -0
  257. data/source-highlight/perl.lang +134 -0
  258. data/source-highlight/php.lang +25 -0
  259. data/source-highlight/postscript.lang +42 -0
  260. data/source-highlight/prolog.lang +37 -0
  261. data/source-highlight/properties.lang +7 -0
  262. data/source-highlight/python.lang +26 -0
  263. data/source-highlight/ruby.lang +32 -0
  264. data/source-highlight/scala.lang +31 -0
  265. data/source-highlight/script_comment.lang +3 -0
  266. data/source-highlight/sh.lang +38 -0
  267. data/source-highlight/slang.lang +25 -0
  268. data/source-highlight/sml.lang +5 -0
  269. data/source-highlight/source-highlight +24 -0
  270. data/source-highlight/spec.lang +12 -0
  271. data/source-highlight/sql.lang +46 -0
  272. data/source-highlight/style.defaults +15 -0
  273. data/source-highlight/style.lang +16 -0
  274. data/source-highlight/style2.style +10 -0
  275. data/source-highlight/style3.style +10 -0
  276. data/source-highlight/symbols.lang +2 -0
  277. data/source-highlight/tcl.lang +35 -0
  278. data/source-highlight/texinfo.outlang +34 -0
  279. data/source-highlight/texinfo.style +20 -0
  280. data/source-highlight/url.lang +3 -0
  281. data/source-highlight/xhtml.outlang +25 -0
  282. data/source-highlight/xhtml_common.outlang +8 -0
  283. data/source-highlight/xhtml_notfixed.outlang +16 -0
  284. data/source-highlight/xhtmlcss.outlang +19 -0
  285. data/source-highlight/xhtmltable.outlang +7 -0
  286. data/source-highlight/xml.lang +17 -0
  287. data/source-highlight/xorg.lang +10 -0
  288. data/templates/asciidoc.css +358 -0
  289. data/templates/asciidoc.html.erb +86 -0
  290. data/templates/manualsonrails.css +165 -0
  291. data/templates/manualsonrails.html.erb +97 -0
  292. data/test/generator_spec.rb +60 -0
  293. data/test/parser_spec.rb +239 -0
  294. data/test/spec_helper.rb +51 -0
  295. 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&#8217;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 &lt; 0: print 'Hello World!'
29
+
30
+ :language: python
31
+
32
+ [source]
33
+ if n &lt; 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} =&gt; #{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">&lt;</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">&lt;</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} =&gt; #{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__ &lt;1&gt;
110
+ # Array#cycle test
111
+ # true =&gt; 0
112
+ # false =&gt; 1
113
+ # true =&gt; 2
114
+ # false =&gt; 3
115
+ # true =&gt; 4
116
+ puts 'Array#cycle test' &lt;2&gt;
117
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
118
+ puts "#{a.inspect} =&gt; #{b.inspect}"
119
+ end
120
+ end
121
+ ---------------------------------------------------------------------
122
+
123
+ &lt;1&gt; First callout.
124
+ &lt;2&gt; 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>&lt;1&gt;</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 =&gt; 0</font></i>
152
+ <font color="#000000">00022:</font> <i><font color="#9A1900"># false =&gt; 1</font></i>
153
+ <font color="#000000">00023:</font> <i><font color="#9A1900"># true =&gt; 2</font></i>
154
+ <font color="#000000">00024:</font> <i><font color="#9A1900"># false =&gt; 3</font></i>
155
+ <font color="#000000">00025:</font> <i><font color="#9A1900"># true =&gt; 4</font></i>
156
+ <font color="#000000">00026:</font> puts <font color="#FF0000">'Array#cycle test'</font> <font color="#FF0000"><b>&lt;2&gt;</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} =&gt; #{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&#8201;&#8212;&#8201;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 &amp;</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>
@@ -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 &