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
|
Binary file
|
Binary file
|
@@ -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>»<a href="index.html">Home</a></div>
|
21
|
+
<div>»<a href="manpage.html">Man Page</a></div>
|
22
|
+
<div>»<a href="userguide.html">User Guide</a></div>
|
23
|
+
<div>»<a href="http://powerman.name/doc/asciidoc">Cheatsheet</a></div>
|
24
|
+
<div>»<a href="a2x.1.html">a2x</a></div>
|
25
|
+
<div>»<a href="README.html">README</a></div>
|
26
|
+
<div>»<a href="CHANGELOG.html">ChangeLog</a></div>
|
27
|
+
<div>»<a href="INSTALL.html">Installation</a></div>
|
28
|
+
<div>»<a href="downloads.html">Downloads</a></div>
|
29
|
+
<div>»<a href="faq.html">FAQ</a></div>
|
30
|
+
<div>»<a href="support.html">Support</a></div>
|
31
|
+
<div id="page-source">»<a href="source-highlight-filter.txt">Page 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’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 < 0: print 'Hello World!'
|
67
|
+
|
68
|
+
:language: python
|
69
|
+
|
70
|
+
[source]
|
71
|
+
if n < 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} => #{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"><</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"><</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} => #{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__ <1>
|
154
|
+
# Array#cycle test
|
155
|
+
# true => 0
|
156
|
+
# false => 1
|
157
|
+
# true => 2
|
158
|
+
# false => 3
|
159
|
+
# true => 4
|
160
|
+
puts 'Array#cycle test' <2>
|
161
|
+
[true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
|
162
|
+
puts "#{a.inspect} => #{b.inspect}"
|
163
|
+
end
|
164
|
+
end
|
165
|
+
---------------------------------------------------------------------
|
166
|
+
|
167
|
+
<1> First callout.
|
168
|
+
<2> 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><1></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 => 0</span></span>
|
197
|
+
<span style="color: #000000">00022:</span> <span style="font-style: italic"><span style="color: #9A1900"># false => 1</span></span>
|
198
|
+
<span style="color: #000000">00023:</span> <span style="font-style: italic"><span style="color: #9A1900"># true => 2</span></span>
|
199
|
+
<span style="color: #000000">00024:</span> <span style="font-style: italic"><span style="color: #9A1900"># false => 3</span></span>
|
200
|
+
<span style="color: #000000">00025:</span> <span style="font-style: italic"><span style="color: #9A1900"># true => 4</span></span>
|
201
|
+
<span style="color: #000000">00026:</span> puts <span style="color: #FF0000">'Array#cycle test'</span> <span style="color: #FF0000"><b><2></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} => #{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 — 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 &</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 &
|