Skip to content
This repository was archived by the owner on Oct 17, 2021. It is now read-only.

Commit 195bf7b

Browse files
author
Stuart Rackham
committed
- Renamed AsciiDoc API class to AsciiDocAPI.
- Added AsciiDoc API documentation file.
1 parent d170c43 commit 195bf7b

File tree

8 files changed

+232
-43
lines changed

8 files changed

+232
-43
lines changed

MANIFEST

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
a2x
22
asciidoc.py
3+
asciidocapi.py
34
BUGS
45
BUGS.txt
56
common.aap
@@ -36,6 +37,7 @@ doc/music-filter.pdf
3637
doc/source-highlight-filter.pdf
3738
doc/*.txt
3839
doc/asciidoc.dict
40+
doc/asciidocapi.txt
3941
examples/website/ASCIIMathML.js
4042
examples/website/LaTeXMathML.js
4143
examples/website/build-website.sh

asciidocapi.py

+20-16
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"""
33
asciidocapi - AsciiDoc API wrapper class.
44
5-
The AsciiDoc class provides an API for executing asciidoc. Minimal example
5+
The AsciiDocAPI class provides an API for executing asciidoc. Minimal example
66
compiles `mydoc.txt` to `mydoc.html`:
77
88
import asciidocapi
9-
asciidoc = asciidocapi.AsciiDoc()
9+
asciidoc = asciidocapi.AsciiDocAPI()
1010
asciidoc.execute('mydoc.txt')
1111
1212
- Full documentation in asciidocapi.txt.
@@ -19,7 +19,7 @@
1919
>>> import StringIO
2020
>>> infile = StringIO.StringIO('Hello *{author}*')
2121
>>> outfile = StringIO.StringIO()
22-
>>> asciidoc = AsciiDoc()
22+
>>> asciidoc = AsciiDocAPI()
2323
>>> asciidoc.options('--no-header-footer')
2424
>>> asciidoc.attributes['author'] = 'Joe Bloggs'
2525
>>> asciidoc.execute(infile, outfile, backend='html4')
@@ -29,7 +29,7 @@
2929
2. Check error handling:
3030
3131
>>> import StringIO
32-
>>> asciidoc = AsciiDoc()
32+
>>> asciidoc = AsciiDocAPI()
3333
>>> infile = StringIO.StringIO('---------')
3434
>>> outfile = StringIO.StringIO()
3535
>>> asciidoc.execute(infile, outfile)
@@ -45,11 +45,11 @@
4545
4646
"""
4747

48+
import sys,os,re
49+
4850
API_VERSION = '0.1.0'
4951
MIN_ASCIIDOC_VERSION = '8.3.6' # Minimum acceptable AsciiDoc version.
5052

51-
import sys,os,re
52-
5353

5454
def find_in_path(fname, path=None):
5555
"""
@@ -71,14 +71,7 @@ class AsciiDocError(Exception):
7171

7272
class Options(object):
7373
"""
74-
List of (key,value) command option tuples.
75-
76-
The following examples append ('--verbose',None) and
77-
('--conf-file','blog.conf') to the options.values list (you can
78-
optionally omit append):
79-
80-
options.append('--verbose')
81-
options.append('--conf-file', 'blog.conf')
74+
Stores asciidoc(1) command options.
8275
"""
8376
def __init__(self, values=[]):
8477
self.values = values[:]
@@ -140,11 +133,15 @@ def __cmp__(self, other):
140133
result = cmp(self.micro, other.micro)
141134
return result
142135

143-
class AsciiDoc(object):
136+
class AsciiDocAPI(object):
144137
"""
145-
The following options are invalid in API context: help, version.
138+
AsciiDoc API class.
146139
"""
147140
def __init__(self, asciidoc_py=None):
141+
"""
142+
Locate and import asciidoc.py.
143+
Initialize instance attributes.
144+
"""
148145
self.options = Options()
149146
self.attributes = {}
150147
self.messages = []
@@ -186,6 +183,10 @@ def __init__(self, asciidoc_py=None):
186183
self.cmd = cmd
187184

188185
def execute(self, infile, outfile=None, backend=None):
186+
"""
187+
Compile infile to outfile using backend format.
188+
infile can outfile can be file path strings or file like objects.
189+
"""
189190
self.messages = []
190191
opts = Options(self.options.values)
191192
if outfile is not None:
@@ -215,6 +216,9 @@ def execute(self, infile, outfile=None, backend=None):
215216

216217

217218
if __name__ == "__main__":
219+
"""
220+
Run module doctests.
221+
"""
218222
import doctest
219223
options = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
220224
doctest.testmod(optionflags=options)

doc/asciidoc.dict

+37-19
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
personal_ws-1.1 en 742
1+
personal_ws-1.1 en 760
22
Sturmer
3-
Kl�ber
43
Kleber
4+
Kl�ber
55
quis
66
auctor
7+
tuples
78
linkcss
89
multi
910
CommentBlock
1011
AsciiDoc's
1112
BOLID
1213
callouts
14+
API
1315
bulleted
1416
starttags
15-
ListingBlock
1617
listingblock
18+
ListingBlock
1719
eval
1820
ListLabel
1921
asc
@@ -38,6 +40,7 @@ programlisting
3840
xhtml
3941
Windtrainer
4042
des
43+
cmd
4144
specialwords
4245
muellner
4346
Miklos
@@ -96,8 +99,8 @@ pageunits
9699
LaTeX
97100
citetitle
98101
emphasizedwords
99-
blocktitle
100102
BlockTitle
103+
blocktitle
101104
DTD
102105
CVS
103106
valign
@@ -126,8 +129,8 @@ luptatum
126129
TitleBlock
127130
fmt
128131
subscripted
129-
middlename
130132
MiddleName
133+
middlename
131134
subdirectories
132135
footnoteref
133136
passtext
@@ -148,8 +151,8 @@ entrytbl
148151
Ghostscript
149152
verear
150153
Buenos
151-
LinuxDoc
152154
linuxdoc
155+
LinuxDoc
153156
PostScript
154157
hhp
155158
Vijay
@@ -164,8 +167,9 @@ ListingBlocks
164167
GPL
165168
hsides
166169
upperalpha
167-
B�lido
170+
docfile
168171
Bolido
172+
B�lido
169173
footrow
170174
misspelt
171175
WINNT
@@ -177,8 +181,8 @@ bloggs
177181
hoc
178182
LiteralParagraphs
179183
primis
180-
verbatimblock
181184
VerbatimBlock
185+
verbatimblock
182186
corpname
183187
shiftwidth
184188
misevaluations
@@ -187,6 +191,7 @@ mattis
187191
Chai
188192
headrow
189193
Efros
194+
setuptools
190195
gui
191196
Blondel
192197
ile
@@ -220,6 +225,7 @@ SimpleList
220225
apos
221226
MSHR
222227
unescaped
228+
IRC
223229
toclevel
224230
runtime
225231
CalloutList
@@ -229,6 +235,7 @@ ctags
229235
sudo
230236
Helvetica
231237
SectionClose
238+
blog
232239
termtag
233240
OpenBlock
234241
joe
@@ -353,6 +360,7 @@ Bouchers
353360
JavaScript
354361
newlists
355362
guimenu
363+
init
356364
ListParagraphs
357365
bodydata
358366
MEPIS
@@ -373,6 +381,7 @@ mantitle
373381
RCS
374382
indentsize
375383
outfilesuffix
384+
doctime
376385
Berglunds
377386
syntaxes
378387
manvolnum
@@ -388,8 +397,8 @@ pre
388397
coid
389398
params
390399
mediaobjects
391-
JavaScripts
392400
javascripts
401+
JavaScripts
393402
sgmlfmt
394403
subsnormal
395404
unchunked
@@ -400,6 +409,7 @@ RevisionLine
400409
refname
401410
listelement
402411
PRS
412+
config
403413
CONFIG
404414
sem
405415
gzip
@@ -422,6 +432,7 @@ fileextension
422432
filetype
423433
URIs
424434
Blackdown
435+
pyc
425436
lang
426437
filesystem
427438
taoup
@@ -460,14 +471,17 @@ arabic
460471
fringilla
461472
retab
462473
BackendBlocks
463-
ChangeLog
464474
changelog
475+
ChangeLog
465476
tis
466477
Ubuntu
467478
sectids
479+
AsciiDocAPI
480+
asciidocapi
468481
Sommer
469482
LabeledList
470483
ZapfDingbats
484+
Julien
471485
hyperlinks
472486
EmailAddress
473487
Cheatsheet
@@ -480,8 +494,8 @@ crlf
480494
vel
481495
Iisaka's
482496
localtime
483-
BlockMacro
484497
blockmacro
498+
BlockMacro
485499
Xandros
486500
groff
487501
POSIX
@@ -507,7 +521,9 @@ configfile
507521
Donec
508522
colpcwidth
509523
uri
524+
AsciiDocError
510525
monospaced
526+
docdate
511527
llevar
512528
utf
513529
subdirectory
@@ -524,8 +540,8 @@ dbtimestamp
524540
txt
525541
BlockId
526542
passthrough
527-
Berguvsv�gen
528543
Berguvsvagen
544+
Berguvsv�gen
529545
noincsearch
530546
TableRow
531547
inlinemediaobject
@@ -537,6 +553,7 @@ xsltproc
537553
coids
538554
resx
539555
NumberedList
556+
getvalue
540557
colstop
541558
undefine
542559
tagname
@@ -573,9 +590,9 @@ Redhat
573590
cb
574591
tuple
575592
cd
576-
asciimathml
577-
AsciiMathML
578593
ASCIIMathML
594+
AsciiMathML
595+
asciimathml
579596
arounds
580597
filename
581598
mansource
@@ -591,8 +608,8 @@ scaledwidth
591608
cp
592609
xsl
593610
fb
594-
DocBook
595611
docbook
612+
DocBook
596613
stylesheet
597614
pagefile
598615
superscripted
@@ -604,6 +621,7 @@ Klum
604621
fo
605622
sgmlformat
606623
et
624+
StringIO
607625
eu
608626
showcomments
609627
gq
@@ -612,8 +630,8 @@ fprintf
612630
colabswidth
613631
tabsize
614632
smallnew
615-
BlockTitles
616633
blocktitles
634+
BlockTitles
617635
localdate
618636
bodyrow
619637
hs
@@ -663,8 +681,8 @@ permalink
663681
td
664682
py
665683
AROUT
666-
literalblock
667684
LiteralBlock
685+
literalblock
668686
sgml
669687
biggy
670688
softtabstop
@@ -680,8 +698,8 @@ tt
680698
blandit
681699
inline
682700
Mart�n
683-
SectionBody
684701
sectionbody
702+
SectionBody
685703
VM
686704
conformant
687705
listchars
@@ -726,8 +744,8 @@ nbsp
726744
qanda
727745
noout
728746
massa
729-
AsciiDoc
730747
asciidoc
748+
AsciiDoc
731749
manmanual
732750
TableBody
733751
realpath

0 commit comments

Comments
 (0)