mizuho 0.9.6 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -2
- data/Rakefile +0 -37
- data/asciidoc/BUGS +9 -18
- data/asciidoc/BUGS.txt +5 -14
- data/asciidoc/CHANGELOG +1433 -266
- data/asciidoc/CHANGELOG.txt +2821 -1810
- data/asciidoc/COPYING +339 -339
- data/asciidoc/COPYRIGHT +18 -18
- data/asciidoc/INSTALL +189 -30
- data/asciidoc/INSTALL.txt +175 -19
- data/asciidoc/MANIFEST +88 -0
- data/asciidoc/Makefile.in +29 -13
- data/asciidoc/README +16 -17
- data/asciidoc/README.txt +35 -36
- data/asciidoc/a2x.py +902 -0
- data/asciidoc/asciidoc.conf +610 -455
- data/asciidoc/asciidoc.py +1965 -1061
- data/asciidoc/asciidocapi.py +257 -0
- data/asciidoc/common.aap +2 -2
- data/asciidoc/configure +1170 -1023
- data/asciidoc/configure.ac +1 -1
- data/asciidoc/dblatex/asciidoc-dblatex.xsl +42 -0
- data/asciidoc/doc/a2x.1 +559 -102
- data/asciidoc/doc/a2x.1.txt +233 -91
- data/asciidoc/doc/article-docinfo.xml +87 -0
- data/asciidoc/doc/article.pdf +0 -0
- data/asciidoc/doc/article.txt +139 -122
- data/asciidoc/doc/asciidoc.1 +157 -46
- data/asciidoc/doc/asciidoc.1.txt +171 -118
- data/asciidoc/doc/asciidoc.conf +7 -8
- data/asciidoc/doc/asciidoc.dict +960 -635
- data/asciidoc/doc/asciidoc.txt +2335 -1464
- data/asciidoc/doc/asciidocapi.txt +189 -0
- data/asciidoc/doc/asciimathml.txt +14 -17
- data/asciidoc/doc/book-multi.txt +181 -155
- data/asciidoc/doc/book.epub +0 -0
- data/asciidoc/doc/book.txt +156 -131
- data/asciidoc/doc/customers.csv +18 -18
- data/asciidoc/doc/epub-notes.txt +210 -0
- data/asciidoc/doc/faq.txt +1122 -547
- data/asciidoc/doc/latex-backend.txt +192 -191
- data/asciidoc/doc/latex-bugs.txt +134 -0
- data/asciidoc/doc/latex-filter.pdf +0 -0
- data/asciidoc/doc/latex-filter.txt +196 -0
- data/asciidoc/doc/latexmath.txt +13 -136
- data/asciidoc/doc/latexmathml.txt +2 -2
- data/asciidoc/doc/main.aap +233 -297
- data/asciidoc/doc/music-filter.pdf +0 -0
- data/asciidoc/doc/music-filter.txt +55 -65
- data/asciidoc/doc/publishing-ebooks-with-asciidoc.txt +398 -0
- data/asciidoc/doc/slidy-example.txt +167 -0
- data/asciidoc/doc/slidy.txt +113 -0
- data/asciidoc/doc/source-highlight-filter.pdf +0 -0
- data/asciidoc/doc/source-highlight-filter.txt +45 -20
- data/asciidoc/doc/testasciidoc.txt +231 -0
- data/asciidoc/docbook-xsl/asciidoc-docbook-xsl.txt +30 -8
- data/asciidoc/docbook-xsl/chunked.xsl +17 -19
- data/asciidoc/docbook-xsl/common.xsl +106 -67
- data/asciidoc/docbook-xsl/epub.xsl +35 -0
- data/asciidoc/docbook-xsl/fo.xsl +3 -0
- data/asciidoc/docbook-xsl/htmlhelp.xsl +16 -17
- data/asciidoc/docbook-xsl/manpage.xsl +31 -31
- data/asciidoc/docbook-xsl/text.xsl +6 -1
- data/asciidoc/docbook-xsl/xhtml.xsl +14 -14
- data/asciidoc/docbook45.conf +759 -0
- data/asciidoc/filters/code/code-filter-readme.txt +37 -37
- data/asciidoc/filters/code/code-filter-test.txt +15 -15
- data/asciidoc/filters/code/code-filter.conf +8 -8
- data/asciidoc/filters/graphviz/asciidoc-graphviz-sample.txt +104 -64
- data/asciidoc/filters/graphviz/graphviz-filter.conf +20 -16
- data/asciidoc/filters/graphviz/graphviz2png.py +54 -39
- data/asciidoc/filters/latex/latex-filter.conf +18 -0
- data/asciidoc/filters/latex/latex2png.py +216 -0
- data/asciidoc/filters/music/music-filter.conf +8 -17
- data/asciidoc/filters/music/music2png.py +40 -32
- data/asciidoc/filters/source/source-highlight-filter.conf +40 -34
- data/asciidoc/help.conf +261 -96
- data/asciidoc/html4.conf +505 -460
- data/asciidoc/html5.conf +686 -0
- data/asciidoc/images/highlighter.png +0 -0
- data/asciidoc/images/icons/caution.png +0 -0
- data/asciidoc/images/icons/example.png +0 -0
- data/asciidoc/images/icons/important.png +0 -0
- data/asciidoc/images/icons/note.png +0 -0
- data/asciidoc/images/icons/tip.png +0 -0
- data/asciidoc/images/icons/warning.png +0 -0
- data/asciidoc/images/smallnew.png +0 -0
- data/asciidoc/javascripts/asciidoc.js +189 -0
- data/asciidoc/javascripts/slidy.js +2845 -0
- data/asciidoc/javascripts/toc.js +8 -0
- data/asciidoc/lang-de.conf +57 -0
- data/asciidoc/lang-en.conf +54 -0
- data/asciidoc/lang-es.conf +49 -9
- data/asciidoc/lang-fr.conf +59 -0
- data/asciidoc/lang-hu.conf +55 -0
- data/asciidoc/lang-it.conf +55 -0
- data/asciidoc/lang-nl.conf +57 -0
- data/asciidoc/lang-pt-BR.conf +56 -0
- data/asciidoc/lang-ru.conf +60 -0
- data/asciidoc/lang-uk.conf +60 -0
- data/asciidoc/latex.conf +700 -663
- data/asciidoc/main.aap +77 -0
- data/asciidoc/slidy.conf +136 -0
- data/asciidoc/{examples/website/xhtml11-manpage.css → stylesheets/asciidoc-manpage.css} +1 -1
- data/asciidoc/stylesheets/asciidoc.css +508 -0
- data/asciidoc/stylesheets/docbook-xsl.css +322 -272
- data/asciidoc/stylesheets/flask-manpage.css +1 -0
- data/asciidoc/stylesheets/flask.css +584 -0
- data/asciidoc/stylesheets/pygments.css +66 -0
- data/asciidoc/stylesheets/slidy.css +445 -0
- data/asciidoc/stylesheets/toc2.css +33 -0
- data/asciidoc/stylesheets/volnitsky-manpage.css +1 -0
- data/asciidoc/stylesheets/volnitsky.css +435 -0
- data/asciidoc/stylesheets/xhtml11-quirks.css +5 -3
- data/asciidoc/tests/asciidocapi.py +257 -0
- data/asciidoc/tests/data/deprecated-quotes.txt +12 -0
- data/asciidoc/tests/data/filters-test.txt +90 -0
- data/asciidoc/tests/data/lang-de-test.txt +106 -0
- data/asciidoc/tests/data/lang-en-test.txt +114 -0
- data/asciidoc/tests/data/lang-es-test.txt +106 -0
- data/asciidoc/tests/data/lang-fr-test.txt +106 -0
- data/asciidoc/tests/data/lang-hu-test.txt +106 -0
- data/asciidoc/tests/data/lang-nl-test.txt +94 -0
- data/asciidoc/tests/data/lang-pt-BR-test.txt +106 -0
- data/asciidoc/tests/data/lang-ru-test.txt +106 -0
- data/asciidoc/tests/data/lang-uk-test.txt +106 -0
- data/asciidoc/tests/data/oldtables.txt +64 -0
- data/asciidoc/tests/data/rcs-id-marker-test.txt +6 -0
- data/asciidoc/tests/data/testcases.conf +2 -0
- data/asciidoc/tests/data/testcases.txt +740 -0
- data/asciidoc/tests/data/utf8-bom-test.txt +9 -0
- data/asciidoc/tests/data/utf8-examples.txt +217 -0
- data/asciidoc/tests/testasciidoc.conf +520 -0
- data/asciidoc/tests/testasciidoc.py +411 -0
- data/asciidoc/text.conf +16 -16
- data/asciidoc/vim/syntax/asciidoc.vim +99 -91
- data/asciidoc/wordpress.conf +43 -3
- data/asciidoc/xhtml11-quirks.conf +61 -57
- data/asciidoc/xhtml11.conf +684 -645
- data/lib/mizuho.rb +2 -0
- data/lib/mizuho/generator.rb +2 -2
- data/test/generator_spec.rb +1 -1
- data/test/parser_spec.rb +1 -1
- data/test/spec_helper.rb +3 -4
- metadata +87 -88
- data/asciidoc/a2x +0 -674
- data/asciidoc/doc/article.css-embedded.html +0 -602
- data/asciidoc/doc/article.html +0 -46
- data/asciidoc/doc/asciidoc-revhistory.xml +0 -27
- data/asciidoc/doc/asciidoc.1.css-embedded.html +0 -598
- data/asciidoc/doc/asciidoc.1.css.html +0 -212
- data/asciidoc/doc/asciidoc.1.html +0 -190
- data/asciidoc/doc/asciidoc.css-embedded.html +0 -7853
- data/asciidoc/doc/asciidoc.css.html +0 -7416
- data/asciidoc/doc/asciidoc.html +0 -3339
- data/asciidoc/doc/book-multi.css-embedded.html +0 -575
- data/asciidoc/doc/book-multi.html +0 -55
- data/asciidoc/doc/book.css-embedded.html +0 -607
- data/asciidoc/doc/book.html +0 -43
- data/asciidoc/doc/docbook-xsl.css +0 -272
- data/asciidoc/doc/latex-backend.html +0 -117
- data/asciidoc/doc/music-filter.html +0 -566
- data/asciidoc/doc/source-highlight-filter.html +0 -214
- data/asciidoc/docbook.conf +0 -721
- data/asciidoc/examples/website/ASCIIMathML.js +0 -938
- data/asciidoc/examples/website/CHANGELOG.html +0 -4389
- data/asciidoc/examples/website/CHANGELOG.txt +0 -1810
- data/asciidoc/examples/website/INSTALL.html +0 -161
- data/asciidoc/examples/website/INSTALL.txt +0 -71
- data/asciidoc/examples/website/LaTeXMathML.js +0 -1223
- data/asciidoc/examples/website/README-website.html +0 -118
- data/asciidoc/examples/website/README-website.txt +0 -29
- data/asciidoc/examples/website/README.html +0 -125
- data/asciidoc/examples/website/README.txt +0 -36
- data/asciidoc/examples/website/a2x.1.html +0 -419
- data/asciidoc/examples/website/a2x.1.txt +0 -204
- data/asciidoc/examples/website/asciidoc-docbook-xsl.html +0 -130
- data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +0 -43
- data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +0 -130
- data/asciidoc/examples/website/asciimathml.txt +0 -64
- data/asciidoc/examples/website/build-website.sh +0 -25
- data/asciidoc/examples/website/customers.csv +0 -18
- data/asciidoc/examples/website/downloads.html +0 -257
- data/asciidoc/examples/website/downloads.txt +0 -121
- data/asciidoc/examples/website/faq.html +0 -673
- data/asciidoc/examples/website/faq.txt +0 -547
- data/asciidoc/examples/website/index.html +0 -419
- data/asciidoc/examples/website/index.txt +0 -245
- data/asciidoc/examples/website/latex-backend.html +0 -535
- data/asciidoc/examples/website/latex-backend.txt +0 -191
- data/asciidoc/examples/website/latexmathml.txt +0 -41
- data/asciidoc/examples/website/layout1.conf +0 -161
- data/asciidoc/examples/website/layout1.css +0 -65
- data/asciidoc/examples/website/layout2.conf +0 -158
- data/asciidoc/examples/website/layout2.css +0 -93
- data/asciidoc/examples/website/manpage.html +0 -266
- data/asciidoc/examples/website/manpage.txt +0 -118
- data/asciidoc/examples/website/music-filter.html +0 -242
- data/asciidoc/examples/website/music-filter.txt +0 -158
- data/asciidoc/examples/website/music1.abc +0 -12
- data/asciidoc/examples/website/music1.png +0 -0
- data/asciidoc/examples/website/music2.ly +0 -9
- data/asciidoc/examples/website/music2.png +0 -0
- data/asciidoc/examples/website/newlists.txt +0 -40
- data/asciidoc/examples/website/newtables.txt +0 -397
- 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 +0 -286
- data/asciidoc/examples/website/source-highlight-filter.txt +0 -203
- data/asciidoc/examples/website/support.html +0 -78
- data/asciidoc/examples/website/support.txt +0 -5
- data/asciidoc/examples/website/toc.js +0 -69
- data/asciidoc/examples/website/userguide.html +0 -7460
- data/asciidoc/examples/website/userguide.txt +0 -4979
- data/asciidoc/examples/website/version83.txt +0 -37
- data/asciidoc/examples/website/version9.html +0 -143
- data/asciidoc/examples/website/version9.txt +0 -48
- data/asciidoc/examples/website/xhtml11-quirks.css +0 -41
- data/asciidoc/examples/website/xhtml11.css +0 -328
- data/asciidoc/stylesheets/xhtml11-manpage.css +0 -18
- data/asciidoc/stylesheets/xhtml11.css +0 -328
Binary file
|
Binary file
|
Binary file
|
@@ -1,286 +0,0 @@
|
|
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>
|
@@ -1,203 +0,0 @@
|
|
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 &
|