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
@@ -24,8 +24,8 @@ div.quoteblock-attribution {
|
|
24
24
|
text-align: right;
|
25
25
|
}
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
pre.verseblock-content {
|
28
|
+
font-family: inherit;
|
29
29
|
}
|
30
30
|
div.verseblock-attribution {
|
31
31
|
padding-top: 0.75em;
|
@@ -33,9 +33,11 @@ div.verseblock-attribution {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
div.exampleblock-content {
|
36
|
-
border-left:
|
36
|
+
border-left: 3px solid #dddddd;
|
37
37
|
padding-left: 0.5em;
|
38
38
|
}
|
39
39
|
|
40
|
+
div.imageblock.latex div.image-title { margin-top: 0.5em; }
|
41
|
+
|
40
42
|
/* IE6 sets dynamically generated links as visited. */
|
41
43
|
div#toc a:visited { color: blue; }
|
@@ -0,0 +1,257 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
"""
|
3
|
+
asciidocapi - AsciiDoc API wrapper class.
|
4
|
+
|
5
|
+
The AsciiDocAPI class provides an API for executing asciidoc. Minimal example
|
6
|
+
compiles `mydoc.txt` to `mydoc.html`:
|
7
|
+
|
8
|
+
import asciidocapi
|
9
|
+
asciidoc = asciidocapi.AsciiDocAPI()
|
10
|
+
asciidoc.execute('mydoc.txt')
|
11
|
+
|
12
|
+
- Full documentation in asciidocapi.txt.
|
13
|
+
- See the doctests below for more examples.
|
14
|
+
|
15
|
+
Doctests:
|
16
|
+
|
17
|
+
1. Check execution:
|
18
|
+
|
19
|
+
>>> import StringIO
|
20
|
+
>>> infile = StringIO.StringIO('Hello *{author}*')
|
21
|
+
>>> outfile = StringIO.StringIO()
|
22
|
+
>>> asciidoc = AsciiDocAPI()
|
23
|
+
>>> asciidoc.options('--no-header-footer')
|
24
|
+
>>> asciidoc.attributes['author'] = 'Joe Bloggs'
|
25
|
+
>>> asciidoc.execute(infile, outfile, backend='html4')
|
26
|
+
>>> print outfile.getvalue()
|
27
|
+
<p>Hello <strong>Joe Bloggs</strong></p>
|
28
|
+
|
29
|
+
>>> asciidoc.attributes['author'] = 'Bill Smith'
|
30
|
+
>>> infile = StringIO.StringIO('Hello _{author}_')
|
31
|
+
>>> outfile = StringIO.StringIO()
|
32
|
+
>>> asciidoc.execute(infile, outfile, backend='docbook')
|
33
|
+
>>> print outfile.getvalue()
|
34
|
+
<simpara>Hello <emphasis>Bill Smith</emphasis></simpara>
|
35
|
+
|
36
|
+
2. Check error handling:
|
37
|
+
|
38
|
+
>>> import StringIO
|
39
|
+
>>> asciidoc = AsciiDocAPI()
|
40
|
+
>>> infile = StringIO.StringIO('---------')
|
41
|
+
>>> outfile = StringIO.StringIO()
|
42
|
+
>>> asciidoc.execute(infile, outfile)
|
43
|
+
Traceback (most recent call last):
|
44
|
+
File "<stdin>", line 1, in <module>
|
45
|
+
File "asciidocapi.py", line 189, in execute
|
46
|
+
raise AsciiDocError(self.messages[-1])
|
47
|
+
AsciiDocError: ERROR: <stdin>: line 1: [blockdef-listing] missing closing delimiter
|
48
|
+
|
49
|
+
|
50
|
+
Copyright (C) 2009 Stuart Rackham. Free use of this software is granted
|
51
|
+
under the terms of the GNU General Public License (GPL).
|
52
|
+
|
53
|
+
"""
|
54
|
+
|
55
|
+
import sys,os,re,imp
|
56
|
+
|
57
|
+
API_VERSION = '0.1.2'
|
58
|
+
MIN_ASCIIDOC_VERSION = '8.4.1' # Minimum acceptable AsciiDoc version.
|
59
|
+
|
60
|
+
|
61
|
+
def find_in_path(fname, path=None):
|
62
|
+
"""
|
63
|
+
Find file fname in paths. Return None if not found.
|
64
|
+
"""
|
65
|
+
if path is None:
|
66
|
+
path = os.environ.get('PATH', '')
|
67
|
+
for dir in path.split(os.pathsep):
|
68
|
+
fpath = os.path.join(dir, fname)
|
69
|
+
if os.path.isfile(fpath):
|
70
|
+
return fpath
|
71
|
+
else:
|
72
|
+
return None
|
73
|
+
|
74
|
+
|
75
|
+
class AsciiDocError(Exception):
|
76
|
+
pass
|
77
|
+
|
78
|
+
|
79
|
+
class Options(object):
|
80
|
+
"""
|
81
|
+
Stores asciidoc(1) command options.
|
82
|
+
"""
|
83
|
+
def __init__(self, values=[]):
|
84
|
+
self.values = values[:]
|
85
|
+
def __call__(self, name, value=None):
|
86
|
+
"""Shortcut for append method."""
|
87
|
+
self.append(name, value)
|
88
|
+
def append(self, name, value=None):
|
89
|
+
if type(value) in (int,float):
|
90
|
+
value = str(value)
|
91
|
+
self.values.append((name,value))
|
92
|
+
|
93
|
+
|
94
|
+
class Version(object):
|
95
|
+
"""
|
96
|
+
Parse and compare AsciiDoc version numbers. Instance attributes:
|
97
|
+
|
98
|
+
string: String version number '<major>.<minor>[.<micro>][suffix]'.
|
99
|
+
major: Integer major version number.
|
100
|
+
minor: Integer minor version number.
|
101
|
+
micro: Integer micro version number.
|
102
|
+
suffix: Suffix (begins with non-numeric character) is ignored when
|
103
|
+
comparing.
|
104
|
+
|
105
|
+
Doctest examples:
|
106
|
+
|
107
|
+
>>> Version('8.2.5') < Version('8.3 beta 1')
|
108
|
+
True
|
109
|
+
>>> Version('8.3.0') == Version('8.3. beta 1')
|
110
|
+
True
|
111
|
+
>>> Version('8.2.0') < Version('8.20')
|
112
|
+
True
|
113
|
+
>>> Version('8.20').major
|
114
|
+
8
|
115
|
+
>>> Version('8.20').minor
|
116
|
+
20
|
117
|
+
>>> Version('8.20').micro
|
118
|
+
0
|
119
|
+
>>> Version('8.20').suffix
|
120
|
+
''
|
121
|
+
>>> Version('8.20 beta 1').suffix
|
122
|
+
'beta 1'
|
123
|
+
|
124
|
+
"""
|
125
|
+
def __init__(self, version):
|
126
|
+
self.string = version
|
127
|
+
reo = re.match(r'^(\d+)\.(\d+)(\.(\d+))?\s*(.*?)\s*$', self.string)
|
128
|
+
if not reo:
|
129
|
+
raise ValueError('invalid version number: %s' % self.string)
|
130
|
+
groups = reo.groups()
|
131
|
+
self.major = int(groups[0])
|
132
|
+
self.minor = int(groups[1])
|
133
|
+
self.micro = int(groups[3] or '0')
|
134
|
+
self.suffix = groups[4] or ''
|
135
|
+
def __cmp__(self, other):
|
136
|
+
result = cmp(self.major, other.major)
|
137
|
+
if result == 0:
|
138
|
+
result = cmp(self.minor, other.minor)
|
139
|
+
if result == 0:
|
140
|
+
result = cmp(self.micro, other.micro)
|
141
|
+
return result
|
142
|
+
|
143
|
+
|
144
|
+
class AsciiDocAPI(object):
|
145
|
+
"""
|
146
|
+
AsciiDoc API class.
|
147
|
+
"""
|
148
|
+
def __init__(self, asciidoc_py=None):
|
149
|
+
"""
|
150
|
+
Locate and import asciidoc.py.
|
151
|
+
Initialize instance attributes.
|
152
|
+
"""
|
153
|
+
self.options = Options()
|
154
|
+
self.attributes = {}
|
155
|
+
self.messages = []
|
156
|
+
# Search for the asciidoc command file.
|
157
|
+
# Try ASCIIDOC_PY environment variable first.
|
158
|
+
cmd = os.environ.get('ASCIIDOC_PY')
|
159
|
+
if cmd:
|
160
|
+
if not os.path.isfile(cmd):
|
161
|
+
raise AsciiDocError('missing ASCIIDOC_PY file: %s' % cmd)
|
162
|
+
elif asciidoc_py:
|
163
|
+
# Next try path specified by caller.
|
164
|
+
cmd = asciidoc_py
|
165
|
+
if not os.path.isfile(cmd):
|
166
|
+
raise AsciiDocError('missing file: %s' % cmd)
|
167
|
+
else:
|
168
|
+
# Try shell search paths.
|
169
|
+
for fname in ['asciidoc.py','asciidoc.pyc','asciidoc']:
|
170
|
+
cmd = find_in_path(fname)
|
171
|
+
if cmd: break
|
172
|
+
else:
|
173
|
+
# Finally try current working directory.
|
174
|
+
for cmd in ['asciidoc.py','asciidoc.pyc','asciidoc']:
|
175
|
+
if os.path.isfile(cmd): break
|
176
|
+
else:
|
177
|
+
raise AsciiDocError('failed to locate asciidoc')
|
178
|
+
self.cmd = os.path.realpath(cmd)
|
179
|
+
self.__import_asciidoc()
|
180
|
+
|
181
|
+
def __import_asciidoc(self, reload=False):
|
182
|
+
'''
|
183
|
+
Import asciidoc module (script or compiled .pyc).
|
184
|
+
See
|
185
|
+
http://groups.google.com/group/asciidoc/browse_frm/thread/66e7b59d12cd2f91
|
186
|
+
for an explanation of why a seemingly straight-forward job turned out
|
187
|
+
quite complicated.
|
188
|
+
'''
|
189
|
+
if os.path.splitext(self.cmd)[1] in ['.py','.pyc']:
|
190
|
+
sys.path.insert(0, os.path.dirname(self.cmd))
|
191
|
+
try:
|
192
|
+
try:
|
193
|
+
if reload:
|
194
|
+
import __builtin__ # Because reload() is shadowed.
|
195
|
+
__builtin__.reload(self.asciidoc)
|
196
|
+
else:
|
197
|
+
import asciidoc
|
198
|
+
self.asciidoc = asciidoc
|
199
|
+
except ImportError:
|
200
|
+
raise AsciiDocError('failed to import ' + self.cmd)
|
201
|
+
finally:
|
202
|
+
del sys.path[0]
|
203
|
+
else:
|
204
|
+
# The import statement can only handle .py or .pyc files, have to
|
205
|
+
# use imp.load_source() for scripts with other names.
|
206
|
+
try:
|
207
|
+
imp.load_source('asciidoc', self.cmd)
|
208
|
+
import asciidoc
|
209
|
+
self.asciidoc = asciidoc
|
210
|
+
except ImportError:
|
211
|
+
raise AsciiDocError('failed to import ' + self.cmd)
|
212
|
+
if Version(self.asciidoc.VERSION) < Version(MIN_ASCIIDOC_VERSION):
|
213
|
+
raise AsciiDocError(
|
214
|
+
'asciidocapi %s requires asciidoc %s or better'
|
215
|
+
% (API_VERSION, MIN_ASCIIDOC_VERSION))
|
216
|
+
|
217
|
+
def execute(self, infile, outfile=None, backend=None):
|
218
|
+
"""
|
219
|
+
Compile infile to outfile using backend format.
|
220
|
+
infile can outfile can be file path strings or file like objects.
|
221
|
+
"""
|
222
|
+
self.messages = []
|
223
|
+
opts = Options(self.options.values)
|
224
|
+
if outfile is not None:
|
225
|
+
opts('--out-file', outfile)
|
226
|
+
if backend is not None:
|
227
|
+
opts('--backend', backend)
|
228
|
+
for k,v in self.attributes.items():
|
229
|
+
if v == '' or k[-1] in '!@':
|
230
|
+
s = k
|
231
|
+
elif v is None: # A None value undefines the attribute.
|
232
|
+
s = k + '!'
|
233
|
+
else:
|
234
|
+
s = '%s=%s' % (k,v)
|
235
|
+
opts('--attribute', s)
|
236
|
+
args = [infile]
|
237
|
+
# The AsciiDoc command was designed to process source text then
|
238
|
+
# exit, there are globals and statics in asciidoc.py that have
|
239
|
+
# to be reinitialized before each run -- hence the reload.
|
240
|
+
self.__import_asciidoc(reload=True)
|
241
|
+
try:
|
242
|
+
try:
|
243
|
+
self.asciidoc.execute(self.cmd, opts.values, args)
|
244
|
+
finally:
|
245
|
+
self.messages = self.asciidoc.messages[:]
|
246
|
+
except SystemExit, e:
|
247
|
+
if e.code:
|
248
|
+
raise AsciiDocError(self.messages[-1])
|
249
|
+
|
250
|
+
|
251
|
+
if __name__ == "__main__":
|
252
|
+
"""
|
253
|
+
Run module doctests.
|
254
|
+
"""
|
255
|
+
import doctest
|
256
|
+
options = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
|
257
|
+
doctest.testmod(optionflags=options)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
// Deprecated quote attributes.
|
2
|
+
[role="foo"]##fun with text##.
|
3
|
+
["green","yellow",2,role="foo"]##fun with text##.
|
4
|
+
[green,yellow,2]##fun with text##.
|
5
|
+
More [red,black,4]*fun with text*.
|
6
|
+
Yet more [red,,1.5]**fun with text**.
|
7
|
+
Yet more [red,,1.5]+fun with text+.
|
8
|
+
Yet more [red,,1.5]'fun with text'.
|
9
|
+
|
10
|
+
Yet more [red,,1.5]_fun with text_.
|
11
|
+
|
12
|
+
Yet more [orange]'fun with text'.
|
@@ -0,0 +1,90 @@
|
|
1
|
+
Filter Tests
|
2
|
+
============
|
3
|
+
|
4
|
+
|
5
|
+
== Toy filter example from User Guide
|
6
|
+
|
7
|
+
[code,python]
|
8
|
+
----------------------------------------------
|
9
|
+
''' A multi-line
|
10
|
+
comment.'''
|
11
|
+
def sub_word(mo):
|
12
|
+
''' Single line comment.'''
|
13
|
+
word = mo.group('word') # Inline comment
|
14
|
+
if word in keywords[language]:
|
15
|
+
return quote + word + quote
|
16
|
+
else:
|
17
|
+
return word
|
18
|
+
----------------------------------------------
|
19
|
+
|
20
|
+
|
21
|
+
== Pychart Chart generations from FAQ
|
22
|
+
|
23
|
+
// Generate chart image file.
|
24
|
+
sys2::[python "{indir}/barchart.py" --format=png --output="{outdir={indir}}/{imagesdir=}{imagesdir?/}barchart.png" --scale=2]
|
25
|
+
|
26
|
+
// Display chart image file.
|
27
|
+
image::barchart.png[]
|
28
|
+
|
29
|
+
|
30
|
+
== Graphviz Graphs
|
31
|
+
|
32
|
+
.Simple graph
|
33
|
+
["graphviz", "graphviz1.png", alt="Graphviz->AsciiDoc->HTML"]
|
34
|
+
---------------------------------------------------------------------
|
35
|
+
digraph G { rankdir=LR; Graphviz->AsciiDoc->HTML}
|
36
|
+
---------------------------------------------------------------------
|
37
|
+
|
38
|
+
.Not so simple graph
|
39
|
+
["graphviz", "graphviz2.png"]
|
40
|
+
---------------------------------------------------------------------
|
41
|
+
digraph automata_0 {
|
42
|
+
size ="8.5, 11";
|
43
|
+
node [shape = circle];
|
44
|
+
0 [ style = filled, color=lightgrey ];
|
45
|
+
2 [ shape = doublecircle ];
|
46
|
+
0 -> 2 [ label = "a " ];
|
47
|
+
0 -> 1 [ label = "other " ];
|
48
|
+
1 -> 2 [ label = "a " ];
|
49
|
+
1 -> 1 [ label = "other " ];
|
50
|
+
2 -> 2 [ label = "a " ];
|
51
|
+
2 -> 1 [ label = "other " ];
|
52
|
+
"Machine: a" [ shape = plaintext ];
|
53
|
+
}
|
54
|
+
---------------------------------------------------------------------
|
55
|
+
|
56
|
+
|
57
|
+
== Music filter
|
58
|
+
|
59
|
+
.A tune generated from ABC notation
|
60
|
+
[music,music1.png]
|
61
|
+
---------------------------------------------------------------------
|
62
|
+
T:The Butterfly
|
63
|
+
R:slip jig
|
64
|
+
C:Tommy Potts
|
65
|
+
H:Fiddle player Tommy Potts made this tune from two older slip jigs,
|
66
|
+
H:one of which is called "Skin the Peelers" in Roche's collection.
|
67
|
+
D:Bothy Band: 1975.
|
68
|
+
M:9/8
|
69
|
+
K:Em
|
70
|
+
vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
|
71
|
+
|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
|
72
|
+
|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
|
73
|
+
---------------------------------------------------------------------
|
74
|
+
|
75
|
+
<<X1,Link to following fragment>>.
|
76
|
+
|
77
|
+
[[X1]]
|
78
|
+
.A fragment generated from LilyPond source
|
79
|
+
["music", "music2.png", "ly", link="music2.ly"]
|
80
|
+
---------------------------------------------------------------------
|
81
|
+
\version "2.10.0"
|
82
|
+
\paper {
|
83
|
+
ragged-right = ##t
|
84
|
+
}
|
85
|
+
{
|
86
|
+
\time 3/4
|
87
|
+
\clef bass
|
88
|
+
c2 e4 g2. f4 e d c2 r4
|
89
|
+
}
|
90
|
+
---------------------------------------------------------------------
|
@@ -0,0 +1,106 @@
|
|
1
|
+
// Test for lang-de.conf language file.
|
2
|
+
:lang: de
|
3
|
+
|
4
|
+
Languages Test
|
5
|
+
==============
|
6
|
+
:revnumber: v1.0
|
7
|
+
:revdate: 2003-12-21
|
8
|
+
|
9
|
+
ifdef::doctype-article[]
|
10
|
+
Zusammenfassung
|
11
|
+
---------------
|
12
|
+
Abstract special section.
|
13
|
+
|
14
|
+
endif::doctype-article[]
|
15
|
+
|
16
|
+
|
17
|
+
ifdef::doctype-book[]
|
18
|
+
Widmung
|
19
|
+
-------
|
20
|
+
Dedication special section.
|
21
|
+
|
22
|
+
|
23
|
+
Vorwort
|
24
|
+
-------
|
25
|
+
Preface special section.
|
26
|
+
|
27
|
+
|
28
|
+
Kolophon
|
29
|
+
--------
|
30
|
+
Colophon special section.
|
31
|
+
|
32
|
+
endif::doctype-book[]
|
33
|
+
|
34
|
+
|
35
|
+
The First Section
|
36
|
+
-----------------
|
37
|
+
Admonishments
|
38
|
+
~~~~~~~~~~~~~
|
39
|
+
Do not translate in the source file -- they are translated to the
|
40
|
+
output file
|
41
|
+
|
42
|
+
NOTE: Lorum ipsum.
|
43
|
+
|
44
|
+
TIP: Lorum ipsum.
|
45
|
+
|
46
|
+
WARNING: Lorum ipsum.
|
47
|
+
|
48
|
+
CAUTION: Lorum ipsum.
|
49
|
+
|
50
|
+
IMPORTANT: Lorum ipsum.
|
51
|
+
|
52
|
+
.Tiger
|
53
|
+
image::../../images/tiger.png[Tiger image]
|
54
|
+
|
55
|
+
Followed by an example table:
|
56
|
+
|
57
|
+
.Table
|
58
|
+
[width="60%",options="header"]
|
59
|
+
|==============================================
|
60
|
+
| Option | Description
|
61
|
+
| -a 'USER GROUP' | Add 'USER' to 'GROUP'.
|
62
|
+
| -R 'GROUP' | Disables access to 'GROUP'.
|
63
|
+
|==============================================
|
64
|
+
|
65
|
+
And now for something completely different: ((monkeys)), lions and
|
66
|
+
tigers.
|
67
|
+
|
68
|
+
|
69
|
+
Anhang A: Example Appendix
|
70
|
+
--------------------------
|
71
|
+
Appendix special section.
|
72
|
+
|
73
|
+
|
74
|
+
Literaturverzeichnis
|
75
|
+
--------------------
|
76
|
+
Bibliography special section.
|
77
|
+
|
78
|
+
[bibliography]
|
79
|
+
- [[[taoup]]] Eric Steven Raymond. 'The Art of Unix
|
80
|
+
Programming'. Addison-Wesley. ISBN 0-13-142901-9.
|
81
|
+
- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
|
82
|
+
'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999.
|
83
|
+
ISBN 1-56592-580-7.
|
84
|
+
|
85
|
+
|
86
|
+
Glossar
|
87
|
+
-------
|
88
|
+
Glossary special section.
|
89
|
+
|
90
|
+
[glossary]
|
91
|
+
A glossary term::
|
92
|
+
The corresponding (indented) definition.
|
93
|
+
|
94
|
+
A second glossary term::
|
95
|
+
The corresponding (indented) definition.
|
96
|
+
|
97
|
+
|
98
|
+
ifdef::basebackend-docbook[]
|
99
|
+
Stichwortverzeichnis
|
100
|
+
--------------------
|
101
|
+
////////////////////////////////////////////////////////////////
|
102
|
+
Index special section.
|
103
|
+
The index is normally left completely empty, it's contents being
|
104
|
+
generated automatically by the DocBook toolchain.
|
105
|
+
////////////////////////////////////////////////////////////////
|
106
|
+
endif::basebackend-docbook[]
|