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
@@ -0,0 +1,286 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <meta name="generator" content="AsciiDoc 8.3.3" />
7
+ <link rel="stylesheet" href="./xhtml11.css" type="text/css" />
8
+ <link rel="stylesheet" href="./xhtml11-quirks.css" type="text/css" />
9
+ <link rel="stylesheet" href="./layout1.css" type="text/css" />
10
+ <title>Source Code Highlight Filter</title>
11
+ </head>
12
+ <body>
13
+ <div id="layout-banner">
14
+ <div id="layout-title">AsciiDoc</div>
15
+ <div id="layout-description">Text based document generation</div>
16
+ </div>
17
+ <table>
18
+ <tr valign="top">
19
+ <td id="layout-menu">
20
+ <div>&#187;<a href="index.html">Home</a></div>
21
+ <div>&#187;<a href="manpage.html">Man&nbsp;Page</a></div>
22
+ <div>&#187;<a href="userguide.html">User&nbsp;Guide</a></div>
23
+ <div>&#187;<a href="http://powerman.name/doc/asciidoc">Cheatsheet</a></div>
24
+ <div>&#187;<a href="a2x.1.html">a2x</a></div>
25
+ <div>&#187;<a href="README.html">README</a></div>
26
+ <div>&#187;<a href="CHANGELOG.html">ChangeLog</a></div>
27
+ <div>&#187;<a href="INSTALL.html">Installation</a></div>
28
+ <div>&#187;<a href="downloads.html">Downloads</a></div>
29
+ <div>&#187;<a href="faq.html">FAQ</a></div>
30
+ <div>&#187;<a href="support.html">Support</a></div>
31
+ <div id="page-source">&#187;<a href="source-highlight-filter.txt">Page&nbsp;Source</a></div>
32
+ </td>
33
+ <td>
34
+ <div id="layout-content">
35
+ <div id="header">
36
+ <h1>Source Code Highlight Filter</h1>
37
+ </div>
38
+ <div id="preamble">
39
+ <div class="sectionbody">
40
+ <div class="paragraph"><p>The <em>AsciiDoc</em> distribution includes a source code syntax highlight
41
+ filter (<tt>source-highlight-filter.conf</tt>). It uses
42
+ <a href="http://www.gnu.org/software/src-highlite/">GNU source-highlight</a> to
43
+ highlight HTML outputs; DocBook outputs are highlighted by toolchains
44
+ that have <tt>programlisting</tt> element highlight support, for example
45
+ <em>dblatex</em>.</p></div>
46
+ <div class="admonitionblock">
47
+ <table><tr>
48
+ <td class="icon">
49
+ <img src="./images/icons/tip.png" alt="Tip" />
50
+ </td>
51
+ <td class="content">If the source <em>language</em> attribute has been set (using an
52
+ <em>AttributeEntry</em> or from the command-line) you don&#8217;t have to specify
53
+ it in each source code block.</td>
54
+ </tr></table>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ <h2 id="_examples">Examples</h2>
59
+ <div class="sectionbody">
60
+ <h3 id="_source_code_paragraphs">Source code paragraphs</h3><div style="clear:left"></div>
61
+ <div class="paragraph"><p>The <tt>source</tt> paragraph style will highlight a paragraph of source
62
+ code. These three code paragraphs:</p></div>
63
+ <div class="listingblock">
64
+ <div class="content">
65
+ <pre><tt>[source,python]
66
+ if n &lt; 0: print 'Hello World!'
67
+
68
+ :language: python
69
+
70
+ [source]
71
+ if n &lt; 0: print 'Hello World!'
72
+
73
+ [source,ruby,numbered]
74
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
75
+ puts "#{a.inspect} =&gt; #{b.inspect}"</tt></pre>
76
+ </div></div>
77
+ <div class="paragraph"><p>Render this highlighted source code:</p></div>
78
+ <div class="exampleblock">
79
+ <div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.4
80
+ by Lorenzo Bettini
81
+ http://www.lorenzobettini.it
82
+ http://www.gnu.org/software/src-highlite -->
83
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">if</span></span> n <span style="color: #990000">&lt;</span> <span style="color: #993399">0</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #FF0000">'Hello World!'</span></tt></pre></div></div>
84
+ <div class="exampleblock">
85
+ <div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.4
86
+ by Lorenzo Bettini
87
+ http://www.lorenzobettini.it
88
+ http://www.gnu.org/software/src-highlite -->
89
+ <pre><tt><span style="font-weight: bold"><span style="color: #0000FF">if</span></span> n <span style="color: #990000">&lt;</span> <span style="color: #993399">0</span><span style="color: #990000">:</span> <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> <span style="color: #FF0000">'Hello World!'</span></tt></pre></div></div>
90
+ <div class="exampleblock">
91
+ <div class="exampleblock-content"><!-- Generator: GNU source-highlight 2.4
92
+ by Lorenzo Bettini
93
+ http://www.lorenzobettini.it
94
+ http://www.gnu.org/software/src-highlite -->
95
+ <pre><tt><span style="color: #000000">00001:</span> <span style="color: #990000">[</span><span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span><span style="color: #990000">].</span><span style="font-weight: bold"><span style="color: #000000">cycle</span></span><span style="color: #990000">([</span><span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">1</span><span style="color: #990000">,</span> <span style="color: #993399">2</span><span style="color: #990000">,</span> <span style="color: #993399">3</span><span style="color: #990000">,</span> <span style="color: #993399">4</span><span style="color: #990000">])</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>a<span style="color: #990000">,</span> b<span style="color: #990000">|</span>
96
+ <span style="color: #000000">00002:</span> puts <span style="color: #FF0000">"#{a.inspect} =&gt; #{b.inspect}"</span></tt></pre></div></div>
97
+ <h3 id="_unnumbered_source_code_listing">Unnumbered source code listing</h3><div style="clear:left"></div>
98
+ <div class="paragraph"><p>This source-highlight filtered block:</p></div>
99
+ <div class="listingblock">
100
+ <div class="content">
101
+ <pre><tt> [source,python]
102
+ ---------------------------------------------------------------------
103
+ ''' A multi-line
104
+ comment.'''
105
+ def sub_word(mo):
106
+ ''' Single line comment.'''
107
+ word = mo.group('word') # Inline comment
108
+ if word in keywords[language]:
109
+ return quote + word + quote
110
+ else:
111
+ return word
112
+ ---------------------------------------------------------------------</tt></pre>
113
+ </div></div>
114
+ <div class="paragraph"><p>Renders this highlighted source code:</p></div>
115
+ <div class="listingblock">
116
+ <div class="content"><!-- Generator: GNU source-highlight 2.4
117
+ by Lorenzo Bettini
118
+ http://www.lorenzobettini.it
119
+ http://www.gnu.org/software/src-highlite -->
120
+ <pre><tt><span style="font-style: italic"><span style="color: #9A1900">''' A multi-line</span></span>
121
+ <span style="font-style: italic"><span style="color: #9A1900"> comment.'''</span></span>
122
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">sub_word</span></span><span style="color: #990000">(</span>mo<span style="color: #990000">):</span>
123
+ <span style="font-style: italic"><span style="color: #9A1900"> ''' Single line comment.'''</span></span>
124
+ word <span style="color: #990000">=</span> mo<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">group</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'word'</span><span style="color: #990000">)</span> <span style="font-style: italic"><span style="color: #9A1900"># Inline comment</span></span>
125
+ <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> word <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> keywords<span style="color: #990000">[</span>language<span style="color: #990000">]:</span>
126
+ <span style="font-weight: bold"><span style="color: #0000FF">return</span></span> quote <span style="color: #990000">+</span> word <span style="color: #990000">+</span> quote
127
+ <span style="font-weight: bold"><span style="color: #0000FF">else</span></span><span style="color: #990000">:</span>
128
+ <span style="font-weight: bold"><span style="color: #0000FF">return</span></span> word</tt></pre></div></div>
129
+ <h3 id="_numbered_source_code_listing_with_callouts">Numbered source code listing with callouts</h3><div style="clear:left"></div>
130
+ <div class="paragraph"><p>This source-highlight filtered block:</p></div>
131
+ <div class="listingblock">
132
+ <div class="content">
133
+ <pre><tt> [source,ruby,numbered]
134
+ ---------------------------------------------------------------------
135
+ #
136
+ # Useful Ruby base class extensions.
137
+ #
138
+
139
+ class Array
140
+
141
+ # Execute a block passing it corresponding items in
142
+ # +self+ and +other_array+.
143
+ # If self has less items than other_array it is repeated.
144
+
145
+ def cycle(other_array) # :yields: item, other_item
146
+ other_array.each_with_index do |item, index|
147
+ yield(self[index % self.length], item)
148
+ end
149
+ end
150
+
151
+ end
152
+
153
+ if $0 == __FILE__ &lt;1&gt;
154
+ # Array#cycle test
155
+ # true =&gt; 0
156
+ # false =&gt; 1
157
+ # true =&gt; 2
158
+ # false =&gt; 3
159
+ # true =&gt; 4
160
+ puts 'Array#cycle test' &lt;2&gt;
161
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
162
+ puts "#{a.inspect} =&gt; #{b.inspect}"
163
+ end
164
+ end
165
+ ---------------------------------------------------------------------
166
+
167
+ &lt;1&gt; First callout.
168
+ &lt;2&gt; Second callout.</tt></pre>
169
+ </div></div>
170
+ <div class="paragraph"><p>Renders this highlighted source code:</p></div>
171
+ <div class="listingblock">
172
+ <div class="content"><!-- Generator: GNU source-highlight 2.4
173
+ by Lorenzo Bettini
174
+ http://www.lorenzobettini.it
175
+ http://www.gnu.org/software/src-highlite -->
176
+ <pre><tt><span style="color: #000000">00001:</span> <span style="font-style: italic"><span style="color: #9A1900">#</span></span>
177
+ <span style="color: #000000">00002:</span> <span style="font-style: italic"><span style="color: #9A1900"># Useful Ruby base class extensions.</span></span>
178
+ <span style="color: #000000">00003:</span> <span style="font-style: italic"><span style="color: #9A1900">#</span></span>
179
+ <span style="color: #000000">00004:</span>
180
+ <span style="color: #000000">00005:</span> <span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Array
181
+ <span style="color: #000000">00006:</span>
182
+ <span style="color: #000000">00007:</span> <span style="font-style: italic"><span style="color: #9A1900"># Execute a block passing it corresponding items in</span></span>
183
+ <span style="color: #000000">00008:</span> <span style="font-style: italic"><span style="color: #9A1900"># +self+ and +other_array+.</span></span>
184
+ <span style="color: #000000">00009:</span> <span style="font-style: italic"><span style="color: #9A1900"># If self has less items than other_array it is repeated.</span></span>
185
+ <span style="color: #000000">00010:</span>
186
+ <span style="color: #000000">00011:</span> <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">cycle</span></span><span style="color: #990000">(</span>other_array<span style="color: #990000">)</span> <span style="font-style: italic"><span style="color: #9A1900"># :yields: item, other_item</span></span>
187
+ <span style="color: #000000">00012:</span> other_array<span style="color: #990000">.</span>each_with_index <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>item<span style="color: #990000">,</span> index<span style="color: #990000">|</span>
188
+ <span style="color: #000000">00013:</span> <span style="font-weight: bold"><span style="color: #0000FF">yield</span></span><span style="color: #990000">(</span><span style="font-weight: bold"><span style="color: #0000FF">self</span></span><span style="color: #990000">[</span>index <span style="color: #990000">%</span> <span style="font-weight: bold"><span style="color: #0000FF">self</span></span><span style="color: #990000">.</span>length<span style="color: #990000">],</span> item<span style="color: #990000">)</span>
189
+ <span style="color: #000000">00014:</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
190
+ <span style="color: #000000">00015:</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
191
+ <span style="color: #000000">00016:</span>
192
+ <span style="color: #000000">00017:</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
193
+ <span style="color: #000000">00018:</span>
194
+ <span style="color: #000000">00019:</span> <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #009900">$0</span> <span style="color: #990000">==</span> <span style="font-weight: bold"><span style="color: #0000FF">__FILE__</span></span> <span style="color: #FF0000"><b>&lt;1&gt;</b></span>
195
+ <span style="color: #000000">00020:</span> <span style="font-style: italic"><span style="color: #9A1900"># Array#cycle test</span></span>
196
+ <span style="color: #000000">00021:</span> <span style="font-style: italic"><span style="color: #9A1900"># true =&gt; 0</span></span>
197
+ <span style="color: #000000">00022:</span> <span style="font-style: italic"><span style="color: #9A1900"># false =&gt; 1</span></span>
198
+ <span style="color: #000000">00023:</span> <span style="font-style: italic"><span style="color: #9A1900"># true =&gt; 2</span></span>
199
+ <span style="color: #000000">00024:</span> <span style="font-style: italic"><span style="color: #9A1900"># false =&gt; 3</span></span>
200
+ <span style="color: #000000">00025:</span> <span style="font-style: italic"><span style="color: #9A1900"># true =&gt; 4</span></span>
201
+ <span style="color: #000000">00026:</span> puts <span style="color: #FF0000">'Array#cycle test'</span> <span style="color: #FF0000"><b>&lt;2&gt;</b></span>
202
+ <span style="color: #000000">00027:</span> <span style="color: #990000">[</span><span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">,</span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span><span style="color: #990000">].</span><span style="font-weight: bold"><span style="color: #000000">cycle</span></span><span style="color: #990000">([</span><span style="color: #993399">0</span><span style="color: #990000">,</span> <span style="color: #993399">1</span><span style="color: #990000">,</span> <span style="color: #993399">2</span><span style="color: #990000">,</span> <span style="color: #993399">3</span><span style="color: #990000">,</span> <span style="color: #993399">4</span><span style="color: #990000">])</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>a<span style="color: #990000">,</span> b<span style="color: #990000">|</span>
203
+ <span style="color: #000000">00028:</span> puts <span style="color: #FF0000">"#{a.inspect} =&gt; #{b.inspect}"</span>
204
+ <span style="color: #000000">00029:</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
205
+ <span style="color: #000000">00030:</span> <span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
206
+ <div class="colist arabic"><ol>
207
+ <li>
208
+ <p>
209
+ First callout.
210
+ </p>
211
+ </li>
212
+ <li>
213
+ <p>
214
+ Second callout.
215
+ </p>
216
+ </li>
217
+ </ol></div>
218
+ </div>
219
+ <h2 id="_installation">Installation</h2>
220
+ <div class="sectionbody">
221
+ <h3 id="_html">HTML</h3><div style="clear:left"></div>
222
+ <div class="paragraph"><p>If you want to syntax highlight <em>AsciiDoc</em> HTML outputs (<tt>html4</tt> and
223
+ <tt>xhtml11</tt> backends) you need to
224
+ install <a href="http://www.gnu.org/software/src-highlite/">GNU
225
+ source-highlight</a> (most distributions have this package).</p></div>
226
+ <h3 id="_docbook">DocBook</h3><div style="clear:left"></div>
227
+ <div class="paragraph"><p><em>AsciiDoc</em> encloses the source code in a DocBook <em>programlisting</em>
228
+ element and leaves source code highlighting to the DocBook toolchain
229
+ (dblatex has a particularly nice programlisting highlighter). The
230
+ DocBook programlisting element is assigned two attributes:</p></div>
231
+ <div class="olist arabic"><ol class="arabic">
232
+ <li>
233
+ <p>
234
+ The <em>language</em> attribute is set to the <em>AsciiDoc</em> <em>language</em>
235
+ attribute.
236
+ </p>
237
+ </li>
238
+ <li>
239
+ <p>
240
+ The <em>linenumbering</em> attribute is set to the <em>AsciiDoc</em> <em>src_numbered</em>
241
+ attribute (<em>numbered</em> or <em>unnumbered</em>).
242
+ </p>
243
+ </li>
244
+ </ol></div>
245
+ <div class="paragraph"><p>If you use <tt><tt>a2x(1)</tt></tt> to generate PDF you need to include the
246
+ <tt>--no-xmllint</tt> option to suppress <tt>xmllint(1)</tt> checking&#8201;&#8212;&#8201;the
247
+ programlisting <em>language</em> attribute (required by the dblatex source
248
+ highlighter) is not part of the DocBook 4 specification (but it is in
249
+ the newer DocBook 5 specification).</p></div>
250
+ <h3 id="_testing">Testing</h3><div style="clear:left"></div>
251
+ <div class="paragraph"><p>Test the filter by converting the test file to HTML with <em>AsciiDoc</em>:</p></div>
252
+ <div class="literalblock">
253
+ <div class="content">
254
+ <pre><tt>$ asciidoc -v ./filters/source-highlight-filter-test.txt
255
+ $ firefox ./filters/source-highlight-filter-test.html &amp;</tt></pre>
256
+ </div></div>
257
+ </div>
258
+ <div id="footer">
259
+ <div id="footer-text">
260
+ Version 8.3.3<br />
261
+ Last updated 2009-01-02 11:18:54 NZDT
262
+ </div>
263
+ <div id="footer-badges">
264
+ <a href="http://validator.w3.org/check?uri=referer">
265
+ <img style="border:none; width:88px; height:31px;"
266
+ src="http://www.w3.org/Icons/valid-xhtml11"
267
+ alt="Valid XHTML 1.1!" />
268
+ </a>
269
+ <a href="http://jigsaw.w3.org/css-validator/check/referer">
270
+ <img style="border:none; width:88px; height:31px;"
271
+ src="http://jigsaw.w3.org/css-validator/images/vcss"
272
+ alt="Valid CSS!" />
273
+ </a>
274
+ <a href="http://www.mozilla.org/products/firefox/">
275
+ <img style="border:none; width:110px; height:32px;"
276
+ src="http://www.spreadfirefox.com/community/images/affiliates/Buttons/110x32/safer.gif"
277
+ alt="Get Firefox!" />
278
+ </a>
279
+ </div>
280
+ </div>
281
+ </div>
282
+ </td>
283
+ </tr>
284
+ </table>
285
+ </body>
286
+ </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 &