summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsrackham <srackham@petrel>2007-10-23 14:23:41 +1300
committersrackham <srackham@petrel>2007-10-23 14:23:41 +1300
commite3ac3be3f1080ab31c259f4f4242a5981c70a26e (patch)
tree5f3fb88e1cc4cf7d0fdf2bc3b64c1e002ed49364
downloadasciidoc-git-e3ac3be3f1080ab31c259f4f4242a5981c70a26e.tar.gz
Initial commit.
-rw-r--r--.hgignore4
-rw-r--r--BUGS28
-rw-r--r--BUGS.txt21
-rw-r--r--CHANGELOG1448
-rw-r--r--CHANGELOG.txt1448
-rw-r--r--COPYING339
-rw-r--r--COPYRIGHT18
-rw-r--r--INSTALL83
-rw-r--r--INSTALL.txt71
-rw-r--r--README46
-rw-r--r--README.txt34
-rwxr-xr-xa2x591
-rw-r--r--asciidoc.conf368
-rwxr-xr-xasciidoc.py4244
-rw-r--r--doc/a2x.1220
-rw-r--r--doc/a2x.1.txt191
-rw-r--r--doc/article.txt124
-rw-r--r--doc/asciidoc-revhistory.xml27
-rw-r--r--doc/asciidoc.1154
-rw-r--r--doc/asciidoc.1.txt108
-rw-r--r--doc/asciidoc.chmbin0 -> 162179 bytes
-rw-r--r--doc/asciidoc.conf6
-rw-r--r--doc/asciidoc.txt4772
-rw-r--r--doc/asciimath.txt47
-rw-r--r--doc/book-multi.txt159
-rw-r--r--doc/book.txt133
-rw-r--r--doc/customers.csv18
l---------doc/docbook-xsl.css1
-rw-r--r--doc/faq.txt172
l---------doc/images1
-rw-r--r--doc/latex-backend.txt193
-rw-r--r--doc/latexmath.txt35
-rw-r--r--doc/main.aap250
-rw-r--r--doc/music-filter.txt157
-rw-r--r--doc/source-highlight-filter.txt174
-rw-r--r--docbook-xsl/asciidoc-docbook-xsl.txt96
-rw-r--r--docbook-xsl/chunked.xsl19
-rw-r--r--docbook-xsl/common.xsl61
-rw-r--r--docbook-xsl/fo.xsl112
-rw-r--r--docbook-xsl/htmlhelp.xsl17
-rw-r--r--docbook-xsl/manpage-sp.patch41
-rw-r--r--docbook-xsl/manpage.xsl28
-rw-r--r--docbook-xsl/shaded-literallayout.patch32
-rw-r--r--docbook-xsl/xhtml.xsl14
-rw-r--r--docbook.conf597
l---------examples/website/ASCIIMathML.js1
l---------examples/website/CHANGELOG.txt1
l---------examples/website/INSTALL.txt1
l---------examples/website/LaTeXMathML.js1
-rw-r--r--examples/website/README-website.txt29
l---------examples/website/README.txt1
l---------examples/website/a2x.1.txt1
l---------examples/website/asciidoc-docbook-xsl.txt1
l---------examples/website/asciimath.txt1
-rwxr-xr-xexamples/website/build-website.sh25
l---------examples/website/customers.csv1
-rw-r--r--examples/website/downloads.txt79
l---------examples/website/faq.txt1
l---------examples/website/images1
-rw-r--r--examples/website/index.txt197
l---------examples/website/latex-backend.txt1
l---------examples/website/latexmath.txt1
-rw-r--r--examples/website/layout1.conf160
-rw-r--r--examples/website/layout1.css65
-rw-r--r--examples/website/layout2.conf158
-rw-r--r--examples/website/layout2.css93
l---------examples/website/manpage.txt1
l---------examples/website/music-filter.txt1
-rw-r--r--examples/website/music1.abc12
-rw-r--r--examples/website/music1.pngbin0 -> 23391 bytes
-rw-r--r--examples/website/music2.ly9
-rw-r--r--examples/website/music2.pngbin0 -> 2017 bytes
l---------examples/website/source-highlight-filter.txt1
-rw-r--r--examples/website/support.txt8
l---------examples/website/toc.js1
l---------examples/website/userguide.txt1
l---------examples/website/xhtml11-manpage.css1
l---------examples/website/xhtml11-quirks.css1
l---------examples/website/xhtml11.css1
-rw-r--r--filters/code-filter-readme.txt37
-rw-r--r--filters/code-filter-test-c++.txt7
-rw-r--r--filters/code-filter-test.txt15
-rw-r--r--filters/code-filter.conf15
-rwxr-xr-xfilters/code-filter.py239
-rw-r--r--filters/music-filter-test.txt40
-rw-r--r--filters/music-filter.conf30
-rwxr-xr-xfilters/music2png.py189
-rw-r--r--filters/source-highlight-filter-test.txt19
-rw-r--r--filters/source-highlight-filter.conf33
-rw-r--r--help.conf202
-rw-r--r--html4.conf358
-rw-r--r--images/highlighter.pngbin0 -> 72099 bytes
-rw-r--r--images/icons/README5
-rw-r--r--images/icons/callouts/1.pngbin0 -> 329 bytes
-rw-r--r--images/icons/callouts/10.pngbin0 -> 361 bytes
-rw-r--r--images/icons/callouts/11.pngbin0 -> 565 bytes
-rw-r--r--images/icons/callouts/12.pngbin0 -> 617 bytes
-rw-r--r--images/icons/callouts/13.pngbin0 -> 623 bytes
-rw-r--r--images/icons/callouts/14.pngbin0 -> 411 bytes
-rw-r--r--images/icons/callouts/15.pngbin0 -> 640 bytes
-rw-r--r--images/icons/callouts/2.pngbin0 -> 353 bytes
-rw-r--r--images/icons/callouts/3.pngbin0 -> 350 bytes
-rw-r--r--images/icons/callouts/4.pngbin0 -> 345 bytes
-rw-r--r--images/icons/callouts/5.pngbin0 -> 348 bytes
-rw-r--r--images/icons/callouts/6.pngbin0 -> 355 bytes
-rw-r--r--images/icons/callouts/7.pngbin0 -> 344 bytes
-rw-r--r--images/icons/callouts/8.pngbin0 -> 357 bytes
-rw-r--r--images/icons/callouts/9.pngbin0 -> 357 bytes
-rw-r--r--images/icons/caution.pngbin0 -> 2554 bytes
-rw-r--r--images/icons/example.pngbin0 -> 2354 bytes
-rw-r--r--images/icons/home.pngbin0 -> 1340 bytes
-rw-r--r--images/icons/important.pngbin0 -> 2657 bytes
-rw-r--r--images/icons/next.pngbin0 -> 1302 bytes
-rw-r--r--images/icons/note.pngbin0 -> 2730 bytes
-rw-r--r--images/icons/prev.pngbin0 -> 1348 bytes
-rw-r--r--images/icons/tip.pngbin0 -> 2602 bytes
-rw-r--r--images/icons/up.pngbin0 -> 1320 bytes
-rw-r--r--images/icons/warning.pngbin0 -> 2828 bytes
-rw-r--r--images/smallnew.pngbin0 -> 323 bytes
-rw-r--r--images/tiger.pngbin0 -> 6515 bytes
-rwxr-xr-xinstall.sh52
-rw-r--r--javascripts/ASCIIMathML.js938
-rw-r--r--javascripts/LaTeXMathML.js1223
-rw-r--r--javascripts/toc.js67
-rw-r--r--latex.conf663
-rw-r--r--linuxdoc.conf285
-rw-r--r--stylesheets/docbook-xsl.css271
-rw-r--r--stylesheets/xhtml-deprecated-manpage.css21
-rw-r--r--stylesheets/xhtml-deprecated.css247
-rw-r--r--stylesheets/xhtml11-manpage.css13
-rw-r--r--stylesheets/xhtml11-quirks.css31
-rw-r--r--stylesheets/xhtml11.css266
-rw-r--r--text.conf16
l---------uninstall.sh1
-rw-r--r--vim/ftdetect/asciidoc_filetype.vim53
-rw-r--r--vim/syntax/asciidoc.vim128
-rw-r--r--xhtml-deprecated-css.conf235
-rw-r--r--xhtml-deprecated.conf352
-rw-r--r--xhtml11-quirks.conf45
-rw-r--r--xhtml11.conf466
140 files changed, 24120 insertions, 0 deletions
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..8996047
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,4 @@
+syntax: glob
+*.swp
+*.pdf
+*.html
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..28fa813
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,28 @@
+
+ Bugs and Known Problems
+
+ version 8.2.3, 12 September 2007
+ _________________________________________________________________
+
+1. AsciiDoc
+
+ * The include1::[] block macro does not work inside ListingBlocks or
+ FilterBlocks. Use include::[] instead.
+ * Reported line numbers in diagnostic messages are sometimes wrong.
+ * Block filters only work in a POSIX environment.
+ * Embedding open brace characters { in argument values can cause
+ incorrect argument substitution.
+ * Attribute references in macro attribute lists can't be unescaped
+ (with the exception of attribute list entry {0}).
+ * Section numbering is incorrect when outputting HTML from a
+ multi-part book type document. This is not a biggy since
+ multi-part books are generally processed to DocBook.
+ * A row of apostrophes in an inline context throws AsciiDoc into an
+ endless loop.
+ * Multiple comma separated command names in the manpage NAME section
+ translate to a single DocBook refname instead of multiple refname
+ elements.
+ _________________________________________________________________
+
+ Version 8.2.3
+ Last updated 2007-09-11 12:56:17 NZDT
diff --git a/BUGS.txt b/BUGS.txt
new file mode 100644
index 0000000..aceb6b6
--- /dev/null
+++ b/BUGS.txt
@@ -0,0 +1,21 @@
+Bugs and Known Problems
+=======================
+
+AsciiDoc
+--------
+- The `\include1::[]` block macro does not work inside ListingBlocks or
+ FilterBlocks. Use `\include::[]` instead.
+- Reported line numbers in diagnostic messages are sometimes wrong.
+- Block filters only work in a POSIX environment.
+- Embedding open brace characters { in argument values can cause
+ incorrect argument substitution.
+- Attribute references in macro attribute lists can't be unescaped
+ (with the exception of attribute list entry `\{0}`).
+- Section numbering is incorrect when outputting HTML from a
+ multi-part book type document. This is not a biggy since multi-part
+ books are generally processed to DocBook.
+- A row of apostrophes in an inline context throws AsciiDoc into an
+ endless loop.
+- Multiple comma separated command names in the manpage NAME section
+ translate to a single DocBook `refname` instead of multiple
+ `refname` elements.
diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..8c8f43f
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,1448 @@
+
+ AsciiDoc ChangeLog
+
+ version 8.2.3, 12 September 2007
+ _________________________________________________________________
+
+1. Version 8.2.3 (2007-09-12)
+
+ Additions and changes
+ * Added VMiklos's permalink patch for auto-generated section IDs
+ (enabled by default by the sectids attribute).
+ * Added [1]FAQ to website.
+ * Changed format of {localdate} attribute to ISO 8601 (%Y-%m-%d).
+ * Added abc2ly --beams=None option to make music2png.py conform to
+ ABC's notion of beams.
+ * XHTML level 2 section headings are now styled with an underlining
+ border.
+ * XHTML links to AsciiDoc title elements are now implemented with
+ title ID attributes (previously separate <a> element targets were
+ generated.
+ * Multi-word first, middle and last names can be entered in the
+ header author line using the underscore as a word separator.
+ * The nested inline macros restriction has now been lifted, for
+ example you can now include links and inline images inside
+ footnotes.
+ * Help topic names can be shortened (so long as they are not
+ ambiguous). For example asciidoc -hm will print the AsciiDoc man
+ page.
+ * Added {two_colons} and {two_semicolons} attributes for escaping
+ labeled list ambiguity.
+ * If quirks mode is disabled the XHTML Mime Type is set to the
+ recommended application/xhtml+xml (rather than text/html).
+
+ Bug fixes
+ * Author information is now correctly set when using attribute
+ entries in the header instead of an author line (previously the
+ author attribute was not being calculated correctly and there were
+ attribute substitution problems).
+ _________________________________________________________________
+
+2. Version 8.2.2 (2007-07-22)
+
+ Additions and changes
+ * [2]LaTeXMathML capability has been added for users who are more
+ familiar with or prefer LaTeX math formulas to the [3]ASCIIMathML
+ notation (thanks to Arthur Sakellariou for the patch).
+ * The source highlight and code filters now process embedded
+ callouts.
+ * Added an --attribute=ATTRIBUTE option to a2x(1) for passing
+ attribute values to asciidoc(1) (a shortcut for
+ --asciidoc-opts="-a ATTRIBUTE").
+ * Image block and inline macros prepend optional {imagesdir}
+ attribute to image link targets.
+
+ Bug fixes
+ * Fixed an assertion error that occurred when a configuration file
+ containing an include::[] macro was loaded using the --conf-file
+ option and the configuration file name did not include an explicit
+ directory path -- patch submitted by Dmitry Potapov.
+ * Asciidoc titles are only converted to lower case if all characters
+ are upper case otherwise case is left unchanged -- patch submitted
+ by Dmitry Potapov.
+ * Added a missing check that input is not stdin before loading
+ configuration files from the document directory -- patch submitted
+ by Dmitry Potapov.
+ * Attribute list items must evaluate to strings, numbers or None
+ (previously it was possible to evaluate to other object types
+ which resulted in surprising attribute values).
+ * If an AsciiDoc document has no title an empty XHTML 1.1 title
+ element is created -- previously the title element was dropped
+ which resulted in invalid XHTML 1.1.
+ * The Vim syntax file no longer highlights escaped callouts.
+ * The Vim syntax highlighter now correctly highlights Double-dollar
+ passthroughs when they enclose dollar delimited ASCIIMathML and
+ LaTeXMathML formulas.
+ _________________________________________________________________
+
+3. Version 8.2.1 (2007-04-06)
+
+ Additions and changes
+ * A number of improvements have been made to the Vim syntax
+ highlighter, for example the word C++ is no longer mistaken for
+ the start of an unconstrained monospace quote.
+ * Labeled list definitions have been tightened -- a list label can
+ no longer containing trailing spaces. The following example is no
+ longer recognized as a valid list label:
+
+ Lorum ipsum ::
+ This change implements the originally intended behavior (as per
+ the AsciiDoc documentation and examples) so there should be very
+ few compatibility issues.
+ _________________________________________________________________
+
+4. Version 8.2.0 (2007-04-04)
+
+ Additions and changes
+ * A Vim syntax file is now included in the AsciiDoc distribution
+ (inspired by Felix Obenhuber's asciidoc.vim script). You can find
+ it (along with a Vim filetype detection script in the distribution
+ ./vim/ directory (the scripts are installed automatically by the
+ AsciiDoc installer ./install.sh). See Appendix J of the AsciiDoc
+ User Guide for details.
+ * Added toclevel attribute (1..4) which sets the number of title
+ levels reported in the table of contents. Defaults to 2 and must
+ be used with the toc attribute. Example usage:
+
+ $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt
+ * Added a listindex attribute which is the current list item index
+ (1..). If this attribute appears outside a list its value is the
+ number of items in the most recently closed list.
+ * The single line titles syntax now accepts trailing suffixes --
+ this syntax matches the title line syntax of a number of popular
+ Wiki markups.
+ * If a QuoteBlock has no attribution or citetitle then the DocBook
+ <attribution> element is not generated (previously generated empty
+ <attribution> element).
+ * If the text of a labeled list item is blank then no texttag is
+ written.
+ * An end of line backslash performs line continuation for horizontal
+ labeled list items.
+ * The Revision line now accommodates Subversion $Id markers (in
+ addition to CVS and RCS markers). Thanks to Tiago Sturmer Daitx
+ for this patch.
+ * Implemented a2x(1) option --skip-asciidoc which allows a2x(1) to
+ convert DocBook XML files not derived from AsciiDoc sources.
+ * If a2x(1) --doctype option is not specified it defaults to manpage
+ if --format=manpage else defaults to article (previously --doctype
+ always defaulted to article).
+ * Added an External Resources section to the [4]AsciiDoc home page.
+ _________________________________________________________________
+
+5. Version 8.1.0 (2006-10-22)
+
+ Additions and changes
+ * AsciiDoc generated XHTML documents now display a table of contents
+ if the toc attribute is defined (JavaScript needs to be enabled
+ for this to work). Thanks to Troy Hanson who contributed this
+ feature based on a JavaScript by Mihai Bazon. I've simplified
+ things somewhat to match Docbook XSL Stylesheets style, see Troy's
+ [5]tpl User Guide for a fancier layout. Use the -a toc -a numbered
+ command-line options to produce a number table of contents.
+ * A [6]music filter is included in the distribution ./filters/
+ directory. It translates music in [7]LilyPond or [8]ABC notation
+ to standard classical notation in the form of a trimmed PNG image
+ which is inserted into the AsciiDoc output document.
+ * Incorporated Paul Melis's Win32 filter patch. This workaround
+ allows AsciiDoc to run filters under Windows.
+ * Added uninstall.sh script.
+ * Rather than proliferate a confusing number of filter block
+ delimiters the following convention has been adopted: delimiters
+ belonging to DelimitedBlock filters distributed with AsciiDoc will
+ consist of a word (normally a noun identifying the block content)
+ followed by four or more tilde characters. This has necessitated
+ changing existing filter delimiters (the old delimiters still work
+ but may be deprecated in future versions):
+ + The example code filter block delimiter is now the word code
+ followed by four or more tilde characters.
+ + The source highlight filter block delimiter is now the word
+ source followed by four or more tilde characters.
+ * Conditionally redefined subscript and superscripting so they use
+ the old replacements mechanism when asciidoc7compatible is defined
+ rather than the asciidoc 8 default unconstrained quoting (patch
+ for affected files attached).
+ * Moved the source highlight filter from ./examples/ to ./filter/.
+ * Added {verbose} intrinsic attribute (useful for passing verbose
+ flag to filters).
+ * Added {outdir} intrinsic attribute.
+ * Renamed {docdir} intrinsic attribute to unambiguous`{indir}
+ ({docdir}` still works but may be removed in future release).
+ * If asciidoc(1) outputs to stdout then intrinsic attribute
+ {docname} is extracted from the input file name.
+ _________________________________________________________________
+
+6. Version 8.0.0 (2006-08-27)
+
+ This is a major release because changes to quoting and index entry
+ handling may break existing documents (see Additions and changes below
+ and Appendix A: Migration Notes in the AsciiDoc User Guide).
+
+ Please report any problems you encounter.
+
+ [9]Stuart Rackham
+
+ Additions and changes
+ * Quoting can can occur within words (based on patch submitted by
+ Benjamin Klum). See the Unconstrained Quotes sub-section in the
+ User Guide.
+ * The underline and plus characters can be used as alternatives to
+ the existing apostrophe and backtick quote characters. They are
+ arguably better choices than the apostrophe and backtick as they
+ are not confused with punctuation.
+ * The syntax for index entry macros have have been deprecated from
+ +...+ and +...+ to ((...)) and (((...))) respectively. Rationale:
+ + Bracketing is consistent other with [[...]] and <<...>>
+ reference macros.
+ + To easily confused with triple plus passthroughs.
+ + To make way for the new monospace quoting.
+ * Superscripts and subscripts are implemented as constrained quotes
+ so they can now be escaped with a leading backslash and prefixed
+ with with an attribute list.
+ * An experimental LaTeX backend has been written by Benjamin Klum (a
+ number additions in this release are to accommodate the LaTeX
+ backend).
+ * include macro file names now expand environment variables and
+ tilde expansions.
+ * A configuration file [quotes] entry can be undefined by setting to
+ a blank value.
+ * Added callto inline macro for Skype callto links.
+ * Added colnumber attribute for table data markup.
+ * A leading comment block or comment lines are now skipped
+ (previously a document had to start with either attribute entries
+ or a document Title).
+ * Experimental rows attribute (number of source lines in table)
+ available in table markup templates (used by experimental LaTeX
+ backend).
+ * Included install shell script written by [10]Jacob Mandelson for
+ installing the tarball distribution.
+ * Added INSTALL documentation file.
+ * Added replacements2 substitution options -- a second replacements
+ section.
+ * Added the ability to redefine normal and verbatim substitutions
+ with subsnormal and subsverbatim entries in configuration file
+ [miscellaneous] section.
+ * By default AttributeEntry values are substituted for
+ specialcharacters and attributes, if you want a different
+ AttributeEntry substitution set the attributeentry-subs attribute.
+ * The name in name=value configuration file entries can now end with
+ a backslash, just escape the trailing backslash with a backslash.
+ For example:
+
+ abc\\=xyz
+ Results in name=abc\ and value=xyz -- previously this would have
+ escaped the = character.
+ * A blank configuration file section deletes any preceding section
+ with the same name (applies to non-markup template sections).
+ * A command-line attribute value with a @ suffix does not override
+ existing document and configuration file attributes (normally
+ command-line attributes have precedence over document and
+ configuration file attributes).
+ * localtime attribute is now encoded from the native system encoding
+ to the output encoding. Patch submitted by [11]FKtPp -- here's his
+ description of the problem:
+ "I am a Chinese user of AsciiDoc and I find that when I use UTF-8
+ (the default encoding) to write asciidoc documents in Windows
+ platform the resulting html footer line will get screwed. It was
+ caused by a localized tzname that was always encoded in the
+ windows native encoding, which in my case is cp936."
+ * a2x(1) can generate Open Document Text files using
+ [12]docbook2odf. Currently docbook2odf(1) only processes a subset
+ of DocBook, unimplemented elements are skipped.
+ * The a2x(1) format option defaults to xhtml (previously a format
+ had to be specified explicitly).
+ * The -d, --doctype=DOCTYPE option has been added to a2x(1) which is
+ a shortcut for --asciidoc-options="--doctype=DOCTYPE".
+ * Replaced a2x(1) --no-icons and --no-copy options with their
+ negated equivalents: --icons and --copy respectively. The default
+ behavior has also changed: copying and use of icons is disabled by
+ default. Rationale:
+ + To make the default behavior more consistent since use of
+ icons and CSS stylesheets does not apply to all formats.
+ + To make the default behavior less surprising (the creation of
+ icon and stylesheet output files must now be explicit).
+ * a2x(1) has been bumped from version 0.1.1 to version 1.0.0.
+
+ Bug fixes
+ * Removed duplicate ./doc/a2x.1.txt from distribution tarball.
+ * Documentation errata.
+ * Attribute replacement is no longer performed twice in Titles and
+ AttributeEntrys.
+ * a2x(1) skipped asciidoc(1) execution when rerun with different
+ --asciidoc-options options, it now always executes asciidoc(1).
+ The problem was that previously asciidoc(1) was executed only if
+ the output file was missing or older than the source file.
+ _________________________________________________________________
+
+7. Version 7.1.2 (2006-03-07)
+
+ Additions and changes
+ * Support for [13]ASCIIMathML has been added. See Appendix I:
+ ASCIIMathML Support in the User Guide and the examples at
+ [14]http://www.methods.co.nz/asciidoc/asciimath.html.
+ * You can now prefix quoted text with inline attributes lists. You
+ can use this to set font size and color (XHTML and HTML outputs).
+ * Added #...# quoting -- it does nothing -- it's purpose is to allow
+ inline attributes to be applied to normal text.
+ * An [15]inline passthrough mechanism has been implemented.
+ * Configuration file comment lines can be escaped with a backslash
+ -- this is to allows the inclusion of configuration lines that
+ start with a hash character.
+ * The scriptsdir attribute can be used to specify the name of the
+ directory containing linked JavaScripts (see the [16]User Guide
+ for details.
+ * The BackendBlock has been renamed PassthroughBlock for consistency
+ with the new inline passthrough naming.
+ * a2x(1) now works with the older bash(1) version 2.05b. Patch
+ submitted by [17]Francis Daly.
+ * Content included by the include1::[] system macro is no longer
+ subject to attribute substitution so that ambiguities no longer
+ arise when used to include CSS or JavaScript files.
+ _________________________________________________________________
+
+8. Version 7.1.1 (2006-02-24)
+
+ Additions and changes
+ * The caption attribute can be used to customize admonition captions
+ as well as image, table and example block element title prefixes
+ (xhtml11 and html4 backends).
+ * You can now override the default icon image using the icon
+ attribute to specify the path of the linked image (xhtml11 and
+ html4 backends only).
+ * The deprecated imagesdir attribute is no longer recognized (use
+ iconsdir instead).
+ * Added Appendix H: Using AsciiDoc with non-English Languages to the
+ AsciiDoc User Guide.
+ * Added Admonition Icons and Captions subsection to the User Guide
+ explaining how to customize Admonition elements.
+
+ Bug fixes
+ * a2x(1) failed when configuration files were installed in the
+ global /etc/asciidoc/ directory -- it was only searching the
+ directory containing the asciidoc executable (thanks to Christian
+ Wiese for finding and submitting a patch this bug).
+ * The html4 backend admonition caption now correctly displays the
+ admonition caption attribute (previously displayed the style
+ attribute).
+ _________________________________________________________________
+
+9. Version 7.1.0 (2006-01-13)
+
+ Additions and changes
+ * a2x(1) toolchain wrapper utility. This overcomes the biggest
+ hurdle for new users which seems to be assembling and using a
+ working DocBook XML toolchain. With a2x(1) you can generate XHTML
+ (chunked and unchunked), PDF, man page, HTML Help and text file
+ outputs from an AsciiDoc input file with a single command. All you
+ need to install (in addition to AsciiDoc) is xsltproc(1), DocBook
+ XSL Stylesheets and optionally FOP (if you want PDF) or lynx(1)
+ (if you want text).
+ * Block titles can now start with any non-space character
+ (previously where not allowed to start with .~-_ characters).
+ * ./stylesheets/docbook.css renamed to ./stylesheets/docbook-xsl.css
+ to clarify its function.
+ * Renamed ./docbook-xsl/manpages.xsl to ./docbook-xsl/manpage.xsl
+ for consistency.
+ * Admonition and navigation icons moved to ./images/icons/ to
+ clarify usage and conform with a2x(1) usage.
+ * Renamed xhtml11 intrinsic attribute imagesdir to iconsdir to keep
+ vocab consistent and changed default value to ./images/icons
+ (previously ./images). imagesdir attribute still accepted but
+ deprecated.
+ * Unused image files have been weeded out of the distribution.
+ * Packager notes (appendix B) have been updated to reflect the needs
+ of a2x(1).
+
+ Important: The renaming of the xhtml11 backend imagesdir intrinsic
+ attribute and it's new default value introduces a backward
+ compatibility issue: if you use the icons attribute you will need to
+ either move your icons to the new default ./images/icons location or
+ include an --attribute iconsdir="your_icons_path" option in your
+ asciidoc commands.
+
+ Bug fixes
+ * Backslash line continuation is now observed in verbatim
+ paragraphs.
+ * Fixed errors generated by example
+ ./examples/website/build-website.sh script.
+ _________________________________________________________________
+
+10. Version 7.0.4 (2005-12-08)
+
+ Additions and changes
+ * Added ternary conditional attributes
+ {<name>@<regexp>:<value1>[:<value2>]} and
+ {<name>$<regexp>:<value1>[:<value2>]}.
+ * Safety violations now generate errors (they previously generated
+ warnings).
+ * asciidoc(1) now defaults to safe mode, consequently the
+ [miscellaneous] safe mode entry and --safe command-line option are
+ no longer necessary (though for backward compatibility asciidoc(1)
+ still accepts the --safe option).
+ * Backend Blocks are now flagged unsafe (they could be used to
+ include arbitrary and hence potentially unsafe output content).
+ * Filters are no longer considered unsafe. There's not much point in
+ insisting on filter safety since the installation of an unsafe
+ filter would require the introduction of new or modified
+ configuration files -- if your application configurations can be
+ compromised you're in all sorts of trouble (safe mode protects
+ against unsafe input files not unsafe configuration). As with all
+ filters, before installing, you should verify that they can't be
+ coerced into generating malicious output or exposing sensitive
+ information.
+
+ Bug fixes
+ * Fixed a lot of glaring grammatical and factual errors in the User
+ Guide.
+ _________________________________________________________________
+
+11. Version 7.0.3 (2005-12-01)
+
+ Additions and changes
+ * Added --safe and --unsafe command-line options -- AsciiDoc can now
+ be executed in a safe mode which disallows the execution of
+ arbitrary code or the inclusion of arbitrary files (see
+ [18]Appendix C in the AsciiDoc User Guide).
+ * Included [19]source-highlight filter in the distribution
+ ./examples/source-highlight-filter/ directory (based on filter
+ submitted by [20]Ryan Phillips).
+ * Included the DocBook XSL Stylesheets 1.69.1 customizations used to
+ generate the distributed AsciiDoc documentation (read the
+ asciidoc-docbook-xsl.txt file in the distribution ./docbook-xsl/
+ directory).
+ * AsciiDoc DocBook XSL Stylesheet drivers moved from ./doc/ to
+ ./docbook-xsl/.
+ * Modified ./doc/manpages.xsl so only URL content is displayed in
+ manpages.
+
+ Bug fixes
+ * Explicitly set table CSS border style (xhtml11 backend) to solid
+ because default border styles vary from browser to browser.
+ _________________________________________________________________
+
+12. Version 7.0.2 (2005-08-28)
+
+ Additions and changes
+ * There are now long versions of all AsciiDoc options.
+ * If the --backend is not specified it defaults to xhtml11.
+ * Added CSS simulated frames layout to the examples website (see
+ ./examples/website/layout2/README-website.txt). This layout does
+ not work with IE6 and the original tables based layout is still
+ the default.
+ * Support page added to AsciiDoc website.
+
+ Bug fixes
+ * Invalid options are now trapped gracefully.
+ * Documentation errata.
+ _________________________________________________________________
+
+13. Version 7.0.1 (2005-06-24)
+
+ Additions and changes
+ * Reverted to use of strong, em, tt XHTML tags -- they're more
+ obvious and no less correct than span tags, besides, the generated
+ file sizes are smaller (the User Guide was 11% smaller).
+ * Table title rendered with caption tag rather than a separate div.
+ * The AsciiDoc stylesdir attribute (if specified) is now recognized
+ when searching for embedded stylesheets (previously only searched
+ default ./stylesheets directory).
+ * Default charset encoding changed from ISO-8859-1 to UTF-8 -- it's
+ less language specific and displays most common languages.
+ * template::[] macros now expand in all configuration file sections
+ previously only in markup template sections.
+ * Cleaned up example website layout CSS and configuration
+ (presentation has not been changed).
+ * Refactored xhtml11.conf configuration file.
+ * Set consistent and sensible permissions on distributed files.
+ * White space is now stripped from DSV formatted table cell data.
+ * class="tableblock" attribute added to tables generated by
+ xhtml-deprecated-css.conf to assist CSS.
+
+ Bug fixes
+ * Illegal character set encoder (specified by the AsciiDoc encoding
+ attribute) and character data are trapped gracefully.
+ * AsciiDoc table format attribute in table attribute lists were not
+ recognized.
+ * The nested horizontal labeled list example in the AsciiDoc User
+ Guide has been dropped -- it generated invalid DocBook markup.
+ _________________________________________________________________
+
+14. Version 7.0.0 (2005-06-06)
+
+ This is a major release with many code and documentation changes.
+ Please report any problems you encounter.
+
+ [21]Stuart Rackham
+
+ Additions and changes
+ * A new xhtml11 backend generates XHTML 1.1 with integrated CSS2
+ replacing the previous xhtml, css, and css-embedded backends.
+ * The CSS stylesheets have finally been rewritten.
+ * The asciidoc(1) command help now includes user [22]customizable
+ help topics. When asciidoc is invoked with the --help option the
+ command argument is interpreted as a help topic.
+ * The previous example website has been replaced by the actual
+ AsciiDoc website (see ./examples/website/.
+ * XHTML generation options now controlled by the following
+ attributes: badges, linkcss, icons, numbered, quirks, theme,
+ stylesdir, imagesdir (see the [23]User Guide for details.
+ * By default HTML and XHTML are output as stand-alone documents (no
+ embedded CSS and no linked admonition icon images).
+ * Documents encoded with the UTF-8 Unicode character set are now
+ processed thanks to a patch supplied by [24]Viktor Vasilev.
+ * The -a ^name command-line syntax to undefine an attribute has been
+ deprecated in favor of the -a name! syntax.
+ * AttributeEntry syntax addition: :name!: to undefine name
+ attribute.
+ * Added template system block macro to allow the inclusion of one
+ configuration file template section within another.
+ * A verse style attribute can now be applied to literal paragraphs
+ and blocks to reproduce line breaks and white space from the
+ source document.
+ * Replacements and Special Words can now be escaped with leading
+ backslashes.
+ * Replacements are now processed in configuration file order
+ (previous ordering was indeterminate).
+ * System macros can now be used in the base asciidoc.conf
+ configuration file.
+ * Deprecated features that emitted warnings in prior versions are no
+ longer tolerated.
+ * The eval system attribute expression evaluates to False the
+ attribute is undefined, if it evaluates to True the result is an
+ empty string.
+ * The Paragraph and DelimitedBlock presubs parameter can be aliased
+ as subs.
+ * Added verbatim substitutions option.
+ * Renamed List Continuation Block to List Block and renamed the
+ listcontinuation option to list.
+ * Deprecated default substitutions option (use normal instead).
+ * The section-numbers section numbering attribute has be renamed
+ numbered.
+ * Dropped the #UNDER CONSTRUCTION# block macro.
+ * Rewrote Paragraph and DelimitedBlock handlers adding a [25]styles
+ configuration entry.
+
+ Bug fixes
+ * Included files are no longer read inside conditionally excluded
+ content.
+ * Manpage command names containing dashes (in the manpage NAME
+ section) were misinterpreted as the spaced dash command
+ name/purpose separator. Bug report and patch supplied by [26]David
+ Greaves.
+ * Unexpected error following malformed author line error.
+ _________________________________________________________________
+
+15. Version 6.0.3 (2005-04-20)
+
+ Additions and changes
+ * Special characters are now substituted in AttributeEntry element
+ values.
+ * Spaced and unspaced em dashes are now recognized (previously only
+ spaced em dashes were recognized).
+ * Replaced the table noborders option with richer frame and grid
+ attributes.
+ * The duplicate macro warning message now only occurs when the
+ verbose (-v) option is enabled.
+ * Single lines starting with two forward slashes hard up against the
+ left margin are treated as comments and are not processed.
+ * Renamed section delimited block option to sectionbody to more
+ accurately reflect it's role.
+ * Added a List Continuation block -- a specialized delimited block
+ that is functionally equivalent to the List Item Continuation
+ feature except that the list contained within the block does not
+ require explicit + list item continuation lines.
+ * Dropped deprecated <u> tags from generated HTML.
+ * Literal Block delimiters must now consist of at least four points
+ (previously three) to avoid lone ellipsis ambiguity.
+
+ Bug fixes
+ * Some system attribute evaluation failures caused unexpected
+ exceptions to occur.
+ _________________________________________________________________
+
+16. Version 6.0.2 (2005-03-30)
+
+ Additions and changes
+ * Three new system block macros have been added -- eval, sys and
+ sys2 which are the block macro equivalents to the same named
+ system attributes.
+ * Intrinsic macros have been renamed system macros along with action
+ attributes which have been renamed system attributes:
+ + To reflect their common (though contextually different)
+ behavior.
+ + To avoid confusion with intrinsic attributes.
+
+ Bug fixes
+ * Asciidoc now searches in /etc/asciidoc/filters for filters.
+ _________________________________________________________________
+
+17. Version 6.0.1 (2005-03-06)
+
+ Additions and changes
+ * A global configuration file location /etc/asciidoc has been added
+ and is now processed before all other locations (patch supplied by
+ [27]Fredrik Steen).
+ * Recoded tempfile.mktemp() and other artifacts that are no longer
+ necessary or desirable (patches supplied by [28]Fredrik Steen).
+ * Added BUGS file to the distribution.
+
+ Bug fixes
+ * Illegal comment syntax in css-embedded-stylesheet.conf resulted in
+ illegal CSS in files generated by the css-embedded backend.
+ _________________________________________________________________
+
+18. Version 6.0.0 (2005-01-28)
+
+ This release has had some fairly major code and documentation changes.
+ Please report any problems you encounter.
+
+ [29]Stuart Rackham
+
+ A lot of new stuff. A new major version number -- some regression
+ incompatibility (hopefully mitigated by deprecated warnings).
+
+ Went mad trying to rein in the current feature anarchy -- established
+ a unified notion of document attributes. Attempted to introduce a
+ consistent vocabulary -- renamed many poorly or inconsistently named
+ entities.
+
+ Actually, deprecated syntax is still processed correctly in almost all
+ cases. One source of incompatibility that may arise if you have
+ customized CSS stylesheets is the change of AsciiDoc CSS class names
+ (see below). I guess the moral is if you've done a lot of
+ configuration file customization and are happy with version 5 then you
+ may want to stay put.
+
+ Note: This version requires Python 2.3 or better to run.
+
+ Additions and changes
+ * Glossary entries have been renamed attributes. This eliminates
+ confusion with the accepted meaning of glossary.
+ * An AttributeEntry block element has been added so that document
+ attributes can be assigned from within an AsciiDoc document.
+ * The AttributeList block element has been added which is a more
+ general solution than the (now deprecated) DelimitedBlock
+ arguments.
+ * An BlockId element has been added for setting block element anchor
+ (link target) IDs.
+ * Quoted text can now span multiple lines (thanks to James Bowlin
+ for this patch).
+ * Inline macros can now span multiple lines.
+ * ``double backtick / apostrophe'' quotes generate "curly quotes".
+ * A warning is now emitted for out of order list item (applies to
+ explicitly enumerated numbered list items).
+ * Added include action attribute.
+ * A line of three or more apostrophes generates an HTML horizontal
+ ruler (<hr/> tag). You will get a warning if processed with
+ non-HTML backend.
+ * An {imagesdir} attribute specifies image file location for images
+ referenced in configuration files when generating HTML (the
+ default location is images).
+ * An {stylesdir} attribute specifies the location of CSS stylesheets
+ when generating styled HTML (the default location for configured
+ markup is .).
+ * list entry has been deprecated, use {0} instead.
+ * New ExampleBlock delimited block along with associated variants
+ Note, Tip, Warning, Caution and Important.
+ * The docbook.conf file now facilitates the optional inclusion of a
+ DocBook revision history file.
+ * To better reflect their purpose the following block elements have
+ been renamed: VerbatimBlock to ListingBlock; IndentedBlock to
+ LiteralBlock; IndentedParagraph to LiteralParagraph; CustomBlock
+ to BackendBlock; SimpleSection to SectionBody. Any corresponding
+ CSS class names have also been changed which could result in
+ backward incompatibility in customized stylesheets.
+ * Swapped plain DocBook admonition icons for Jimmac's DocBook icons
+ ([30]http://jimmac.musichall.cz/ikony.php3). The original plain
+ icons have been moved to ./images/plain.
+ * Renamed html backend to xhtml to better reflect it's function
+ (former html-4 backend renamed to html).
+ * A new inline anchor macro syntax [[[<id>]]] is available, it
+ displays [<id>] at the anchor location and is for anchoring
+ bibliography list entries.
+ * An optional single-line titles syntax can be used.
+ * Tweaks to distributed CSS stylesheets and FOP fo.xsl customization
+ file.
+ * List Item Continuation has been implemented which allows
+ additional block elements to be included in list items by
+ separating them from the preceding list item element with a line
+ containing a single plus character.
+ * A new Horizontal Labeled List list type has been added. Generates
+ two column list -- the first column contains the list element
+ labels, the second contains the element text. Same syntax as
+ Vertical Labeled Lists except the double colon label suffix is
+ followed by the start of the list item text.
+
+ Bug fixes
+ * Fixed broken backslash line continuation.
+ * Labeled list end tags were not undergoing attribute substitution.
+ * Documents without any author information now generate legitimate
+ DocBook (previously if the author line was not included in the
+ document header then an empty (illegal) DocBook author element was
+ generated).
+ * Multiple spaces in filter command arguments were replaced by a
+ single space. The ./examples/asciidoc2text/asciidoc2text.sh script
+ now indents text correctly.
+ _________________________________________________________________
+
+19. Version 5.1.1 (2004-10-10)
+
+ 15-December-2004: Interim update: Updated asciidoc.py to fix broken
+ join_lines function -- no other changes.
+ * PDF documentation is now produced from DocBook XML using XSLTLib
+ and FOP. Previously we processed DocBook SGML with jw(1) (which
+ used Dvips to convert DVI files to PDF). FOP has come a long way
+ in the last 12 months and produces very acceptable PDF under both
+ Linux and Windows.
+ * Sections detailing how to install and use the DocBook XSL
+ Stylesheets, xsltproc, FOP toolchain and the AsciiDoc XSLT drivers
+ have been added to the User Guide.
+ * The PDF output from the he example article template has been
+ included in the distribution (./doc/article.pdf).
+ * Special characters are emitted using decimal Unicode character
+ codes (previously used named character entities which cannot be
+ assumed included in non-HTML documents).
+ * Added registered trademark ® to [replacements].
+ * CSS stylesheet tweaks.
+ * Admonitions (Note, Tip, Important, Warning, Caution) include icons
+ when generating css output.
+ _________________________________________________________________
+
+20. Version 5.1.0 (2004-09-18)
+
+ * Callouts have been implemented (see the Callouts section of the
+ AsciiDoc User Guide for details).
+ * Added XSL drivers for generating XHTML, chunked XHTML and HTML
+ Help from DocBook XML using XSL stylesheets and xsltproc(1).
+ * Added CSS stylesheet for HTML generated from DocBook XML using XSL
+ stylesheets.
+ * Distribution contains HTML Help formatted User Guide
+ (./doc/asciidoc.chm), the User Guide tells you how it's generated.
+ * Images referred to by distributed stylesheets are now located in
+ the ./images subdirectory (previously located in .).
+ * Filters path names are now handled properly under Cygwin.
+ * The usual documentation and examples additions, updates and
+ polishing.
+ _________________________________________________________________
+
+21. Version 5.0.9 (2004-09-09)
+
+ * The convention of using a .asc file extension for AsciiDoc files
+ has been dropped in favor of the familiar .txt extension. It makes
+ more sense in that AsciiDoc is a text presentation format and
+ because .asc clashed with the same extension used by other
+ applications. It's only a naming convention -- you don't have to
+ switch if you don't want to.
+ * Changed the subscript formatting character from underline to tilde
+ since underscores in file names are reasonably common (especially
+ in link and image macros).
+ * An alternative syntax for the index term inline macro has been
+ added: <primary>,<secondary>,<tertiary>.
+ * Index terms that have secondary and tertiary entries now
+ additionally generate separate index terms for the secondary and
+ tertiary entries.
+ * A <primary> index term inline macro has been added which displays
+ the term in the primary text flow.
+ * Added alternative variable list definition using double semi-colon
+ terminator as opposed to the standard double colon terminator so
+ variable lists can be nested to two levels.
+ * Footnotes now appear on a separate line in HTML and Linuxdoc
+ outputs.
+ * Python version compatibility is checked at startup.
+ * Preface and appendix section titles in multi-part Book documents
+ are meant to be out of sequence -- warnings are no longer emitted
+ when outputting HTML.
+ * Empty section warnings have been replaced by error messages and
+ are emitted only if invalid markup would result.
+ * Missing macro sections or invalid macro name warnings are only
+ generated at startup if the -v (verbose) option is set. Otherwise
+ they are deferred until a matching macro is encountered in the
+ input file.
+ * Missing or invalid table definition warnings are only generated at
+ startup if the -v (verbose) option is set. Otherwise they are
+ deferred until a matching table is encountered in the input file.
+ * AsciiDoc now makes more of an effort to continue in the face of
+ errors.
+ * Fixed broken ./examples/website/main.aap script.
+ * Converted distribution text files DOS text format as a sop to
+ Windows users with challenged text editors.
+ * Documentation additions and corrections.
+ _________________________________________________________________
+
+22. Version 5.0.8 (2004-05-15)
+
+ * Spurious out of sequence level 2 warnings no longer appear when
+ processing book document multi-part book top level Preface and
+ Appendix sub-sections since they are (correctly) out of sequence.
+ * A warning is no longer emitted for empty Index sections since this
+ is normal when generating DocBook outputs.
+ * Fixed: [quotes] configuration file entries where not being
+ overridden by downstream configuration file entries.
+ * Footnote text is now output enclosed in square brackets in HTML
+ documents.
+ * Added superscripts and subscripts to the standard PRS
+ configuration files.
+ * Adjusted CSS stylesheets so list titles don't have so much space
+ between title and first list item (broken in IE6 due to poor CSS
+ compliance). Lessened sidebar title top margin.
+ _________________________________________________________________
+
+23. Version 5.0.7 (2004-04-22)
+
+ * The version 5.0.6 README incorrectly stated that AsciiDoc would
+ run under Python 2.0, in fact it requires Python 2.1 or better.
+ The README has been corrected.
+ * Documented techniques for combining and splitting AsciiDoc
+ documents and processing the combined and split parts (see the
+ Tips and Tricks section of the User Guide).
+ * An example of marking up superscripts and subscripts is documented
+ in the Tips and Tricks section of the User Guide (the example
+ configuration file is in the AsciiDoc examples directory).
+ * Added ellipsis to shipped [replacements]; three periods output an
+ ellipsis entity.
+ * Removed unused SectionClose class.
+ * The AsciiDoc Preamble element is output as a DocBook Preface when
+ processed as a book document type (in older AsciiDoc versions a
+ warning was issued and processing stopped).
+ * Fixed a quoting anomaly: quoted text can no longer begin or end
+ with with white space.
+ _________________________________________________________________
+
+24. Version 5.0.6 (2004-03-07)
+
+ * New image macro implements optional image scaling and linking and
+ works in both inline and block contexts. The image macro
+ obsolesces the existing graphic block macro and icon inline macro.
+ * Macro substitution section names now have -inlinemacro and
+ -blockmacro suffixes to resolve context ambiguity, make their
+ purpose clearer and relieve section namespace congestion.
+ * Header derived glossary entries can now be overridden from the
+ command-line.
+ * Special character substitution is now performed on AuthorLine
+ derived author names.
+ * A macro or block argument called options can be used as a shortcut
+ for a list named arguments with zero length string values.
+ * Tables can be output without borders using the options="noborders"
+ argument.
+ * Table data lines that do not immediately follow a table section
+ underline can now be blank. This allows CSV data with embedded
+ blank lines to be processed correctly.
+ * Blank DSV format table data lines are silently skipped.
+ * Tightened up on enforcement of configuration file section names to
+ reduce the possibility of section content being seen as a section
+ header line.
+ * Section titles can be optionally suffixed with title arguments
+ enclosed in double square brackets.
+ * A replacement has been added to asciidoc.conf to replace inline
+ double dashes with the &mdash; entity.
+ * Changed the .UNDER-CONSTRUCTION. macro syntax to
+ #UNDER-CONSTRUCTION# so it is not mistaken for a BlockTitle.
+ Similarly changed the .NEW. replacement with #NEW#.
+ * #NEW# and #UNDER-CONSTRUCTION# macros are now included in the
+ DocBook backend.
+ * Replaced shipped smallnew.gif with smallnew.png.
+ * Documentation tidy ups.
+ _________________________________________________________________
+
+25. Version 5.0.5 (2004-02-25)
+
+ * Fixed the disappearing paragraph titles problem that was caused by
+ Inline macros (incorrectly) processing BlockTitles.
+ * Tightened AuthorLine validation. Previously invalid email
+ addresses and embedded special characters in the AuthorLine
+ resulted in invalid output markup.
+ _________________________________________________________________
+
+26. Version 5.0.4 (2004-02-09)
+
+ * Reinstated missing infile, outfile, filetype and
+ filetype-<filetype> glossary entries.
+ * As of version 5.0.3 asciidoc(1) now requires Python 2.0 or
+ greater, this has now been documented.
+ _________________________________________________________________
+
+27. Version 5.0.3 (2004-01-23)
+
+ * Fixed problem that caused any filters directory file containing
+ .conf (not just those with the .conf extension) from being loaded.
+ * All [miscellaneous] configuration file entries can now be
+ referenced like glossary entries (they are now processed
+ internally as glossary entries).
+ * The output file line terminator (previously hardwired to \r\n is
+ now set using the newline entry in the configuration file
+ [miscellaneous] section.
+ * The misspelt blocktitles configuration file entry name has been
+ corrected (to blocktitle).
+ * An {empty} glossary entry has been added to the default
+ configuration which is useful for outputting trailing blank lines
+ from configuration file substitution sections.
+ _________________________________________________________________
+
+28. Version 5.0.2 (2003-12-18)
+
+ * New (alternative) anchor and xref macro syntax (old syntax still
+ valid).
+ * DocBook mediaobject and inlinemediaobject tags are generated in
+ place of graphic and inlinegraphic tags by the AsciiDoc graphic
+ and icon macros. If a macro argument is specified it is the
+ alternative text output if the target document format does not
+ support the specified graphic file format.
+ * Dropped the LinuxDoc left and right square bracket special
+ character substitutions as they interfered with macro
+ substitution.
+ * Documentation updates and corrections.
+ _________________________________________________________________
+
+29. Version 5.0.1 (2003-12-09)
+
+ * Fixed problem with anchor tag when generating CSS styled HTML.
+ _________________________________________________________________
+
+30. Version 5.0 (2003-12-08)
+
+ This release has had some fairly major code and documentation changes.
+ Please report any problems you encounter.
+
+ [31]Stuart Rackham
+
+ * AsciiDoc can now produce a full-blown multi-part DocBook book
+ including dedication, abstract, preface, colophon, glossary,
+ appendix, bibliography and book part elements using the new
+ specialsections configuration file section.
+ * All Section element children (Paragraph, DelimitedBlock, List,
+ Table, BlockMacro) can now be titled using the BlockTitle element.
+ A BlockTitle element is a single line containing a title and
+ beginning with a period.
+ * The index and backmatter macros have been dropped, superseded by
+ specialsections.
+ * The AsciiDoc Preface element has been renamed Preamble (to avoid
+ confusion with the DocBook book preface element).
+ * Out of sequence titles are now tolerated with a warning. This
+ allows book document level 0 sections to be processed.
+ * An anchor inline macro has been added for document link target
+ creation.
+ * Note, Tip, Important and Warning paragraph types have been added
+ to support the corresponding DocBook elements.
+ * Title substitution is now performed in SidebarBlock titles.
+ * DocBook graphics now output as figure and informalfigure elements
+ rather than mediaobjects. This ensures numbered figures and a
+ lists of figures are produced by the DocBook toolchain.
+ * You can now escape block argument lines by appending a backslash.
+ Alternatively, if you embed arguments in the delimiter line
+ AsciiDoc does not check for an arguments line.
+ * The default DocBook backend file extension has been changed from
+ .docbook to .xml (.sgml for the docbook-sgml backend).
+ * Warnings are output by default (previously they only printed when
+ verbose option enabled).
+ * A Question and Answer variable list definition has been added to
+ the shipped configuration files, primarily to create DocBook qanda
+ DocBook elements.
+ * Fixed broken code-filter -b linuxdoc option. The asciidoc.asc User
+ Guide can now be processed by linuxdoc(1) (although tables are
+ dropped because LinuxDoc does not implement tables).
+
+ Compatibility issues:
+ 1. Table titles are no longer in the arguments line, use the new
+ BlockTitles.
+ 2. Graphic titles are no longer in the graphic block macro caption,
+ use the new BlockTitles.
+ 3. The code-filter title must be placed in a preceding BlockTitle.
+ 4. SidebarBlock titles must be placed in a preceding BlockTitle.
+ 5. The DelimitedBlock option sidebar has been renamed to section.
+ 6. The default DocBook backend file extension has been changed from
+ .docbook to .xml (.sgml for the docbook-sgml backend).
+ _________________________________________________________________
+
+31. Version 4.2 (2003-11-26)
+
+ * The default HTML output is now XHTML 1.0 markup. To output the
+ former HTML 4 markup specify the html-4 backend.
+ * The default DocBook output is now DocBook XML. To output the
+ former DocBook SGML specify the docbook-sgml backend. The
+ associated docbook-sgml.conf file illustrates how to support minor
+ DTD variations. Examples of using the xmlto(1) command for DocBook
+ conversion have been added to the User Guide.
+ * Glossary entries set using the command-line -g option can now be
+ referenced in configuration files.
+ * Configuration dumps (-c command-line option) no longer output
+ redundant undefined glossary entries.
+ * DelimitedBlock arguments can now be specified in a separate
+ arguments line immediately following the leading delimiter line,
+ This is in preference to the existing delimiter embedded
+ arguments. Reasons:
+ + The syntax is in keeping with the Tables arguments syntax.
+ + It's easier to enter and implements line continuation.
+ * A new QuoteBlock DelimitedBlock definition has been added to the
+ distribution configuration files.
+ * The table arguments lines can be continued using the backslash
+ line continuation character.
+ * Added new calculated glossary reference type {<name>%<value>}.
+ * Double-quote characters can now appear in unquoted positional
+ arguments.
+ _________________________________________________________________
+
+32. Version 4.1 (2003-11-13)
+
+ * Added DSV (Delimiter Separated Values) tables format.
+ * {eval:<expr>} glossary references drop the containing line if
+ <expr> evaluates to None.
+ * Block, Table and Macro arguments can now be positional (quoted or
+ unquoted).
+ * Vocabulary change: DelimitedBlock, Table and Macro attributes are
+ now referred to as arguments. This makes more sense in light of
+ the extended syntax and avoids confusion with backend markup tag
+ attributes.
+ * tablewidth table ruler parameter can now be expressed in percent
+ units (0..100). If between 0 and 1 then the original fractional
+ unit measure is applied.
+ * The use of quoting for generating footnotes and index entries has
+ been dropped in favor of footnote and indexterm inline macros.
+ * backmatter inline macro included in distribution.
+ * Fixed: CSS styled HTML tables are now fully XHTML 1.0 conformant.
+ * Fixed: tablewidth was processed incorrectly when passed as table
+ argument.
+ * Fixed: Glossary references like {x={y}} were one character off if
+ {x] was defined and {y} was not.
+ _________________________________________________________________
+
+33. Version 4.0 (2003-11-08)
+
+ This release has had some fairly major code and documentation changes.
+ Please report any problems you encounter.
+
+ Stuart Rackham
+
+ * Added tables to AsciiDoc.
+ * Added two special subs options: default specifies the default
+ substitution options and none specifies no substitution. These
+ options can only appear singly.
+ * Line continuation using a trailing backslash character is
+ available in Paragraphs, ListItems, Tables.
+ * The left and right quotes for quoted text can now be specified
+ separately.
+ * Shipped configuration files implement footnotes (only useful for
+ DocBook output) using \[[]] quoting.
+ * Shipped configuration files implement index terms (only useful for
+ DocBook and LinuxDoc output) using \(()) quoting.
+ * The shipped html backend configuration now emits valid HTML 4.01
+ Transitional.
+ * Added new calculated glossary reference types {<name>!<value>} and
+ {<name>#<value>}.
+ * The DelimitedBlock params option has been dropped in favor of the
+ new block attributes mechanism. If you have customized block
+ params options you may need to adjust source files to use the
+ block attributes syntax. The example code filter has been updated
+ to reflect these changes.
+ * The code filter now has a -t tabsize option.
+ * Replaced -w option with -v (verbose) option. The warnings option
+ was just to confusing.
+ * Named attributes can now be specified in macro calls.
+ * The tabsize attribute is recognized in the built-in include
+ macros. A tabsize of zero suppresses tab expansion.
+ * The configuration file [options] section has been split into
+ [miscellaneous] and [titles]. If you have customized any of these
+ settings you will need to adjust the affected configuration files.
+ * Configuration file [miscellaneous] entries can now also be set
+ using the command-line -g option.
+ * Fixed: error that occurred when attempting to use zero length
+ configuration and source files.
+ * Fixed: blocking filter halt problem.
+ * Fixed: inline macro escape prefix problem.
+ * Fixed: missing macros from configuration dump problem.
+ * Fixed: named macros were dumped incorrectly.
+ * Many documentation changes/additions/corrections.
+ _________________________________________________________________
+
+34. Version 3.2.2 (2003-10-26)
+
+ * Added -n option (synonym for -g section-numbers).
+ * Dropped the processing commentary (hey, this is Unix).
+ * Added new calculated glossary reference type {<name>?<value>}.
+ <name> is the glossary entry name and <value> is the text
+ substituted if the glossary entry is defined. <value> can only
+ contain literal text (no glossary references allowed).
+ * Added asciidoc2text to distribution examples/asciidoc2text
+ directory (converts AsciiDoc source to text file with section
+ numbering).
+ * Fixed incorrect nesting of Simple lists inside Variable lists.
+ * List definitions have been modified so that list items can be
+ indented. This allows a more intuitive indentation of nested lists
+ in AsciiDoc source.
+ * Lists must be separated from preceding paragraphs by a blank line.
+ This is to avoid paragraph lines being mistaken for list items.
+ * Corrected asciidoc man page documentation error: the`-f` option
+ does not search relative to source document directory for the
+ configuration file.
+ * Minor updates to various distribution .conf files.
+ * Included badges.conf in examples directory.
+ * css-embedded-stylesheet.conf now supports footer badges.
+ * The default in-line element processing order has been changed:
+ Glossary References are now processed before Inline Macros. This
+ allows glossary expansions to occur inside macro references.
+ * Glossary entries are now allowed in Author and Revision lines.
+ * Default List subs options and Paragraph presubs options are
+ assigned the following default value if not specified:
+
+ specialcharacters,quotes,specialwords,replacements,glossary,macros
+ * Documentation changes/additions/corrections.
+ _________________________________________________________________
+
+35. Version 3.2 (2003-05-26)
+
+ * Added a -s command-line option to suppress the output of [header]
+ and [footer] sections.
+ * Article document headers are no longer mandatory: this allows
+ AsciiDoc to process arbitrary chunks of text. When used in
+ conjunction with the new -s command-line option corresponding
+ chunks of backend markup can be generated.
+ * AsciiDoc now emits a warning message and continues when an out of
+ sequence section title is detected (previously it failed and
+ halted). This allows document sections to be processed separately.
+ * Optional presubs and postsubs entries have been added to
+ DelimitedBlock and Paragraph definitions. As a consequence
+ substitution options are no longer legal in options entries.
+ * presubs and postsubs substitutions are processed in the order the
+ options are specified (rather than the fixed options order of
+ previous versions).
+ * ./filters subdirectories are automatically searched for filter
+ commands.
+ * A title-subs configuration option specifies the substitutions
+ performed on document Header and Section titles.
+ * A subs entry in now included in List configuration file
+ definitions that specified substitutions performed on list entry
+ text.
+ * Configuration files are auto-loaded from ./filters subdirectories.
+ * Added example code filter (see ./examples/filters).
+ * Bug fix: if section was empty you may have got erroneous missing
+ tag "paragraph" error.
+ * Internal code tidy up.
+ _________________________________________________________________
+
+36. Version 3.1 (2003-05-18)
+
+ * In version 3.0 a [macros] section entry of the form name was
+ equivalent to name=. An entry of the form name now undefines the
+ entry (to bring it in line with the behavior of other special
+ sections).
+ * Paragraphs have now been generalized (in the same way as Lists and
+ DelimitedBlocks).
+ * The indentsize option has been dropped as as consequence of
+ paragraph generalization.
+ * Pipe | characters can be included in substituted tag and
+ substitution section text using the {brvbar} (broken vertical bar)
+ glossary reference.
+ * Removed the restriction requiring substitution section text
+ placeholders | to be on a separate line.
+ * Added an -e asciidoc(1) command option that excludes implicit
+ configuration files (used in conjunction with -c generated
+ configuration files).
+ * Version 3.0 documentation has undergone a considerable cleanup.
+ * The dumping of quoted section entries (see -c option) now works
+ correctly.
+ * The format of special section entries has been made consistent:
+ name undefines the entry; name= sets the entry value to a blank
+ string; name=value sets the entry value to value.
+ * As a consequence of the previous change the caret prefix is no
+ longer used in glossary configuration file entries (although it is
+ still used when undefining an entry using the -g command-line
+ option).
+ _________________________________________________________________
+
+37. Version 3.0 (2003-05-13)
+
+ This version is the culmination of work begun in the 2.x releases
+ whereby fixed policy has been replaced by extensible mechanisms.
+ * Added -c command-line option to dump a composite asciidoc(1)
+ configuration file to stdout.
+ * Lists and Delimited Blocks are now defined by a set of
+ configuration file parameter sections. The user can modify the
+ default definitions or add new ones.
+ * Block content can now be processed through external filters.
+ * The default behavior for Custom Blocks is to perform glossary
+ substitution (previously there was no substitution inside Custom
+ Blocks).
+ * The old 2.x style macros have been reimplemented; as with Lists
+ and Delimited Blocks there syntax and behavior can be configured
+ by the user. The default macro syntax remains the same but the
+ semantics are now (hopefully) a bit more intelligible.
+ * Block and Builtin macros use :: delimiter instead of the 2.x
+ single colon delimit (to distinguish them from inline macros). The
+ 2.x syntax is still supported for backward compatibility.
+ * Nested lists are now supported and IndentedParagraphs can be
+ included in list items.
+ * Conditional source inclusion can be specified using built in
+ ifdef, ifndef and endif macros.
+ * The new conditional source inclusion feature has been used to
+ reduce the number of default configuration files down to one per
+ backend.
+ * A change of name: 2.x Substitutions are now called Replacements
+ and the 2.x [substitutions] configuration file section is now
+ called [replacements] (the old name is still recognized for
+ backward compatibility).
+ * The line break is now implemented as a Replacements substitution.
+ * Inline icon macro for inline images has been added to default
+ configuration files.
+ _________________________________________________________________
+
+38. Version 2.2 (2003-04-07)
+
+ * The master.conf configuration file name has been deprecated in
+ favor of asciidoc.conf.
+ * The standard configuration files set is now loaded from the
+ .asciidoc folder in the users home directory (if it exists) and
+ then from the source document directory. Configuration files that
+ don't exist are silently skipped.
+ * Configuration files named like the source file will be
+ automatically loaded if they are found in the source file
+ directory. For example if the source file is mydoc.asc and the -b
+ html option is used then asciidoc(1) will look for mydoc.conf and
+ mydoc-html.conf in that order.
+ * The characters used to quote formatted text can be configured and
+ extended by the user (see the master.conf [quotes] section).
+ * Quoted text can now be escaped by prefixing a backslash character
+ to the leading quote.
+ * The double single-quote '' strong text quote has been deprecated
+ in favor of an asterisk * character.
+ * Added {eval:expression}, {sys:command} and {sys2:command} glossary
+ reference actions.
+ * Trailing brace characters } are now allowed inside glossary
+ references provided they are escaped with a backslash character.
+ * Glossary entries can now be escaped by prefixing a backslash
+ character to the leading brace character (use this in preference
+ to placing the backslash inside the brace).
+ * The output macro has been deprecated (use the new include1 macro
+ inside a CustomBlock).
+ * The default document type is article (asciidoc no longer attempts
+ to guess).
+ * Files included within DelimitedBlocks are not searched for block
+ termination underlines. This ensures the entire file is part of
+ the DelimitedBlock.
+ * include macros can now be used in configuration files.
+ * Corrected {infile} and {outfile} glossary entry documentation.
+ * File inclusion is now limited to a depth of 5 to catch recursion
+ loops.
+ * Inline tags have been deprecated, they're not necessary and they
+ immediately make the source document backend specific. Use
+ CustomBlocks or Substitutions instead.
+ _________________________________________________________________
+
+39. Version 2.1 (2003-03-17)
+
+ * Added section auto numbering {sectnum} glossary entry
+ (auto-numbering function contributed by Ludovico Magnocavallo).
+ * asciidoc(1) now correctly returns non-zero exit status if an error
+ occurs.
+ * An AsciiDoc example website has been included in the AsciiDoc
+ distribution examples/website directory (also online at
+ http://www.methods.co.nz/asciidoc/examples/website/).
+ * NOTE: The asciidoc wrapper script included in the 2.0 distribution
+ has been dropped, if you've symlinked or aliased to asciidoc
+ you'll need to change them to point directly to asciidoc.py
+ instead.
+ * An RCS $Id$ marker can be used as the document header revision
+ line (based on a patch submitted by Ludovico Magnocavallo).
+ * In addition to the name=value glossary entry format two new ones
+ have been introduced: name (the default value is set to an empty
+ string) and ^name (the glossary entry is undefined).
+ * The -q command-line option has been deprecated and the -w level
+ command-line option added.
+ NOTE: By default skipped substitution warnings are now suppressed.
+ * If a configuration file specified with the -f command-line option
+ is not found relative to the current working directory then the
+ search is repeated relative to the asciidoc(1) directory. This
+ allows global configuration files to be used.
+ * Added {infile}, {outfile} predefined glossary entries.
+ * Added under-construction macro to HTML article configuration
+ files.
+ * Deprecated {asciidoc_version} glossary entry in favor of
+ {asciidoc-version} (to it consistent with other entries).
+ _________________________________________________________________
+
+40. Version 2.0 (2003-02-24)
+
+ * The emphasized, strong and monospaced words options have been
+ generalized with the introduction of macro based special words
+ lists.
+ * Glossary references can now appear in both the document and macro
+ bodies.
+ * All output files use crlf line termination (previously used UNIX
+ lf (newline) termination).
+ * Added [substitutions] section which implements arbitrary regular
+ expression based substitutions.
+ * An optional master.conf configuration file can be used for entries
+ that are not backend or document type specific.
+ * Special character definitions moved from the code to the new
+ [special_characters] configuration file section.
+ * Configuration file glossary added.
+ * Command-line -g glossary entry added.
+ * A new book document type has been implemented for the docbook
+ backend. It outputs DocBook book documents.
+ * A major internal change has been the implementation of
+ parametrized user definable macros. Internally most document
+ elements are now processed as macros.
+ * Configuration file macro variables can be specified with default
+ values (literals or other macro variables).
+ * An attempt has been made to tighten up the vocabulary used to
+ describe the AsciiDoc document syntax.
+ * The term abstract has been replaced by the more general term
+ preface and a new preface section introduced into article
+ configuration files (replacing the synopsis sections).
+ * Any section elements can now be put in the document preface
+ (previous versions only allowed paragraphs).
+ * AsciiDoc Blocks have been unified and their behavior can be user
+ defined and parametrized.
+ * An output inclusion allows an external file to be written directly
+ to the backend output file.
+ * A new CustomBlock has been added. Default behavior is to insert
+ the enveloped AsciiDoc source lines directly into the output file.
+ * A line break tag can be inserted by terminating a line with a +
+ character (only really useful for HTML backends).
+ * An fourth section level has been introduced.
+ * The SidebarBlock delimiter line characters have been changed. The
+ deprecated underline is still accepted.
+ * Levels 2 and 3 title underline characters have been changed. The
+ deprecated underlines are still accepted.
+ * Lines with backend specific inline tags can be inserted into
+ AsciiDoc source files.
+ * Single words enveloped by underscores are no longer emphasized.
+ This feature was deprecated as it is redundant (use single quotes
+ instead) and was being applied to file names with underscores.
+ * A -q quiet option has been added to suppress warning messages.
+ * Badge images sourced locally.
+ * Added author and author-mail meta tags to HTML configuration
+ files.
+ _________________________________________________________________
+
+41. Version 1.5 (2003-01-08)
+
+ * Implemented sidebar document elements.
+ * Explicit checks for user specified configuration files and input
+ file (rather than throwing exception).
+ _________________________________________________________________
+
+42. Version 1.4 (2003-01-04)
+
+ * New configuration file options emphasizedwords and strongwords.
+ These allow the definition of words that will always be emphasized
+ or rendered in a strong font without inline formatting.
+ * Document and section titles are no long subject to inline
+ formatting.
+ * Multiple configuration files can be overlaid in a single command.
+ * Configuration file tags and options entries can now be overridden
+ on an entry by entry basis (previously the entire section was
+ overloaded).
+ * Configuration file tags and options entries are now cached this
+ has resulted in around 37% performance improvement over version
+ 1.3.
+ * Variable lists can now contain multiple terms per list item.
+ * Placeholder paragraph eliminated from empty sections that contain
+ subsections.
+ * Added {asciidoc_version} substitution variable.
+ * More documentation additions and tidy ups.
+ _________________________________________________________________
+
+43. Version 1.3 (2003-01-01)
+
+ * A new strong text formatting convention has been implemented: Word
+ phrases enclosed in pairs of single quote characters (acute
+ accents) are rendered in a strong font (usually bold).
+ * Paragraphs can now be followed immediately by Simple lists and
+ Ordered lists without an intervening blank line.
+ * A user specified configuration file (asciidoc(1) -f option)
+ overlays the default configuration file rather than replacing it.
+ Custom configuration files need only contain those sections that
+ have been customized.
+ * Comment Block delimiters have been relaxed slightly. They must
+ start with three forward slashes /// but the remainder can contain
+ any characters, this allows comments to be embedded in the
+ delimiter line.
+ * Leading non-digit characters preceding revision number are now
+ ignored.
+ * Set default indentsize [option] from 2 to documented default value
+ of zero in HTML backend html-article.conf and html-manpage.conf
+ files.
+ * Fixed error that occurred when taking input from stdin without
+ explicitly specifying a document type.
+ * Restored file name and line number error message information.
+ * Changed deprecated -t option to -d in asciidoc --help and usage
+ command output.
+ * CSS styles tweaking.
+ * Code, configuration file and documentation tidy ups.
+ _________________________________________________________________
+
+44. Version 1.2 (2002-12-28)
+
+ * Implemented include URL to allow file inclusion.
+ * fileextension configuration file [option] renamed to more sensible
+ outfilesuffix (fileextension still accepted by this version but
+ will be dropped in future).
+ * Improved error reporting.
+ * CSS backends generate valid XHTML.
+ * New css-embedded backend generates HTML with embedded stylesheets
+ (use the css backend for linked stylesheets). The css-embedded
+ backend output contains no linked images so the generated html
+ files are completely self contained.
+ * Bug fixes.
+ _________________________________________________________________
+
+45. Version 1.1 (2002-12-03)
+
+ * Added css (cascading style sheets) backend
+ * Implemented IndentedBlock document element.
+ * Tabsize command-line option has been deprecated in favor of
+ configuration file.
+ * Default indent width changed to zero.
+ * Added {localdate} and {localtime} substitution variables.
+ * Added optional [options] configuration file section with
+ fileextension, tabsize and indentsize options.
+ * Implemented {authorinitials} substitution variable.
+ * Added https link type.
+ * Corrected [graphic] substitution from {title} to {caption} in
+ linuxdoc-article.conf configuration file.
+ * Fixed error that occurred when == title underline was used.
+ _________________________________________________________________
+
+46. Version 1.0 (2002-11-25)
+
+ First AsciiDoc public release along with AsciiDoc web site
+ ([32]http://www.methods.co.nz/asciidoc/) and SourceForge.net project
+ registration ([33]https://sourceforge.net/projects/asciidoc/).
+ _________________________________________________________________
+
+ Version 8.2.3
+ Last updated 2007-09-11 12:56:18 NZDT
+
+References
+
+ 1. http://www.methods.co.nz/asciidoc/faq.html
+ 2. http://www.maths.nottingham.ac.uk/personal/drw/lm.html
+ 3. http://www.methods.co.nz/asciidoc/asciimath.html
+ 4. http://www.methods.co.nz/asciidoc/index.html
+ 5. http://tpl.sourceforge.net/userguide.html
+ 6. http://www.methods.co.nz/asciidoc/music-filter.html
+ 7. http://lilypond.org/
+ 8. http://abcnotation.org.uk/
+ 9. mailto:srackham@methods.co.nz
+ 10. mailto:jlm@ofb.net
+ 11. mailto:m_pupil@yahoo.com.cn
+ 12. http://open.comsultia.com/docbook2odf/
+ 13. http://www1.chapman.edu/~jipsen/mathml/asciimath.html
+ 14. http://www.methods.co.nz/asciidoc/asciimath.html
+ 15. file://localhost/tmp/XXXXNLfkv1/userguide.html#X50
+ 16. file://localhost/tmp/XXXXNLfkv1/userguide.html#X33
+ 17. mailto:francis@daoine.org
+ 18. file://localhost/tmp/XXXXNLfkv1/userguide.html#X39
+ 19. file://localhost/tmp/XXXXNLfkv1/source-highlight-filter.html
+ 20. mailto:trolocsis@gmail.com
+ 21. mailto:srackham@methods.co.nz
+ 22. file://localhost/tmp/XXXXNLfkv1/userguide.html#X36
+ 23. file://localhost/tmp/XXXXNLfkv1/userguide.html#X33
+ 24. mailto:viktor@rbg.informatik.tu-darmstadt.de
+ 25. file://localhost/tmp/XXXXNLfkv1/userguide.html#X23
+ 26. mailto:david@dgreaves.com
+ 27. mailto:stone@debian.org
+ 28. mailto:stone@debian.org
+ 29. mailto:srackham@methods.co.nz
+ 30. http://jimmac.musichall.cz/ikony.php3
+ 31. mailto:srackham@methods.co.nz
+ 32. http://www.methods.co.nz/asciidoc/
+ 33. https://sourceforge.net/projects/asciidoc/
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 0000000..7149b3b
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,1448 @@
+AsciiDoc ChangeLog
+==================
+
+Version 8.2.3 (2007-09-12)
+--------------------------
+.Additions and changes
+- Added VMiklos's 'permalink' patch for auto-generated section IDs
+ (enabled by default by the `sectids` attribute).
+- Added http://www.methods.co.nz/asciidoc/faq.html[FAQ] to website.
+- Changed format of \{localdate} attribute to ISO 8601 (`%Y-%m-%d`).
+- Added `abc2ly --beams=None` option to make `music2png.py` conform to
+ ABC's notion of beams.
+- XHTML level 2 section headings are now styled with an underlining
+ border.
+- XHTML links to AsciiDoc title elements are now implemented with
+ title ID attributes (previously separate `<a>` element targets were
+ generated.
+- Multi-word first, middle and last names can be entered in the header
+ author line using the underscore as a word separator.
+- The nested inline macros restriction has now been lifted, for
+ example you can now include links and inline images inside
+ footnotes.
+- Help topic names can be shortened (so long as they are not
+ ambiguous). For example `asciidoc -hm` will print the AsciiDoc man
+ page.
+- Added `\{two_colons}` and `\{two_semicolons}` attributes for
+ escaping labeled list ambiguity.
+- If quirks mode is disabled the XHTML Mime Type is set to the
+ recommended `application/xhtml+xml` (rather than `text/html`).
+
+.Bug fixes
+- Author information is now correctly set when using attribute entries
+ in the header instead of an author line (previously the 'author'
+ attribute was not being calculated correctly and there were
+ attribute substitution problems).
+
+
+Version 8.2.2 (2007-07-22)
+--------------------------
+.Additions and changes
+- http://www.maths.nottingham.ac.uk/personal/drw/lm.html[LaTeXMathML]
+ capability has been added for users who are more familiar with or
+ prefer LaTeX math formulas to the
+ http://www.methods.co.nz/asciidoc/asciimath.html[ASCIIMathML]
+ notation (thanks to Arthur Sakellariou for the patch).
+- The 'source highlight' and 'code' filters now process embedded
+ callouts.
+- Added an `--attribute=ATTRIBUTE` option to `a2x(1)` for passing
+ attribute values to asciidoc(1) (a shortcut for `--asciidoc-opts="-a
+ ATTRIBUTE"`).
+- Image block and inline macros prepend optional `\{imagesdir}`
+ attribute to image link targets.
+
+
+.Bug fixes
+- Fixed an assertion error that occurred when a configuration file
+ containing an `\include::[]` macro was loaded using the
+ `\--conf-file` option and the configuration file name did not
+ include an explicit directory path -- patch submitted by Dmitry
+ Potapov.
+- Asciidoc titles are only converted to lower case if all characters
+ are upper case otherwise case is left unchanged -- patch submitted
+ by Dmitry Potapov.
+- Added a missing check that input is not stdin before loading
+ configuration files from the document directory -- patch submitted
+ by Dmitry Potapov.
+- Attribute list items must evaluate to strings, numbers or None
+ (previously it was possible to evaluate to other object types which
+ resulted in surprising attribute values).
+- If an AsciiDoc document has no title an empty XHTML 1.1 'title'
+ element is created -- previously the 'title' element was dropped
+ which resulted in invalid XHTML 1.1.
+- The Vim syntax file no longer highlights escaped callouts.
+- The Vim syntax highlighter now correctly highlights Double-dollar
+ passthroughs when they enclose dollar delimited ASCIIMathML and
+ LaTeXMathML formulas.
+
+
+Version 8.2.1 (2007-04-06)
+--------------------------
+.Additions and changes
+- A number of improvements have been made to the Vim syntax
+ highlighter, for example the word C++ is no longer mistaken for the
+ start of an unconstrained monospace quote.
+- Labeled list definitions have been tightened -- a list label can no
+ longer containing trailing spaces. The following example is no
+ longer recognized as a valid list label:
+
+ Lorum ipsum ::
++
+This change implements the originally intended behavior (as per the
+AsciiDoc documentation and examples) so there should be very few
+compatibility issues.
+
+.Bug fixes
+
+
+Version 8.2.0 (2007-04-04)
+--------------------------
+.Additions and changes
+- A Vim syntax file is now included in the AsciiDoc distribution
+ (inspired by Felix Obenhuber's `asciidoc.vim` script). You can find
+ it (along with a Vim filetype detection script in the distribution
+ `./vim/` directory (the scripts are installed automatically by the
+ AsciiDoc installer `./install.sh`). See 'Appendix J' of the
+ 'AsciiDoc User Guide' for details.
+- Added 'toclevel' attribute (1..4) which sets the number of title
+ levels reported in the table of contents. Defaults to 2 and must be
+ used with the 'toc' attribute. Example usage:
+
+ $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt
+
+- Added a `listindex` attribute which is the current list item index
+ (1..). If this attribute appears outside a list its value is the
+ number of items in the most recently closed list.
+- The single line titles syntax now accepts trailing suffixes -- this
+ syntax matches the title line syntax of a number of popular Wiki
+ markups.
+- If a QuoteBlock has no attribution or citetitle then the DocBook
+ `<attribution>` element is not generated (previously generated empty
+ `<attribution>` element).
+- If the text of a labeled list item is blank then no `texttag` is
+ written.
+- An end of line backslash performs line continuation for horizontal
+ labeled list items.
+- The Revision line now accommodates Subversion `$Id` markers (in
+ addition to CVS and RCS markers). Thanks to Tiago Sturmer Daitx for
+ this patch.
+- Implemented `a2x(1)` option `--skip-asciidoc` which allows `a2x(1)`
+ to convert DocBook XML files not derived from AsciiDoc sources.
+- If `a2x(1) --doctype` option is not specified it defaults to
+ `manpage` if `--format=manpage` else defaults to `article`
+ (previously `--doctype` always defaulted to `article`).
+- Added an 'External Resources' section to the
+ http://www.methods.co.nz/asciidoc/index.html[AsciiDoc home page].
+
+.Bug fixes
+
+
+Version 8.1.0 (2006-10-22)
+--------------------------
+.Additions and changes
+- AsciiDoc generated XHTML documents now display a table of contents
+ if the 'toc' attribute is defined (JavaScript needs to be enabled
+ for this to work). Thanks to Troy Hanson who contributed this
+ feature based on a JavaScript by Mihai Bazon. I've simplified things
+ somewhat to match Docbook XSL Stylesheets style, see Troy's
+ http://tpl.sourceforge.net/userguide.html[tpl User Guide] for a
+ fancier layout. Use the `-a toc -a numbered` command-line options to
+ produce a number table of contents.
+- A http://www.methods.co.nz/asciidoc/music-filter.html[music filter]
+ is included in the distribution `./filters/` directory. It
+ translates music in http://lilypond.org/[LilyPond] or
+ http://abcnotation.org.uk/[ABC] notation to standard classical
+ notation in the form of a trimmed PNG image which is inserted into
+ the AsciiDoc output document.
+- Incorporated Paul Melis's Win32 filter patch. This workaround
+ allows AsciiDoc to run filters under Windows.
+- Added `uninstall.sh` script.
+- Rather than proliferate a confusing number of filter block
+ delimiters the following convention has been adopted: delimiters
+ belonging to DelimitedBlock filters distributed with AsciiDoc will
+ consist of a word (normally a noun identifying the block content)
+ followed by four or more tilde characters. This has necessitated
+ changing existing filter delimiters (the old delimiters still work
+ but may be deprecated in future versions):
+
+ * The example code filter block delimiter is now the word `code`
+ followed by four or more tilde characters.
+ * The source highlight filter block delimiter is now the word
+ `source` followed by four or more tilde characters.
+
+- Conditionally redefined subscript and superscripting so they use the
+ old replacements mechanism when asciidoc7compatible is defined
+ rather than the asciidoc 8 default unconstrained quoting (patch for
+ affected files attached).
+- Moved the source highlight filter from `./examples/` to `./filter/`.
+- Added `\{verbose}` intrinsic attribute (useful for passing verbose
+ flag to filters).
+- Added `\{outdir}` intrinsic attribute.
+- Renamed `\{docdir}` intrinsic attribute to unambiguous`\{indir}`
+ (`\{docdir}` still works but may be removed in future release).
+- If `asciidoc(1)` outputs to stdout then intrinsic attribute
+ `\{docname}` is extracted from the input file name.
+
+
+Version 8.0.0 (2006-08-27)
+--------------------------
+*********************************************************************
+This is a major release because changes to quoting and index entry
+handling may break existing documents (see 'Additions and changes'
+below and 'Appendix A: Migration Notes' in the AsciiDoc User Guide).
+
+Please report any problems you encounter.
+
+mailto:srackham@methods.co.nz['Stuart Rackham']
+*********************************************************************
+
+.Additions and changes
+- Quoting can can occur within words (based on patch submitted by
+ Benjamin Klum). See the 'Unconstrained Quotes' sub-section in the
+ User Guide.
+
+- The underline and plus characters can be used as alternatives to the
+ existing apostrophe and backtick quote characters. They are arguably
+ better choices than the apostrophe and backtick as they are not
+ confused with punctuation.
+
+- The syntax for index entry macros have have been deprecated from
+ `\+...\+` and `\++...++` to `\((...))` and `\(((...)))` respectively.
+ Rationale:
+ * Bracketing is consistent other with `[[...]]` and `<<...>>`
+ reference macros.
+ * To easily confused with triple plus passthroughs.
+ * To make way for the new monospace quoting.
+
+- Superscripts and subscripts are implemented as constrained quotes so
+ they can now be escaped with a leading backslash and prefixed with
+ with an attribute list.
+
+- An experimental LaTeX backend has been written by Benjamin Klum (a
+ number additions in this release are to accommodate the LaTeX
+ backend).
+- `include` macro file names now expand environment variables and
+ tilde expansions.
+- A configuration file `[quotes]` entry can be undefined by setting to
+ a blank value.
+- Added `callto` inline macro for Skype 'callto' links.
+- Added `colnumber` attribute for table data markup.
+- A leading comment block or comment lines are now skipped (previously
+ a document had to start with either attribute entries or a document
+ Title).
+- Experimental `rows` attribute (number of source lines in table)
+ available in table markup templates (used by experimental LaTeX
+ backend).
+- Included install shell script written by mailto:jlm@ofb.net[Jacob
+ Mandelson] for installing the tarball distribution.
+- Added INSTALL documentation file.
+- Added 'replacements2' substitution options -- a second replacements
+ section.
+- Added the ability to redefine 'normal' and 'verbatim' substitutions
+ with `subsnormal` and `subsverbatim` entries in configuration file
+ `[miscellaneous]` section.
+- By default `AttributeEntry` values are substituted for
+ `specialcharacters` and `attributes`, if you want a different
+ AttributeEntry substitution set the `attributeentry-subs` attribute.
+- The `name` in `name=value` configuration file entries can now end
+ with a backslash, just escape the trailing backslash with a
+ backslash. For example:
+
+ abc\\=xyz
++
+Results in `name=abc\` and `value=xyz` -- previously this would have
+escaped the `=` character.
+
+- A blank configuration file section deletes any preceding section
+ with the same name (applies to non-markup template sections).
+- A command-line attribute value with a `@` suffix does not override
+ existing document and configuration file attributes (normally
+ command-line attributes have precedence over document and
+ configuration file attributes).
+- `localtime` attribute is now encoded from the native system encoding
+ to the output encoding. Patch submitted by
+ mailto:m_pupil@yahoo.com.cn[FKtPp] -- here's his description of the
+ problem:
++
+``I am a Chinese user of AsciiDoc and I find that when I use UTF-8
+(the default encoding) to write asciidoc documents in Windows platform
+the resulting html footer line will get screwed. It was caused by a
+localized tzname that was always encoded in the windows native
+encoding, which in my case is 'cp936'.''
+
+- a2x(1) can generate Open Document Text files using
+ http://open.comsultia.com/docbook2odf/[docbook2odf]. Currently
+ `docbook2odf(1)` only processes a subset of DocBook, unimplemented
+ elements are skipped.
+- The a2x(1) format option defaults to `xhtml` (previously a format
+ had to be specified explicitly).
+- The `-d, \--doctype=DOCTYPE` option has been added to a2x(1) which
+ is a shortcut for `\--asciidoc-options="\--doctype=DOCTYPE"`.
+- Replaced a2x(1) `\--no-icons` and `\--no-copy` options with their
+ negated equivalents: `\--icons` and `\--copy` respectively. The
+ default behavior has also changed: copying and use of icons is
+ disabled by default. Rationale:
+ * To make the default behavior more consistent since use of icons
+ and CSS stylesheets does not apply to all formats.
+ * To make the default behavior less surprising (the creation of icon
+ and stylesheet output files must now be explicit).
+
+- a2x(1) has been bumped from version 0.1.1 to version 1.0.0.
+
+
+.Bug fixes
+- Removed duplicate `./doc/a2x.1.txt` from distribution tarball.
+- Documentation errata.
+- Attribute replacement is no longer performed twice in Titles and
+ AttributeEntrys.
+- a2x(1) skipped asciidoc(1) execution when rerun with different
+ `\--asciidoc-options` options, it now always executes asciidoc(1).
+ The problem was that previously asciidoc(1) was executed only if the
+ output file was missing or older than the source file.
+
+
+Version 7.1.2 (2006-03-07)
+--------------------------
+.Additions and changes
+- Support for
+ http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
+ has been added. See 'Appendix I: ASCIIMathML Support' in the User
+ Guide and the examples at
+ http://www.methods.co.nz/asciidoc/asciimath.html[].
+- You can now prefix quoted text with inline attributes lists. You
+ can use this to set font size and color (XHTML and HTML outputs).
+- Added `\##...\##` quoting -- it does nothing -- it's purpose is to
+ allow inline attributes to be applied to normal text.
+- An link:userguide.html#X50[inline passthrough] mechanism has been
+ implemented.
+- Configuration file comment lines can be escaped with a backslash --
+ this is to allows the inclusion of configuration lines that start
+ with a hash character.
+- The `scriptsdir` attribute can be used to specify the name of the
+ directory containing linked JavaScripts (see the
+ link:userguide.html#X33[User Guide] for details.
+- The BackendBlock has been renamed PassthroughBlock for consistency
+ with the new inline passthrough naming.
+- `a2x(1)` now works with the older `bash(1)` version 2.05b. Patch
+ submitted by mailto:francis@daoine.org[Francis Daly].
+- Content included by the `\include1::[]` system macro is no longer
+ subject to attribute substitution so that ambiguities no longer
+ arise when used to include CSS or JavaScript files.
+
+
+Version 7.1.1 (2006-02-24)
+--------------------------
+.Additions and changes
+- The `caption` attribute can be used to customize admonition captions
+ as well as image, table and example block element title prefixes
+ (`xhtml11` and `html4` backends).
+- You can now override the default icon image using the `icon`
+ attribute to specify the path of the linked image (xhtml11 and html4
+ backends only).
+- The deprecated `imagesdir` attribute is no longer recognized (use
+ `iconsdir` instead).
+- Added 'Appendix H: Using AsciiDoc with non-English Languages' to the
+ AsciiDoc User Guide.
+- Added 'Admonition Icons and Captions' subsection to the User Guide
+ explaining how to customize Admonition elements.
+
+.Bug fixes
+- `a2x(1)` failed when configuration files were installed in the
+ global `/etc/asciidoc/` directory -- it was only searching the
+ directory containing the asciidoc executable (thanks to Christian
+ Wiese for finding and submitting a patch this bug).
+- The html4 backend admonition caption now correctly displays the
+ admonition `caption` attribute (previously displayed the `style`
+ attribute).
+
+
+Version 7.1.0 (2006-01-13)
+--------------------------
+.Additions and changes
+- `a2x(1)` toolchain wrapper utility. This overcomes the biggest
+ hurdle for new users which seems to be assembling and using a
+ working DocBook XML toolchain. With `a2x(1)` you can generate XHTML
+ (chunked and unchunked), PDF, man page, HTML Help and text file
+ outputs from an AsciiDoc input file with a single command. All you
+ need to install (in addition to AsciiDoc) is xsltproc(1), DocBook XSL
+ Stylesheets and optionally FOP (if you want PDF) or lynx(1) (if you
+ want text).
+- Block titles can now start with any non-space character (previously
+ where not allowed to start with `.~-_` characters).
+- `./stylesheets/docbook.css` renamed to
+ `./stylesheets/docbook-xsl.css` to clarify its function.
+- Renamed `./docbook-xsl/manpages.xsl` to `./docbook-xsl/manpage.xsl`
+ for consistency.
+- Admonition and navigation icons moved to `./images/icons/` to
+ clarify usage and conform with a2x(1) usage.
+- Renamed xhtml11 intrinsic attribute `imagesdir` to `iconsdir` to
+ keep vocab consistent and changed default value to `./images/icons`
+ (previously `./images`). `imagesdir` attribute still accepted but
+ deprecated.
+- Unused image files have been weeded out of the distribution.
+- Packager notes (appendix B) have been updated to reflect the needs
+ of `a2x(1)`.
+
+IMPORTANT: The renaming of the xhtml11 backend `imagesdir` intrinsic
+attribute and it's new default value introduces a backward
+compatibility issue: if you use the `icons` attribute you will need to
+either move your icons to the new default `./images/icons` location or
+include an `--attribute{nbsp}iconsdir="your_icons_path"` option in
+your asciidoc commands.
+
+.Bug fixes
+- Backslash line continuation is now observed in verbatim paragraphs.
+- Fixed errors generated by example
+ `./examples/website/build-website.sh` script.
+
+
+Version 7.0.4 (2005-12-08)
+--------------------------
+.Additions and changes
+- Added ternary conditional attributes
+ `\{<name>@<regexp>:<value1>[:<value2>]}` and
+ `\{<name>$<regexp>:<value1>[:<value2>]}`.
+- Safety violations now generate errors (they previously generated
+ warnings).
+- asciidoc(1) now defaults to safe mode, consequently the
+ `[miscellaneous]` safe mode entry and `--safe` command-line option
+ are no longer necessary (though for backward compatibility
+ asciidoc(1) still accepts the `--safe` option).
+- Backend Blocks are now flagged unsafe (they could be used to include
+ arbitrary and hence potentially unsafe output content).
+- Filters are no longer considered unsafe. There's not much point in
+ insisting on filter safety since the installation of an unsafe
+ filter would require the introduction of new or modified
+ configuration files -- if your application configurations can be
+ compromised you're in all sorts of trouble (safe mode protects
+ against unsafe input files not unsafe configuration). As with all
+ filters, before installing, you should verify that they can't be
+ coerced into generating malicious output or exposing sensitive
+ information.
+
+.Bug fixes
+- Fixed a lot of glaring grammatical and factual errors in the User
+ Guide.
+
+
+Version 7.0.3 (2005-12-01)
+--------------------------
+.Additions and changes
+- Added `--safe` and `--unsafe` command-line options -- AsciiDoc can
+ now be executed in a 'safe mode' which disallows the execution of
+ arbitrary code or the inclusion of arbitrary files (see
+ link:userguide.html#X39[Appendix C in the AsciiDoc User Guide]).
+- Included link:source-highlight-filter.html[source-highlight filter]
+ in the distribution `./examples/source-highlight-filter/` directory
+ (based on filter submitted by mailto:trolocsis@gmail.com[Ryan
+ Phillips]).
+- Included the DocBook XSL Stylesheets 1.69.1 customizations used to
+ generate the distributed AsciiDoc documentation (read the
+ `asciidoc-docbook-xsl.txt` file in the distribution `./docbook-xsl/`
+ directory).
+- AsciiDoc DocBook XSL Stylesheet drivers moved from `./doc/` to
+ `./docbook-xsl/`.
+- Modified `./doc/manpages.xsl` so only URL content is displayed in
+ manpages.
+
+.Bug fixes
+- Explicitly set table CSS border style (`xhtml11` backend) to `solid`
+ because default border styles vary from browser to browser.
+
+
+Version 7.0.2 (2005-08-28)
+--------------------------
+.Additions and changes
+- There are now long versions of all AsciiDoc options.
+- If the `--backend` is not specified it defaults to `xhtml11`.
+- Added CSS simulated frames layout to the examples website (see
+ `./examples/website/layout2/README-website.txt`). This layout does
+ not work with IE6 and the original tables based layout is still the
+ default.
+- Support page added to AsciiDoc website.
+
+.Bug fixes
+- Invalid options are now trapped gracefully.
+- Documentation errata.
+
+
+Version 7.0.1 (2005-06-24)
+--------------------------
+.Additions and changes
+- Reverted to use of `strong`, `em`, `tt` XHTML tags -- they're more
+ obvious and no less correct than `span` tags, besides, the generated
+ file sizes are smaller (the 'User Guide' was 11% smaller).
+- Table title rendered with `caption` tag rather than a separate
+ `div`.
+- The AsciiDoc 'stylesdir' attribute (if specified) is now recognized
+ when searching for embedded stylesheets (previously only searched
+ default `./stylesheets` directory).
+- Default charset encoding changed from ISO-8859-1 to UTF-8 -- it's
+ less language specific and displays most common languages.
+- `\template::[]` macros now expand in all configuration file sections
+ previously only in markup template sections.
+- Cleaned up example website layout CSS and configuration
+ (presentation has not been changed).
+- Refactored `xhtml11.conf` configuration file.
+- Set consistent and sensible permissions on distributed files.
+- White space is now stripped from DSV formatted table cell data.
+- `class="tableblock"` attribute added to tables generated by
+ `xhtml-deprecated-css.conf` to assist CSS.
+
+.Bug fixes
+- Illegal character set encoder (specified by the AsciiDoc `encoding`
+ attribute) and character data are trapped gracefully.
+- AsciiDoc table 'format' attribute in table attribute lists were not
+ recognized.
+- The nested horizontal labeled list example in the 'AsciiDoc User
+ Guide' has been dropped -- it generated invalid DocBook markup.
+
+
+Version 7.0.0 (2005-06-06)
+--------------------------
+***************************************************
+This is a major release with many code and
+documentation changes.
+Please report any problems you encounter.
+
+mailto:srackham@methods.co.nz['Stuart Rackham']
+***************************************************
+
+.Additions and changes
+- A new 'xhtml11' backend generates XHTML 1.1 with integrated CSS2
+ replacing the previous 'xhtml', 'css', and 'css-embedded' backends.
+- The CSS stylesheets have finally been rewritten.
+- The asciidoc(1) command help now includes user
+ link:userguide.html#X36[customizable help] topics. When asciidoc is
+ invoked with the `\--help` option the command argument is
+ interpreted as a help topic.
+- The previous example website has been replaced by the actual
+ AsciiDoc website (see `./examples/website/`.
+- XHTML generation options now controlled by the following attributes:
+ 'badges', 'linkcss', 'icons', 'numbered', 'quirks', 'theme',
+ 'stylesdir', 'imagesdir' (see the link:userguide.html#X33[User
+ Guide] for details.
+- By default HTML and XHTML are output as stand-alone documents (no
+ embedded CSS and no linked admonition icon images).
+- Documents encoded with the UTF-8 Unicode character set are now
+ processed thanks to a patch supplied by
+ mailto:viktor@rbg.informatik.tu-darmstadt.de[Viktor Vasilev].
+- The `-a ^name` command-line syntax to undefine an attribute has been
+ deprecated in favor of the `-a name!` syntax.
+- AttributeEntry syntax addition: `:name!:` to undefine `name` attribute.
+- Added `template` system block macro to allow the inclusion of one
+ configuration file template section within another.
+- A 'verse' style attribute can now be applied to literal paragraphs
+ and blocks to reproduce line breaks and white space from the source
+ document.
+- Replacements and Special Words can now be escaped with leading
+ backslashes.
+- Replacements are now processed in configuration file order (previous
+ ordering was indeterminate).
+- System macros can now be used in the base `asciidoc.conf`
+ configuration file.
+- Deprecated features that emitted warnings in prior versions are no
+ longer tolerated.
+- The `eval` system attribute expression evaluates to `False` the
+ attribute is undefined, if it evaluates to `True` the result is an
+ empty string.
+- The Paragraph and DelimitedBlock 'presubs' parameter can be aliased
+ as 'subs'.
+- Added 'verbatim' substitutions option.
+- Renamed 'List Continuation Block' to 'List Block' and renamed the
+ 'listcontinuation' option to 'list'.
+- Deprecated 'default' substitutions option (use 'normal' instead).
+- The 'section-numbers' section numbering attribute has be renamed
+ 'numbered'.
+- Dropped the '\#UNDER CONSTRUCTION#' block macro.
+- Rewrote Paragraph and DelimitedBlock handlers adding a
+ link:userguide.html#X23[styles] configuration entry.
+
+.Bug fixes
+- Included files are no longer read inside conditionally excluded
+ content.
+- Manpage command names containing dashes (in the manpage NAME
+ section) were misinterpreted as the spaced dash command name/purpose
+ separator. Bug report and patch supplied by
+ mailto:david@dgreaves.com[David Greaves].
+- Unexpected error following malformed author line error.
+
+
+Version 6.0.3 (2005-04-20)
+--------------------------
+.Additions and changes
+- Special characters are now substituted in AttributeEntry element
+ values.
+- Spaced and unspaced em dashes are now recognized (previously only
+ spaced em dashes were recognized).
+- Replaced the table 'noborders' option with richer 'frame' and 'grid'
+ attributes.
+- The `duplicate macro` warning message now only occurs when the
+ verbose (`-v`) option is enabled.
+- Single lines starting with two forward slashes hard up against the
+ left margin are treated as comments and are not processed.
+- Renamed 'section' delimited block option to 'sectionbody' to more
+ accurately reflect it's role.
+- Added a List Continuation block -- a specialized delimited block
+ that is functionally equivalent to the List Item Continuation
+ feature except that the list contained within the block does not
+ require explicit '+' list item continuation lines.
+- Dropped deprecated `<u>` tags from generated HTML.
+- Literal Block delimiters must now consist of at least four points
+ (previously three) to avoid lone ellipsis ambiguity.
+
+.Bug fixes
+- Some system attribute evaluation failures caused unexpected
+ exceptions to occur.
+
+
+Version 6.0.2 (2005-03-30)
+--------------------------
+.Additions and changes
+- Three new 'system' block macros have been added -- `eval`, `sys` and
+ `sys2` which are the block macro equivalents to the same named
+ system attributes.
+- 'Intrinsic' macros have been renamed 'system' macros along with
+ 'action' attributes which have been renamed 'system' attributes:
+ * To reflect their common (though contextually different) behavior.
+ * To avoid confusion with 'intrinsic attributes'.
+
+.Bug fixes
+- Asciidoc now searches in `/etc/asciidoc/filters` for filters.
+
+
+Version 6.0.1 (2005-03-06)
+--------------------------
+.Additions and changes
+- A global configuration file location `/etc/asciidoc` has been added
+ and is now processed before all other locations (patch supplied by
+ mailto:stone@debian.org[Fredrik Steen]).
+- Recoded `tempfile.mktemp()` and other artifacts that are no longer
+ necessary or desirable (patches supplied by
+ mailto:stone@debian.org[Fredrik Steen]).
+- Added BUGS file to the distribution.
+
+.Bug fixes
+- Illegal comment syntax in `css-embedded-stylesheet.conf` resulted in
+ illegal CSS in files generated by the `css-embedded` backend.
+
+
+Version 6.0.0 (2005-01-28)
+--------------------------
+***************************************************
+This release has had some fairly major code and
+documentation changes. Please report any problems
+you encounter.
+
+mailto:srackham@methods.co.nz['Stuart Rackham']
+***************************************************
+
+A lot of new stuff. A new major version number -- some regression
+incompatibility (hopefully mitigated by 'deprecated' warnings).
+
+Went mad trying to rein in the current feature anarchy -- established
+a unified notion of document attributes. Attempted to introduce a
+consistent vocabulary -- renamed many poorly or inconsistently named
+entities.
+
+Actually, deprecated syntax is still processed correctly in almost all
+cases. One source of incompatibility that may arise if you have
+customized CSS stylesheets is the change of AsciiDoc CSS class names
+(see below). I guess the moral is if you've done a lot of
+configuration file customization and are happy with version 5 then you
+may want to stay put.
+
+NOTE: This version requires Python 2.3 or better to run.
+
+.Additions and changes
+- 'Glossary entries' have been renamed 'attributes'. This eliminates
+ confusion with the accepted meaning of glossary.
+- An `AttributeEntry` block element has been added so that document
+ attributes can be assigned from within an AsciiDoc document.
+- The `AttributeList` block element has been added which is a more
+ general solution than the (now deprecated) DelimitedBlock arguments.
+- An BlockId element has been added for setting block element anchor
+ (link target) IDs.
+- Quoted text can now span multiple lines (thanks to James Bowlin for
+ this patch).
+- Inline macros can now span multiple lines.
+- \``double backtick / apostrophe'' quotes generate ``curly quotes''.
+- A warning is now emitted for out of order list item (applies to
+ explicitly enumerated numbered list items).
+- Added `include` action attribute.
+- A line of three or more apostrophes generates an HTML horizontal
+ ruler (`<hr/>` tag). You will get a warning if processed with
+ non-HTML backend.
+- An `\{imagesdir}` attribute specifies image file location for images
+ referenced in configuration files when generating HTML (the default
+ location is `images`).
+- An `\{stylesdir}` attribute specifies the location of CSS
+ stylesheets when generating styled HTML (the default location for
+ configured markup is `.`).
+- The use of the (often inappropriately named) `{caption}` attribute
+ list entry has been deprecated, use `\{0}` instead.
+- New 'ExampleBlock' delimited block along with associated variants
+ Note, Tip, Warning, Caution and Important.
+- The `docbook.conf` file now facilitates the optional inclusion of a
+ DocBook revision history file.
+- To better reflect their purpose the following block elements have
+ been renamed: `VerbatimBlock` to `ListingBlock`; `IndentedBlock` to
+ `LiteralBlock`; `IndentedParagraph` to `LiteralParagraph`;
+ `CustomBlock` to `BackendBlock`; `SimpleSection` to `SectionBody`.
+ Any corresponding CSS class names have also been changed which could
+ result in backward incompatibility in customized stylesheets.
+- Swapped plain DocBook admonition icons for Jimmac's DocBook icons
+ (http://jimmac.musichall.cz/ikony.php3[]). The original plain icons
+ have been moved to `./images/plain`.
+- Renamed `html` backend to `xhtml` to better reflect it's function
+ (former `html-4` backend renamed to `html`).
+- A new inline anchor macro syntax `[[[<id>]]]` is available, it
+ displays `[<id>]` at the anchor location and is for anchoring
+ bibliography list entries.
+- An optional 'single-line titles' syntax can be used.
+- Tweaks to distributed CSS stylesheets and FOP `fo.xsl` customization
+ file.
+- 'List Item Continuation' has been implemented which allows
+ additional block elements to be included in list items by separating
+ them from the preceding list item element with a line containing a
+ single plus character.
+- A new 'Horizontal Labeled List' list type has been added. Generates
+ two column list -- the first column contains the list element
+ labels, the second contains the element text. Same syntax as
+ `Vertical Labeled Lists` except the double colon label suffix is
+ followed by the start of the list item text.
+
+.Bug fixes
+- Fixed broken backslash line continuation.
+- Labeled list end tags were not undergoing attribute substitution.
+- Documents without any author information now generate legitimate
+ DocBook (previously if the author line was not included in the
+ document header then an empty (illegal) DocBook `author` element was
+ generated).
+- Multiple spaces in filter command arguments were replaced by a
+ single space. The `./examples/asciidoc2text/asciidoc2text.sh` script
+ now indents text correctly.
+
+
+Version 5.1.1 (2004-10-10)
+--------------------------
+*15-December-2004: Interim update:* Updated `asciidoc.py` to fix
+broken `join_lines` function -- no other changes.
+
+- PDF documentation is now produced from DocBook XML using XSLTLib and
+ FOP. Previously we processed DocBook SGML with `jw(1)` (which used
+ Dvips to convert DVI files to PDF). FOP has come a long way in the
+ last 12 months and produces very acceptable PDF under both Linux and
+ Windows.
+- Sections detailing how to install and use the DocBook XSL
+ Stylesheets, xsltproc, FOP toolchain and the AsciiDoc XSLT drivers
+ have been added to the User Guide.
+- The PDF output from the he example article template has been
+ included in the distribution (`./doc/article.pdf`).
+- Special characters are emitted using decimal Unicode character codes
+ (previously used named character entities which cannot be assumed
+ included in non-HTML documents).
+- Added registered trademark (R) to `[replacements]`.
+- CSS stylesheet tweaks.
+- Admonitions (Note, Tip, Important, Warning, Caution) include icons
+ when generating css output.
+
+
+Version 5.1.0 (2004-09-18)
+--------------------------
+- Callouts have been implemented (see the 'Callouts' section of the
+ AsciiDoc User Guide for details).
+- Added XSL drivers for generating XHTML, chunked XHTML and HTML Help
+ from DocBook XML using XSL stylesheets and xsltproc(1).
+- Added CSS stylesheet for HTML generated from DocBook XML using XSL
+ stylesheets.
+- Distribution contains HTML Help formatted User Guide
+ (`./doc/asciidoc.chm`), the User Guide tells you how it's generated.
+- Images referred to by distributed stylesheets are now located in the
+ `./images` subdirectory (previously located in `.`).
+- Filters path names are now handled properly under Cygwin.
+- The usual documentation and examples additions, updates and
+ polishing.
+
+
+Version 5.0.9 (2004-09-09)
+--------------------------
+- The convention of using a `.asc` file extension for AsciiDoc files
+ has been dropped in favor of the familiar `.txt` extension. It makes
+ more sense in that AsciiDoc is a text presentation format and
+ because `.asc` clashed with the same extension used by other
+ applications. It's only a naming convention -- you don't have to
+ switch if you don't want to.
+- Changed the subscript formatting character from underline to tilde
+ since underscores in file names are reasonably common (especially in
+ link and image macros).
+- An alternative syntax for the index term inline macro has been
+ added: `++<primary>,<secondary>,<tertiary>++`.
+- Index terms that have secondary and tertiary entries now
+ additionally generate separate index terms for the secondary and
+ tertiary entries.
+- A `+<primary>+` index term inline macro has been added which
+ displays the term in the primary text flow.
+- Added alternative variable list definition using double semi-colon
+ terminator as opposed to the standard double colon terminator so
+ variable lists can be nested to two levels.
+- Footnotes now appear on a separate line in HTML and Linuxdoc
+ outputs.
+- Python version compatibility is checked at startup.
+- Preface and appendix section titles in multi-part Book documents are
+ meant to be out of sequence -- warnings are no longer emitted when
+ outputting HTML.
+- Empty section warnings have been replaced by error messages and are
+ emitted only if invalid markup would result.
+- Missing macro sections or invalid macro name warnings are only
+ generated at startup if the `-v` (verbose) option is set. Otherwise
+ they are deferred until a matching macro is encountered in the input
+ file.
+- Missing or invalid table definition warnings are only generated at
+ startup if the `-v` (verbose) option is set. Otherwise they are
+ deferred until a matching table is encountered in the input file.
+- AsciiDoc now makes more of an effort to continue in the face of
+ errors.
+- Fixed broken `./examples/website/main.aap` script.
+- Converted distribution text files DOS text format as a sop to
+ Windows users with challenged text editors.
+- Documentation additions and corrections.
+
+
+Version 5.0.8 (2004-05-15)
+--------------------------
+- Spurious 'out of sequence' level 2 warnings no longer appear when
+ processing 'book' document multi-part book top level Preface and
+ Appendix sub-sections since they are (correctly) out of sequence.
+- A warning is no longer emitted for empty Index sections since this
+ is normal when generating DocBook outputs.
+- Fixed: `[quotes]` configuration file entries where not being
+ overridden by downstream configuration file entries.
+- Footnote text is now output enclosed in square brackets in HTML
+ documents.
+- Added superscripts and subscripts to the standard PRS configuration
+ files.
+- Adjusted CSS stylesheets so list titles don't have so much space
+ between title and first list item (broken in IE6 due to poor CSS
+ compliance). Lessened sidebar title top margin.
+
+
+Version 5.0.7 (2004-04-22)
+--------------------------
+- The version 5.0.6 README incorrectly stated that AsciiDoc would run
+ under Python 2.0, in fact it requires Python 2.1 or better. The
+ README has been corrected.
+- Documented techniques for combining and splitting AsciiDoc documents
+ and processing the combined and split parts (see the 'Tips and
+ Tricks' section of the User Guide).
+- An example of marking up superscripts and subscripts is documented
+ in the 'Tips and Tricks' section of the User Guide (the example
+ configuration file is in the AsciiDoc `examples` directory).
+- Added ellipsis to shipped `[replacements]`; three periods output an
+ ellipsis entity.
+- Removed unused 'SectionClose' class.
+- The AsciiDoc 'Preamble' element is output as a DocBook 'Preface'
+ when processed as a 'book' document type (in older AsciiDoc versions
+ a warning was issued and processing stopped).
+- Fixed a quoting anomaly: quoted text can no longer begin or end with
+ with white space.
+
+
+Version 5.0.6 (2004-03-07)
+--------------------------
+- New 'image' macro implements optional image scaling and linking and
+ works in both inline and block contexts. The 'image' macro obsolesces
+ the existing 'graphic' block macro and 'icon' inline macro.
+- Macro substitution section names now have `-inlinemacro` and
+ `-blockmacro` suffixes to resolve context ambiguity, make their
+ purpose clearer and relieve section namespace congestion.
+- Header derived glossary entries can now be overridden from the
+ command-line.
+- Special character substitution is now performed on AuthorLine
+ derived author names.
+- A macro or block argument called 'options' can be used as a shortcut
+ for a list named arguments with zero length string values.
+- Tables can be output without borders using the `options="noborders"`
+ argument.
+- Table data lines that do not immediately follow a table section
+ underline can now be blank. This allows CSV data with embedded blank
+ lines to be processed correctly.
+- Blank DSV format table data lines are silently skipped.
+- Tightened up on enforcement of configuration file section names to
+ reduce the possibility of section content being seen as a section
+ header line.
+- Section titles can be optionally suffixed with title arguments
+ enclosed in double square brackets.
+- A replacement has been added to `asciidoc.conf` to replace inline
+ double dashes with the `&mdash;` entity.
+- Changed the `.UNDER-CONSTRUCTION.` macro syntax to
+ `\#UNDER-CONSTRUCTION#` so it is not mistaken for a BlockTitle.
+ Similarly changed the `.NEW.` replacement with
+ `{amp}\#35;NEW{amp}#35;`.
+- `{amp}\#35;NEW{amp}#35;` and `\#UNDER-CONSTRUCTION#` macros are now
+ included in the DocBook backend.
+- Replaced shipped `smallnew.gif` with `smallnew.png`.
+- Documentation tidy ups.
+
+
+Version 5.0.5 (2004-02-25)
+--------------------------
+- Fixed the disappearing paragraph titles problem that was caused by
+ Inline macros (incorrectly) processing BlockTitles.
+- Tightened AuthorLine validation. Previously invalid email addresses
+ and embedded special characters in the AuthorLine resulted in
+ invalid output markup.
+
+
+Version 5.0.4 (2004-02-09)
+--------------------------
+- Reinstated missing `infile`, `outfile`, `filetype` and
+ `filetype-<filetype>` glossary entries.
+- As of version 5.0.3 asciidoc(1) now requires Python 2.0 or greater,
+ this has now been documented.
+
+
+Version 5.0.3 (2004-01-23)
+--------------------------
+- Fixed problem that caused any filters directory file containing
+ `.conf` (not just those with the `.conf` extension) from being
+ loaded.
+- All `[miscellaneous]` configuration file entries can now be
+ referenced like glossary entries (they are now processed internally
+ as glossary entries).
+- The output file line terminator (previously hardwired to `\r\n` is
+ now set using the `newline` entry in the configuration file
+ `[miscellaneous]` section.
+- The misspelt `blocktitles` configuration file entry name has been
+ corrected (to `blocktitle`).
+- An `\{empty}` glossary entry has been added to the default
+ configuration which is useful for outputting trailing blank lines
+ from configuration file substitution sections.
+
+
+Version 5.0.2 (2003-12-18)
+--------------------------
+- New (alternative) 'anchor' and 'xref' macro syntax (old syntax still
+ valid).
+- DocBook `mediaobject` and `inlinemediaobject` tags are generated in
+ place of `graphic` and `inlinegraphic` tags by the AsciiDoc
+ `graphic` and `icon` macros. If a macro argument is specified it is
+ the alternative text output if the target document format does not
+ support the specified graphic file format.
+- Dropped the LinuxDoc left and right square bracket special character
+ substitutions as they interfered with macro substitution.
+- Documentation updates and corrections.
+
+
+Version 5.0.1 (2003-12-09)
+--------------------------
+- Fixed problem with anchor tag when generating CSS styled HTML.
+
+
+Version 5.0 (2003-12-08)
+------------------------
+***************************************************
+This release has had some fairly major code and
+documentation changes. Please report any problems
+you encounter.
+
+mailto:srackham@methods.co.nz['Stuart Rackham']
+***************************************************
+
+- AsciiDoc can now produce a full-blown multi-part DocBook book
+ including dedication, abstract, preface, colophon, glossary,
+ appendix, bibliography and book part elements using the new
+ `specialsections` configuration file section.
+- All Section element children (Paragraph, DelimitedBlock, List,
+ Table, BlockMacro) can now be titled using the BlockTitle element.
+ A BlockTitle element is a single line containing a title and
+ beginning with a period.
+- The `index` and `backmatter` macros have been dropped, superseded by
+ `specialsections`.
+- The AsciiDoc 'Preface' element has been renamed 'Preamble' (to avoid
+ confusion with the DocBook book preface element).
+- Out of sequence titles are now tolerated with a warning. This allows
+ book document level 0 sections to be processed.
+- An 'anchor' inline macro has been added for document link target
+ creation.
+- 'Note', 'Tip', 'Important' and 'Warning' paragraph types have been
+ added to support the corresponding DocBook elements.
+- Title substitution is now performed in SidebarBlock titles.
+- DocBook graphics now output as `figure` and `informalfigure`
+ elements rather than `mediaobjects`. This ensures numbered figures
+ and a lists of figures are produced by the DocBook toolchain.
+- You can now escape block argument lines by appending a backslash.
+ Alternatively, if you embed arguments in the delimiter line AsciiDoc
+ does not check for an arguments line.
+- The default DocBook backend file extension has been changed from
+ `.docbook` to `.xml` (`.sgml` for the 'docbook-sgml' backend).
+- Warnings are output by default (previously they only printed when
+ verbose option enabled).
+- A Question and Answer variable list definition has been added to the
+ shipped configuration files, primarily to create DocBook `qanda`
+ DocBook elements.
+- Fixed broken code-filter `-b linuxdoc` option. The asciidoc.asc User
+ Guide can now be processed by linuxdoc(1) (although tables are
+ dropped because LinuxDoc does not implement tables).
+
+.Compatibility issues:
+1. Table titles are no longer in the arguments line, use the new
+ BlockTitles.
+2. Graphic titles are no longer in the 'graphic' block macro caption,
+ use the new BlockTitles.
+3. The code-filter title must be placed in a preceding BlockTitle.
+4. SidebarBlock titles must be placed in a preceding BlockTitle.
+5. The DelimitedBlock option 'sidebar' has been renamed to 'section'.
+6. The default DocBook backend file extension has been changed from
+`.docbook` to `.xml` (`.sgml` for the 'docbook-sgml' backend).
+
+
+Version 4.2 (2003-11-26)
+------------------------
+- The default HTML output is now XHTML 1.0 markup. To output the
+ former HTML 4 markup specify the `html-4` backend.
+- The default DocBook output is now DocBook XML. To output the former
+ DocBook SGML specify the `docbook-sgml` backend. The associated
+ `docbook-sgml.conf` file illustrates how to support minor DTD
+ variations. Examples of using the `xmlto(1)` command for DocBook
+ conversion have been added to the User Guide.
+- Glossary entries set using the command-line -g option can now be
+ referenced in configuration files.
+- Configuration dumps (`-c` command-line option) no longer output
+ redundant undefined glossary entries.
+- DelimitedBlock arguments can now be specified in a separate arguments
+ line immediately following the leading delimiter line, This is in
+ preference to the existing delimiter embedded arguments. Reasons:
+ * The syntax is in keeping with the Tables arguments syntax.
+ * It's easier to enter and implements line continuation.
+- A new QuoteBlock DelimitedBlock definition has been added to the
+ distribution configuration files.
+- The table arguments lines can be continued using the backslash line
+ continuation character.
+- Added new calculated glossary reference type `\{<name>%<value>}`.
+- Double-quote characters can now appear in unquoted positional
+ arguments.
+
+
+Version 4.1 (2003-11-13)
+------------------------
+- Added DSV (Delimiter Separated Values) tables format.
+- `\{eval:<expr>}` glossary references drop the containing line if
+ `<expr>` evaluates to `None`.
+- Block, Table and Macro arguments can now be positional (quoted or
+ unquoted).
+- Vocabulary change: DelimitedBlock, Table and Macro 'attributes' are
+ now referred to as 'arguments'. This makes more sense in light of the
+ extended syntax and avoids confusion with backend markup tag
+ attributes.
+- 'tablewidth' table ruler parameter can now be expressed in percent
+ units (0..100). If between 0 and 1 then the original fractional unit
+ measure is applied.
+- The use of quoting for generating footnotes and index entries has
+ been dropped in favor of 'footnote' and 'indexterm' inline macros.
+- 'backmatter' inline macro included in distribution.
+- Fixed: CSS styled HTML tables are now fully XHTML 1.0 conformant.
+- Fixed: 'tablewidth' was processed incorrectly when passed as table
+ argument.
+- Fixed: Glossary references like `\{x=\{y}}` were one character off
+ if \{x] was defined and `\{y}` was not.
+
+
+Version 4.0 (2003-11-08)
+------------------------
+***************************************************
+This release has had some fairly major code and
+documentation changes. Please report any problems
+you encounter.
+
+'Stuart Rackham'
+***************************************************
+
+- Added tables to AsciiDoc.
+- Added two special 'subs' options: 'default' specifies the default
+ substitution options and 'none' specifies no substitution. These
+ options can only appear singly.
+- Line continuation using a trailing backslash character is available
+ in Paragraphs, ListItems, Tables.
+- The left and right quotes for quoted text can now be specified
+ separately.
+- Shipped configuration files implement footnotes (only useful for
+ DocBook output) using \[[]] quoting.
+- Shipped configuration files implement index terms (only useful for
+ DocBook and LinuxDoc output) using \(()) quoting.
+- The shipped 'html' backend configuration now emits valid 'HTML 4.01
+ Transitional'.
+- Added new calculated glossary reference types `\{<name>!<value>}`
+ and `\{<name>#<value>}`.
+- The DelimitedBlock 'params' option has been dropped in favor of the
+ new 'block attributes' mechanism. If you have customized block
+ params options you may need to adjust source files to use the
+ 'block attributes' syntax. The example code filter has been updated
+ to reflect these changes.
+- The code filter now has a `-t tabsize` option.
+- Replaced `-w` option with `-v` (verbose) option. The warnings option
+ was just to confusing.
+- Named attributes can now be specified in macro calls.
+- The 'tabsize' attribute is recognized in the built-in `include`
+ macros. A tabsize of zero suppresses tab expansion.
+- The configuration file `[options]` section has been split into
+ `[miscellaneous]` and `[titles]`. If you have customized any of
+ these settings you will need to adjust the affected configuration
+ files.
+- Configuration file `[miscellaneous]` entries can now also be set
+ using the command-line `-g` option.
+- Fixed: error that occurred when attempting to use zero length
+ configuration and source files.
+- Fixed: blocking filter halt problem.
+- Fixed: inline macro escape prefix problem.
+- Fixed: missing macros from configuration dump problem.
+- Fixed: named macros were dumped incorrectly.
+- Many documentation changes/additions/corrections.
+
+
+Version 3.2.2 (2003-10-26)
+--------------------------
+- Added `-n` option (synonym for `-g section-numbers`).
+- Dropped the processing commentary (hey, this is Unix).
+- Added new calculated glossary reference type `\{<name>?<value>}`.
+ `<name>` is the glossary entry name and `<value>` is the text
+ substituted if the glossary entry is defined. `<value>` can only
+ contain literal text (no glossary references allowed).
+- Added `asciidoc2text` to distribution `examples/asciidoc2text`
+ directory (converts AsciiDoc source to text file with section
+ numbering).
+- Fixed incorrect nesting of Simple lists inside Variable lists.
+- List definitions have been modified so that list items can be
+ indented. This allows a more intuitive indentation of nested lists
+ in AsciiDoc source.
+- Lists must be separated from preceding paragraphs by a blank line.
+ This is to avoid paragraph lines being mistaken for list items.
+- Corrected asciidoc man page documentation error: the`-f` option does
+ *not* search relative to source document directory for the
+ configuration file.
+- Minor updates to various distribution `.conf` files.
+- Included `badges.conf` in `examples` directory.
+- `css-embedded-stylesheet.conf` now supports footer badges.
+- The default in-line element processing order has been changed:
+ Glossary References are now processed before Inline Macros. This
+ allows glossary expansions to occur inside macro references.
+- Glossary entries are now allowed in Author and Revision lines.
+- Default List `subs` options and Paragraph `presubs` options are
+ assigned the following default value if not specified:
+
+ specialcharacters,quotes,specialwords,replacements,glossary,macros
+
+- Documentation changes/additions/corrections.
+
+
+Version 3.2 (2003-05-26)
+------------------------
+- Added a `-s` command-line option to suppress the output of
+ `[header]` and `[footer]` sections.
+- Article document headers are no longer mandatory: this allows
+ AsciiDoc to process arbitrary chunks of text. When used in
+ conjunction with the new `-s` command-line option corresponding
+ chunks of backend markup can be generated.
+- AsciiDoc now emits a warning message and continues when an out of
+ sequence section title is detected (previously it failed and
+ halted). This allows document sections to be processed separately.
+- Optional 'presubs' and 'postsubs' entries have been added to
+ 'DelimitedBlock' and 'Paragraph' definitions. As a consequence
+ substitution options are no longer legal in 'options' entries.
+- 'presubs' and 'postsubs' substitutions are processed in the order
+ the options are specified (rather than the fixed 'options' order of
+ previous versions).
+- ./filters subdirectories are automatically searched for filter
+ commands.
+- A 'title-subs' configuration option specifies the substitutions
+ performed on document Header and Section titles.
+- A 'subs' entry in now included in List configuration file
+ definitions that specified substitutions performed on list entry
+ text.
+- Configuration files are auto-loaded from ./filters subdirectories.
+- Added example code filter (see ./examples/filters).
+- Bug fix: if section was empty you may have got erroneous 'missing
+ tag "paragraph"' error.
+- Internal code tidy up.
+
+
+Version 3.1 (2003-05-18)
+------------------------
+- In version 3.0 a `[macros]` section entry of the form 'name' was
+ equivalent to 'name='. An entry of the form 'name' now undefines the
+ entry (to bring it in line with the behavior of other special
+ sections).
+- Paragraphs have now been generalized (in the same way as Lists and
+ DelimitedBlocks).
+- The 'indentsize' option has been dropped as as consequence of
+ paragraph generalization.
+- Pipe | characters can be included in substituted tag and
+ substitution section text using the \{brvbar} (broken vertical bar)
+ glossary reference.
+- Removed the restriction requiring substitution section text
+ placeholders | to be on a separate line.
+- Added an `-e` asciidoc(1) command option that excludes implicit
+ configuration files (used in conjunction with `-c` generated
+ configuration files).
+- Version 3.0 documentation has undergone a considerable cleanup.
+- The dumping of quoted section entries (see `-c` option) now works
+ correctly.
+- The format of special section entries has been made consistent:
+ `name` undefines the entry; `name=` sets the entry value to a blank
+ string; `name=value` sets the entry value to `value`.
+- As a consequence of the previous change the caret prefix is no
+ longer used in glossary configuration file entries (although it is
+ still used when undefining an entry using the `-g` command-line
+ option).
+
+
+Version 3.0 (2003-05-13)
+------------------------
+This version is the culmination of work begun in the 2.x releases
+whereby fixed policy has been replaced by extensible mechanisms.
+
+- Added `-c` command-line option to dump a composite asciidoc(1)
+ configuration file to stdout.
+- Lists and Delimited Blocks are now defined by a set of configuration
+ file parameter sections. The user can modify the default
+ definitions or add new ones.
+- Block content can now be processed through external filters.
+- The default behavior for Custom Blocks is to perform glossary
+ substitution (previously there was no substitution inside Custom
+ Blocks).
+- The old 2.x style macros have been reimplemented; as with Lists and
+ Delimited Blocks there syntax and behavior can be configured by the
+ user. The default macro syntax remains the same but the semantics
+ are now (hopefully) a bit more intelligible.
+- Block and Builtin macros use :: delimiter instead of the 2.x single
+ colon delimit (to distinguish them from inline macros). The 2.x
+ syntax is still supported for backward compatibility.
+- Nested lists are now supported and IndentedParagraphs can be
+ included in list items.
+- Conditional source inclusion can be specified using built in `ifdef`,
+ `ifndef` and `endif` macros.
+- The new conditional source inclusion feature has been used to reduce
+ the number of default configuration files down to one per backend.
+- A change of name: 2.x 'Substitutions' are now called 'Replacements'
+ and the 2.x `[substitutions]` configuration file section is now
+ called `[replacements]` (the old name is still recognized for
+ backward compatibility).
+- The line break is now implemented as a 'Replacements' substitution.
+- Inline 'icon' macro for inline images has been added to default
+ configuration files.
+
+Version 2.2 (2003-04-07)
+------------------------
+- The `master.conf` configuration file name has been deprecated in
+ favor of `asciidoc.conf`.
+- The standard configuration files set is now loaded from the
+ `.asciidoc` folder in the users home directory (if it exists) and
+ then from the source document directory. Configuration files that
+ don't exist are silently skipped.
+- Configuration files named like the source file will be automatically
+ loaded if they are found in the source file directory. For example
+ if the source file is `mydoc.asc` and the `-b html` option is used
+ then asciidoc(1) will look for `mydoc.conf` and `mydoc-html.conf` in
+ that order.
+- The characters used to quote formatted text can be configured and
+ extended by the user (see the master.conf [quotes] section).
+- Quoted text can now be escaped by prefixing a backslash character to
+ the leading quote.
+- The double single-quote '' strong text quote has been deprecated in
+ favor of an asterisk * character.
+- Added \{eval:expression}, \{sys:command} and \{sys2:command}
+ glossary reference actions.
+- Trailing brace characters `}` are now allowed inside glossary
+ references provided they are escaped with a backslash character.
+- Glossary entries can now be escaped by prefixing a backslash
+ character to the leading brace character (use this in preference to
+ placing the backslash inside the brace).
+- The output macro has been deprecated (use the new include1 macro
+ inside a CustomBlock).
+- The default document type is `article` (asciidoc no longer attempts
+ to guess).
+- Files included within DelimitedBlocks are not searched for block
+ termination underlines. This ensures the entire file is part of the
+ DelimitedBlock.
+- `include` macros can now be used in configuration files.
+- Corrected \{infile} and \{outfile} glossary entry documentation.
+- File inclusion is now limited to a depth of 5 to catch recursion
+ loops.
+- Inline tags have been deprecated, they're not necessary and they
+ immediately make the source document backend specific. Use
+ CustomBlocks or Substitutions instead.
+
+Version 2.1 (2003-03-17)
+------------------------
+- Added section auto numbering `\{sectnum}` glossary entry
+ (auto-numbering function contributed by Ludovico Magnocavallo).
+- asciidoc(1) now correctly returns non-zero exit status if an error
+ occurs.
+- An AsciiDoc example website has been included in the AsciiDoc
+ distribution `examples/website` directory (also online at
+ http://www.methods.co.nz/asciidoc/examples/website/).
+- NOTE: The `asciidoc` wrapper script included in the 2.0 distribution
+ has been dropped, if you've symlinked or aliased to `asciidoc` you'll
+ need to change them to point directly to `asciidoc.py` instead.
+- An RCS $Id$ marker can be used as the document header revision line
+ (based on a patch submitted by Ludovico Magnocavallo).
+- In addition to the `name=value` glossary entry format two new ones
+ have been introduced: `name` (the default value is set to an empty
+ string) and `^name` (the glossary entry is undefined).
+- The `-q` command-line option has been deprecated and the `-w level`
+ command-line option added. +
+ NOTE: By default skipped substitution warnings are now suppressed.
+- If a configuration file specified with the `-f` command-line option
+ is not found relative to the current working directory then the
+ search is repeated relative to the asciidoc(1) directory. This
+ allows global configuration files to be used.
+- Added `\{infile}`, `\{outfile}` predefined glossary entries.
+- Added `under-construction` macro to HTML article configuration
+ files.
+- Deprecated `\{asciidoc_version}` glossary entry in favor of
+ `\{asciidoc-version}` (to it consistent with other entries).
+
+Version 2.0 (2003-02-24)
+------------------------
+- The emphasized, strong and monospaced words options have been
+ generalized with the introduction of macro based 'special words'
+ lists.
+- Glossary references can now appear in both the document and macro
+ bodies.
+- All output files use `crlf` line termination (previously used UNIX
+ `lf` (newline) termination).
+- Added [substitutions] section which implements arbitrary regular
+ expression based substitutions.
+- An optional `master.conf` configuration file can be used for entries
+ that are not backend or document type specific.
+- Special character definitions moved from the code to the new
+ [special_characters] configuration file section.
+- Configuration file glossary added.
+- Command-line -g glossary entry added.
+- A new 'book' document type has been implemented for the 'docbook'
+ backend. It outputs DocBook 'book' documents.
+- A major internal change has been the implementation of parametrized
+ user definable 'macros'. Internally most document elements are now
+ processed as macros.
+- Configuration file macro variables can be specified with default
+ values (literals or other macro variables).
+- An attempt has been made to tighten up the vocabulary used to
+ describe the AsciiDoc document syntax.
+- The term abstract has been replaced by the more general term
+ 'preface' and a new preface section introduced into article
+ configuration files (replacing the synopsis sections).
+- Any section elements can now be put in the document preface
+ (previous versions only allowed paragraphs).
+- AsciiDoc Blocks have been unified and their behavior can be user
+ defined and parametrized.
+- An 'output' inclusion allows an external file to be written directly
+ to the backend output file.
+- A new CustomBlock has been added. Default behavior is to insert the
+ enveloped AsciiDoc source lines directly into the output file.
+- A 'line break' tag can be inserted by terminating a line with a '+'
+ character (only really useful for HTML backends).
+- An fourth section level has been introduced.
+- The SidebarBlock delimiter line characters have been changed. The
+ deprecated underline is still accepted.
+- Levels 2 and 3 title underline characters have been changed. The
+ deprecated underlines are still accepted.
+- Lines with backend specific inline tags can be inserted into
+ AsciiDoc source files.
+- Single words enveloped by underscores are no longer emphasized. This
+ feature was deprecated as it is redundant (use single quotes
+ instead) and was being applied to file names with underscores.
+- A `-q` quiet option has been added to suppress warning messages.
+- Badge images sourced locally.
+- Added 'author' and 'author-mail' meta tags to HTML configuration
+ files.
+
+Version 1.5 (2003-01-08)
+------------------------
+- Implemented sidebar document elements.
+- Explicit checks for user specified configuration files and input
+ file (rather than throwing exception).
+
+Version 1.4 (2003-01-04)
+------------------------
+- New configuration file options 'emphasizedwords' and 'strongwords'.
+ These allow the definition of words that will always be emphasized
+ or rendered in a strong font without inline formatting.
+- Document and section titles are no long subject to inline
+ formatting.
+- Multiple configuration files can be overlaid in a single command.
+- Configuration file tags and options entries can now be overridden on
+ an entry by entry basis (previously the entire section was
+ overloaded).
+- Configuration file tags and options entries are now cached this has
+ resulted in around 37% performance improvement over version 1.3.
+- Variable lists can now contain multiple terms per list item.
+- Placeholder paragraph eliminated from empty sections that contain
+ subsections.
+- Added \{asciidoc_version} substitution variable.
+- More documentation additions and tidy ups.
+
+Version 1.3 (2003-01-01)
+------------------------
+- A new 'strong' text formatting convention has been implemented:
+ Word phrases enclosed in pairs of single quote characters (acute
+ accents) are rendered in a strong font (usually bold).
+- Paragraphs can now be followed immediately by Simple lists and
+ Ordered lists without an intervening blank line.
+- A user specified configuration file (`asciidoc(1)` -f option)
+ overlays the default configuration file rather than replacing it.
+ Custom configuration files need only contain those sections
+ that have been customized.
+- Comment Block delimiters have been relaxed slightly. They must start
+ with three forward slashes /// but the remainder can contain any
+ characters, this allows comments to be embedded in the delimiter line.
+- Leading non-digit characters preceding revision number are now
+ ignored.
+- Set default indentsize [option] from 2 to documented default value
+ of zero in HTML backend html-article.conf and html-manpage.conf
+ files.
+- Fixed error that occurred when taking input from stdin without
+ explicitly specifying a document type.
+- Restored file name and line number error message information.
+- Changed deprecated -t option to -d in asciidoc --help and usage
+ command output.
+- CSS styles tweaking.
+- Code, configuration file and documentation tidy ups.
+
+Version 1.2 (2002-12-28)
+------------------------
+- Implemented 'include' URL to allow file inclusion.
+- `fileextension` configuration file [option] renamed to more sensible
+ `outfilesuffix` (`fileextension` still accepted by this version but
+ will be dropped in future).
+- Improved error reporting.
+- CSS backends generate valid XHTML.
+- New `css-embedded` backend generates HTML with embedded stylesheets
+ (use the `css` backend for linked stylesheets). The css-embedded
+ backend output contains no linked images so the generated html files
+ are completely self contained.
+- Bug fixes.
+
+Version 1.1 (2002-12-03)
+------------------------
+- Added css (cascading style sheets) backend
+- Implemented IndentedBlock document element.
+- Tabsize command-line option has been deprecated in
+ favor of configuration file.
+- Default indent width changed to zero.
+- Added \{localdate} and \{localtime} substitution variables.
+- Added optional [options] configuration file section with
+ fileextension, tabsize and indentsize options.
+- Implemented \{authorinitials} substitution variable.
+- Added https link type.
+- Corrected [graphic] substitution from \{title} to \{caption}
+ in linuxdoc-article.conf configuration file.
+- Fixed error that occurred when '==' title underline was
+ used.
+
+Version 1.0 (2002-11-25)
+------------------------
+First AsciiDoc public release along with AsciiDoc web site
+(http://www.methods.co.nz/asciidoc/[]) and SourceForge.net project registration
+(https://sourceforge.net/projects/asciidoc/[]).
+
+// vim: set syntax=asciidoc:
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..9285110
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..47ddcb4
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,18 @@
+Copyright (C) 2000-2007 Stuart Rackham
+
+Email: srackham@methods.co.nz
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..4c1be99
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,83 @@
+
+ AsciiDoc Installation
+
+ version 8.2.3, 12 September 2007
+
+ Note: The current version of AsciiDoc requires Python 2.3 or newer to
+ run. If you don't already have an up-to-date version of Python
+ installed it can be downloaded from the official Python website
+ [1]http://www.python.org/.
+
+ The latest AsciiDoc downloads can be found on the AsciiDoc website
+ [2]http://www.methods.co.nz/asciidoc/downloads.html and at the
+ SourceForge [3]http://sourceforge.net/projects/asciidoc/):
+ _________________________________________________________________
+
+1. Prepackaged AsciiDoc installation
+
+ The AsciiDoc [4]downloads page lists AsciiDoc packages for various
+ Linux distributions.
+ _________________________________________________________________
+
+2. Distribution tarball installation
+
+ If your flavor or UNIX or Linux is not supported or you prefer to
+ install from source use the install.sh shell script in the tarball
+ root directory (thanks to [5]Jacob Mandelson for the initial
+ implementation of this script).
+
+ install.sh installs AsciiDoc executables, configuration files and man
+ pages in the usual locations. Here's how:
+
+ $ tar -xzf asciidoc-8.2.3.tar.gz
+ $ cd asciidoc-8.2.3
+ $ sudo ./install.sh
+
+ Note: This script was tested on Ubuntu Linux. You may need to edit
+ install.sh if your file locations differ from those wired into the
+ script.
+
+ The uninstall.sh script (actually just a symlink to install.sh) will
+ uninstall AsciiDoc.
+
+ If Vim is installed on your system install.sh will install the Vim
+ syntax highlighter and filetype detection scripts in the global
+ /etc/vim directory (asciidoc.vim in /etc/vim/syntax/ and
+ asciidoc_filetype.vim in /etc/vim/ftdetect/).
+
+ To install locally put asciidoc.vim in ~/.vim/syntax/ and
+ asciidoc_filetype.vim in ~/.vim/ftdetect/.
+ _________________________________________________________________
+
+3. Microsoft Windows installation
+
+ To install the zip formatted distribution just unzip the contents to a
+ new folder:
+
+ $ mkdir asciidoc
+ $ cd asciidoc
+ $ unzip ../asciidoc-8.2.3.zip
+ _________________________________________________________________
+
+4. Testing your installation
+
+ Test out asciidoc by changing to the AsciiDoc application directory
+ and convert the User Guide document (./doc/asciidoc.txt) to XHTML
+ (./doc/asciidoc.html):
+
+ $ asciidoc doc/asciidoc.txt
+
+ Note: Windows users will need to execute the asciidoc.py script
+ directly or create a suitable asciidoc.bat file.
+ _________________________________________________________________
+
+ Version 8.2.3
+ Last updated 2007-09-11 12:56:21 NZDT
+
+References
+
+ 1. http://www.python.org/
+ 2. http://www.methods.co.nz/asciidoc/downloads.html
+ 3. http://sourceforge.net/projects/asciidoc/
+ 4. http://www.methods.co.nz/asciidoc/downloads.html
+ 5. mailto:jlm@ofb.net
diff --git a/INSTALL.txt b/INSTALL.txt
new file mode 100644
index 0000000..de8d569
--- /dev/null
+++ b/INSTALL.txt
@@ -0,0 +1,71 @@
+AsciiDoc Installation
+=====================
+
+NOTE: The current version of AsciiDoc requires *Python 2.3 or newer*
+to run. If you don't already have an up-to-date version of Python
+installed it can be downloaded from the official Python website
+http://www.python.org/[].
+
+The latest AsciiDoc downloads can be found on the AsciiDoc website
+http://www.methods.co.nz/asciidoc/downloads.html[] and at the
+SourceForge http://sourceforge.net/projects/asciidoc/[]):
+
+Prepackaged AsciiDoc installation
+---------------------------------
+The AsciiDoc
+http://www.methods.co.nz/asciidoc/downloads.html[downloads page]
+lists AsciiDoc packages for various Linux distributions.
+
+
+Distribution tarball installation
+---------------------------------
+If your flavor or UNIX or Linux is not supported or you prefer to
+install from source use the `install.sh` shell script in the tarball
+root directory (thanks to mailto:jlm@ofb.net[Jacob Mandelson] for the
+initial implementation of this script).
+
+`install.sh` installs AsciiDoc executables, configuration files and
+man pages in the usual locations. Here's how:
+
+[subs="normal"]
+ $ tar -xzf asciidoc-{revision}.tar.gz
+ $ cd asciidoc-{revision}
+ $ sudo ./install.sh
+
+NOTE: This script was tested on Ubuntu Linux. You may need to edit
+`install.sh` if your file locations differ from those wired into the
+script.
+
+The `uninstall.sh` script (actually just a symlink to `install.sh`)
+will uninstall AsciiDoc.
+
+If Vim is installed on your system `install.sh` will install the Vim
+syntax highlighter and filetype detection scripts in the global
+`/etc/vim` directory (`asciidoc.vim` in `/etc/vim/syntax/` and
+`asciidoc_filetype.vim` in `/etc/vim/ftdetect/`).
+
+To install locally put `asciidoc.vim` in `\~/.vim/syntax/` and
+`asciidoc_filetype.vim` in `~/.vim/ftdetect/`.
+
+
+Microsoft Windows installation
+------------------------------
+To install the zip formatted distribution just unzip the contents to a
+new folder:
+
+[subs="normal"]
+ $ mkdir asciidoc
+ $ cd asciidoc
+ $ unzip ../asciidoc-{revision}.zip
+
+
+Testing your installation
+-------------------------
+Test out asciidoc by changing to the AsciiDoc application directory
+and convert the User Guide document (`./doc/asciidoc.txt`) to XHTML
+(`./doc/asciidoc.html`):
+
+ $ asciidoc doc/asciidoc.txt
+
+NOTE: Windows users will need to execute the `asciidoc.py` script
+directly or create a suitable `asciidoc.bat` file.
diff --git a/README b/README
new file mode 100644
index 0000000..052706b
--- /dev/null
+++ b/README
@@ -0,0 +1,46 @@
+
+ AsciiDoc README File
+
+ version 8.2.3, 12 September 2007
+ _________________________________________________________________
+
+1. Prerequisites
+
+ AsciiDoc is written in Python so you need a Python interpreter
+ (version 2.3 or later) to execute asciidoc(1). Python is installed by
+ default in most Linux distributions. You can download Python from the
+ official Python website [1]http://www.python.org.
+ _________________________________________________________________
+
+2. Obtaining AsciiDoc
+
+ The latest AsciiDoc version and online documentation can be found at
+ [2]http://www.methods.co.nz/asciidoc/ and at the SourceForge
+ [3]http://sourceforge.net/projects/asciidoc/.
+ _________________________________________________________________
+
+3. Tools
+
+ Current AsciiDoc version tested on Xubuntu Linux 7.04 with:
+ * Python 2.5.1
+ * DocBook XSL Stylesheets 1.72.0 (with AsciiDoc drivers and
+ patches).
+ * xsltproc (libxml 20627, libxslt 10120 and libexslt 813).
+ * FOP 0.20.5.
+ * GNU source-highlight 2.4.
+ _________________________________________________________________
+
+4. COPYING
+
+ Copyright © 2002-2007 Stuart Rackham. Free use of this software is
+ granted under the terms of the GNU General Public License (GPL).
+ _________________________________________________________________
+
+ Version 8.2.3
+ Last updated 2007-09-11 12:56:21 NZDT
+
+References
+
+ 1. http://www.python.org/
+ 2. http://www.methods.co.nz/asciidoc/
+ 3. http://sourceforge.net/projects/asciidoc/
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..d0fc9c0
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,34 @@
+AsciiDoc README File
+====================
+
+Prerequisites
+-------------
+AsciiDoc is written in Python so you need a Python interpreter
+(version 2.3 or later) to execute asciidoc(1). Python is installed by
+default in most Linux distributions. You can download Python from the
+official Python website http://www.python.org[].
+
+
+Obtaining AsciiDoc
+------------------
+The latest AsciiDoc version and online documentation can be found at
+http://www.methods.co.nz/asciidoc/[] and at the SourceForge
+http://sourceforge.net/projects/asciidoc/[].
+
+
+Tools
+-----
+Current AsciiDoc version tested on Xubuntu Linux 7.04 with:
+
+- Python 2.5.1
+- DocBook XSL Stylesheets 1.72.0 (with AsciiDoc drivers and patches).
+- xsltproc (libxml 20627, libxslt 10120 and libexslt 813).
+- FOP 0.20.5.
+- GNU source-highlight 2.4.
+
+
+COPYING
+-------
+Copyright (C) 2002-2007 Stuart Rackham. Free use of this software
+is granted under the terms of the GNU General Public License (GPL).
+
diff --git a/a2x b/a2x
new file mode 100755
index 0000000..b4eb498
--- /dev/null
+++ b/a2x
@@ -0,0 +1,591 @@
+#!/usr/bin/env bash
+#
+# a2x - convert Asciidoc text file to PDF, XHTML, HTML Help, manpage
+# or plain text
+#
+# Copyright (C) 2007 Stuart Rackham. Free use of this software is granted
+# under the terms of the GNU General Public License (GPL).
+#
+
+VERSION=1.0.0
+BASENAME=$(basename "$0")
+REALNAME="$0"
+if [ ! -e "$REALNAME" ]; then
+ REALNAME=$(which "$REALNAME")
+fi
+REALNAME="$(readlink -f "$REALNAME")"
+CONF_DIR=/etc/asciidoc
+
+#--------------------------------------------------------------------
+# Constants.
+#--------------------------------------------------------------------
+
+# These are mostly related to command options and are set by parse_options().
+ASCIIDOC_OPTS=
+COPY=no
+DESTINATION_DIR=
+DOCTYPE=
+DRY_RUN=no
+FORMAT=xhtml
+ICONS=no
+ICONS_DIR=./images/icons
+SKIP_ASCIIDOC=no
+SRC_DIR=
+SRC_FILE=
+SRC_NAME= # Source file name sans path and file name extension.
+STYLESHEET=./docbook-xsl.css
+VERBOSE_2=no
+VERBOSE=no
+XSLTPROC_OPTS=
+
+#--------------------------------------------------------------------
+# General purpose functions
+#--------------------------------------------------------------------
+
+# Write $1 to stderr with backslash-escaped characters and no trailing newline.
+function write_console()
+{
+ echo -ne "$1" >&2
+}
+
+# Write newline to stderr.
+function newline()
+{
+ echo >&2
+}
+
+# Write $1 message to stderr.
+function console_msg()
+{
+ echo "$BASENAME: $1" >&2
+}
+
+# Write $1 to stderr if verbose or dry-run options set.
+function verbose_msg()
+{
+ if isyes "$VERBOSE" || isyes "$DRY_RUN"; then
+ console_msg "$1"
+ fi
+}
+
+# Return 0 if $1 is interpreted as an affirmative string.
+function isyes()
+{
+ case "$1" in
+ y|Y|yes|YES|Yes|true|TRUE|True) return 0;;
+ esac
+ return 1
+}
+
+# Log message $1 and exit with status $2 (default 1).
+function quit()
+{
+ local err tmp
+ err=${2:-1}
+ if [ $err -ne 0 ]; then
+ tmp="$VERBOSE"
+ VERBOSE=yes # Force console error exit message.
+ console_msg "failed: $1"
+ VERBOSE="$tmp"
+ else
+ console_msg "$1"
+ fi
+ cleanup
+ exit $err
+}
+
+# Execute the $1 command in the current shell subject to VERBOSE, DRY_RUN shell
+# variables.
+function execute_command()
+{
+ if isyes "$VERBOSE" || isyes "$DRY_RUN"; then
+ console_msg "eval: $1"
+ fi
+ if isyes "$DRY_RUN"; then
+ return 0
+ else
+ eval $1
+ return $?
+ fi
+}
+
+# Same as execute_command() but if error occurs prints optional $2 message and
+# exits program.
+function execute_command_2()
+{
+ local msg
+ execute_command "$1"
+ if [ $? -ne 0 ]; then
+ if [ -n "$2" ]; then
+ msg="$2"
+ else
+ msg="$1"
+ fi
+ quit "$msg"
+ fi
+}
+
+# Return 127 if $1 is not in search path else return 0.
+function require()
+{
+ if ! which "$1" >/dev/null 2>&1; then
+ quit "cannot find required program: $1" 127
+ fi
+}
+
+# Join path $1 to path $2.
+function join()
+{
+ if [ -n "$1" ]; then
+ echo "$1/$2"
+ else
+ echo "$2"
+ fi
+}
+
+# Echo the total size in bytes of file name arguments.
+function file_size()
+{
+ echo $(du -cb "$@" | tail -1 | awk '{print $1}')
+}
+
+#--------------------------------------------------------------------
+# Application specific functions
+#--------------------------------------------------------------------
+
+# Trap interrupts.
+function set_trap()
+{
+ # By convention exit code is 128 + signal number.
+ trap "newline; quit 'exiting: SIGINT' 130" SIGINT
+ trap "newline; quit 'exiting: SIGQUIT' 131" SIGQUIT
+ trap "quit 'exiting: SIGHUP' 129" SIGHUP
+ trap "quit 'exiting: SIGTERM' 143" SIGTERM
+}
+
+# Called at program exit.
+function cleanup()
+{
+ if [ "$(pwd)" != "$PWD" ]; then
+ execute_command "cd \"$PWD\""
+ fi
+}
+
+# Print help summary.
+function help()
+{
+ cat <<EOF
+synopsis:
+
+ $BASENAME [OPTIONS] FILE
+
+options:
+ -a, --attribute=ATTRIBUTE set asciidoc(1) attribute value
+ --asciidoc-opts=ASCIIDOC_OPTS asciidoc(1) options
+ --copy copy icons or HTML stylesheet
+ -D, --destination-dir=PATH output directory (defaults to FILE directory)
+ -d, --doctype=DOCTYPE article, manpage, book
+ -f, --format=FORMAT chunked,htmlhelp,manpage,pdf,text,xhtml
+ -h, --help print command syntax summary
+ --icons use admonition, callout and navigation icons
+ --icons-dir=PATH admonition and navigation icon directory
+ -n, --dry-run don't do anything just print the commands
+ -s, --skip-asciidoc skip asciidoc(1) execution
+ --stylesheet=PATH target HTML CSS stylesheet file name.
+ --version print program version to stdout
+ -v, --verbose print operational details to stderr
+ --xsltproc-opts=XSLTPROC_OPTS xsltproc(1) options
+EOF
+}
+
+# Print full path name of file $1 searching first in the directory containing
+# the asciidoc executable and then in the global configuration directory.
+function conf_file()
+{
+ local result dir
+ # First look in same directory as asciidoc executable.
+ dir="$(dirname "$REALNAME")"
+ if [ ! -f "$dir/$1" -a -d $CONF_DIR ]; then
+ dir=$CONF_DIR
+ fi
+ result="$dir/$1"
+ echo $result
+}
+
+#--------------------------------------------------------------------
+# Process command-line arguments $@
+#--------------------------------------------------------------------
+function parse_options()
+{
+ if [ -z "$*" ]; then
+ help; exit 0
+ fi
+ require "getopt"
+ getopt -T >/dev/null
+ if [ $? -ne 4 ]; then
+ quit "enhanced getopt(1) required"
+ fi
+ short_opts="a:d:D:f:hnsv"
+ long_opts="attribute:,asciidoc-opts:,destination-dir:,doctype:,help,icons-dir:,dry-run,format:,copy,icons,skip-asciidoc,stylesheet:,version,verbose,xsltproc-opts:"
+ args=$(getopt -o $short_opts -l $long_opts -n $BASENAME -- "$@" 2>/dev/null)
+ if [ $? -ne 0 ]; then
+ quit "invalid command options, run: a2x --help"
+ fi
+ eval set -- "$args" # Set positional variables.
+ while true ; do
+ case "$1" in
+ -a|--attribute)
+ ASCIIDOC_OPTS="$ASCIIDOC_OPTS -a \"$2\""
+ shift 2 ;;
+ --asciidoc-opts)
+ ASCIIDOC_OPTS="$ASCIIDOC_OPTS $2"
+ shift 2 ;;
+ --copy)
+ COPY=yes;
+ shift ;;
+ -d|--doctype)
+ DOCTYPE=$2
+ shift 2 ;;
+ -D|--destination-dir)
+ DESTINATION_DIR=$2
+ shift 2 ;;
+ -f|--format)
+ FORMAT=$2
+ shift 2 ;;
+ -h|--help)
+ help; exit 0 ;;
+ --icons)
+ ICONS=yes;
+ shift ;;
+ --icons-dir)
+ ICONS_DIR=$2
+ shift 2 ;;
+ -n|--dry-run)
+ DRY_RUN=yes;
+ shift ;;
+ -s|--skip-asciidoc)
+ SKIP_ASCIIDOC=yes;
+ shift ;;
+ --stylesheet)
+ STYLESHEET=$2
+ shift 2 ;;
+ --version)
+ echo "$BASENAME $VERSION" ; exit 0 ;;
+ -v|--verbose)
+ if isyes "$VERBOSE"; then
+ VERBOSE_2=yes
+ else
+ VERBOSE=yes
+ fi
+ shift ;;
+ --xsltproc-opts)
+ XSLTPROC_OPTS="$XSLTPROC_OPTS $2"
+ shift 2 ;;
+ --)
+ shift; break ;;
+ *)
+ quit "unrecognized option: $1" ;;
+ esac
+ done
+
+ if isyes "$DRY_RUN"; then
+ VERBOSE=yes
+ fi
+
+ if [ $# -eq 0 ]; then
+ quit "source file not specified"
+ fi
+ if [ $# -ne 1 ]; then
+ quit "only one source file allowed"
+ fi
+ if [ ! -r "$1" ]; then
+ quit "source file not found: $1"
+ fi
+ SRC_FILE=$1
+ SRC_DIR=$(dirname "$1")
+ SRC_NAME=$1
+ SRC_NAME=${SRC_NAME##*/} # Strip path.
+ SRC_NAME=${SRC_NAME%.*} # Strip extension.
+}
+
+#--------------------------------------------------------------------
+# Validate program options.
+#--------------------------------------------------------------------
+function validate_options()
+{
+ case "$FORMAT" in
+ chunked|htmlhelp|manpage|odt|pdf|text|xhtml) ;;
+ *) quit "illegal format: $FORMAT" ;;
+ esac
+
+ if [ -z "$DOCTYPE" ]; then
+ if [ "$FORMAT" = "manpage" ]; then
+ DOCTYPE=manpage
+ else
+ DOCTYPE=article
+ fi
+ fi
+ case "$DOCTYPE" in
+ article|book|manpage) ;;
+ *) quit "illegal doctype: $DOCTYPE" ;;
+ esac
+
+ if [ -z "$ICONS_DIR" ]; then
+ quit "icons directory not specified"
+ fi
+ if [[ "$ICONS_DIR" == /* ]]; then
+ quit "icons directory must be relative: $ICONS_DIR"
+ fi
+ ICONS_DIR=${ICONS_DIR%*/} # Strip trailing backslash.
+
+ if [ ! -z "$DESTINATION_DIR" ]; then
+ if [ ! -d "$DESTINATION_DIR" ]; then
+ quit "destination directory not found: $DESTINATION_DIR"
+ fi
+ else
+ DESTINATION_DIR="$SRC_DIR"
+ fi
+
+ if [ -z "$STYLESHEET" ]; then
+ quit "stylesheet cannot be blank"
+ fi
+ if [[ "$STYLESHEET" == /* ]]; then
+ quit "stylesheet path must be relative: $STYLESHEET"
+ fi
+}
+
+# Conditionally copy distribution stylesheet and admonition and navigation
+# icons to destination directory $1.
+function copy_stylesheet_and_icons()
+{
+ if isyes $COPY; then
+ copy_stylesheet "$1"
+ if isyes $ICONS; then
+ copy_icons "$1/$ICONS_DIR"
+ fi
+ fi
+}
+
+# Copy distribution stylesheet to destination directory $1.
+function copy_stylesheet()
+{
+ local src dst
+ src=$(conf_file stylesheets/docbook-xsl.css)
+ if [ ! -r "$src" ]; then
+ quit "file not found: $src"
+ fi
+ dst="$1/$STYLESHEET"
+ # Check we're not trying to copy the file onto itself.
+ if [[ "$src" -ef "$dst" ]]; then
+ return
+ fi
+ execute_command_2 "cp -u \"$src\" \"$dst\""
+}
+
+# Copy distribution admonition and navigation icons to destination directory
+# $1.
+function copy_icons()
+{
+ local src dst
+ dst="$1"
+ # Set source icons directory.
+ src=$(conf_file images/icons/home.png)
+ if [ ! -r "$src" ]; then
+ quit "file not found: $src"
+ fi
+ src=$(dirname "$src")
+ # Check we're not trying to copy the file onto itself.
+ if [[ "$src" -ef "$dst" ]]; then
+ return
+ fi
+ if [ -e "$dst" ]; then
+ if [ ! -d "$dst" ]; then
+ quit "icon destination must be a directory: $dst"
+ fi
+ else
+ execute_command_2 "mkdir -p \"$dst\""
+ fi
+ execute_command_2 "cp -rfu \"$src/\"* \"$dst\""
+}
+
+#--------------------------------------------------------------------
+# Format conversion functions.
+#--------------------------------------------------------------------
+
+# Convert AsciiDoc $SRC_FILE to DocBook XML if it is newer than the
+# XML output file. $1 has additional asciidoc(1) options.
+function to_docbook()
+{
+ local xml
+ xml="$SRC_DIR/$SRC_NAME.xml"
+ if isyes $SKIP_ASCIIDOC; then
+ if [ ! -r "$xml" ]; then
+ quit "file not found: $xml"
+ fi
+ return
+ fi
+ require "asciidoc"
+ execute_command_2 "asciidoc $ASCIIDOC_OPTS $1 -b docbook \"$SRC_FILE\""
+}
+
+function to_xhtml()
+{
+ require "xsltproc"
+ local xsl xml html
+ xsl=$(conf_file docbook-xsl/xhtml.xsl)
+ if [ ! -r "$xsl" ]; then
+ quit "file not found: $xsl"
+ fi
+ to_docbook
+ xml=$(readlink -f "$SRC_DIR/$SRC_NAME.xml")
+ html="$SRC_NAME.html"
+ copy_stylesheet_and_icons "$DESTINATION_DIR"
+ execute_command_2 "cd \"$DESTINATION_DIR\""
+ execute_command_2 "xsltproc $XSLTPROC_OPTS --nonet \
+ \"$xsl\" \"$xml\" >\"$html\""
+ execute_command_2 "cd - >/dev/null"
+}
+
+function to_chunked()
+{
+ require "xsltproc"
+ local chunkdir xsl xml hhp chm
+ case "$FORMAT" in
+ chunked)
+ chunkdir="$DESTINATION_DIR/$SRC_NAME.chunked"
+ xsl=chunked.xsl
+ ;;
+ htmlhelp)
+ chunkdir="$DESTINATION_DIR/$SRC_NAME.htmlhelp"
+ hhp="$SRC_NAME.hhp"
+ chm="$SRC_NAME.chm"
+ XSLTPROC_OPTS="$XSLTPROC_OPTS \
+ --stringparam htmlhelp.hhp \"$hhp\"
+ --stringparam htmlhelp.chm \"$chm\""
+ xsl=htmlhelp.xsl
+ ;;
+ esac
+ xsl=$(conf_file docbook-xsl/$xsl)
+ if [ ! -r "$xsl" ]; then
+ quit "file not found: $xsl"
+ fi
+ to_docbook
+ xml=$(readlink -f "$SRC_DIR/$SRC_NAME.xml")
+ if [ ! -d "$chunkdir" ]; then
+ execute_command_2 "mkdir \"$chunkdir\""
+ fi
+ execute_command_2 "rm -f \"$chunkdir/*.html\""
+ copy_stylesheet_and_icons "$chunkdir"
+ execute_command_2 "cd \"$DESTINATION_DIR\""
+ execute_command_2 "xsltproc $XSLTPROC_OPTS --nonet \
+ --stringparam base.dir \"$(basename "$chunkdir")/\" \
+ \"$xsl\" \"$xml\""
+ execute_command_2 "cd - >/dev/null"
+}
+
+function to_manpage()
+{
+ require "xsltproc"
+ local xsl xml
+ xsl=$(conf_file docbook-xsl/manpage.xsl)
+ if [ ! -r "$xsl" ]; then
+ quit "file not found: $xsl"
+ fi
+ to_docbook "-d manpage"
+ xml=$(readlink -f "$SRC_DIR/$SRC_NAME.xml")
+ execute_command_2 "cd \"$DESTINATION_DIR\""
+ execute_command_2 "xsltproc $XSLTPROC_OPTS --nonet \
+ \"$xsl\" \"$xml\""
+ execute_command_2 "cd - >/dev/null"
+}
+
+function to_pdf()
+{
+ require "xsltproc"
+ require "fop.sh"
+ local xsl xml fo pdf
+ xsl=$(conf_file docbook-xsl/fo.xsl)
+ if [ ! -r "$xsl" ]; then
+ quit "file not found: $xsl"
+ fi
+ xml="$SRC_DIR/$SRC_NAME.xml"
+ fo="$SRC_DIR/$SRC_NAME.fo"
+ pdf="$DESTINATION_DIR/$SRC_NAME.pdf"
+ to_docbook
+ execute_command_2 "xsltproc $XSLTPROC_OPTS --nonet \
+ \"$xsl\" \"$xml\" >\"$fo\""
+ execute_command_2 "fop.sh \"$fo\" \"$pdf\""
+}
+
+function to_odt()
+{
+ require "docbook2odf"
+ local xml odt opts
+ xml="$SRC_DIR/$SRC_NAME.xml"
+ odt="$DESTINATION_DIR/$SRC_NAME.odt"
+ opts="--force"
+ if ! isyes $VERBOSE; then
+ opts="$opts --quiet"
+ fi
+ to_docbook
+ execute_command_2 "docbook2odf $opts \"$xml\" --output-file \"$odt\""
+}
+
+function to_text()
+{
+ require "asciidoc"
+ require "lynx"
+ local html text conf
+ html="$SRC_DIR/$SRC_NAME.html"
+ text="$DESTINATION_DIR/$SRC_NAME.text"
+ conf=$(conf_file text.conf)
+ execute_command_2 "asciidoc $ASCIIDOC_OPTS -f "$conf" -b html4 \
+ -o - \"$SRC_FILE\" | lynx -dump -stdin >\"$text\""
+}
+
+#--------------------------------------------------------------------
+# Main
+#--------------------------------------------------------------------
+
+PWD=`pwd`
+set_trap
+parse_options "$@"
+validate_options
+ASCIIDOC_OPTS="--doctype=$DOCTYPE $ASCIIDOC_OPTS"
+if isyes $VERBOSE_2; then
+ ASCIIDOC_OPTS="$ASCIIDOC_OPTS --verbose"
+ XSLTPROC_OPTS="$XSLTPROC_OPTS --verbose"
+fi
+case "$FORMAT" in
+ xhtml|chunked|htmlhelp)
+ XSLTPROC_OPTS="$XSLTPROC_OPTS \
+ --stringparam html.stylesheet \"$STYLESHEET\""
+ ;;
+esac
+if isyes $ICONS; then
+ XSLTPROC_OPTS="$XSLTPROC_OPTS --stringparam callout.graphics 1 \
+ --stringparam navig.graphics 0 \
+ --stringparam admon.textlabel 0 \
+ --stringparam admon.graphics 1 \
+ --stringparam admon.graphics.path \"$ICONS_DIR/\" \
+ --stringparam callout.graphics.path \"$ICONS_DIR/callouts/\" \
+ --stringparam navig.graphics.path \"$ICONS_DIR/\""
+else
+ XSLTPROC_OPTS="$XSLTPROC_OPTS --stringparam callout.graphics 0 \
+ --stringparam navig.graphics 0 \
+ --stringparam admon.textlabel 1 \
+ --stringparam admon.graphics 0"
+fi
+case "$FORMAT" in
+ chunked|htmlhelp) to_chunked;;
+ manpage) to_manpage;;
+ odt) to_odt;;
+ pdf) to_pdf;;
+ text) to_text;;
+ xhtml) to_xhtml;;
+esac
+cleanup
+
+#--------------------------------------------------------------------
+# vim: set et ts=4 sw=4 sts=4:
+#--------------------------------------------------------------------
diff --git a/asciidoc.conf b/asciidoc.conf
new file mode 100644
index 0000000..3317e4c
--- /dev/null
+++ b/asciidoc.conf
@@ -0,0 +1,368 @@
+#
+# asciidoc.conf
+#
+# Asciidoc global configuration file.
+# Contains backend independent configuration settings that are applied to all
+# AsciiDoc documents.
+#
+
+[miscellaneous]
+tabsize=8
+textwidth=70
+newline=\r\n
+
+[attributes]
+sectids=
+iconsdir=./images/icons
+encoding=UTF-8
+quirks=
+empty=
+# Attribute and AttributeList element patterns.
+attributeentry-pattern=^:(?P<attrname>[a-zA-Z].*?):(?P<attrvalue>.*)$
+attributelist-pattern=(?u)(^\[\[(?P<id>[\w\-_]+)\]\]$)|(^\[(?P<attrlist>.*)\]$)
+# Substitution attributes for escaping AsciiDoc processing.
+amp=&
+lt=<
+gt=>
+brvbar=|
+nbsp=&#160;
+backslash=\
+two_colons=::
+two_semicolons=;;
+
+[titles]
+subs=specialcharacters,quotes,replacements,macros,attributes
+# Double-line title pattern and underlines.
+sectiontitle=^(?P<title>.*?)$
+underlines="==","--","~~","^^","++"
+# Single-line title patterns.
+sect0=^= +(?P<title>[\S].*?)( +=)?$
+sect1=^== +(?P<title>[\S].*?)( +==)?$
+sect2=^=== +(?P<title>[\S].*?)( +===)?$
+sect3=^==== +(?P<title>[\S].*?)( +====)?$
+sect4=^===== +(?P<title>[\S].*?)( +=====)?$
+blocktitle=^\.(?P<title>\S.*)$
+
+[specialcharacters]
+&=&amp;
+<=&lt;
+>=&gt;
+
+[quotes]
+# Constrained quotes.
+*=strong
+'=emphasis
+`=monospaced
+``|''=quoted
+ifdef::asciidoc7compatible[]
+\##=unquoted
+endif::asciidoc7compatible[]
+ifndef::asciidoc7compatible[]
+\#=unquoted
+_=emphasis
++=monospaced
+# Unconstrained quotes.
+**=#strong
+__=#emphasis
+++=#monospaced
+\##=#unquoted
+^=#superscript
+~=#subscript
+endif::asciidoc7compatible[]
+
+[specialwords]
+emphasizedwords=
+strongwords=
+monospacedwords=
+
+[tags]
+# $$ inline passthrough.
+passthrough=|
+
+[replacements]
+# Replacements performed in order of configuration file entry. The first entry
+# of each replacement pair performs the (non-escaped) replacement, the second
+# strips the backslash from the esaped replacement.
+
+# (C) Copyright (entity reference &copy;)
+(?<!\\)\(C\)=&#169;
+\\\(C\)=(C)
+
+# (R) registered trade mark (entity reference &reg;
+(?<!\\)\(R\)=&#174;
+\\\(R\)=(R)
+
+# (TM) Trademark (entity reference &trade;)
+(?<!\\)\(TM\)=&#8482;
+\\\(TM\)=(TM)
+
+# -- Spaced and unspaced em dashes (entity reference &mdash;)
+# But disallow unspaced in man pages because double-dash option name prefixes
+# are pervasive.
+ifndef::doctype-manpage[]
+(^|[^-\\])--($|[^-])=\1&#8212;\2
+endif::doctype-manpage[]
+ifdef::doctype-manpage[]
+(^|\s*[^\S\\])--($|\s+)=\1&#8212;\2
+endif::doctype-manpage[]
+\\--(?!-)=--
+
+# ... Ellipsis (entity reference &hellip;)
+(?<!\\)\.\.\.=&#8230;
+\\\.\.\.=...
+
+##
+# The following require non-standard embedded fonts in PDF files so are not
+# enabled.
+# -> right arrow
+#-&gt;=&#8594;
+# => right double arrow
+#=&gt;=&#8658;
+# <- left arrow
+#&lt;-=&#8592;
+# <= left double arrow
+#&lt;\==&#8656;
+
+# Paragraphs.
+[paradef-default]
+delimiter=(?s)(?P<text>\S.*)
+template=paragraph
+posattrs=style
+verse-style=template="verseparagraph"
+NOTE-style=template="admonitionparagraph",name="note",caption="Note"
+TIP-style=template="admonitionparagraph",name="tip",caption="Tip"
+IMPORTANT-style=template="admonitionparagraph",name="important",caption="Important"
+WARNING-style=template="admonitionparagraph",name="warning",caption="Warning"
+CAUTION-style=template="admonitionparagraph",name="caution",caption="Caution"
+
+[paradef-literal]
+delimiter=(?s)(?P<text>\s+.*)
+options=listelement
+template=literalparagraph
+subs=verbatim
+
+[paradef-admonition]
+delimiter=(?s)^\s*(?P<style>NOTE|TIP|IMPORTANT|WARNING|CAUTION):\s+(?P<text>.+)
+NOTE-style=template="admonitionparagraph",name="note",caption="Note"
+TIP-style=template="admonitionparagraph",name="tip",caption="Tip"
+IMPORTANT-style=template="admonitionparagraph",name="important",caption="Important"
+WARNING-style=template="admonitionparagraph",name="warning",caption="Warning"
+CAUTION-style=template="admonitionparagraph",name="caution",caption="Caution"
+
+[macros]
+# Inline macros.
+# Backslash prefix required for escape processing.
+# (?s) re flag for line spanning.
+
+# Explicit so they can be nested.
+(?su)[\\]?(?P<name>(http|https|ftp|file|mailto|callto|image|link)):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
+# Anchor: [[[id]]]. Bibliographic anchor.
+(?su)[\\]?\[\[\[(?P<attrlist>[\w][\w-]*?)\]\]\]=anchor3
+# Anchor: [[id,xreflabel]]
+(?su)[\\]?\[\[(?P<attrlist>[\w"].*?)\]\]=anchor2
+# Link: <<id,text>>
+(?su)[\\]?&lt;&lt;(?P<attrlist>[\w"].*?)&gt;&gt;=xref2
+
+ifdef::asciidoc7compatible[]
+# Index term: ++primary,secondary,tertiary++
+(?su)(?<!\S)[\\]?\+\+(?P<attrlist>[^+].*?)\+\+(?!\+)=indexterm
+# Index term: +primary+
+# Follows ++...++ macro otherwise it will match them.
+(?<!\S)[\\]?\+(?P<attrlist>[^\s\+][^+].*?)\+(?!\+)=indexterm2
+endif::asciidoc7compatible[]
+
+ifndef::asciidoc7compatible[]
+# Index term: (((primary,secondary,tertiary)))
+(?su)(?<!\()[\\]?\(\(\((?P<attrlist>[^(].*?)\)\)\)(?!\))=indexterm
+# Index term: ((primary))
+# Follows (((...))) macro otherwise it will match them.
+(?<!\()[\\]?\(\((?P<attrlist>[^\s\(][^(].*?)\)\)(?!\))=indexterm2
+endif::asciidoc7compatible[]
+
+# Callout
+[\\]?&lt;(?P<index>\d+)&gt;=callout
+
+# Default inline macro (listed last as a catchall)).
+(?su)[\\]?(?P<name>\w(\w|-)*?):(?P<target>\S*?)(\[(?P<attrlist>.*?)\])=
+
+# Block macros.
+(?u)^(?P<name>\w(\w|-)*?)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=#
+^'{4,}$=#ruler
+^//([^/].*|)$=#comment
+
+# System macros.
+# This default system macro is hardwired into asciidoc.
+#(?u)^(?P<name>\w(\w|-)*?)::(?P<target>\S*?)(\[(?P<attrlist>.*?)\])$=+
+
+# Delimited blocks.
+[blockdef-comment]
+delimiter=^/{4,}
+options=skip
+
+[comment-blockmacro]
+# Outputs nothing.
+
+[blockdef-sidebar]
+delimiter=^\*{4,}$
+template=sidebarblock
+options=sectionbody
+
+[blockdef-list]
+delimiter=^--$
+template=listblock
+options=list
+
+[listblock]
+|
+
+[blockdef-passthrough]
+delimiter=^\+{4,}$
+template=passthroughblock
+subs=attributes,macros
+
+[blockdef-listing]
+delimiter=^-{4,}$
+template=listingblock
+subs=verbatim
+
+[blockdef-literal]
+delimiter=^\.{4,}$
+template=literalblock
+subs=verbatim
+posattrs=style
+verse-style=template="verseblock",subs="normal"
+
+[blockdef-quote]
+delimiter=^_{4,}$
+template=quoteblock
+options=sectionbody
+subs=normal
+posattrs=attribution,citetitle
+
+[blockdef-example]
+delimiter=^\={4,}$
+template=exampleblock
+options=sectionbody
+posattrs=style
+NOTE-style=template="admonitionblock",name="note",caption="Note"
+TIP-style=template="admonitionblock",name="tip",caption="Tip"
+IMPORTANT-style=template="admonitionblock",name="important",caption="Important"
+WARNING-style=template="admonitionblock",name="warning",caption="Warning"
+CAUTION-style=template="admonitionblock",name="caution",caption="Caution"
+
+
+# Lists.
+[listdef-bulleted]
+type=bulleted
+delimiter=^\s*- +(?P<text>.+)$
+listtag=ilist
+itemtag=ilistitem
+texttag=ilisttext
+
+[listdef-bulleted2]
+type=bulleted
+delimiter=^\s*\* +(?P<text>.+)$
+listtag=ilist
+itemtag=ilistitem
+texttag=ilisttext
+
+[listdef-numbered]
+type=numbered
+delimiter=^\s*(?P<index>\d*)\. +(?P<text>.+)$
+listtag=olist
+itemtag=olistitem
+texttag=olisttext
+
+[listdef-numbered2]
+type=numbered
+delimiter=^\s*(?P<index>[.a-z])\. +(?P<text>.+)$
+listtag=olist2
+itemtag=olistitem
+texttag=olisttext
+
+[listdef-vlabeled]
+type=labeled
+delimiter=^\s*(?P<label>.*\S)::$
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+[listdef-vlabeled2]
+type=labeled
+delimiter=^\s*(?P<label>.*\S);;$
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+[listdef-hlabeled]
+type=labeled
+delimiter=^\s*(?P<label>.*\S)((::\s*\\)|(::\s+(?P<text>.+)))$
+listtag=hlist
+itemtag=hlistitem
+texttag=hlisttext
+entrytag=hlistentry
+labeltag=hlistterm
+
+[listdef-hlabeled2]
+type=labeled
+delimiter=^\s*(?P<label>.*\S)((;;\s*\\)|(;;\s+(?P<text>.+)))$
+listtag=hlist
+itemtag=hlistitem
+texttag=hlisttext
+entrytag=hlistentry
+labeltag=hlistterm
+
+
+# Question and Answer list.
+[listdef-qanda]
+type=labeled
+delimiter=^\s*(?P<label>.*\S)\?\?$
+listtag=qlist
+itemtag=qlistitem
+texttag=qlisttext
+entrytag=qlistentry
+labeltag=qlistterm
+
+# Bibliography list.
+[listdef-bibliography]
+type=bulleted
+delimiter=^\+ +(?P<text>.+)$
+listtag=blist
+itemtag=blistitem
+texttag=blisttext
+
+# Glossary list.
+[listdef-glossary]
+type=labeled
+delimiter=^(?P<label>.*\S):-$
+listtag=glist
+itemtag=glistitem
+texttag=glisttext
+entrytag=glistentry
+labeltag=glistterm
+
+# Callout list.
+[listdef-callout]
+type=callout
+delimiter=^<?(?P<index>\d*)> +(?P<text>.+)$
+listtag=colist
+itemtag=colistitem
+texttag=colisttext
+
+# Tables.
+[tabledef-default]
+fillchar=-
+format=fixed
+
+[tabledef-csv]
+fillchar=~
+format=csv
+
+[tabledef-dsv]
+fillchar=_
+format=dsv
diff --git a/asciidoc.py b/asciidoc.py
new file mode 100755
index 0000000..637b3a5
--- /dev/null
+++ b/asciidoc.py
@@ -0,0 +1,4244 @@
+#!/usr/bin/env python
+'''
+asciidoc - converts an AsciiDoc text file to DocBook, HTML or LinuxDoc
+
+Copyright (C) 2002-2007 Stuart Rackham. Free use of this software is granted
+under the terms of the GNU General Public License (GPL).
+'''
+
+import sys, os, re, string, time, traceback, tempfile, popen2, codecs, locale
+from types import *
+
+VERSION = '8.2.3' # See CHANGLOG file for version history.
+
+#---------------------------------------------------------------------------
+# Program onstants.
+#---------------------------------------------------------------------------
+DEFAULT_BACKEND = 'xhtml11'
+DEFAULT_DOCTYPE = 'article'
+# Allowed substitution options for List, Paragraph and DelimitedBlock
+# definition subs entry.
+SUBS_OPTIONS = ('specialcharacters','quotes','specialwords',
+ 'replacements', 'attributes','macros','callouts','normal','verbatim',
+ 'none','passthroughs','replacements2')
+# Default value for unspecified subs and presubs configuration file entries.
+SUBS_NORMAL = ('specialcharacters','quotes','attributes',
+ 'specialwords','replacements','macros','passthroughs')
+SUBS_VERBATIM = ('specialcharacters','callouts')
+
+NAME_RE = r'(?u)[^\W\d][-\w]*' # Valid section or attrbibute name.
+
+
+#---------------------------------------------------------------------------
+# Utility functions and classes.
+#---------------------------------------------------------------------------
+
+class EAsciiDoc(Exception):
+ pass
+
+
+from UserDict import UserDict
+
+class OrderedDict(UserDict):
+ '''Python Cookbook: Ordered Dictionary, Submitter: David Benjamin'''
+ def __init__(self, d = None):
+ self._keys = []
+ UserDict.__init__(self, d)
+ def __delitem__(self, key):
+ UserDict.__delitem__(self, key)
+ self._keys.remove(key)
+ def __setitem__(self, key, item):
+ UserDict.__setitem__(self, key, item)
+ if key not in self._keys: self._keys.append(key)
+ def clear(self):
+ UserDict.clear(self)
+ self._keys = []
+ def copy(self):
+ d = UserDict.copy(self)
+ d._keys = self._keys[:]
+ return d
+ def items(self):
+ return zip(self._keys, self.values())
+ def keys(self):
+ return self._keys
+ def popitem(self):
+ try:
+ key = self._keys[-1]
+ except IndexError:
+ raise KeyError('dictionary is empty')
+ val = self[key]
+ del self[key]
+ return (key, val)
+ def setdefault(self, key, failobj = None):
+ UserDict.setdefault(self, key, failobj)
+ if key not in self._keys: self._keys.append(key)
+ def update(self, d):
+ UserDict.update(self, d)
+ for key in d.keys():
+ if key not in self._keys: self._keys.append(key)
+ def values(self):
+ return map(self.get, self._keys)
+
+def print_stderr(line):
+ sys.stderr.write(line+os.linesep)
+
+def verbose(msg,linenos=True):
+ '''-v option messages.'''
+ if config.verbose:
+ console(msg,linenos=linenos)
+
+def warning(msg,linenos=True):
+ console(msg,'WARNING: ',linenos)
+
+def deprecated(old, new, linenos=True):
+ console("%s: %s" % (old,new), 'DEPRECATED: ', linenos)
+
+def error(msg):
+ '''Report fatal error but don't exit application, continue in the hope of
+ reporting all fatal errors finishing with a non-zero exit code.'''
+ console(msg,'ERROR: ')
+ document.has_errors = True
+
+def console(msg, prefix='', linenos=True):
+ '''Print message to stderr. 'offset' is added to reported line number for
+ warnings emitted when reading ahead.'''
+ s = prefix
+ if linenos and reader.cursor:
+ s = s + "%s: line %d: " \
+ % (os.path.basename(reader.cursor[0]),reader.cursor[1])
+ s = s + msg
+ print_stderr(s)
+
+def file_in(fname,dir):
+ '''Return True if file fname resides inside directory dir.'''
+ assert os.path.isfile(fname)
+ # Empty dir (not to be confused with None) means the current directory.
+ if dir == '':
+ dir = os.getcwd()
+ else:
+ assert os.path.isdir(dir)
+ dir = os.path.abspath(dir)
+ fname = realpath(fname)
+ return os.path.commonprefix((dir,fname)) == dir
+
+def safe():
+ return document.safe
+
+def is_safe_file(fname, dir=None):
+ # A safe file must reside in directory dir (defaults to the source file
+ # directory).
+ if dir is None:
+ if document.infile == '<stdin>':
+ return not safe()
+ dir = os.path.dirname(document.infile)
+ elif dir == '':
+ dir = '.'
+ return not safe() or file_in(fname,dir)
+
+# Return file name which must reside in the parent file directory.
+# Return None if file is not found or not safe.
+def safe_filename(fname, parentdir):
+ if not os.path.isabs(fname):
+ # Include files are relative to parent document
+ # directory.
+ fname = os.path.join(parentdir,fname)
+ if not os.path.isfile(fname):
+ warning('include file not found: %s' % fname)
+ return None
+ if not is_safe_file(fname, parentdir):
+ unsafe_error('include file: %s' % fname)
+ return None
+ return fname
+
+def unsafe_error(msg):
+ error('unsafe: '+msg)
+
+def realpath(fname):
+ '''Return the absolute pathname of the file fname. Follow symbolic links.
+ os.realpath() not available in Python prior to 2.2 and not portable.'''
+ # Follow symlinks to the actual executable.
+ wd = os.getcwd()
+ try:
+ while os.path.islink(fname):
+ linkdir = os.path.dirname(fname)
+ fname = os.readlink(fname)
+ if linkdir: os.chdir(linkdir) # Symlinks can be relative.
+ fname = os.path.abspath(fname)
+ finally:
+ os.chdir(wd)
+ return os.path.normpath(fname)
+
+def syseval(cmd):
+ # Run shell command and return stdout.
+ child = os.popen(cmd)
+ data = child.read()
+ err = child.close()
+ if not err:
+ return data
+ else:
+ return ''
+
+def assign(dst,src):
+ '''Assign all attributes from 'src' object to 'dst' object.'''
+ for a,v in src.__dict__.items():
+ setattr(dst,a,v)
+
+def strip_quotes(s):
+ '''Trim white space and, if necessary, quote characters from s.'''
+ s = string.strip(s)
+ # Strip quotation mark characters from quoted strings.
+ if len(s) >= 3 and s[0] == '"' and s[-1] == '"':
+ s = s[1:-1]
+ return s
+
+def is_regexp(s):
+ '''Return True if s is a valid regular expression else return False.'''
+ try: re.compile(s)
+ except: return False
+ else: return True
+
+def join_regexp(relist):
+ '''Join list of regular expressions re1,re2,... to single regular
+ expression (re1)|(re2)|...'''
+ if len(relist) == 0:
+ return None
+ result = []
+ # Delete named groups to avoid ambiguity.
+ for s in relist:
+ result.append(re.sub(r'\?P<\S+?>','',s))
+ result = string.join(result,')|(')
+ result = '('+result+')'
+ return result
+
+def validate(value,rule,errmsg):
+ '''Validate value against rule expression. Throw EAsciiDoc exception with
+ errmsg if validation fails.'''
+ try:
+ if not eval(string.replace(rule,'$',str(value))):
+ raise EAsciiDoc,errmsg
+ except:
+ raise EAsciiDoc,errmsg
+ return value
+
+def join_lines(lines):
+ '''Return a list in which lines terminated with the backslash line
+ continuation character are joined.'''
+ result = []
+ s = ''
+ continuation = False
+ for line in lines:
+ if line and line[-1] == '\\':
+ s = s + line[:-1]
+ continuation = True
+ continue
+ if continuation:
+ result.append(s+line)
+ s = ''
+ continuation = False
+ else:
+ result.append(line)
+ if continuation:
+ result.append(s)
+ return result
+
+def dovetail(lines1, lines2):
+ '''Append list or tuple of strings 'lines2' to list 'lines1'. Join the
+ last string in 'lines1' with the first string in 'lines2' into a single
+ string.'''
+ assert isinstance(lines1,list) or isinstance(lines1,tuple)
+ assert isinstance(lines2,list) or isinstance(lines2,tuple)
+ if not lines1 or not lines2:
+ return list(lines1) + list(lines2)
+ result = list(lines1[:-1])
+ result.append(lines1[-1] + lines2[0])
+ result += list(lines2[1:])
+ return result
+
+def dovetail_tags(stag,content,etag):
+ '''Merge the end tag with the first content line and the last
+ content line with the end tag. This ensures verbatim elements don't
+ include extraneous opening and closing line breaks.'''
+ return dovetail(dovetail(stag,content), etag)
+
+def parse_attributes(attrs,dict):
+ '''Update a dictionary with name/value attributes from the attrs string.
+ The attrs string is a comma separated list of values and keyword name=value
+ pairs. Values must preceed keywords and are named '1','2'... The entire
+ attributes list is named '0'. If keywords are specified string values must
+ be quoted. Examples:
+
+ attrs: ''
+ dict: {}
+
+ attrs: 'hello,world'
+ dict: {'2': 'world', '0': 'hello,world', '1': 'hello'}
+
+ attrs: '"hello",planet="earth"'
+ dict: {'planet': 'earth', '0': '"hello",planet="earth"', '1': 'hello'}
+ '''
+ def f(*args,**keywords):
+ # Name and add aguments '1','2'... to keywords.
+ for i in range(len(args)):
+ if not keywords.has_key(str(i+1)):
+ keywords[str(i+1)] = args[i]
+ return keywords
+
+ if not attrs:
+ return
+ dict['0'] = attrs
+ # Replace line separators with spaces so line spanning works.
+ s = re.sub(r'\s', ' ', attrs)
+ try:
+ d = eval('f('+s+')')
+ # Attributes must evaluate to strings, numbers or None.
+ for v in d.values():
+ if not (isinstance(v,str) or isinstance(v,int) or isinstance(v,float) or v is None):
+ raise
+ dict.update(d)
+ except:
+ # Try quoting the attrs.
+ s = string.replace(s,'"',r'\"') # Escape double-quotes.
+ s = string.split(s,',')
+ s = map(lambda x: '"'+string.strip(x)+'"',s)
+ s = string.join(s,',')
+ try:
+ d = eval('f('+s+')')
+ except:
+ return # If there's a syntax error leave with {0}=attrs.
+ for k in d.keys(): # Drop any empty positional arguments.
+ if d[k] == '': del d[k]
+ dict.update(d)
+ assert len(d) > 0
+
+def parse_named_attributes(s,attrs):
+ '''Update a attrs dictionary with name="value" attributes from the s string.
+ Returns False if invalid syntax.
+ Example:
+ attrs: 'star="sun",planet="earth"'
+ dict: {'planet':'earth', 'star':'sun'}
+ '''
+ def f(**keywords): return keywords
+
+ try:
+ d = eval('f('+s+')')
+ attrs.update(d)
+ return True
+ except:
+ return False
+
+def parse_list(s):
+ '''Parse comma separated string of Python literals. Return a tuple of of
+ parsed values.'''
+ try:
+ result = eval('tuple(['+s+'])')
+ except:
+ raise EAsciiDoc,'malformed list: '+s
+ return result
+
+def parse_options(options,allowed,errmsg):
+ '''Parse comma separated string of unquoted option names and return as a
+ tuple of valid options. 'allowed' is a list of allowed option values.
+ If allowed=() then all legitimate names are allowed.
+ 'errmsg' is an error message prefix if an illegal option error is thrown.'''
+ result = []
+ if options:
+ for s in re.split(r'\s*,\s*',options):
+ if (allowed and s not in allowed) or (s == '' or not is_name(s)):
+ raise EAsciiDoc,'%s: %s' % (errmsg,s)
+ result.append(s)
+ return tuple(result)
+
+def symbolize(s):
+ '''Drop non-symbol characters and convert to lowercase.'''
+ return string.lower(re.sub(r'(?u)[^\w\-_]', '', s))
+
+def is_name(s):
+ '''Return True if s is valid attribute, macro or tag name
+ (starts with alpha containing alphanumeric and dashes only).'''
+ return re.match(NAME_RE,s) is not None
+
+def subs_quotes(text):
+ '''Quoted text is marked up and the resulting text is
+ returned.'''
+ # The quote patterns are iterated in reverse sort order to avoid ambiguity.
+ # So, for example, __ is processed before _.
+ keys = config.quotes.keys()
+ keys.sort()
+ keys.reverse()
+ for q in keys:
+ i = string.find(q,'|')
+ if i != -1 and q != '|' and q != '||':
+ lq = q[:i] # Left quote.
+ rq = q[i+1:] # Right quote.
+ else:
+ lq = rq = q
+ tag = config.quotes[q]
+ # Unconstrained quotes prefix the tag name with a hash.
+ if tag[0] == '#':
+ tag = tag[1:]
+ # Unconstrained quotes can appear anywhere.
+ reo = re.compile(r'(?msu)(^|.)(\[(?P<attrs>[^[]+?)\])?' \
+ + r'(?:' + re.escape(lq) + r')' \
+ + r'(?P<content>.+?)(?:'+re.escape(rq)+r')')
+ else:
+ # The text within constrained quotes must be bounded by white space.
+ # Non-word (\W) characters are allowed at boundaries to accomodate
+ # enveloping quotes.
+ reo = re.compile(r'(?msu)(^|\W)(\[(?P<attrs>[^[]+?)\])?' \
+ + r'(?:' + re.escape(lq) + r')' \
+ + r'(?P<content>.+?)(?:'+re.escape(rq)+r')(?=\W|$)')
+ pos = 0
+ while True:
+ mo = reo.search(text,pos)
+ if not mo: break
+ if text[mo.start()] == '\\':
+ pos = mo.end()
+ else:
+ attrs = {}
+ parse_attributes(mo.group('attrs'), attrs)
+ stag,etag = config.tag(tag, attrs)
+ s = mo.group(1) + stag + mo.group('content') + etag
+ text = text[:mo.start()] + s + text[mo.end():]
+ pos = mo.start() + len(s)
+ # Unescape escaped quotes.
+ text = string.replace(text,'\\'+lq, lq)
+ if lq != rq:
+ text = string.replace(text,'\\'+rq, rq)
+ return text
+
+def subs_tag(tag,dict={}):
+ '''Perform attribute substitution and split tag string returning start, end
+ tag tuple (c.f. Config.tag()).'''
+ s = subs_attrs(tag,dict)
+ if not s:
+ warning('tag "%s" dropped: contains undefined attribute' % tag)
+ return [None,None]
+ result = string.split(s,'|')
+ if len(result) == 1:
+ return result+[None]
+ elif len(result) == 2:
+ return result
+ else:
+ raise EAsciiDoc,'malformed tag: %s' % tag
+
+def parse_entry(entry, dict=None, unquote=False, unique_values=False,
+ allow_name_only=False):
+ '''Parse name=value entry to dictionary 'dict'. Return tuple (name,value)
+ or None if illegal entry.
+ If the syntax is name= then value is set to ''.
+ If the syntax is name and allow_name_only=True then value is set to ''.
+ If the syntax is name! and allow_name_only=True then value is set to None.
+ Leading and trailing white space is striped from 'name' and 'value'.
+ 'name' can contain any printable characters. If 'name includes the equals
+ '=' character it must be escaped with a backslash.
+ If 'unquote' is True leading and trailing double-quotes are stripped from
+ 'name' and 'value'.
+ If unique_values' is True then dictionary entries with the same value are
+ removed before the parsed entry is added.'''
+ mo = re.search(r'(?:[^\\](=))|(?:[\\][\\](=))',entry)
+ if mo: # name=value entry.
+ if mo.group(1):
+ name = entry[:mo.start(1)]
+ value = entry[mo.end(1):]
+ else:
+ # An escaped (double) backslash preceeded the '='
+ name = entry[:mo.start(2)-1] # Strip the second backslash.
+ value = entry[mo.end(2):]
+ elif allow_name_only and entry: # name or name! entry.
+ name = entry
+ if name[-1] == '!':
+ name = name[:-1]
+ value = None
+ else:
+ value = ''
+ else:
+ return None
+ if unquote:
+ name = strip_quotes(name)
+ if value is not None:
+ value = strip_quotes(value)
+ else:
+ name = string.strip(name)
+ if value is not None:
+ value = string.strip(value)
+ if not name:
+ return None
+ if dict is not None:
+ if unique_values:
+ for k,v in dict.items():
+ if v == value: del dict[k]
+ dict[name] = value
+ return name,value
+
+def parse_entries(entries, dict, unquote=False, unique_values=False,
+ allow_name_only=False):
+ '''Parse name=value entries from from lines of text in 'entries' into
+ dictionary 'dict'. Blank lines are skipped.'''
+ for entry in entries:
+ if entry and not parse_entry(entry, dict, unquote, unique_values,
+ allow_name_only):
+ raise EAsciiDoc,'malformed section entry: %s' % entry
+
+def load_sections(sections, fname, dir=None, namepat=NAME_RE):
+ '''Loads sections dictionary with sections from file fname.
+ Existing sections are overlaid. Silently skips missing configuration
+ files.'''
+ if dir:
+ fname = os.path.join(dir, fname)
+ # Sliently skip missing configuration file.
+ if not os.path.isfile(fname):
+ return
+ lines = open(fname).readlines()
+ reo = re.compile(r'^\[(?P<section>'+namepat+')\]\s*$')
+ section,contents = '',[]
+ for line in lines:
+ if line and line[0] == '#': # Skip comment lines.
+ continue
+ line = string.rstrip(line)
+ found = reo.findall(line)
+ if found:
+ if section: # Store previous section.
+ sections[section] = contents
+ section = found[0].lower()
+ contents = []
+ else:
+ contents.append(line)
+ if section and contents: # Store last section.
+ sections[section] = contents
+
+def dump_section(name,dict,f=sys.stdout):
+ '''Write parameters in 'dict' as in configuration file section format with
+ section 'name'.'''
+ f.write('[%s]%s' % (name,writer.newline))
+ for k,v in dict.items():
+ k = str(k)
+ # Quote if necessary.
+ if len(k) != len(string.strip(k)):
+ k = '"'+k+'"'
+ if v and len(v) != len(string.strip(v)):
+ v = '"'+v+'"'
+ if v is None:
+ # Don't dump undefined attributes.
+ continue
+ else:
+ s = k+'='+v
+ if s[0] == '#':
+ s = '\\' + s # Escape so not treated as comment lines.
+ f.write('%s%s' % (s,writer.newline))
+ f.write(writer.newline)
+
+def update_attrs(attrs,dict):
+ '''Update 'attrs' dictionary with parsed attributes in dictionary 'dict'.'''
+ for k,v in dict.items():
+ if not is_name(k):
+ raise EAsciiDoc,'illegal attribute name: %s' % k
+ attrs[k] = v
+
+def readlines(fname):
+ '''Read lines from file named 'fname' and strip trailing white space.'''
+ # Read file.
+ f = open(fname)
+ try:
+ lines = f.readlines()
+ finally:
+ f.close()
+ # Strip newlines.
+ for i in range(len(lines)):
+ lines[i] = string.rstrip(lines[i])
+ return lines
+
+def filter_lines(filter,lines,dict={}):
+ '''Run 'lines' through the 'filter' shell command and return the result. The
+ 'dict' dictionary contains additional filter attributes.'''
+ # BUG: Has problems finding filters with spaces in command name.
+ if not filter:
+ return lines
+ #if os.name != 'posix':
+ # warning('filters do not work in a non-posix environment')
+ # return lines
+ # Perform attributes substitution on the filter command.
+ s = subs_attrs(filter,dict)
+ if not s:
+ raise EAsciiDoc,'missing filter attribute: %s' % filter
+ filter = s
+ # Search for the filter command in both user and application 'filters'
+ # sub-directories.
+ mo = re.match(r'^(?P<cmd>\S+)(?P<tail>.*)$', filter)
+ cmd = mo.group('cmd')
+ found = False
+ if not os.path.dirname(cmd):
+ # Check in asciidoc user and application directories for unqualified
+ # file name.
+ if USER_DIR:
+ cmd2 = os.path.join(USER_DIR,'filters',cmd)
+ if os.path.isfile(cmd2):
+ found = True
+ if not found:
+ cmd2 = os.path.join(CONF_DIR,'filters',cmd)
+ if os.path.isfile(cmd2):
+ found = True
+ if not found:
+ cmd2 = os.path.join(APP_DIR,'filters',cmd)
+ if os.path.isfile(cmd2):
+ found = True
+ if found:
+ cmd = cmd2
+ else:
+ if os.__dict__.has_key('uname') and os.uname()[0][:6] == 'CYGWIN':
+ # popen2() does not like non-drive letter path names under
+ # Cygwin.
+ s = string.strip(syseval('cygpath -m ' + cmd))
+ if s:
+ cmd = s
+ if os.path.isfile(cmd):
+ found = True
+ else:
+ warning('filter not found: %s' % cmd)
+ if found:
+ filter = '"' + cmd + '"' + mo.group('tail')
+ verbose('filtering: ' + filter)
+ if sys.platform == 'win32':
+ # Paul Melis's <p.e.c.melis@rug.nl> patch for filters on Win32
+ # This workaround is necessary because Windows select() doesn't
+ # work with regular files.
+ fd,tmp = tempfile.mkstemp()
+ os.close(fd)
+ try:
+ try:
+ # Windows doesn't like running scripts directly so explicitly
+ # specify interpreter.
+ if found:
+ if cmd[-3:] == '.py':
+ filter = 'python ' + filter
+ elif cmd[-3:] == '.rb':
+ filter = 'ruby ' + filter
+ w = os.popen(filter + ' > "%s"' % tmp, 'w')
+ i = 0
+ while i < len(lines):
+ line = lines[i]
+ w.write(line + os.linesep)
+ i = i + 1
+ w.close()
+ r = open(tmp, 'rt')
+ result = []
+ for s in r.readlines():
+ result.append(string.rstrip(s))
+ r.close()
+ except:
+ raise EAsciiDoc,'filter error: %s' % filter
+ finally:
+ os.unlink(tmp)
+ else:
+ try:
+ import select
+ result = []
+ r,w = popen2.popen2(filter)
+ # Polled I/O loop to alleviate full buffer deadlocks.
+ i = 0
+ while i < len(lines):
+ line = lines[i]
+ if select.select([],[w.fileno()],[],0)[1]:
+ w.write(line+os.linesep) # Use platform line terminator.
+ i = i+1
+ if select.select([r.fileno()],[],[],0)[0]:
+ s = r.readline()
+ if not s: break # Exit if filter output closes.
+ result.append(string.rstrip(s))
+ w.close()
+ for s in r.readlines():
+ result.append(string.rstrip(s))
+ r.close()
+ except:
+ raise EAsciiDoc,'filter error: %s' % filter
+ # There's no easy way to guage whether popen2() found and executed the
+ # filter, so guess that if it produced no output there is probably a
+ # problem.
+ if lines and not result:
+ warning('no output from filter: %s' % filter)
+ return result
+
+def system(name, args, is_macro=False):
+ '''Evaluate a system attribute ({name:args}) or system block macro
+ (name::[args]). If is_macro is True then we are processing a system
+ block macro otherwise it's a system attribute.
+ NOTE: The include1 attribute is used internally by the include1::[] macro
+ and is not for public use.'''
+ if is_macro:
+ syntax = '%s::[%s]'
+ separator = '\n'
+ else:
+ syntax = '{%s:%s}'
+ separator = writer.newline
+ if name not in ('eval','sys','sys2','include','include1'):
+ msg = 'illegal '+syntax % (name,args)
+ if is_macro:
+ msg += ': macro name'
+ else:
+ msg += ': executable attribute name'
+ warning(msg)
+ return None
+ if name != 'include1':
+ verbose(('evaluating: '+syntax) % (name,args))
+ if safe() and name not in ('include','include1'):
+ unsafe_error(syntax % (name,args))
+ return None
+ result = None
+ if name == 'eval':
+ try:
+ result = eval(args)
+ if result is True:
+ result = ''
+ elif result is False:
+ result = None
+ elif result is not None:
+ result = str(result)
+ except:
+ warning((syntax+': expression evaluation error') % (name,args))
+ elif name in ('sys','sys2'):
+ result = ''
+ fd,tmp = tempfile.mkstemp()
+ os.close(fd)
+ try:
+ cmd = args
+ cmd = cmd + (' > %s' % tmp)
+ if name == 'sys2':
+ cmd = cmd + ' 2>&1'
+ if os.system(cmd):
+ warning((syntax+': non-zero exit status') % (name,args))
+ try:
+ if os.path.isfile(tmp):
+ lines = readlines(tmp)
+ else:
+ lines = []
+ except:
+ raise EAsciiDoc,(syntax+': temp file read error') % (name,args)
+ result = string.join(lines, separator)
+ finally:
+ if os.path.isfile(tmp):
+ os.remove(tmp)
+ elif name == 'include':
+ if not os.path.exists(args):
+ warning((syntax+': file does not exist') % (name,args))
+ elif not is_safe_file(args):
+ unsafe_error(syntax % (name,args))
+ else:
+ result = readlines(args)
+ if result:
+ result = subs_attrs(result)
+ result = string.join(result, separator)
+ result = string.expandtabs(result, reader.tabsize)
+ else:
+ result = ''
+ elif name == 'include1':
+ result = string.join(config.include1[args], separator)
+ else:
+ assert False
+ return result
+
+def subs_attrs(lines,dict={}):
+ '''Substitute 'lines' of text with attributes from the global
+ document.attributes dictionary and from the 'dict' dictionary ('dict'
+ entries take precedence). Return a tuple of the substituted lines. 'lines'
+ containing undefined attributes are deleted. If 'lines' is a string then
+ return a string.
+
+ - Attribute references are substituted in the following order: simple,
+ conditional, system.
+ - If a 'dict' value includes an attribute reference it won't be substituted
+ unless it's substitution order follows that of the source attribute
+ reference.
+
+ The moral is that any attribute references in 'dict' attribute values
+ should be substituted beforehand.'''
+
+ def end_brace(text,start):
+ '''Return index following end brace that matches brace at start in
+ text.'''
+ assert text[start] == '{'
+ n = 0
+ result = start
+ for c in text[start:]:
+ # Skip braces that are followed by a backslash.
+ if result == len(text)-1 or text[result+1] != '\\':
+ if c == '{': n = n + 1
+ elif c == '}': n = n - 1
+ result = result + 1
+ if n == 0: break
+ return result
+
+ if isinstance(lines,StringType):
+ string_result = True
+ lines = [lines]
+ else:
+ string_result = False
+ lines = list(lines)
+ attrs = document.attributes.copy()
+ attrs.update(dict)
+ # Substitute all attributes in all lines.
+ for i in range(len(lines)-1,-1,-1): # Reverse iterate lines.
+ text = lines[i]
+ # Make it easier for regular expressions.
+ text = string.replace(text,'\\{','{\\')
+ text = string.replace(text,'\\}','}\\')
+ # Expand simple attributes ({name}).
+ # Nested attributes not allowed.
+ reo = re.compile(r'(?su)\{(?P<name>[^\\\W][-\w]*?)\}(?!\\)')
+ pos = 0
+ while True:
+ mo = reo.search(text,pos)
+ if not mo: break
+ s = attrs.get(mo.group('name'))
+ if s is None:
+ pos = mo.end()
+ else:
+ s = str(s)
+ text = text[:mo.start()] + s + text[mo.end():]
+ pos = mo.start() + len(s)
+ # Expand conditional attributes.
+ reo = re.compile(r'(?su)\{(?P<name>[^\\\W][-\w]*?)' \
+ r'(?P<op>\=|\?|!|#|%|@|\$)' \
+ r'(?P<value>.*?)\}(?!\\)')
+ pos = 0
+ while True:
+ mo = reo.search(text,pos)
+ if not mo: break
+ attr = mo.group()
+ name = mo.group('name')
+ lval = attrs.get(name)
+ op = mo.group('op')
+ # mo.end() is not good enough because '{x={y}}' matches '{x={y}'.
+ end = end_brace(text,mo.start())
+ rval = text[mo.start('value'):end-1]
+ if lval is None:
+ if op == '=': s = rval
+ elif op == '?': s = ''
+ elif op == '!': s = rval
+ elif op == '#': s = '{'+name+'}' # So the line is dropped.
+ elif op == '%': s = rval
+ elif op in ('@','$'):
+ s = '{'+name+'}' # So the line is dropped.
+ else:
+ assert False, 'illegal attribute: %s' % attr
+ else:
+ if op == '=': s = lval
+ elif op == '?': s = rval
+ elif op == '!': s = ''
+ elif op == '#': s = rval
+ elif op == '%': s = '{zzzzz}' # So the line is dropped.
+ elif op in ('@','$'):
+ v = re.split(r'(?<!\\):',rval)
+ if len(v) not in (2,3):
+ error('illegal attribute syntax: %s' % attr)
+ s = ''
+ elif not is_regexp('^'+v[0]+'$'):
+ error('illegal attribute regexp: %s' % attr)
+ s = ''
+ else:
+ v = [s.replace('\\:',':') for s in v]
+ re_mo = re.match('^'+v[0]+'$',lval)
+ if op == '@':
+ if re_mo:
+ s = v[1] # {<name>@<re>:<v1>[:<v2>]}
+ else:
+ if len(v) == 3: # {<name>@<re>:<v1>:<v2>}
+ s = v[2]
+ else: # {<name>@<re>:<v1>}
+ s = ''
+ else:
+ if re_mo:
+ if len(v) == 2: # {<name>$<re>:<v1>}
+ s = v[1]
+ elif v[1] == '': # {<name>$<re>::<v2>}
+ s = '{zzzzz}' # So the line is dropped.
+ else: # {<name>$<re>:<v1>:<v2>}
+ s = v[1]
+ else:
+ if len(v) == 2: # {<name>$<re>:<v1>}
+ s = '{zzzzz}' # So the line is dropped.
+ else: # {<name>$<re>:<v1>:<v2>}
+ s = v[2]
+ else:
+ assert False, 'illegal attribute: %s' % attr
+ s = str(s)
+ text = text[:mo.start()] + s + text[end:]
+ pos = mo.start() + len(s)
+ # Drop line if it contains unsubstituted {name} references.
+ skipped = re.search(r'(?su)\{[^\\\W][-\w]*?\}(?!\\)', text)
+ if skipped:
+ del lines[i]
+ continue;
+ # Expand system attributes.
+ reo = re.compile(r'(?su)\{(?P<action>[^\\\W][-\w]*?):(?P<expr>.*?)\}(?!\\)')
+ skipped = False
+ pos = 0
+ while True:
+ mo = reo.search(text,pos)
+ if not mo: break
+ expr = mo.group('expr')
+ expr = expr.replace('{\\','{')
+ expr = expr.replace('}\\','}')
+ s = system(mo.group('action'),expr)
+ if s is None:
+ skipped = True
+ break
+ text = text[:mo.start()] + s + text[mo.end():]
+ pos = mo.start() + len(s)
+ # Drop line if the action returns None.
+ if skipped:
+ del lines[i]
+ continue;
+ # Remove backslash from escaped entries.
+ text = text.replace('{\\','{')
+ text = text.replace('}\\','}')
+ lines[i] = text
+ if string_result:
+ if lines:
+ return string.join(lines,'\n')
+ else:
+ return None
+ else:
+ return tuple(lines)
+
+def char_encoding():
+ encoding = document.attributes.get('encoding')
+ if encoding:
+ try:
+ codecs.lookup(encoding)
+ except LookupError,e:
+ raise EAsciiDoc,str(e)
+ return encoding
+
+def char_len(s):
+ return len(char_decode(s))
+
+def char_decode(s):
+ if char_encoding():
+ try:
+ return s.decode(char_encoding())
+ except Exception:
+ raise EAsciiDoc, \
+ "'%s' codec can't decode \"%s\"" % (char_encoding(), s)
+ else:
+ return s
+
+def char_encode(s):
+ if char_encoding():
+ return s.encode(char_encoding())
+ else:
+ return s
+
+class Lex:
+ '''Lexical analysis routines. Static methods and attributes only.'''
+ prev_element = None
+ prev_cursor = None
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def next():
+ '''Returns class of next element on the input (None if EOF). The
+ reader is assumed to be at the first line following a previous element,
+ end of file or line one. Exits with the reader pointing to the first
+ line of the next element or EOF (leading blank lines are skipped).'''
+ reader.skip_blank_lines()
+ if reader.eof(): return None
+ # Optimization: If we've already checked for an element at this
+ # position return the element.
+ if Lex.prev_element and Lex.prev_cursor == reader.cursor:
+ return Lex.prev_element
+ result = None
+ # Check for Title.
+ if not result and Title.isnext():
+ result = Title
+ # Check for Block Macro.
+ if not result and macros.isnext():
+ result = macros.current
+ # Check for List.
+ if not result and lists.isnext():
+ result = lists.current
+ # Check for DelimitedBlock.
+ if not result and blocks.isnext():
+ # Skip comment blocks.
+ if 'skip' in blocks.current.options:
+ blocks.current.translate()
+ return Lex.next()
+ else:
+ result = blocks.current
+ # Check for Table.
+ if not result and tables.isnext():
+ result = tables.current
+ # Check for AttributeEntry.
+ if not result and AttributeEntry.isnext():
+ result = AttributeEntry
+ # Check for AttributeList.
+ if not result and AttributeList.isnext():
+ result = AttributeList
+ # Check for BlockTitle.
+ if not result and BlockTitle.isnext():
+ result = BlockTitle
+ # If it's none of the above then it must be an Paragraph.
+ if not result:
+ if not paragraphs.isnext():
+ raise EAsciiDoc,'paragraph expected'
+ result = paragraphs.current
+ # Cache answer.
+ Lex.prev_cursor = reader.cursor
+ Lex.prev_element = result
+ return result
+ next = staticmethod(next)
+
+ # Extract the passthrough text and replace with temporary placeholders.
+ def extract_passthroughs(text, passthroughs):
+ # +++ passthrough.
+ lq1 = r'(?P<lq>\+{3})'
+ rq1 = r'\+{3}'
+ reo1 = re.compile(r'(?msu)(^|[^\w+])(' + lq1 + r')' \
+ + r'(?P<content>.+?)(' + rq1 + r')(?=[^\w+]|$)')
+ # $$ passthrough.
+ lq2 = r'(\[(?P<attrs>[^[]+?)\])?(?P<lq>\${2})'
+ rq2 = r'\${2}'
+ reo2 = re.compile(r'(?msu)(^|[^\w$\]])(' + lq2 + r')' \
+ + r'(?P<content>.+?)(' + rq2 + r')(?=[^\w$]|$)')
+ reo = reo1
+ pos = 0
+ while True:
+ mo = reo.search(text,pos)
+ if not mo:
+ if reo == reo1:
+ reo = reo2
+ pos = 0
+ continue
+ else:
+ break
+ if text[mo.start()] == '\\':
+ pos = mo.end()
+ else:
+ content = mo.group('content')
+ if mo.group('lq') == '$$':
+ content = config.subs_specialchars(content)
+ attrs = {}
+ parse_attributes(mo.group('attrs'), attrs)
+ stag,etag = config.tag('$$passthrough', attrs)
+ if not stag:
+ etag = '' # Drop end tag if start tag has been.
+ content = stag + content + etag
+ passthroughs.append(content)
+ # Tabs are expanded when the source is read so using them here
+ # guarantees the placeholders are unambiguous.
+ s = mo.group(1) + '\t' + str(len(passthroughs)-1) + '\t'
+ text = text[:mo.start()] + s + text[mo.end():]
+ pos = mo.start() + len(s)
+ # Unescape escaped passthroughs.
+ text = string.replace(text,'\\+++', '+++')
+ text = string.replace(text,'\\$$', '$$')
+ return text
+ extract_passthroughs = staticmethod(extract_passthroughs)
+
+ # Replace passthough placeholders with the original passthrough text.
+ def restore_passthroughs(text, passthroughs):
+ for i,v in enumerate(passthroughs):
+ text = string.replace(text, '\t'+str(i)+'\t', passthroughs[i], 1)
+ return text
+ restore_passthroughs = staticmethod(restore_passthroughs)
+
+ def subs_1(s,options):
+ '''Perform substitution specified in 'options' (in 'options' order) on
+ a single line 's' of text. Returns the substituted string.
+ Does not process 'attributes' or 'passthroughs' substitutions.'''
+ if not s:
+ return s
+ result = s
+ for o in options:
+ if o == 'specialcharacters':
+ result = config.subs_specialchars(result)
+ # Quoted text.
+ elif o == 'quotes':
+ result = subs_quotes(result)
+ # Special words.
+ elif o == 'specialwords':
+ result = config.subs_specialwords(result)
+ # Replacements.
+ elif o in ('replacements','replacements2'):
+ result = config.subs_replacements(result,o)
+ # Inline macros.
+ elif o == 'macros':
+ result = macros.subs(result)
+ elif o == 'callouts':
+ result = macros.subs(result,callouts=True)
+ else:
+ raise EAsciiDoc,'illegal substitution option: %s' % o
+ return result
+ subs_1 = staticmethod(subs_1)
+
+ def subs(lines,options):
+ '''Perform inline processing specified by 'options' (in 'options'
+ order) on sequence of 'lines'.'''
+ if len(options) == 1:
+ if options[0] == 'none':
+ options = ()
+ elif options[0] == 'normal':
+ options = config.subsnormal
+ elif options[0] == 'verbatim':
+ options = config.subsverbatim
+ if not lines or not options:
+ return lines
+ # Join lines so quoting can span multiple lines.
+ para = string.join(lines,"\n")
+ if 'passthroughs' in options:
+ passthroughs = []
+ para = Lex.extract_passthroughs(para,passthroughs)
+ for o in options:
+ if o == 'attributes':
+ # If we don't substitute attributes line-by-line then a single
+ # undefined attribute will drop the entire paragraph.
+ lines = subs_attrs(para.split("\n"))
+ para = string.join(lines,"\n")
+ elif o != 'passthroughs':
+ para = Lex.subs_1(para,(o,))
+ if 'passthroughs' in options:
+ para = Lex.restore_passthroughs(para,passthroughs)
+ return para.split("\n")
+ subs = staticmethod(subs)
+
+ def set_margin(lines, margin=0):
+ '''Utility routine that sets the left margin to 'margin' space in a
+ block of non-blank lines.'''
+ # Calculate width of block margin.
+ lines = list(lines)
+ width = len(lines[0])
+ for s in lines:
+ i = re.search(r'\S',s).start()
+ if i < width: width = i
+ # Strip margin width from all lines.
+ for i in range(len(lines)):
+ lines[i] = ' '*margin + lines[i][width:]
+ return lines
+ set_margin = staticmethod(set_margin)
+
+#---------------------------------------------------------------------------
+# Document element classes parse AsciiDoc reader input and write DocBook writer
+# output.
+#---------------------------------------------------------------------------
+class Document:
+ def __init__(self):
+ self.doctype = None # 'article','manpage' or 'book'.
+ self.backend = None # -b option argument.
+ self.infile = None # Source file name.
+ self.outfile = None # Output file name.
+ self.attributes = {}
+ self.level = 0 # 0 => front matter. 1,2,3 => sect1,2,3.
+ self.has_errors = False # Set true if processing errors were flagged.
+ self.safe = True # Default safe mode.
+ def init_attrs(self):
+ # Set implicit attributes.
+ d = time.localtime(time.time())
+ self.attributes['localdate'] = time.strftime('%Y-%m-%d',d)
+ s = time.strftime('%H:%M:%S',d)
+ if time.daylight:
+ self.attributes['localtime'] = s + ' ' + time.tzname[1]
+ else:
+ self.attributes['localtime'] = s + ' ' + time.tzname[0]
+ # Attempt to convert the localtime to the output encoding.
+ try:
+ self.attributes['localtime'] = char_encode(
+ self.attributes['localtime'].decode(
+ locale.getdefaultlocale()[1]
+ )
+ )
+ except:
+ pass
+ self.attributes['asciidoc-version'] = VERSION
+ self.attributes['backend'] = document.backend
+ self.attributes['doctype'] = document.doctype
+ self.attributes['backend-'+document.backend] = ''
+ self.attributes['doctype-'+document.doctype] = ''
+ self.attributes[document.backend+'-'+document.doctype] = ''
+ self.attributes['asciidoc-dir'] = APP_DIR
+ self.attributes['user-dir'] = USER_DIR
+ if self.infile != '<stdin>':
+ self.attributes['infile'] = self.infile
+ self.attributes['indir'] = os.path.dirname(self.infile)
+ self.attributes['docdir'] = os.path.dirname(self.infile) #DEPRECATED
+ self.attributes['docname'] = os.path.splitext(
+ os.path.basename(self.infile))[0]
+ if config.verbose:
+ self.attributes['verbose'] = ''
+ # Update with configuration file attributes.
+ self.attributes.update(config.conf_attrs)
+ # Update with command-line attributes.
+ self.attributes.update(config.cmd_attrs)
+ # Extract miscellaneous configuration section entries from attributes.
+ config.load_miscellaneous(config.conf_attrs)
+ config.load_miscellaneous(config.cmd_attrs)
+ self.attributes['newline'] = config.newline # Use raw (unescaped) value.
+ if self.outfile:
+ if self.outfile != '<stdout>':
+ self.attributes['outfile'] = self.outfile
+ self.attributes['outdir'] = os.path.dirname(self.outfile)
+ self.attributes['docname'] = os.path.splitext(
+ os.path.basename(self.outfile))[0]
+ ext = os.path.splitext(self.outfile)[1][1:]
+ elif config.outfilesuffix:
+ ext = config.outfilesuffix[1:]
+ else:
+ ext = ''
+ if ext:
+ self.attributes['filetype'] = ext
+ self.attributes['filetype-'+ext] = ''
+ def translate(self):
+ assert self.doctype in ('article','manpage','book'), \
+ 'illegal document type'
+ assert self.level == 0
+ config.expand_all_templates()
+ # Skip leading comment block.
+ if blocks.isnext() and 'skip' in blocks.current.options:
+ blocks.current.translate()
+ # Skip leading comment lines.
+ while macros.isnext() and macros.current.name == 'comment':
+ macros.current.translate()
+ # Skip leading attribute entries.
+ AttributeEntry.translate_all()
+ # Process document header.
+ has_header = Lex.next() is Title and Title.level == 0
+ if self.doctype == 'manpage' and not has_header:
+ error('manpage document title is mandatory')
+ if has_header:
+ Header.translate()
+ # Command-line entries override header derived entries.
+ self.attributes.update(config.cmd_attrs)
+ if config.header_footer:
+ hdr = config.subs_section('header',{})
+ writer.write(hdr)
+ if self.doctype in ('article','book'):
+ # Translate 'preamble' (untitled elements between header
+ # and first section title).
+ if Lex.next() is not Title:
+ stag,etag = config.section2tags('preamble')
+ writer.write(stag)
+ Section.translate_body()
+ writer.write(etag)
+ else:
+ # Translate manpage SYNOPSIS.
+ if Lex.next() is not Title:
+ error('SYNOPSIS section expected')
+ else:
+ Title.translate()
+ if string.upper(Title.dict['title']) <> 'SYNOPSIS':
+ error('second section must be named SYNOPSIS')
+ if Title.level != 1:
+ error('SYNOPSIS section title must be at level 1')
+ d = {}
+ d.update(Title.dict)
+ AttributeList.consume(d)
+ stag,etag = config.section2tags('sect-synopsis',d)
+ writer.write(stag)
+ Section.translate_body()
+ writer.write(etag)
+ else:
+ if config.header_footer:
+ hdr = config.subs_section('header',{})
+ writer.write(hdr)
+ if Lex.next() is not Title:
+ Section.translate_body()
+ # Process remaining sections.
+ while not reader.eof():
+ if Lex.next() is not Title:
+ raise EAsciiDoc,'section title expected'
+ Section.translate()
+ Section.setlevel(0) # Write remaining unwritten section close tags.
+ # Substitute document parameters and write document footer.
+ if config.header_footer:
+ ftr = config.subs_section('footer',{})
+ writer.write(ftr)
+ def parse_author(self,s):
+ ''' Return False if the author is malformed.'''
+ attrs = self.attributes # Alias for readability.
+ s = string.strip(s)
+ mo = re.match(r'^(?P<name1>[^<>\s]+)'
+ '(\s+(?P<name2>[^<>\s]+))?'
+ '(\s+(?P<name3>[^<>\s]+))?'
+ '(\s+<(?P<email>\S+)>)?$',s)
+ if not mo:
+ error('malformed author: %s' % s)
+ return False
+ firstname = mo.group('name1')
+ if mo.group('name3'):
+ middlename = mo.group('name2')
+ lastname = mo.group('name3')
+ else:
+ middlename = None
+ lastname = mo.group('name2')
+ firstname = firstname.replace('_',' ')
+ if middlename:
+ middlename = middlename.replace('_',' ')
+ if lastname:
+ lastname = lastname.replace('_',' ')
+ email = mo.group('email')
+ if firstname:
+ attrs['firstname'] = firstname
+ if middlename:
+ attrs['middlename'] = middlename
+ if lastname:
+ attrs['lastname'] = lastname
+ if email:
+ attrs['email'] = email
+ return True
+ def process_author_names(self):
+ ''' Calculate any missing author related attributes.'''
+ attrs = self.attributes # Alias for readability.
+ firstname = attrs.get('firstname','')
+ middlename = attrs.get('middlename','')
+ lastname = attrs.get('lastname','')
+ author = attrs.get('author')
+ initials = attrs.get('authorinitials')
+ if author and not (firstname or middlename or lastname):
+ if not self.parse_author(author):
+ return
+ attrs['author'] = author.replace('_',' ')
+ self.process_author_names()
+ return
+ if not author:
+ author = '%s %s %s' % (firstname, middlename, lastname)
+ author = author.strip()
+ author = re.sub(r'\s+',' ', author)
+ if not initials:
+ initials = firstname[:1] + middlename[:1] + lastname[:1]
+ initials = initials.upper()
+ names = [firstname,middlename,lastname,author,initials]
+ for i,v in enumerate(names):
+ v = config.subs_specialchars(v)
+ v = subs_attrs(v)
+ names[i] = v
+ firstname,middlename,lastname,author,initials = names
+ if firstname:
+ attrs['firstname'] = firstname
+ if middlename:
+ attrs['middlename'] = middlename
+ if lastname:
+ attrs['lastname'] = lastname
+ if author:
+ attrs['author'] = author
+ if initials:
+ attrs['authorinitials'] = initials
+ if author:
+ attrs['authored'] = ''
+
+
+class Header:
+ '''Static methods and attributes only.'''
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def translate():
+ assert Lex.next() is Title and Title.level == 0
+ Title.translate()
+ attrs = document.attributes # Alias for readability.
+ attrs['doctitle'] = Title.dict['title']
+ if document.doctype == 'manpage':
+ # manpage title formatted like mantitle(manvolnum).
+ mo = re.match(r'^(?P<mantitle>.*)\((?P<manvolnum>.*)\)$',
+ attrs['doctitle'])
+ if not mo:
+ error('malformed manpage title')
+ else:
+ mantitle = mo.group('mantitle').strip()
+ # mantitle is lowered only if in ALL CAPS
+ if mantitle == mantitle.upper():
+ mantitle = mantitle.lower()
+ attrs['mantitle'] = mantitle;
+ attrs['manvolnum'] = mo.group('manvolnum').strip()
+ AttributeEntry.translate_all()
+ s = reader.read_next()
+ if s:
+ s = reader.read()
+ document.parse_author(s)
+ AttributeEntry.translate_all()
+ if reader.read_next():
+ # Parse revision line.
+ s = reader.read()
+ s = subs_attrs(s)
+ if s:
+ # Match RCS/CVS/SVN $Id$ marker format.
+ mo = re.match(r'^\$Id: \S+ (?P<revision>\S+)'
+ ' (?P<date>\S+) \S+ \S+ (\S+ )?\$$',s)
+ if not mo:
+ # Match AsciiDoc revision,date format.
+ mo = re.match(r'^\D*(?P<revision>.*?),(?P<date>.+)$',s)
+ if mo:
+ revision = mo.group('revision').strip()
+ date = mo.group('date').strip()
+ else:
+ revision = None
+ date = s.strip()
+ if revision:
+ attrs['revision'] = config.subs_specialchars(revision)
+ if date:
+ attrs['date'] = config.subs_specialchars(date)
+ AttributeEntry.translate_all()
+ if document.doctype == 'manpage':
+ # Translate mandatory NAME section.
+ if Lex.next() is not Title:
+ error('NAME section expected')
+ else:
+ Title.translate()
+ if string.upper(Title.dict['title']) <> 'NAME':
+ error('first section must be named NAME')
+ if Title.level != 1:
+ error('NAME section title must be at level 1')
+ if not isinstance(Lex.next(),Paragraph):
+ error('malformed NAME section body')
+ lines = reader.read_until(r'^$')
+ s = string.join(lines)
+ mo = re.match(r'^(?P<manname>.*?)\s+-\s+(?P<manpurpose>.*)$',s)
+ if not mo:
+ error('malformed NAME section body')
+ attrs['manname'] = string.strip(mo.group('manname'))
+ attrs['manpurpose'] = string.strip(mo.group('manpurpose'))
+ document.process_author_names()
+ if document.backend == 'linuxdoc' and not attrs.has_key('author'):
+ warning('linuxdoc requires author name')
+ translate = staticmethod(translate)
+
+class AttributeEntry:
+ '''Static methods and attributes only.'''
+ pattern = None
+ subs = None
+ name = None
+ value = None
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def isnext():
+ result = False # Assume not next.
+ if not AttributeEntry.pattern:
+ pat = document.attributes.get('attributeentry-pattern')
+ if not pat:
+ error("[attributes] missing 'attributeentry-pattern' entry")
+ AttributeEntry.pattern = pat
+ if not AttributeEntry.subs:
+ subs = document.attributes.get('attributeentry-subs')
+ if subs:
+ subs = parse_options(subs,SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' % ('attributes','attributeentry-subs',subs))
+ else:
+ subs = ('specialcharacters','attributes')
+ AttributeEntry.subs = subs
+ line = reader.read_next()
+ if line:
+ mo = re.match(AttributeEntry.pattern,line)
+ if mo:
+ name = mo.group('attrname').strip()
+ if name[-1] == '!': # Names like name! are None.
+ name = name[:-1]
+ value = None
+ else:
+ value = mo.group('attrvalue').strip()
+ # Strip white space and illegal name chars.
+ name = re.sub(r'(?u)[^\w\-_]', '', name).lower()
+ AttributeEntry.name = name
+ AttributeEntry.value = value
+ result = True
+ return result
+ isnext = staticmethod(isnext)
+ def translate():
+ assert Lex.next() is AttributeEntry
+ attr = AttributeEntry # Alias for brevity.
+ reader.read() # Discard attribute from reader.
+ # Don't override command-line attributes.
+ if config.cmd_attrs.has_key(attr.name):
+ return
+ # Update document.attributes from previously parsed attribute.
+ if attr.value:
+ attr.value = Lex.subs((attr.value,), attr.subs)
+ attr.value = string.join(attr.value, writer.newline)
+ if attr.value is not None:
+ document.attributes[attr.name] = attr.value
+ elif document.attributes.has_key(attr.name):
+ del document.attributes[attr.name]
+ translate = staticmethod(translate)
+ def translate_all():
+ ''' Process all contiguous attribute lines on reader.'''
+ while AttributeEntry.isnext():
+ AttributeEntry.translate()
+ translate_all = staticmethod(translate_all)
+
+class AttributeList:
+ '''Static methods and attributes only.'''
+ pattern = None
+ match = None
+ attrs = {}
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def isnext():
+ result = False # Assume not next.
+ if not AttributeList.pattern:
+ if not document.attributes.has_key('attributelist-pattern'):
+ error("[attributes] missing 'attributelist-pattern' entry")
+ AttributeList.pattern = document.attributes['attributelist-pattern']
+ line = reader.read_next()
+ if line:
+ mo = re.match(AttributeList.pattern, line)
+ if mo:
+ AttributeList.match = mo
+ result = True
+ return result
+ isnext = staticmethod(isnext)
+ def translate():
+ assert Lex.next() is AttributeList
+ reader.read() # Discard attribute list from reader.
+ d = AttributeList.match.groupdict()
+ for k,v in d.items():
+ if v is not None:
+ if k == 'attrlist':
+ v = subs_attrs(v)
+ if v:
+ parse_attributes(v, AttributeList.attrs)
+ else:
+ AttributeList.attrs[k] = v
+ translate = staticmethod(translate)
+ def consume(d):
+ '''Add attribute list to the dictionary 'd' and reset the
+ list.'''
+ if AttributeList.attrs:
+ d.update(AttributeList.attrs)
+ AttributeList.attrs = {}
+ consume = staticmethod(consume)
+
+class BlockTitle:
+ '''Static methods and attributes only.'''
+ title = None
+ pattern = None
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def isnext():
+ result = False # Assume not next.
+ line = reader.read_next()
+ if line:
+ mo = re.match(BlockTitle.pattern,line)
+ if mo:
+ BlockTitle.title = mo.group('title')
+ result = True
+ return result
+ isnext = staticmethod(isnext)
+ def translate():
+ assert Lex.next() is BlockTitle
+ reader.read() # Discard title from reader.
+ # Perform title substitutions.
+ if not Title.subs:
+ Title.subs = config.subsnormal
+ s = Lex.subs((BlockTitle.title,), Title.subs)
+ s = string.join(s,writer.newline)
+ if not s:
+ warning('blank block title')
+ BlockTitle.title = s
+ translate = staticmethod(translate)
+ def consume(d):
+ '''If there is a title add it to dictionary 'd' then reset title.'''
+ if BlockTitle.title:
+ d['title'] = BlockTitle.title
+ BlockTitle.title = None
+ consume = staticmethod(consume)
+
+class Title:
+ '''Processes Header and Section titles. Static methods and attributes
+ only.'''
+ # Class variables
+ underlines = ('==','--','~~','^^','++') # Levels 0,1,2,3,4.
+ subs = ()
+ pattern = None
+ level = 0
+ dict = {}
+ sectname = None
+ section_numbers = [0]*len(underlines)
+ dump_dict = {}
+ linecount = None # Number of lines in title (1 or 2).
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def translate():
+ '''Parse the Title.dict and Title.level from the reader. The
+ real work has already been done by parse().'''
+ assert Lex.next() is Title
+ # Discard title from reader.
+ for i in range(Title.linecount):
+ reader.read()
+ Title.setsectname()
+ # Perform title substitutions.
+ if not Title.subs:
+ Title.subs = config.subsnormal
+ s = Lex.subs((Title.dict['title'],), Title.subs)
+ s = string.join(s,writer.newline)
+ if not s:
+ warning('blank section title')
+ Title.dict['title'] = s
+ translate = staticmethod(translate)
+ def isnext():
+ lines = reader.read_ahead(2)
+ return Title.parse(lines)
+ isnext = staticmethod(isnext)
+ def parse(lines):
+ '''Parse title at start of lines tuple.'''
+ if len(lines) == 0: return False
+ if len(lines[0]) == 0: return False # Title can't be blank.
+ # Check for single-line titles.
+ result = False
+ for level in range(len(Title.underlines)):
+ k = 'sect%s' % level
+ if Title.dump_dict.has_key(k):
+ mo = re.match(Title.dump_dict[k], lines[0])
+ if mo:
+ Title.dict = mo.groupdict()
+ Title.level = level
+ Title.linecount = 1
+ result = True
+ break
+ if not result:
+ # Check for double-line titles.
+ if not Title.pattern: return False # Single-line titles only.
+ if len(lines) < 2: return False
+ title,ul = lines[:2]
+ title_len = char_len(title)
+ ul_len = char_len(ul)
+ if ul_len < 2: return False
+ # Fast elimination check.
+ if ul[:2] not in Title.underlines: return False
+ # Length of underline must be within +-3 of title.
+ if not (ul_len-3 < title_len < ul_len+3): return False
+ # Check for valid repetition of underline character pairs.
+ s = ul[:2]*((ul_len+1)/2)
+ if ul != s[:ul_len]: return False
+ # Don't be fooled by back-to-back delimited blocks, require at
+ # least one alphanumeric character in title.
+ if not re.search(r'(?u)\w',title): return False
+ mo = re.match(Title.pattern, title)
+ if mo:
+ Title.dict = mo.groupdict()
+ Title.level = list(Title.underlines).index(ul[:2])
+ Title.linecount = 2
+ result = True
+ # Check for expected pattern match groups.
+ if result:
+ if not Title.dict.has_key('title'):
+ warning('[titles] entry has no <title> group')
+ Title.dict['title'] = lines[0]
+ for k,v in Title.dict.items():
+ if v is None: del Title.dict[k]
+ return result
+ parse = staticmethod(parse)
+ def load(dict):
+ '''Load and validate [titles] section entries from dict.'''
+ if dict.has_key('underlines'):
+ errmsg = 'malformed [titles] underlines entry'
+ try:
+ underlines = parse_list(dict['underlines'])
+ except:
+ raise EAsciiDoc,errmsg
+ if len(underlines) != len(Title.underlines):
+ raise EAsciiDoc,errmsg
+ for s in underlines:
+ if len(s) !=2:
+ raise EAsciiDoc,errmsg
+ Title.underlines = tuple(underlines)
+ Title.dump_dict['underlines'] = dict['underlines']
+ if dict.has_key('subs'):
+ Title.subs = parse_options(dict['subs'], SUBS_OPTIONS,
+ 'illegal [titles] subs entry')
+ Title.dump_dict['subs'] = dict['subs']
+ if dict.has_key('sectiontitle'):
+ pat = dict['sectiontitle']
+ if not pat or not is_regexp(pat):
+ raise EAsciiDoc,'malformed [titles] sectiontitle entry'
+ Title.pattern = pat
+ Title.dump_dict['sectiontitle'] = pat
+ if dict.has_key('blocktitle'):
+ pat = dict['blocktitle']
+ if not pat or not is_regexp(pat):
+ raise EAsciiDoc,'malformed [titles] blocktitle entry'
+ BlockTitle.pattern = pat
+ Title.dump_dict['blocktitle'] = pat
+ # Load single-line title patterns.
+ for k in ('sect0','sect1','sect2','sect3','sect4'):
+ if dict.has_key(k):
+ pat = dict[k]
+ if not pat or not is_regexp(pat):
+ raise EAsciiDoc,'malformed [titles] %s entry' % k
+ Title.dump_dict[k] = pat
+ # TODO: Check we have either a Title.pattern or at least one
+ # single-line title pattern -- can this be done here or do we need
+ # check routine like the other block checkers?
+ load = staticmethod(load)
+ def dump():
+ dump_section('titles',Title.dump_dict)
+ dump = staticmethod(dump)
+ def setsectname():
+ '''Set Title section name. First search for section title in
+ [specialsections], if not found use default 'sect<level>' name.'''
+ for pat,sect in config.specialsections.items():
+ mo = re.match(pat,Title.dict['title'])
+ if mo:
+ title = mo.groupdict().get('title')
+ if title is not None:
+ Title.dict['title'] = string.strip(title)
+ else:
+ Title.dict['title'] = string.strip(mo.group())
+ Title.sectname = sect
+ break
+ else:
+ Title.sectname = 'sect%d' % Title.level
+ setsectname = staticmethod(setsectname)
+ def getnumber(level):
+ '''Return next section number at section 'level' formatted like
+ 1.2.3.4.'''
+ number = ''
+ for l in range(len(Title.section_numbers)):
+ n = Title.section_numbers[l]
+ if l == 0:
+ continue
+ elif l < level:
+ number = '%s%d.' % (number, n)
+ elif l == level:
+ number = '%s%d.' % (number, n + 1)
+ Title.section_numbers[l] = n + 1
+ elif l > level:
+ # Reset unprocessed section levels.
+ Title.section_numbers[l] = 0
+ return number
+ getnumber = staticmethod(getnumber)
+
+
+class Section:
+ '''Static methods and attributes only.'''
+ endtags = [] # Stack of currently open section (level,endtag) tuples.
+ ids = [] # List of already used ids.
+ def __init__(self):
+ raise AssertionError,'no class instances allowed'
+ def savetag(level,etag):
+ '''Save section end.'''
+ Section.endtags.append((level,etag))
+ savetag = staticmethod(savetag)
+ def setlevel(level):
+ '''Set document level and write open section close tags up to level.'''
+ while Section.endtags and Section.endtags[-1][0] >= level:
+ writer.write(Section.endtags.pop()[1])
+ document.level = level
+ setlevel = staticmethod(setlevel)
+ def gen_id(title):
+ ''' The normalized value of the id attribute is an NCName according to
+ the 'Namespaces in XML' Recommendation:
+ NCName ::= NCNameStartChar NCNameChar*
+ NCNameChar ::= NameChar - ':'
+ NCNameStartChar ::= Letter | '_'
+ NameChar ::= Letter | Digit | '.' | '-' | '_' | ':'
+ '''
+ id = re.sub(r'[^a-zA-Z0-9]+', '_', title).strip('_').lower()
+ # Prefix with underscore to ensure a valid id start character and to
+ # ensure the id does not clash with existing document id's.
+ id = '_' + id
+ i = 1
+ while True:
+ if i == 1:
+ tid = id
+ else:
+ tid = '%s_%d' % (id, i)
+ if tid not in Section.ids:
+ Section.ids.append(tid)
+ return tid
+ else:
+ tid = id
+ i += 1
+ gen_id = staticmethod(gen_id)
+ def translate():
+ assert Lex.next() is Title
+ prev_sectname = Title.sectname
+ Title.translate()
+ if Title.level == 0 and document.doctype != 'book':
+ error('only book doctypes can contain level 0 sections')
+ if Title.level > document.level \
+ and document.backend == 'docbook' \
+ and prev_sectname in ('sect-colophon','sect-abstract', \
+ 'sect-dedication','sect-glossary','sect-bibliography'):
+ error('%s section cannot contain sub-sections' % prev_sectname)
+ if Title.level > document.level+1:
+ # Sub-sections of multi-part book level zero Preface and Appendices
+ # are meant to be out of sequence.
+ if document.doctype == 'book' \
+ and document.level == 0 \
+ and Title.level == 2 \
+ and prev_sectname in ('sect-preface','sect-appendix'):
+ pass
+ else:
+ warning('section title out of sequence: '
+ 'expected level %d, got level %d'
+ % (document.level+1, Title.level))
+ if not document.attributes.get('sectids') is None \
+ and 'id' not in AttributeList.attrs:
+ # Generate ids for sections.
+ AttributeList.attrs['id'] = Section.gen_id(Title.dict['title'])
+ Section.setlevel(Title.level)
+ Title.dict['sectnum'] = Title.getnumber(document.level)
+ AttributeList.consume(Title.dict)
+ stag,etag = config.section2tags(Title.sectname,Title.dict)
+ Section.savetag(Title.level,etag)
+ writer.write(stag)
+ Section.translate_body()
+ translate = staticmethod(translate)
+ def translate_body(terminator=Title):
+ isempty = True
+ next = Lex.next()
+ while next and next is not terminator:
+ if next is Title and isinstance(terminator,DelimitedBlock):
+ error('title not permitted in sidebar body')
+ if document.backend == 'linuxdoc' \
+ and document.level == 0 \
+ and not isinstance(next,Paragraph):
+ warning('only paragraphs are permitted in linuxdoc synopsis')
+ next.translate()
+ next = Lex.next()
+ isempty = False
+ # The section is not empty if contains a subsection.
+ if next and isempty and Title.level > document.level:
+ isempty = False
+ # Report empty sections if invalid markup will result.
+ if isempty:
+ if document.backend == 'docbook' and Title.sectname != 'sect-index':
+ error('empty section is not valid')
+ translate_body = staticmethod(translate_body)
+
+class AbstractBlock:
+ def __init__(self):
+ self.OPTIONS = () # The set of allowed options values
+ # Configuration parameter names common to all blocks.
+ self.CONF_ENTRIES = ('options','subs','presubs','postsubs',
+ 'posattrs','style','.*-style')
+ # Configuration parameters.
+ self.name=None # Configuration file section name.
+ self.delimiter=None # Regular expression matching block delimiter.
+ self.template=None # template section entry.
+ self.options=() # options entry list.
+ self.presubs=None # presubs/subs entry list.
+ self.postsubs=() # postsubs entry list.
+ self.filter=None # filter entry.
+ self.posattrs=() # posattrs entry list.
+ self.style=None # Default style.
+ self.styles=OrderedDict() # Styles dictionary.
+ # Before a block is processed it's attributes (from it's
+ # attributes list) are merged with the block configuration parameters
+ # (by self.process_attributes()) resulting in the template substitution
+ # dictionary (self.attributes) and the block's procssing parameters
+ # (self.parameters).
+ self.attributes={}
+ # The names of block parameters.
+ self.PARAM_NAMES=('template','options','presubs','postsubs','filter')
+ self.parameters={}
+ # Leading delimiter match object.
+ self.mo=None
+ def is_conf_entry(self,param):
+ '''Return True if param matches an allowed configuration file entry
+ name.'''
+ for s in self.CONF_ENTRIES:
+ if re.match('^'+s+'$',param):
+ return True
+ return False
+ def load(self,name,entries):
+ '''Update block definition from section 'entries' dictionary.'''
+ for k in entries.keys():
+ if not self.is_conf_entry(k):
+ raise EAsciiDoc,'illegal [%s] entry name: %s' % (name,k)
+ self.name = name
+ for k,v in entries.items():
+ if not is_name(k):
+ raise EAsciiDoc, \
+ 'malformed [%s] entry name: %s' % (name,k)
+ if k == 'delimiter':
+ if v and is_regexp(v):
+ self.delimiter = v
+ else:
+ raise EAsciiDoc,'malformed [%s] regexp: %s' % (name,v)
+ elif k == 'template':
+ if not is_name(v):
+ raise EAsciiDoc, \
+ 'malformed [%s] template name: %s' % (name,v)
+ self.template = v
+ elif k == 'style':
+ if not is_name(v):
+ raise EAsciiDoc, \
+ 'malformed [%s] style name: %s' % (name,v)
+ self.style = v
+ elif k == 'posattrs':
+ self.posattrs = parse_options(v, (),
+ 'illegal [%s] %s: %s' % (name,k,v))
+ elif k == 'options':
+ self.options = parse_options(v,self.OPTIONS,
+ 'illegal [%s] %s: %s' % (name,k,v))
+ elif k == 'presubs' or k == 'subs':
+ self.presubs = parse_options(v,SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' % (name,k,v))
+ elif k == 'postsubs':
+ self.postsubs = parse_options(v,SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' % (name,k,v))
+ elif k == 'filter':
+ self.filter = v
+ else:
+ mo = re.match(r'^(?P<style>.*)-style$',k)
+ if mo:
+ if not v:
+ raise EAsciiDoc, 'empty [%s] style: %s' % (name,k)
+ style = mo.group('style')
+ d = {}
+ if not parse_named_attributes(v,d):
+ raise EAsciiDoc,'malformed [%s] style: %s' % (name,v)
+ self.styles[style] = d
+ def dump(self):
+ '''Write block definition to stdout.'''
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('['+self.name+']')
+ if self.is_conf_entry('delimiter'):
+ write('delimiter='+self.delimiter)
+ if self.template:
+ write('template='+self.template)
+ if self.options:
+ write('options='+string.join(self.options,','))
+ if self.presubs:
+ if self.postsubs:
+ write('presubs='+string.join(self.presubs,','))
+ else:
+ write('subs='+string.join(self.presubs,','))
+ if self.postsubs:
+ write('postsubs='+string.join(self.postsubs,','))
+ if self.filter:
+ write('filter='+self.filter)
+ if self.posattrs:
+ write('posattrs='+string.join(self.posattrs,','))
+ if self.style:
+ write('style='+self.style)
+ if self.styles:
+ for style,d in self.styles.items():
+ s = ''
+ for k,v in d.items():
+ if isinstance(v,tuple):
+ v = string.join(v,',')
+ s += k+'="'+v+'",'
+ write(style+'-style='+s[:-1])
+ def validate(self):
+ '''Validate block after the complete configuration has been loaded.'''
+ if self.is_conf_entry('delimiter') and not self.delimiter:
+ raise EAsciiDoc,'[%s] missing delimiter' % self.name
+ if self.style:
+ if not self.styles.has_key(self.style):
+ warning(' missing [%s] %s-style entry' % (self.name,self.style))
+ # Check all styles for missing templates.
+ all_styles_have_template = True
+ for k,v in self.styles.items():
+ t = v.get('template')
+ if t and not config.sections.has_key(t):
+ warning('[%s] missing template section' % t)
+ if not t:
+ all_styles_have_template = False
+ # Check we have a valid template entry or alternatively that all the
+ # styles have templates.
+ if self.is_conf_entry('template') and not 'skip' in self.options:
+ if self.template:
+ if not config.sections.has_key(self.template):
+ warning('[%s] missing template section' % self.template)
+ elif not all_styles_have_template:
+ warning('[%s] styles missing templates' % self.name)
+ def isnext(self):
+ '''Check if this block is next in document reader.'''
+ result = False
+ reader.skip_blank_lines()
+ if reader.read_next():
+ mo = re.match(self.delimiter,reader.read_next())
+ if mo:
+ self.mo = mo
+ result = True
+ return result
+ def translate(self):
+ '''Translate block from document reader.'''
+ if not self.presubs:
+ self.presubs = config.subsnormal
+ def update_params(self,src,dst):
+ '''Copy block processing parameters from src to dst dictionaries.'''
+ for k,v in src.items():
+ if k == 'template':
+ dst[k] = v
+ elif k == 'options':
+ dst[k] = parse_options(v,self.OPTIONS,
+ 'illegal [%s] %s: %s' % (self.name,k,v))
+ elif k in ('subs','presubs','postsubs'):
+ subs = parse_options(v,SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' % (self.name,k,v))
+ if k == 'subs':
+ dst['presubs'] = subs
+ else:
+ dst[k] = subs
+ elif k == 'filter':
+ dst[k] = v
+ def merge_attributes(self,attrs):
+ '''Merge block attributes 'attrs' dictionary with the block
+ configuration parameters setting self.attributes (template substitution
+ attributes) and self.parameters (block processing parameters).'''
+ self.attributes = {}
+ self.attributes.update(attrs)
+ # Configure positional attributes.
+ for i,v in enumerate(self.posattrs):
+ if self.attributes.has_key(str(i+1)):
+ self.attributes[v] = self.attributes[str(i+1)]
+ # Calculate dynamic block parameters.
+ # Start with configuration file defaults.
+ self.parameters['template'] = self.template
+ self.parameters['options'] = self.options
+ self.parameters['presubs'] = self.presubs
+ self.parameters['postsubs'] = self.postsubs
+ self.parameters['filter'] = self.filter
+ # Load the selected style attributes.
+ style = self.attributes.get('style',self.style)
+ if style is not None:
+ if not self.styles.has_key(style):
+ warning('missing [%s] %s-style entry' % (self.name,style))
+ else:
+ self.attributes['style'] = style
+ for k,v in self.styles[style].items():
+ if k in self.PARAM_NAMES:
+ self.parameters[k] = v
+ elif not self.attributes.has_key(k):
+ # Style attributes don't take precedence over explicit.
+ self.attributes[k] = v
+ # Override config and style attributes with document attributes.
+ self.update_params(self.attributes,self.parameters)
+ assert isinstance(self.parameters['options'],tuple)
+ assert isinstance(self.parameters['presubs'],tuple)
+ assert isinstance(self.parameters['postsubs'],tuple)
+ def get_options(self):
+ return self.parameters['options']
+ def get_subs(self):
+ return (self.parameters['presubs'], self.parameters['postsubs'])
+ def get_template(self):
+ return self.parameters['template']
+ def get_filter(self):
+ return self.parameters['filter']
+
+class AbstractBlocks:
+ '''List of block definitions.'''
+ PREFIX = '' # Conf file section name prefix set in derived classes.
+ BLOCK_TYPE = None # Block type set in derived classes.
+ def __init__(self):
+ self.current=None
+ self.blocks = [] # List of Block objects.
+ self.default = None # Default Block.
+ self.delimiter = None # Combined tables delimiter regular expression.
+ def load(self,sections):
+ '''Load block definition from 'sections' dictionary.'''
+ for k in sections.keys():
+ if re.match(r'^'+ self.PREFIX + r'.+$',k):
+ d = {}
+ parse_entries(sections.get(k,()),d)
+ for b in self.blocks:
+ if b.name == k:
+ break
+ else:
+ b = self.BLOCK_TYPE()
+ self.blocks.append(b)
+ try:
+ b.load(k,d)
+ except EAsciiDoc,e:
+ raise EAsciiDoc,'[%s] %s' % (k,str(e))
+ def dump(self):
+ for b in self.blocks:
+ b.dump()
+ def isnext(self):
+ for b in self.blocks:
+ if b.isnext():
+ self.current = b
+ return True;
+ return False
+ def validate(self):
+ '''Validate the block definitions.'''
+ # Validate delimiters and build combined lists delimiter pattern.
+ for b in self.blocks:
+ assert b.__class__ is self.BLOCK_TYPE
+ b.validate()
+ if b.is_conf_entry('delimiter'):
+ delimiters = []
+ for b in self.blocks:
+ b.validate()
+ if b.delimiter:
+ delimiters.append(b.delimiter)
+ self.delimiter = join_regexp(delimiters)
+
+class Paragraph(AbstractBlock):
+ def __init__(self):
+ AbstractBlock.__init__(self)
+ self.CONF_ENTRIES += ('delimiter','template','filter')
+ self.OPTIONS = ('listelement',)
+ self.text=None # Text in first line of paragraph.
+ def load(self,name,entries):
+ AbstractBlock.load(self,name,entries)
+ def dump(self):
+ AbstractBlock.dump(self)
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('')
+ def isnext(self):
+ result = AbstractBlock.isnext(self)
+ if result:
+ self.text = self.mo.groupdict().get('text')
+ return result
+ def translate(self):
+ AbstractBlock.translate(self)
+ attrs = {}
+ attrs.update(self.mo.groupdict())
+ BlockTitle.consume(attrs)
+ AttributeList.consume(attrs)
+ self.merge_attributes(attrs)
+ reader.read() # Discard (already parsed item first line).
+ body = reader.read_until(r'^\+$|^$|'+blocks.delimiter+r'|'+tables.delimiter)
+ body = [self.text] + list(body)
+ presubs,postsubs = self.get_subs()
+ # Don't join verbatim paragraphs.
+ if 'verbatim' not in (presubs + postsubs):
+ body = join_lines(body)
+ body = Lex.set_margin(body) # Move body to left margin.
+ body = Lex.subs(body,presubs)
+ if self.get_filter():
+ body = filter_lines(self.get_filter(),body,self.attributes)
+ body = Lex.subs(body,postsubs)
+ template = self.get_template()
+ stag,etag = config.section2tags(template, self.attributes)
+ # Write start tag, content, end tag.
+ writer.write(dovetail_tags(stag,body,etag))
+
+class Paragraphs(AbstractBlocks):
+ '''List of paragraph definitions.'''
+ BLOCK_TYPE = Paragraph
+ PREFIX = 'paradef-'
+ def __init__(self):
+ AbstractBlocks.__init__(self)
+ def load(self,sections):
+ AbstractBlocks.load(self,sections)
+ def validate(self):
+ AbstractBlocks.validate(self)
+ # Check we have a default paragraph definition, put it last in list.
+ for b in self.blocks:
+ if b.name == 'paradef-default':
+ self.blocks.append(b)
+ self.default = b
+ self.blocks.remove(b)
+ break
+ else:
+ raise EAsciiDoc,'missing [paradef-default] section'
+
+class List(AbstractBlock):
+ TAGS = ('listtag','itemtag','texttag','entrytag','labeltag')
+ TYPES = ('bulleted','numbered','labeled','callout')
+ def __init__(self):
+ AbstractBlock.__init__(self)
+ self.CONF_ENTRIES += ('delimiter','type') + self.TAGS
+ self.listtag=None
+ self.itemtag=None
+ self.texttag=None # Tag for list item text.
+ self.labeltag=None # Variable lists only.
+ self.entrytag=None # Variable lists only.
+ self.label=None # List item label (labeled lists).
+ self.text=None # Text in first line of list item.
+ self.index=None # Matched delimiter 'index' group (numbered lists).
+ self.type=None # List type.
+ self.listindex=None # Current list index (1..)
+ def load(self,name,entries):
+ AbstractBlock.load(self,name,entries)
+ for k,v in entries.items():
+ if k == 'type':
+ if v in self.TYPES:
+ self.type = v
+ else:
+ raise EAsciiDoc,'illegal list type: %s' % v
+ elif k in self.TAGS:
+ if is_name(v):
+ setattr(self,k,v)
+ else:
+ raise EAsciiDoc,'illegal list %s name: %s' % (k,v)
+ def dump(self):
+ AbstractBlock.dump(self)
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('type='+self.type)
+ write('listtag='+self.listtag)
+ write('itemtag='+self.itemtag)
+ write('texttag='+self.texttag)
+ if self.type == 'labeled':
+ write('entrytag='+self.entrytag)
+ write('labeltag='+self.labeltag)
+ write('')
+ def isnext(self):
+ result = AbstractBlock.isnext(self)
+ if result:
+ self.label = self.mo.groupdict().get('label')
+ self.text = self.mo.groupdict().get('text')
+ self.index = self.mo.groupdict().get('index')
+ return result
+ def translate_entry(self):
+ assert self.type == 'labeled'
+ stag,etag = config.tag(self.entrytag, self.attributes)
+ if stag:
+ writer.write(stag)
+ if self.listtag == 'hlist':
+ # Horizontal label list.
+ reader.read() # Discard (already parsed item first line).
+ writer.write_tag(self.labeltag, [self.label],
+ self.presubs, self.attributes)
+ else:
+ # Write multiple labels (vertical label list).
+ while Lex.next() is self:
+ reader.read() # Discard (already parsed item first line).
+ writer.write_tag(self.labeltag, [self.label],
+ self.presubs, self.attributes)
+ # Write item text.
+ self.translate_item()
+ if etag:
+ writer.write(etag)
+ def iscontinued(self):
+ if reader.read_next() == '+':
+ reader.read() # Discard.
+ # Allow attribute list to precede continued list item element.
+ while Lex.next() is AttributeList:
+ Lex.next().translate()
+ return True
+ else:
+ return False
+ def translate_item(self):
+ if lists.listblock:
+ self.translate_item_2()
+ else:
+ self.translate_item_1()
+ def translate_item_1(self):
+ '''Translation for '+' style list continuation.'''
+ if self.type == 'callout':
+ self.attributes['coids'] = calloutmap.calloutids(self.listindex)
+ stag,etag = config.tag(self.itemtag, self.attributes)
+ if stag:
+ writer.write(stag)
+ if self.text and self.text == '+':
+ # Pathalogical case: continued Horizontal Labeled List with no
+ # item text.
+ continued = True
+ elif not self.text and self.iscontinued():
+ # Pathalogical case: continued Vertical Labeled List with no
+ # item text.
+ continued = True
+ else:
+ # Write ItemText.
+ text = reader.read_until(lists.delimiter + r'|^\+$|^$|' +
+ blocks.delimiter + r'|' + tables.delimiter)
+ if self.text is not None:
+ text = [self.text] + list(text)
+ text = join_lines(text)
+ if text:
+ writer.write_tag(self.texttag, text, self.presubs, self.attributes)
+ continued = self.iscontinued()
+ while True:
+ next = Lex.next()
+ if next in lists.open:
+ break
+ elif isinstance(next,List):
+ next.translate()
+ elif isinstance(next,Paragraph) and 'listelement' in next.options:
+ next.translate()
+ elif continued:
+ if next is Title or next is BlockTitle:
+ error('title not allowed in list item continuation')
+ next.translate()
+ else:
+ break
+ continued = self.iscontinued()
+ if etag:
+ writer.write(etag)
+ def translate_item_2(self):
+ '''Translation for List block style lists.'''
+ if self.type == 'callout':
+ self.attributes['coids'] = calloutmap.calloutids(self.listindex)
+ stag,etag = config.tag(self.itemtag, self.attributes)
+ if stag:
+ writer.write(stag)
+ if self.text or reader.read_next():
+ # Write ItemText.
+ text = reader.read_until(lists.delimiter + r'|^$|' +
+ blocks.delimiter + r'|' + tables.delimiter)
+ if self.text is not None:
+ text = [self.text] + list(text)
+ text = join_lines(text)
+ writer.write_tag(self.texttag, text, self.presubs, self.attributes)
+ while True:
+ next = Lex.next()
+ if next in lists.open:
+ break
+ elif next is lists.listblock:
+ break
+ elif isinstance(next,List):
+ next.translate()
+ elif isinstance(next,Paragraph) and 'listelement' in next.options:
+ next.translate()
+ elif lists.listblock:
+ if next is Title or next is BlockTitle:
+ error('title not allowed in list item continuation')
+ next.translate()
+ else:
+ break
+ if etag:
+ writer.write(etag)
+ def check_index(self):
+ ''' Check calculated listindex (1,2,...) against the item index in the
+ document (self.index).'''
+ assert self.type in ('numbered','callout')
+ if self.index:
+ matched = False
+ if re.match(r'\d+', self.index):
+ i = int(self.index)
+ matched = True
+ elif re.match(r'[a-z]', self.index):
+ i = ord(self.index) - ord('a') + 1
+ matched = True
+ if matched and i != self.listindex:
+ print 'type: ',self.type,': expected ',self.listindex,' got ',i
+ warning("list item %s out of sequence" % self.index)
+ def translate(self):
+ AbstractBlock.translate(self)
+ lists.open.append(self)
+ attrs = {}
+ attrs.update(self.mo.groupdict())
+ BlockTitle.consume(attrs)
+ AttributeList.consume(attrs)
+ self.merge_attributes(attrs)
+ stag,etag = config.tag(self.listtag, self.attributes)
+ if stag:
+ writer.write(stag)
+ self.listindex = 0
+ while Lex.next() is self:
+ self.listindex += 1
+ document.attributes['listindex'] = str(self.listindex)
+ if self.type in ('numbered','callout'):
+ self.check_index()
+ if self.type in ('bulleted','numbered','callout'):
+ reader.read() # Discard (already parsed item first line).
+ self.translate_item()
+ elif self.type == 'labeled':
+ self.translate_entry()
+ else:
+ raise AssertionError,'illegal [%s] list type"' % self.name
+ if etag:
+ writer.write(etag)
+ if self.type == 'callout':
+ calloutmap.validate(self.listindex)
+ calloutmap.listclose()
+ lists.open.pop()
+ if len(lists.open):
+ document.attributes['listindex'] = str(lists.open[-1].listindex)
+
+class Lists(AbstractBlocks):
+ '''List of List objects.'''
+ BLOCK_TYPE = List
+ PREFIX = 'listdef-'
+ def __init__(self):
+ AbstractBlocks.__init__(self)
+ self.open = [] # A stack of the current and parent lists.
+ self.listblock = None # Current list is in list block.
+ def load(self,sections):
+ AbstractBlocks.load(self,sections)
+ def validate(self):
+ AbstractBlocks.validate(self)
+ for b in self.blocks:
+ # Check list has valid type.
+ if not b.type in b.TYPES:
+ raise EAsciiDoc,'[%s] illegal type' % b.name
+ # Check all list tags.
+ if not b.listtag or not config.tags.has_key(b.listtag):
+ warning('[%s] missing listtag' % b.name)
+ if not b.itemtag or not config.tags.has_key(b.itemtag):
+ warning('[%s] missing tag itemtag' % b.name)
+ if not b.texttag or not config.tags.has_key(b.texttag):
+ warning('[%s] missing tag texttag' % b.name)
+ if b.type == 'labeled':
+ if not b.entrytag or not config.tags.has_key(b.entrytag):
+ warning('[%s] missing entrytag' % b.name)
+ if not b.labeltag or not config.tags.has_key(b.labeltag):
+ warning('[%s] missing labeltag' % b.name)
+
+class DelimitedBlock(AbstractBlock):
+ def __init__(self):
+ AbstractBlock.__init__(self)
+ self.CONF_ENTRIES += ('delimiter','template','filter')
+ self.OPTIONS = ('skip','sectionbody','list')
+ def load(self,name,entries):
+ AbstractBlock.load(self,name,entries)
+ def dump(self):
+ AbstractBlock.dump(self)
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('')
+ def isnext(self):
+ return AbstractBlock.isnext(self)
+ def translate(self):
+ AbstractBlock.translate(self)
+ if 'list' in self.options:
+ lists.listblock = self
+ reader.read() # Discard delimiter.
+ attrs = {}
+ # Leave list block attributes for the list element.
+ if lists.listblock is not self:
+ BlockTitle.consume(attrs)
+ AttributeList.consume(attrs)
+ self.merge_attributes(attrs)
+ options = self.get_options()
+ if safe() and self.name == 'blockdef-backend':
+ unsafe_error('Backend Block')
+ # Discard block body.
+ reader.read_until(self.delimiter,same_file=True)
+ elif 'skip' in options:
+ # Discard block body.
+ reader.read_until(self.delimiter,same_file=True)
+ else:
+ template = self.get_template()
+ stag,etag = config.section2tags(template,self.attributes)
+ if 'sectionbody' in options or 'list' in options:
+ # The body is treated like a SimpleSection.
+ writer.write(stag)
+ Section.translate_body(self)
+ writer.write(etag)
+ else:
+ body = reader.read_until(self.delimiter,same_file=True)
+ presubs,postsubs = self.get_subs()
+ body = Lex.subs(body,presubs)
+ if self.get_filter():
+ body = filter_lines(self.get_filter(),body,self.attributes)
+ body = Lex.subs(body,postsubs)
+ # Write start tag, content, end tag.
+ writer.write(dovetail_tags(stag,body,etag))
+ if 'list' in options:
+ lists.listblock = None
+ if reader.eof():
+ error('closing [%s] delimiter expected' % self.name)
+ else:
+ delimiter = reader.read() # Discard delimiter line.
+ assert re.match(self.delimiter,delimiter)
+
+class DelimitedBlocks(AbstractBlocks):
+ '''List of delimited blocks.'''
+ BLOCK_TYPE = DelimitedBlock
+ PREFIX = 'blockdef-'
+ def __init__(self):
+ AbstractBlocks.__init__(self)
+ def load(self,sections):
+ '''Update blocks defined in 'sections' dictionary.'''
+ AbstractBlocks.load(self,sections)
+ def validate(self):
+ AbstractBlocks.validate(self)
+
+class Column:
+ '''Table column.'''
+ def __init__(self):
+ self.colalign = None # 'left','right','center'
+ self.rulerwidth = None
+ self.colwidth = None # Output width in page units.
+
+class Table(AbstractBlock):
+ COL_STOP = r"(`|'|\.)" # RE.
+ ALIGNMENTS = {'`':'left', "'":'right', '.':'center'}
+ FORMATS = ('fixed','csv','dsv')
+ def __init__(self):
+ AbstractBlock.__init__(self)
+ self.CONF_ENTRIES += ('template','fillchar','format','colspec',
+ 'headrow','footrow','bodyrow','headdata',
+ 'footdata', 'bodydata')
+ # Configuration parameters.
+ self.fillchar=None
+ self.format=None # 'fixed','csv','dsv'
+ self.colspec=None
+ self.headrow=None
+ self.footrow=None
+ self.bodyrow=None
+ self.headdata=None
+ self.footdata=None
+ self.bodydata=None
+ # Calculated parameters.
+ self.underline=None # RE matching current table underline.
+ self.isnumeric=False # True if numeric ruler.
+ self.tablewidth=None # Optional table width scale factor.
+ self.columns=[] # List of Columns.
+ # Other.
+ self.check_msg='' # Message set by previous self.validate() call.
+ def load(self,name,entries):
+ AbstractBlock.load(self,name,entries)
+ '''Update table definition from section entries in 'entries'.'''
+ for k,v in entries.items():
+ if k == 'fillchar':
+ if v and len(v) == 1:
+ self.fillchar = v
+ else:
+ raise EAsciiDoc,'malformed table fillchar: %s' % v
+ elif k == 'format':
+ if v in Table.FORMATS:
+ self.format = v
+ else:
+ raise EAsciiDoc,'illegal table format: %s' % v
+ elif k == 'colspec':
+ self.colspec = v
+ elif k == 'headrow':
+ self.headrow = v
+ elif k == 'footrow':
+ self.footrow = v
+ elif k == 'bodyrow':
+ self.bodyrow = v
+ elif k == 'headdata':
+ self.headdata = v
+ elif k == 'footdata':
+ self.footdata = v
+ elif k == 'bodydata':
+ self.bodydata = v
+ def dump(self):
+ AbstractBlock.dump(self)
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('fillchar='+self.fillchar)
+ write('format='+self.format)
+ if self.colspec:
+ write('colspec='+self.colspec)
+ if self.headrow:
+ write('headrow='+self.headrow)
+ if self.footrow:
+ write('footrow='+self.footrow)
+ write('bodyrow='+self.bodyrow)
+ if self.headdata:
+ write('headdata='+self.headdata)
+ if self.footdata:
+ write('footdata='+self.footdata)
+ write('bodydata='+self.bodydata)
+ write('')
+ def validate(self):
+ AbstractBlock.validate(self)
+ '''Check table definition and set self.check_msg if invalid else set
+ self.check_msg to blank string.'''
+ # Check global table parameters.
+ if config.textwidth is None:
+ self.check_msg = 'missing [miscellaneous] textwidth entry'
+ elif config.pagewidth is None:
+ self.check_msg = 'missing [miscellaneous] pagewidth entry'
+ elif config.pageunits is None:
+ self.check_msg = 'missing [miscellaneous] pageunits entry'
+ elif self.headrow is None:
+ self.check_msg = 'missing headrow entry'
+ elif self.footrow is None:
+ self.check_msg = 'missing footrow entry'
+ elif self.bodyrow is None:
+ self.check_msg = 'missing bodyrow entry'
+ elif self.headdata is None:
+ self.check_msg = 'missing headdata entry'
+ elif self.footdata is None:
+ self.check_msg = 'missing footdata entry'
+ elif self.bodydata is None:
+ self.check_msg = 'missing bodydata entry'
+ else:
+ # No errors.
+ self.check_msg = ''
+ def isnext(self):
+ return AbstractBlock.isnext(self)
+ def parse_ruler(self,ruler):
+ '''Parse ruler calculating underline and ruler column widths.'''
+ fc = re.escape(self.fillchar)
+ # Strip and save optional tablewidth from end of ruler.
+ mo = re.match(r'^(.*'+fc+r'+)([\d\.]+)$',ruler)
+ if mo:
+ ruler = mo.group(1)
+ self.tablewidth = float(mo.group(2))
+ self.attributes['tablewidth'] = str(float(self.tablewidth))
+ else:
+ self.tablewidth = None
+ self.attributes['tablewidth'] = '100.0'
+ # Guess whether column widths are specified numerically or not.
+ if ruler[1] != self.fillchar:
+ # If the first column does not start with a fillchar then numeric.
+ self.isnumeric = True
+ elif ruler[1:] == self.fillchar*len(ruler[1:]):
+ # The case of one column followed by fillchars is numeric.
+ self.isnumeric = True
+ else:
+ self.isnumeric = False
+ # Underlines must be 3 or more fillchars.
+ self.underline = r'^' + fc + r'{3,}$'
+ splits = re.split(self.COL_STOP,ruler)[1:]
+ # Build self.columns.
+ for i in range(0,len(splits),2):
+ c = Column()
+ c.colalign = self.ALIGNMENTS[splits[i]]
+ s = splits[i+1]
+ if self.isnumeric:
+ # Strip trailing fillchars.
+ s = re.sub(fc+r'+$','',s)
+ if s == '':
+ c.rulerwidth = None
+ else:
+ c.rulerwidth = int(validate(s,'int($)>0',
+ 'malformed ruler: bad width'))
+ else: # Calculate column width from inter-fillchar intervals.
+ if not re.match(r'^'+fc+r'+$',s):
+ raise EAsciiDoc,'malformed ruler: illegal fillchars'
+ c.rulerwidth = len(s)+1
+ self.columns.append(c)
+ # Fill in unspecified ruler widths.
+ if self.isnumeric:
+ if self.columns[0].rulerwidth is None:
+ prevwidth = 1
+ for c in self.columns:
+ if c.rulerwidth is None:
+ c.rulerwidth = prevwidth
+ prevwidth = c.rulerwidth
+ def build_colspecs(self):
+ '''Generate colwidths and colspecs. This can only be done after the
+ table arguments have been parsed since we use the table format.'''
+ self.attributes['cols'] = len(self.columns)
+ # Calculate total ruler width.
+ totalwidth = 0
+ for c in self.columns:
+ totalwidth = totalwidth + c.rulerwidth
+ if totalwidth <= 0:
+ raise EAsciiDoc,'zero width table'
+ # Calculate marked up colwidths from rulerwidths.
+ for c in self.columns:
+ # Convert ruler width to output page width.
+ width = float(c.rulerwidth)
+ if self.format == 'fixed':
+ if self.tablewidth is None:
+ # Size proportional to ruler width.
+ colfraction = width/config.textwidth
+ else:
+ # Size proportional to page width.
+ colfraction = width/totalwidth
+ else:
+ # Size proportional to page width.
+ colfraction = width/totalwidth
+ c.colwidth = colfraction * config.pagewidth # To page units.
+ if self.tablewidth is not None:
+ c.colwidth = c.colwidth * self.tablewidth # Scale factor.
+ if self.tablewidth > 1:
+ c.colwidth = c.colwidth/100 # tablewidth is in percent.
+ # Build colspecs.
+ if self.colspec:
+ cols = []
+ i = 0
+ for c in self.columns:
+ i += 1
+ self.attributes['colalign'] = c.colalign
+ self.attributes['colwidth'] = str(int(c.colwidth))
+ self.attributes['colnumber'] = str(i + 1)
+ s = subs_attrs(self.colspec,self.attributes)
+ if not s:
+ warning('colspec dropped: contains undefined attribute')
+ else:
+ cols.append(s)
+ self.attributes['colspecs'] = string.join(cols,writer.newline)
+ def split_rows(self,rows):
+ '''Return a two item tuple containing a list of lines up to but not
+ including the next underline (continued lines are joined ) and the
+ tuple of all lines after the underline.'''
+ reo = re.compile(self.underline)
+ i = 0
+ while not reo.match(rows[i]):
+ i = i+1
+ if i == 0:
+ raise EAsciiDoc,'missing table rows'
+ if i >= len(rows):
+ raise EAsciiDoc,'closing [%s] underline expected' % self.name
+ return (join_lines(rows[:i]), rows[i+1:])
+ def parse_rows(self, rows, rtag, dtag):
+ '''Parse rows list using the row and data tags. Returns a substituted
+ list of output lines.'''
+ result = []
+ # Source rows are parsed as single block, rather than line by line, to
+ # allow the CSV reader to handle multi-line rows.
+ if self.format == 'fixed':
+ rows = self.parse_fixed(rows)
+ elif self.format == 'csv':
+ rows = self.parse_csv(rows)
+ elif self.format == 'dsv':
+ rows = self.parse_dsv(rows)
+ else:
+ assert True,'illegal table format'
+ # Substitute and indent all data in all rows.
+ stag,etag = subs_tag(rtag,self.attributes)
+ for row in rows:
+ result.append(' '+stag)
+ for data in self.subs_row(row,dtag):
+ result.append(' '+data)
+ result.append(' '+etag)
+ return result
+ def subs_row(self, data, dtag):
+ '''Substitute the list of source row data elements using the data tag.
+ Returns a substituted list of output table data items.'''
+ result = []
+ if len(data) < len(self.columns):
+ warning('fewer row data items then table columns')
+ if len(data) > len(self.columns):
+ warning('more row data items than table columns')
+ for i in range(len(self.columns)):
+ if i > len(data) - 1:
+ d = '' # Fill missing column data with blanks.
+ else:
+ d = data[i]
+ c = self.columns[i]
+ self.attributes['colalign'] = c.colalign
+ self.attributes['colwidth'] = str(int(c.colwidth))
+ self.attributes['colnumber'] = str(i + 1)
+ stag,etag = subs_tag(dtag,self.attributes)
+ # Insert AsciiDoc line break (' +') where row data has newlines
+ # ('\n'). This is really only useful when the table format is csv
+ # and the output markup is HTML. It's also a bit dubious in that it
+ # assumes the user has not modified the shipped line break pattern.
+ subs = self.get_subs()[0]
+ if 'replacements' in subs:
+ # Insert line breaks in cell data.
+ d = re.sub(r'(?m)\n',r' +\n',d)
+ d = string.split(d,'\n') # So writer.newline is written.
+ else:
+ d = [d]
+ result = result + [stag] + Lex.subs(d,subs) + [etag]
+ return result
+ def parse_fixed(self,rows):
+ '''Parse the list of source table rows. Each row item in the returned
+ list contains a list of cell data elements.'''
+ result = []
+ for row in rows:
+ data = []
+ start = 0
+ # build an encoded representation
+ row = char_decode(row)
+ for c in self.columns:
+ end = start + c.rulerwidth
+ if c is self.columns[-1]:
+ # Text in last column can continue forever.
+ # Use the encoded string to slice, but convert back
+ # to plain string before further processing
+ data.append(string.strip(char_encode(row[start:])))
+ else:
+ data.append(string.strip(char_encode(row[start:end])))
+ start = end
+ result.append(data)
+ return result
+ def parse_csv(self,rows):
+ '''Parse the list of source table rows. Each row item in the returned
+ list contains a list of cell data elements.'''
+ import StringIO
+ import csv
+ result = []
+ rdr = csv.reader(StringIO.StringIO(string.join(rows,'\r\n')),
+ skipinitialspace=True)
+ try:
+ for row in rdr:
+ result.append(row)
+ except:
+ raise EAsciiDoc,'csv parse error: %s' % row
+ return result
+ def parse_dsv(self,rows):
+ '''Parse the list of source table rows. Each row item in the returned
+ list contains a list of cell data elements.'''
+ separator = self.attributes.get('separator',':')
+ separator = eval('"'+separator+'"')
+ if len(separator) != 1:
+ raise EAsciiDoc,'malformed dsv separator: %s' % separator
+ # TODO If separator is preceeded by an odd number of backslashes then
+ # it is escaped and should not delimit.
+ result = []
+ for row in rows:
+ # Skip blank lines
+ if row == '': continue
+ # Unescape escaped characters.
+ row = eval('"'+row.replace('"','\\"')+'"')
+ data = row.split(separator)
+ data = [s.strip() for s in data]
+ result.append(data)
+ return result
+ def translate(self):
+ AbstractBlock.translate(self)
+ # Reset instance specific properties.
+ self.underline = None
+ self.columns = []
+ attrs = {}
+ BlockTitle.consume(attrs)
+ # Add relevant globals to table substitutions.
+ attrs['pagewidth'] = str(config.pagewidth)
+ attrs['pageunits'] = config.pageunits
+ # Mix in document attribute list.
+ AttributeList.consume(attrs)
+ # Validate overridable attributes.
+ for k,v in attrs.items():
+ if k == 'format':
+ if v not in self.FORMATS:
+ raise EAsciiDoc, 'illegal [%s] %s: %s' % (self.name,k,v)
+ self.format = v
+ elif k == 'tablewidth':
+ try:
+ self.tablewidth = float(attrs['tablewidth'])
+ except:
+ raise EAsciiDoc, 'illegal [%s] %s: %s' % (self.name,k,v)
+ self.merge_attributes(attrs)
+ # Parse table ruler.
+ ruler = reader.read()
+ assert re.match(self.delimiter,ruler)
+ self.parse_ruler(ruler)
+ # Read the entire table.
+ table = []
+ while True:
+ line = reader.read_next()
+ # Table terminated by underline followed by a blank line or EOF.
+ if len(table) > 0 and re.match(self.underline,table[-1]):
+ if line in ('',None):
+ break;
+ if line is None:
+ raise EAsciiDoc,'closing [%s] underline expected' % self.name
+ table.append(reader.read())
+ # EXPERIMENTAL: The number of lines in the table, requested by Benjamin Klum.
+ self.attributes['rows'] = str(len(table))
+ #TODO: Inherited validate() doesn't set check_msg, needs checking.
+ if self.check_msg: # Skip if table definition was marked invalid.
+ warning('skipping %s table: %s' % (self.name,self.check_msg))
+ return
+ # Generate colwidths and colspecs.
+ self.build_colspecs()
+ # Generate headrows, footrows, bodyrows.
+ # Headrow, footrow and bodyrow data replaces same named attributes in
+ # the table markup template. In order to ensure this data does not get
+ # a second attribute substitution (which would interfere with any
+ # already substituted inline passthroughs) unique placeholders are used
+ # (the tab character does not appear elsewhere since it is expanded on
+ # input) which are replaced after template attribute substitution.
+ headrows = footrows = []
+ bodyrows,table = self.split_rows(table)
+ if table:
+ headrows = bodyrows
+ bodyrows,table = self.split_rows(table)
+ if table:
+ footrows,table = self.split_rows(table)
+ if headrows:
+ headrows = self.parse_rows(headrows, self.headrow, self.headdata)
+ headrows = string.join(headrows,writer.newline)
+ self.attributes['headrows'] = '\theadrows\t'
+ if footrows:
+ footrows = self.parse_rows(footrows, self.footrow, self.footdata)
+ footrows = string.join(footrows,writer.newline)
+ self.attributes['footrows'] = '\tfootrows\t'
+ bodyrows = self.parse_rows(bodyrows, self.bodyrow, self.bodydata)
+ bodyrows = string.join(bodyrows,writer.newline)
+ self.attributes['bodyrows'] = '\tbodyrows\t'
+ table = subs_attrs(config.sections[self.template],self.attributes)
+ table = string.join(table, writer.newline)
+ # Before we finish replace the table head, foot and body place holders
+ # with the real data.
+ if headrows:
+ table = table.replace('\theadrows\t', headrows, 1)
+ if footrows:
+ table = table.replace('\tfootrows\t', footrows, 1)
+ table = table.replace('\tbodyrows\t', bodyrows, 1)
+ writer.write(table)
+
+class Tables(AbstractBlocks):
+ '''List of tables.'''
+ BLOCK_TYPE = Table
+ PREFIX = 'tabledef-'
+ def __init__(self):
+ AbstractBlocks.__init__(self)
+ def load(self,sections):
+ AbstractBlocks.load(self,sections)
+ '''Update tables defined in 'sections' dictionary.'''
+ def validate(self):
+ # Does not call AbstractBlocks.validate().
+ # Check we have a default table definition,
+ for i in range(len(self.blocks)):
+ if self.blocks[i].name == 'tabledef-default':
+ default = self.blocks[i]
+ break
+ else:
+ raise EAsciiDoc,'missing [table-default] section'
+ # Set default table defaults.
+ if default.format is None: default.subs = 'fixed'
+ # Propagate defaults to unspecified table parameters.
+ for b in self.blocks:
+ if b is not default:
+ if b.fillchar is None: b.fillchar = default.fillchar
+ if b.format is None: b.format = default.format
+ if b.template is None: b.template = default.template
+ if b.colspec is None: b.colspec = default.colspec
+ if b.headrow is None: b.headrow = default.headrow
+ if b.footrow is None: b.footrow = default.footrow
+ if b.bodyrow is None: b.bodyrow = default.bodyrow
+ if b.headdata is None: b.headdata = default.headdata
+ if b.footdata is None: b.footdata = default.footdata
+ if b.bodydata is None: b.bodydata = default.bodydata
+ # Check all tables have valid fill character.
+ for b in self.blocks:
+ if not b.fillchar or len(b.fillchar) != 1:
+ raise EAsciiDoc,'[%s] missing or illegal fillchar' % b.name
+ # Build combined tables delimiter patterns and assign defaults.
+ delimiters = []
+ for b in self.blocks:
+ # Ruler is:
+ # (ColStop,(ColWidth,FillChar+)?)+, FillChar+, TableWidth?
+ b.delimiter = r'^(' + Table.COL_STOP \
+ + r'(\d*|' + re.escape(b.fillchar) + r'*)' \
+ + r')+' \
+ + re.escape(b.fillchar) + r'+' \
+ + '([\d\.]*)$'
+ delimiters.append(b.delimiter)
+ if not b.headrow:
+ b.headrow = b.bodyrow
+ if not b.footrow:
+ b.footrow = b.bodyrow
+ if not b.headdata:
+ b.headdata = b.bodydata
+ if not b.footdata:
+ b.footdata = b.bodydata
+ self.delimiter = join_regexp(delimiters)
+ # Check table definitions are valid.
+ for b in self.blocks:
+ b.validate()
+ if config.verbose:
+ if b.check_msg:
+ warning('[%s] table definition: %s' % (b.name,b.check_msg))
+
+class Macros:
+ # Default system macro syntax.
+ SYS_DEFAULT = r'(?u)^(?P<name>\w(\w|-)*?)::(?P<target>\S*?)' + \
+ r'(\[(?P<attrlist>.*?)\])$'
+ def __init__(self):
+ self.macros = [] # List of Macros.
+ self.current = None # The last matched block macro.
+ # Initialize default system macro.
+ m = Macro()
+ m.pattern = self.SYS_DEFAULT
+ m.prefix = '+'
+ m.reo = re.compile(m.pattern)
+ self.macros.append(m)
+ def load(self,entries):
+ for entry in entries:
+ m = Macro()
+ m.load(entry)
+ if m.name is None:
+ # Delete undefined macro.
+ for i in range(len(self.macros)-1,-1,-1):
+ if self.macros[i].pattern == m.pattern:
+ del self.macros[i]
+ else:
+ # Check for duplicates.
+ for m2 in self.macros:
+ if m.equals(m2):
+ verbose('duplicate macro: '+entry)
+ break
+ else:
+ self.macros.append(m)
+ def dump(self):
+ write = lambda s: sys.stdout.write('%s%s' % (s,writer.newline))
+ write('[macros]')
+ # Dump all macros except the first (built-in system) macro.
+ for m in self.macros[1:]:
+ write('%s=%s%s' % (m.pattern,m.prefix,m.name))
+ write('')
+ def validate(self):
+ # Check all named sections exist.
+ if config.verbose:
+ for m in self.macros:
+ if m.name and m.prefix != '+':
+ m.section_name()
+ def subs(self,text,prefix='',callouts=False):
+ # If callouts is True then only callout macros are processed, if False
+ # then all non-callout macros are processed.
+ result = text
+ for m in self.macros:
+ if m.prefix == prefix:
+ if callouts ^ (m.name != 'callout'):
+ result = m.subs(result)
+ return result
+ def isnext(self):
+ '''Return matching macro if block macro is next on reader.'''
+ reader.skip_blank_lines()
+ line = reader.read_next()
+ if line:
+ for m in self.macros:
+ if m.prefix == '#':
+ if m.reo.match(line):
+ self.current = m
+ return m
+ return False
+ def match(self,prefix,name,text):
+ '''Return re match object matching 'text' with macro type 'prefix',
+ macro name 'name'.'''
+ for m in self.macros:
+ if m.prefix == prefix:
+ mo = m.reo.match(text)
+ if mo:
+ if m.name == name:
+ return mo
+ if re.match(name,mo.group('name')):
+ return mo
+ return None
+
+# Macro set just prior to calling _subs_macro(). Ugly but there's no way
+# to pass optional arguments with _subs_macro().
+_macro = None
+
+def _subs_macro(mo):
+ '''Function called to perform inline macro substitution. Uses matched macro
+ regular expression object and returns string containing the substituted
+ macro body. Called by Macros().subs().'''
+ # Check if macro reference is escaped.
+ if mo.group()[0] == '\\':
+ return mo.group()[1:] # Strip leading backslash.
+ d = mo.groupdict()
+ # Delete groups that didn't participate in match.
+ for k,v in d.items():
+ if v is None: del d[k]
+ if _macro.name:
+ name = _macro.name
+ else:
+ if not d.has_key('name'):
+ warning('missing macro name group: %s' % mo.re.pattern)
+ return ''
+ name = d['name']
+ section_name = _macro.section_name(name)
+ if not section_name:
+ return ''
+ # If we're dealing with a block macro get optional block ID and block title.
+ if _macro.prefix == '#':
+ AttributeList.consume(d)
+ BlockTitle.consume(d)
+ # Parse macro attributes.
+ if d.has_key('attrlist'):
+ if d['attrlist'] in (None,''):
+ del d['attrlist']
+ else:
+ parse_attributes(d['attrlist'],d)
+ if name == 'callout':
+ listindex =int(d['index'])
+ d['coid'] = calloutmap.add(listindex)
+ # Unescape special characters in LaTeX target file names.
+ if document.backend == 'latex' and d.has_key('target') and d['target']:
+ if not d.has_key('0'):
+ d['0'] = d['target']
+ d['target']= config.subs_specialchars_reverse(d['target'])
+ # BUG: We've already done attribute substitution on the macro which means
+ # that any escaped attribute references are now unescaped and will be
+ # substituted by config.subs_section() below. As a partial fix have withheld
+ # {0} from substitution but this kludge doesn't fix it for other attributes
+ # containing unescaped references.
+ a0 = d.get('0')
+ if a0:
+ d['0'] = chr(0) # Replace temporarily with unused character.
+ body = config.subs_section(section_name,d)
+ if len(body) == 0:
+ result = ''
+ elif len(body) == 1:
+ result = body[0]
+ else:
+ if _macro.prefix == '#':
+ result = string.join(body,writer.newline)
+ else:
+ # Internally processed inline macros use UNIX line separator.
+ result = string.join(body,'\n')
+ if a0:
+ result = string.replace(result, chr(0), a0)
+ return result
+
+class Macro:
+ def __init__(self):
+ self.pattern = None # Matching regular expression.
+ self.name = '' # Conf file macro name (None if implicit).
+ self.prefix = '' # '' if inline, '+' if system, '#' if block.
+ self.reo = None # Compiled pattern re object.
+ def section_name(self,name=None):
+ '''Return macro markup template section name based on macro name and
+ prefix. Return None section not found.'''
+ assert self.prefix != '+'
+ if not name:
+ assert self.name
+ name = self.name
+ if self.prefix == '#':
+ suffix = '-blockmacro'
+ else:
+ suffix = '-inlinemacro'
+ if config.sections.has_key(name+suffix):
+ return name+suffix
+ else:
+ warning('missing macro section: [%s]' % name+suffix)
+ return None
+ def equals(self,m):
+ if self.pattern != m.pattern:
+ return False
+ if self.name != m.name:
+ return False
+ if self.prefix != m.prefix:
+ return False
+ return True
+ def load(self,entry):
+ e = parse_entry(entry)
+ if not e:
+ raise EAsciiDoc,'malformed macro entry: %s' % entry
+ self.pattern, self.name = e
+ if not is_regexp(self.pattern):
+ raise EAsciiDoc,'illegal regular expression in macro entry: %s' \
+ % entry
+ self.reo = re.compile(self.pattern)
+ if self.name:
+ if self.name[0] in ('+','#'):
+ self.prefix, self.name = self.name[0], self.name[1:]
+ if self.name and not is_name(self.name):
+ raise EAsciiDoc,'illegal section name in macro entry: %s' % entry
+ def subs(self,text):
+ global _macro
+ _macro = self # Pass the macro to _subs_macro().
+ return self.reo.sub(_subs_macro,text)
+ def translate(self):
+ ''' Block macro translation.'''
+ assert self.prefix == '#'
+ s = reader.read()
+ s = subs_attrs(s) # Substitute global attributes.
+ if s:
+ s = self.subs(s)
+ if s:
+ writer.write(s)
+
+class CalloutMap:
+ def __init__(self):
+ self.comap = {} # key = list index, value = callouts list.
+ self.calloutindex = 0 # Current callout index number.
+ self.listnumber = 1 # Current callout list number.
+ def listclose(self):
+ # Called when callout list is closed.
+ self.listnumber += 1
+ self.calloutindex = 0
+ self.comap = {}
+ def add(self,listindex):
+ # Add next callout index to listindex map entry. Return the callout id.
+ self.calloutindex += 1
+ # Append the coindex to a list in the comap dictionary.
+ if not self.comap.has_key(listindex):
+ self.comap[listindex] = [self.calloutindex]
+ else:
+ self.comap[listindex].append(self.calloutindex)
+ return self.calloutid(self.listnumber, self.calloutindex)
+ def calloutid(listnumber,calloutindex):
+ return 'CO%d-%d' % (listnumber,calloutindex)
+ calloutid = staticmethod(calloutid)
+ def calloutids(self,listindex):
+ # Retieve list of callout indexes that refer to listindex.
+ if self.comap.has_key(listindex):
+ result = ''
+ for coindex in self.comap[listindex]:
+ result += ' ' + self.calloutid(self.listnumber,coindex)
+ return result.strip()
+ else:
+ error('no callouts refer to list item '+str(listindex))
+ return ''
+ def validate(self,maxlistindex):
+ # Check that all list indexes referenced by callouts exist.
+ for listindex in self.comap.keys():
+ if listindex > maxlistindex:
+ warning('callout refers to non-existent list item '
+ + str(listindex))
+
+#---------------------------------------------------------------------------
+# Input stream Reader and output stream writer classes.
+#---------------------------------------------------------------------------
+
+class Reader1:
+ '''Line oriented AsciiDoc input file reader. Processes include and
+ conditional inclusion system macros. Tabs are expanded and lines are right
+ trimmed.'''
+ # This class is not used directly, use Reader class instead.
+ READ_BUFFER_MIN = 10 # Read buffer low level.
+ def __init__(self):
+ self.f = None # Input file object.
+ self.fname = None # Input file name.
+ self.next = [] # Read ahead buffer containing
+ # [filename,linenumber,linetext] lists.
+ self.cursor = None # Last read() [filename,linenumber,linetext].
+ self.tabsize = 8 # Tab expansion number of spaces.
+ self.parent = None # Included reader's parent reader.
+ self._lineno = 0 # The last line read from file object f.
+ self.include_depth = 0 # Current include depth.
+ self.include_max = 5 # Maxiumum allowed include depth.
+ def open(self,fname):
+ self.fname = fname
+ verbose('reading: '+fname)
+ if fname == '<stdin>':
+ self.f = sys.stdin
+ else:
+ self.f = open(fname,"rb")
+ self._lineno = 0 # The last line read from file object f.
+ self.next = []
+ # Prefill buffer by reading the first line and then pushing it back.
+ if Reader1.read(self):
+ self.unread(self.cursor)
+ self.cursor = None
+ def closefile(self):
+ '''Used by class methods to close nested include files.'''
+ self.f.close()
+ self.next = []
+ def close(self):
+ self.closefile()
+ self.__init__()
+ def read(self,skip=False):
+ '''Read next line. Return None if EOF. Expand tabs. Strip trailing
+ white space. Maintain self.next read ahead buffer. If skip=True then
+ conditional exclusion is active (ifdef and ifndef macros).'''
+ # Top up buffer.
+ if len(self.next) <= self.READ_BUFFER_MIN:
+ s = self.f.readline()
+ if s:
+ self._lineno = self._lineno + 1
+ while s:
+ if self.tabsize != 0:
+ s = string.expandtabs(s,self.tabsize)
+ s = string.rstrip(s)
+ self.next.append([self.fname,self._lineno,s])
+ if len(self.next) > self.READ_BUFFER_MIN:
+ break
+ s = self.f.readline()
+ if s:
+ self._lineno = self._lineno + 1
+ # Return first (oldest) buffer entry.
+ if len(self.next) > 0:
+ self.cursor = self.next[0]
+ del self.next[0]
+ result = self.cursor[2]
+ # Check for include macro.
+ mo = macros.match('+',r'include[1]?',result)
+ if mo and not skip:
+ # Perform attribute substitution on inlcude macro file name.
+ fname = subs_attrs(mo.group('target'))
+ if not fname:
+ return Reader1.read(self) # Return next input line.
+ if self.include_depth >= self.include_max:
+ raise EAsciiDoc,'maxiumum inlcude depth exceeded'
+ if self.fname != '<stdin>':
+ fname = os.path.expandvars(os.path.expanduser(fname))
+ fname = safe_filename(fname, os.path.dirname(self.fname))
+ if not fname:
+ return Reader1.read(self) # Return next input line.
+ if mo.group('name') == 'include1':
+ if not config.dumping:
+ # Store the include file in memory for later
+ # retrieval by the {include1:} system attribute.
+ config.include1[fname] = readlines(fname)
+ return '{include1:%s}' % fname
+ else:
+ # This is a configuration dump, just pass the macro
+ # call through.
+ return result
+ # Parse include macro attributes.
+ attrs = {}
+ parse_attributes(mo.group('attrlist'),attrs)
+ # Clone self and set as parent (self assumes the role of child).
+ parent = Reader1()
+ assign(parent,self)
+ self.parent = parent
+ if attrs.has_key('tabsize'):
+ self.tabsize = int(validate(attrs['tabsize'],'int($)>=0', \
+ 'illegal include macro tabsize argument'))
+ self.open(fname)
+ self.include_depth = self.include_depth + 1
+ result = Reader1.read(self)
+ else:
+ if not Reader1.eof(self):
+ result = Reader1.read(self)
+ else:
+ result = None
+ return result
+ def eof(self):
+ '''Returns True if all lines have been read.'''
+ if len(self.next) == 0:
+ # End of current file.
+ if self.parent:
+ self.closefile()
+ assign(self,self.parent) # Restore parent reader.
+ return Reader1.eof(self)
+ else:
+ return True
+ else:
+ return False
+ def read_next(self):
+ '''Like read() but does not advance file pointer.'''
+ if Reader1.eof(self):
+ return None
+ else:
+ return self.next[0][2]
+ def unread(self,cursor):
+ '''Push the line (filename,linenumber,linetext) tuple back into the read
+ buffer. Note that it's up to the caller to restore the previous
+ cursor.'''
+ assert cursor
+ self.next.insert(0,cursor)
+
+class Reader(Reader1):
+ ''' Wraps (well, sought of) Reader1 class and implements conditional text
+ inclusion.'''
+ def __init__(self):
+ Reader1.__init__(self)
+ self.depth = 0 # if nesting depth.
+ self.skip = False # true if we're skipping ifdef...endif.
+ self.skipname = '' # Name of current endif macro target.
+ self.skipto = -1 # The depth at which skipping is reenabled.
+ def read_super(self):
+ result = Reader1.read(self,self.skip)
+ if result is None and self.skip:
+ raise EAsciiDoc,'missing endif::%s[]' % self.skipname
+ return result
+ def read(self):
+ result = self.read_super()
+ if result is None:
+ return None
+ while self.skip:
+ mo = macros.match('+',r'ifdef|ifndef|endif',result)
+ if mo:
+ name = mo.group('name')
+ target = mo.group('target')
+ if name == 'endif':
+ self.depth = self.depth-1
+ if self.depth < 0:
+ raise EAsciiDoc,'mismatched macro: %s' % result
+ if self.depth == self.skipto:
+ self.skip = False
+ if target and self.skipname != target:
+ raise EAsciiDoc,'mismatched macro: %s' % result
+ else: # ifdef or ifndef.
+ if not target:
+ raise EAsciiDoc,'missing macro target: %s' % result
+ self.depth = self.depth+1
+ result = self.read_super()
+ if result is None:
+ return None
+ mo = macros.match('+',r'ifdef|ifndef|endif',result)
+ if mo:
+ name = mo.group('name')
+ target = mo.group('target')
+ if name == 'endif':
+ self.depth = self.depth-1
+ else: # ifdef or ifndef.
+ if not target:
+ raise EAsciiDoc,'missing macro target: %s' % result
+ defined = document.attributes.get(target) is not None
+ if name == 'ifdef':
+ self.skip = not defined
+ else: # ifndef.
+ self.skip = defined
+ if self.skip:
+ self.skipto = self.depth
+ self.skipname = target
+ self.depth = self.depth+1
+ result = self.read()
+ if result:
+ # Expand executable block macros.
+ mo = macros.match('+',r'eval|sys|sys2',result)
+ if mo:
+ action = mo.group('name')
+ cmd = mo.group('attrlist')
+ s = system(action, cmd, is_macro=True)
+ if s is not None:
+ self.cursor[2] = s # So we don't re-evaluate.
+ result = s
+ return result
+ def eof(self):
+ return self.read_next() is None
+ def read_next(self):
+ save_cursor = self.cursor
+ result = self.read()
+ if result is not None:
+ self.unread(self.cursor)
+ self.cursor = save_cursor
+ return result
+ def read_all(self,fname):
+ '''Read all lines from file fname and return as list. Use like class
+ method: Reader().read_all(fname)'''
+ result = []
+ self.open(fname)
+ try:
+ while not self.eof():
+ result.append(self.read())
+ finally:
+ self.close()
+ return result
+ def read_lines(self,count=1):
+ '''Return tuple containing count lines.'''
+ result = []
+ i = 0
+ while i < count and not self.eof():
+ result.append(self.read())
+ return tuple(result)
+ def read_ahead(self,count=1):
+ '''Same as read_lines() but does not advance the file pointer.'''
+ result = []
+ putback = []
+ save_cursor = self.cursor
+ try:
+ i = 0
+ while i < count and not self.eof():
+ result.append(self.read())
+ putback.append(self.cursor)
+ i = i+1
+ while putback:
+ self.unread(putback.pop())
+ finally:
+ self.cursor = save_cursor
+ return tuple(result)
+ def skip_blank_lines(self):
+ reader.read_until(r'\s*\S+')
+ def read_until(self,pattern,same_file=False):
+ '''Like read() but reads lines up to (but not including) the first line
+ that matches the pattern regular expression. If same_file is True
+ then the terminating pattern must occur in the file the was being read
+ when the routine was called.'''
+ if same_file:
+ fname = self.cursor[0]
+ result = []
+ reo = re.compile(pattern)
+ while not self.eof():
+ save_cursor = self.cursor
+ s = self.read()
+ if (not same_file or fname == self.cursor[0]) and reo.match(s):
+ self.unread(self.cursor)
+ self.cursor = save_cursor
+ break
+ result.append(s)
+ return tuple(result)
+ # NOT USED -- part of unimplemented attempt a generalised line continuation.
+ def read_continuation(self):
+ '''Like read() but treats trailing backslash as line continuation
+ character.'''
+ s = self.read()
+ if s is None:
+ return None
+ result = ''
+ while s is not None and len(s) > 0 and s[-1] == '\\':
+ result = result + s[:-1]
+ s = self.read()
+ if s is not None:
+ result = result + s
+ return result
+ # NOT USED -- part of unimplemented attempt a generalised line continuation.
+ def read_next_continuation(self):
+ '''Like read_next() but treats trailing backslash as line continuation
+ character.'''
+ save_cursor = self.cursor
+ result = self.read_continuation()
+ if result is not None:
+ self.unread(self.cursor)
+ self.cursor = save_cursor
+ return result
+
+class Writer:
+ '''Writes lines to output file.'''
+ newline = '\r\n' # End of line terminator.
+ f = None # Output file object.
+ fname= None # Output file name.
+ lines_out = 0 # Number of lines written.
+ skip_blank_lines = False # If True don't output blank lines.
+ def open(self,fname):
+ self.fname = os.path.abspath(fname)
+ verbose('writing: '+fname)
+ if fname == '<stdout>':
+ self.f = sys.stdout
+ else:
+ self.f = open(fname,"wb+")
+ self.lines_out = 0
+ def close(self):
+ if self.fname != '<stdout>':
+ self.f.close()
+ def write_line(self, line=None):
+ if not (self.skip_blank_lines and (not line or not string.strip(line))):
+ if line is not None:
+ self.f.write(line + self.newline)
+ else:
+ self.f.write(self.newline)
+ self.lines_out = self.lines_out + 1
+ def write(self,*args):
+ '''Iterates arguments, writes tuple and list arguments one line per
+ element, else writes argument as single line. If no arguments writes
+ blank line. If argument is None nothing is written. self.newline is
+ appended to each line.'''
+ if len(args) == 0:
+ self.write_line()
+ self.lines_out = self.lines_out + 1
+ else:
+ for arg in args:
+ if isinstance(arg,list) or isinstance(arg,tuple):
+ for s in arg:
+ self.write_line(s)
+ elif arg is not None:
+ self.write_line(arg)
+ def write_tag(self,tagname,content,subs=None,d=None):
+ '''Write content enveloped by configuration file tag tagname.
+ Substitutions specified in the 'subs' list are perform on the
+ 'content'.'''
+ if subs is None:
+ subs = config.subsnormal
+ stag,etag = config.tag(tagname,d)
+ if stag:
+ self.write(stag)
+ if content:
+ self.write(Lex.subs(content,subs))
+ if etag:
+ self.write(etag)
+
+#---------------------------------------------------------------------------
+# Configuration file processing.
+#---------------------------------------------------------------------------
+def _subs_specialwords(mo):
+ '''Special word substitution function called by
+ Config.subs_specialwords().'''
+ word = mo.re.pattern # The special word.
+ template = config.specialwords[word] # The corresponding markup template.
+ if not config.sections.has_key(template):
+ raise EAsciiDoc,'missing special word template [%s]' % template
+ if mo.group()[0] == '\\':
+ return mo.group()[1:] # Return escaped word.
+ args = {}
+ args['words'] = mo.group() # The full match string is argument 'words'.
+ args.update(mo.groupdict()) # Add other named match groups to the arguments.
+ # Delete groups that didn't participate in match.
+ for k,v in args.items():
+ if v is None: del args[k]
+ lines = subs_attrs(config.sections[template],args)
+ if len(lines) == 0:
+ result = ''
+ elif len(lines) == 1:
+ result = lines[0]
+ else:
+ result = string.join(lines,writer.newline)
+ return result
+
+class Config:
+ '''Methods to process configuration files.'''
+ # Predefined section name regexp's.
+ SPECIAL_SECTIONS= ('tags','miscellaneous','attributes','specialcharacters',
+ 'specialwords','macros','replacements','quotes','titles',
+ r'paradef.+',r'listdef.+',r'blockdef.+',r'tabledef.*',
+ 'replacements2')
+ def __init__(self):
+ self.sections = OrderedDict() # Keyed by section name containing
+ # lists of section lines.
+ # Command-line options.
+ self.verbose = False
+ self.header_footer = True # -s, --no-header-footer option.
+ # [miscellaneous] section.
+ self.tabsize = 8
+ self.textwidth = 70
+ self.newline = '\r\n'
+ self.pagewidth = None
+ self.pageunits = None
+ self.outfilesuffix = ''
+ self.subsnormal = SUBS_NORMAL
+ self.subsverbatim = SUBS_VERBATIM
+
+ self.tags = {} # Values contain (stag,etag) tuples.
+ self.specialchars = {} # Values of special character substitutions.
+ self.specialwords = {} # Name is special word pattern, value is macro.
+ self.replacements = OrderedDict() # Key is find pattern, value is
+ #replace pattern.
+ self.replacements2 = OrderedDict()
+ self.specialsections = {} # Name is special section name pattern, value
+ # is corresponding section name.
+ self.quotes = {} # Values contain corresponding tag name.
+ self.fname = '' # Most recently loaded configuration file name.
+ self.conf_attrs = {} # Glossary entries from conf files.
+ self.cmd_attrs = {} # Attributes from command-line -a options.
+ self.loaded = [] # Loaded conf files.
+ self.include1 = {} # Holds include1::[] files for {include1:}.
+ self.dumping = False # True if asciidoc -c option specified.
+
+ def load(self,fname,dir=None):
+ '''Loads sections dictionary with sections from file fname.
+ Existing sections are overlaid. Silently skips missing configuration
+ files.'''
+ if dir:
+ fname = os.path.join(dir, fname)
+ # Sliently skip missing configuration file.
+ if not os.path.isfile(fname):
+ return
+ # Don't load conf files twice (local and application conf files are the
+ # same if the source file is in the application directory).
+ if realpath(fname) in self.loaded:
+ return
+ rdr = Reader() # Reader processes system macros.
+ rdr.open(fname)
+ self.fname = fname
+ reo = re.compile(r'(?u)^\[(?P<section>[^\W\d][\w-]*)\]\s*$')
+ sections = OrderedDict()
+ section,contents = '',[]
+ while not rdr.eof():
+ s = rdr.read()
+ if s and s[0] == '#': # Skip comment lines.
+ continue
+ if s[:2] == '\\#': # Unescape lines starting with '#'.
+ s = s[1:]
+ s = string.rstrip(s)
+ found = reo.findall(s)
+ if found:
+ if section: # Store previous section.
+ if sections.has_key(section) \
+ and self.is_special_section(section):
+ if string.join(contents,''):
+ # Merge special sections.
+ sections[section] = sections[section] + contents
+ else:
+ print 'blank section'
+ del sections[section]
+ else:
+ sections[section] = contents
+ section = found[0].lower()
+ contents = []
+ else:
+ contents.append(s)
+ if section and contents: # Store last section.
+ if sections.has_key(section) \
+ and self.is_special_section(section):
+ if string.join(contents,''):
+ # Merge special sections.
+ sections[section] = sections[section] + contents
+ else:
+ del sections[section]
+ else:
+ sections[section] = contents
+ rdr.close()
+ # Delete blank lines from sections.
+ for k in sections.keys():
+ for i in range(len(sections[k])-1,-1,-1):
+ if not sections[k][i]:
+ del sections[k][i]
+ elif not self.is_special_section(k):
+ break # Only trailing blanks from non-special sections.
+ # Add/overwrite new sections.
+ self.sections.update(sections)
+ self.parse_tags()
+ # Internally [miscellaneous] section entries are just attributes.
+ d = {}
+ parse_entries(sections.get('miscellaneous',()), d, unquote=True,
+ allow_name_only=True)
+ update_attrs(self.conf_attrs,d)
+ d = {}
+ parse_entries(sections.get('attributes',()), d, unquote=True,
+ allow_name_only=True)
+ update_attrs(self.conf_attrs,d)
+ # Update document attributes so they are available immediately.
+ document.init_attrs()
+ d = {}
+ parse_entries(sections.get('titles',()),d)
+ Title.load(d)
+ parse_entries(sections.get('specialcharacters',()),self.specialchars)
+ parse_entries(sections.get('quotes',()),self.quotes)
+ self.parse_specialwords()
+ self.parse_replacements()
+ self.parse_replacements('replacements2')
+ self.parse_specialsections()
+ paragraphs.load(sections)
+ lists.load(sections)
+ blocks.load(sections)
+ tables.load(sections)
+ macros.load(sections.get('macros',()))
+ self.loaded.append(realpath(fname))
+
+ def load_all(self,dir):
+ '''Load the standard configuration files from directory 'dir'.'''
+ self.load('asciidoc.conf',dir)
+ conf = document.backend + '.conf'
+ self.load(conf,dir)
+ conf = document.backend + '-' + document.doctype + '.conf'
+ self.load(conf,dir)
+ # Load ./filters/*.conf files if they exist.
+ filters = os.path.join(dir,'filters')
+ if os.path.isdir(filters):
+ for f in os.listdir(filters):
+ if re.match(r'^.+\.conf$',f):
+ self.load(f,filters)
+
+ def load_miscellaneous(self,d):
+ '''Set miscellaneous configuration entries from dictionary 'd'.'''
+ def set_misc(name,rule='True',intval=False):
+ if d.has_key(name):
+ errmsg = 'illegal [miscellaneous] %s entry' % name
+ if intval:
+ setattr(self, name, int(validate(d[name],rule,errmsg)))
+ else:
+ setattr(self, name, validate(d[name],rule,errmsg))
+ set_misc('tabsize','int($)>0',intval=True)
+ set_misc('textwidth','int($)>0',intval=True)
+ set_misc('pagewidth','int($)>0',intval=True)
+ set_misc('pageunits')
+ set_misc('outfilesuffix')
+ if d.has_key('newline'):
+ # Convert escape sequences to their character values.
+ self.newline = eval('"'+d['newline']+'"')
+ if d.has_key('subsnormal'):
+ self.subsnormal = parse_options(d['subsnormal'],SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' %
+ ('miscellaneous','subsnormal',d['subsnormal']))
+ if d.has_key('subsverbatim'):
+ self.subsverbatim = parse_options(d['subsverbatim'],SUBS_OPTIONS,
+ 'illegal [%s] %s: %s' %
+ ('miscellaneous','subsverbatim',d['subsverbatim']))
+
+ def validate(self):
+ '''Check the configuration for internal consistancy. Called after all
+ configuration files have been loaded.'''
+ # Heuristic validate that at least one configuration file was loaded.
+ if not self.specialchars or not self.tags or not lists:
+ raise EAsciiDoc,'incomplete configuration files'
+ # Check special characters are only one character long.
+ for k in self.specialchars.keys():
+ if len(k) != 1:
+ raise EAsciiDoc,'[specialcharacters] ' \
+ 'must be a single character: %s' % k
+ # Check all special words have a corresponding inline macro body.
+ for macro in self.specialwords.values():
+ if not is_name(macro):
+ raise EAsciiDoc,'illegal special word name: %s' % macro
+ if not self.sections.has_key(macro):
+ warning('missing special word macro: [%s]' % macro)
+ # Check all text quotes have a corresponding tag.
+ for q in self.quotes.keys():
+ tag = self.quotes[q]
+ if not tag:
+ del self.quotes[q] # Undefine quote.
+ else:
+ if tag[0] == '#':
+ tag = tag[1:]
+ if not self.tags.has_key(tag):
+ warning('[quotes] %s missing tag definition: %s' % (q,tag))
+ # Check all specialsections section names exist.
+ for k,v in self.specialsections.items():
+ if not self.sections.has_key(v):
+ warning('[%s] missing specialsections section' % v)
+ paragraphs.validate()
+ lists.validate()
+ blocks.validate()
+ tables.validate()
+ macros.validate()
+
+ def is_special_section(self,section_name):
+ for name in self.SPECIAL_SECTIONS:
+ if re.match(name,section_name):
+ return True
+ return False
+
+ def dump(self):
+ '''Dump configuration to stdout.'''
+ # Header.
+ hdr = ''
+ hdr = hdr + '#' + writer.newline
+ hdr = hdr + '# Generated by AsciiDoc %s for %s %s.%s' % \
+ (VERSION,document.backend,document.doctype,writer.newline)
+ t = time.asctime(time.localtime(time.time()))
+ hdr = hdr + '# %s%s' % (t,writer.newline)
+ hdr = hdr + '#' + writer.newline
+ sys.stdout.write(hdr)
+ # Dump special sections.
+ # Dump only the configuration file and command-line attributes.
+ # [miscellanous] entries are dumped as part of the [attributes].
+ d = {}
+ d.update(self.conf_attrs)
+ d.update(self.cmd_attrs)
+ dump_section('attributes',d)
+ Title.dump()
+ dump_section('quotes',self.quotes)
+ dump_section('specialcharacters',self.specialchars)
+ d = {}
+ for k,v in self.specialwords.items():
+ if d.has_key(v):
+ d[v] = '%s "%s"' % (d[v],k) # Append word list.
+ else:
+ d[v] = '"%s"' % k
+ dump_section('specialwords',d)
+ dump_section('replacements',self.replacements)
+ dump_section('replacements2',self.replacements2)
+ dump_section('specialsections',self.specialsections)
+ d = {}
+ for k,v in self.tags.items():
+ d[k] = '%s|%s' % v
+ dump_section('tags',d)
+ paragraphs.dump()
+ lists.dump()
+ blocks.dump()
+ tables.dump()
+ macros.dump()
+ # Dump remaining sections.
+ for k in self.sections.keys():
+ if not self.is_special_section(k):
+ sys.stdout.write('[%s]%s' % (k,writer.newline))
+ for line in self.sections[k]:
+ sys.stdout.write('%s%s' % (line,writer.newline))
+ sys.stdout.write(writer.newline)
+
+ def subs_section(self,section,d):
+ '''Section attribute substitution using attributes from
+ document.attributes and 'd'. Lines containing undefinded
+ attributes are deleted.'''
+ if self.sections.has_key(section):
+ return subs_attrs(self.sections[section],d)
+ else:
+ warning('missing [%s] section' % section)
+ return ()
+
+ def parse_tags(self):
+ '''Parse [tags] section entries into self.tags dictionary.'''
+ d = {}
+ parse_entries(self.sections.get('tags',()),d)
+ for k,v in d.items():
+ if v is None:
+ if self.tags.has_key(k):
+ del self.tags[k]
+ elif v == 'none':
+ self.tags[k] = (None,None)
+ else:
+ mo = re.match(r'(?P<stag>.*)\|(?P<etag>.*)',v)
+ if mo:
+ self.tags[k] = (mo.group('stag'), mo.group('etag'))
+ else:
+ raise EAsciiDoc,'[tag] %s value malformed' % k
+
+ def tag(self, name, d=None):
+ '''Returns (starttag,endtag) tuple named name from configuration file
+ [tags] section. Raise error if not found. If a dictionary 'd' is
+ passed then merge with document attributes and perform attribute
+ substitution on tags.'''
+
+ # TODO: Tags should be stored a single string, not split into start
+ # and end tags since most are going to be substituted anyway (see
+ # subs_tag() for how we should process them. parse_tags() (above)
+ # should only validate i.e. parse_check(). This routine should be renamed
+ # split_tag() and would call subs_tag(). self.tags dictionary values
+ # would be strings not tuples.
+
+ if not self.tags.has_key(name):
+ raise EAsciiDoc, 'missing tag: %s' % name
+ stag,etag = self.tags[name]
+ if d is not None:
+ # TODO: Should we warn if substitution drops a tag?
+ if stag:
+ stag = subs_attrs(stag,d)
+ if etag:
+ etag = subs_attrs(etag,d)
+ if stag is None: stag = ''
+ if etag is None: etag = ''
+ return (stag,etag)
+
+ def parse_specialsections(self):
+ '''Parse specialsections section to self.specialsections dictionary.'''
+ # TODO: This is virtually the same as parse_replacements() and should
+ # be factored to single routine.
+ d = {}
+ parse_entries(self.sections.get('specialsections',()),d,unquote=True)
+ for pat,sectname in d.items():
+ pat = strip_quotes(pat)
+ if not is_regexp(pat):
+ raise EAsciiDoc,'[specialsections] entry ' \
+ 'is not a valid regular expression: %s' % pat
+ if sectname is None:
+ if self.specialsections.has_key(pat):
+ del self.specialsections[pat]
+ else:
+ self.specialsections[pat] = sectname
+
+ def parse_replacements(self,sect='replacements'):
+ '''Parse replacements section into self.replacements dictionary.'''
+ replacements = getattr(self,sect)
+ d = OrderedDict()
+ parse_entries(self.sections.get(sect,()), d, unquote=True)
+ for pat,rep in d.items():
+ pat = strip_quotes(pat)
+ if not is_regexp(pat):
+ raise EAsciiDoc,'[%s] entry in %s is not a valid' \
+ ' regular expression: %s' % (sect,self.fname,pat)
+ if rep is None:
+ if replacements.has_key(pat):
+ del replacements[pat]
+ else:
+ replacements[pat] =strip_quotes(rep)
+
+ def subs_replacements(self,s,sect='replacements'):
+ '''Substitute patterns from self.replacements in 's'.'''
+ result = s
+ for pat,rep in getattr(self,sect).items():
+ result = re.sub(pat, rep, result)
+ return result
+
+ def parse_specialwords(self):
+ '''Parse special words section into self.specialwords dictionary.'''
+ reo = re.compile(r'(?:\s|^)(".+?"|[^"\s]+)(?=\s|$)')
+ for line in self.sections.get('specialwords',()):
+ e = parse_entry(line)
+ if not e:
+ raise EAsciiDoc,'[specialwords] entry in %s is malformed: %s' \
+ % (self.fname,line)
+ name,wordlist = e
+ if not is_name(name):
+ raise EAsciiDoc,'[specialwords] name in %s is illegal: %s' \
+ % (self.fname,name)
+ if wordlist is None:
+ # Undefine all words associated with 'name'.
+ for k,v in self.specialwords.items():
+ if v == name:
+ del self.specialwords[k]
+ else:
+ words = reo.findall(wordlist)
+ for word in words:
+ word = strip_quotes(word)
+ if not is_regexp(word):
+ raise EAsciiDoc,'[specialwords] entry in %s ' \
+ 'is not a valid regular expression: %s' \
+ % (self.fname,word)
+ self.specialwords[word] = name
+
+ def subs_specialchars(self,s):
+ '''Perform special character substitution on string 's'.'''
+ '''It may seem like a good idea to escape special characters with a '\'
+ character, the reason we don't is because the escape character itself
+ then has to be escaped and this makes including code listings
+ problematic. Use the predefined {amp},{lt},{gt} attributes instead.'''
+ result = ''
+ for ch in s:
+ result = result + self.specialchars.get(ch,ch)
+ return result
+
+ def subs_specialchars_reverse(self,s):
+ '''Perform reverse special character substitution on string 's'.'''
+ result = s
+ for k,v in self.specialchars.items():
+ result = string.replace(result, v, k)
+ return result
+
+ def subs_specialwords(self,s):
+ '''Search for word patterns from self.specialwords in 's' and
+ substitute using corresponding macro.'''
+ result = s
+ for word in self.specialwords.keys():
+ result = re.sub(word, _subs_specialwords, result)
+ return result
+
+ def expand_templates(self,section):
+ result = []
+ for line in self.sections[section]:
+ mo = macros.match('+',r'template',line)
+ if mo:
+ s = mo.group('attrlist')
+ if self.sections.has_key(s):
+ result += self.sections[s]
+ else:
+ warning('missing [%s] section' % s)
+ else:
+ result.append(line)
+ return result
+
+ def expand_all_templates(self):
+ for k in self.sections.keys():
+ self.sections[k] = self.expand_templates(k)
+
+ def section2tags(self,section,d={}):
+ '''Perform attribute substitution on 'section' using document
+ attributes plus 'd' attributes. Return tuple (stag,etag) containing
+ pre and post | placeholder tags.'''
+ assert section is not None
+ if self.sections.has_key(section):
+ body = self.sections[section]
+ else:
+ warning('missing [%s] section' % section)
+ body = ()
+ # Split macro body into start and end tag lists.
+ stag = []
+ etag = []
+ in_stag = True
+ for s in body:
+ if in_stag:
+ mo = re.match(r'(?P<stag>.*)\|(?P<etag>.*)',s)
+ if mo:
+ if mo.group('stag'):
+ stag.append(mo.group('stag'))
+ if mo.group('etag'):
+ etag.append(mo.group('etag'))
+ in_stag = False
+ else:
+ stag.append(s)
+ else:
+ etag.append(s)
+ # Do attribute substitution last so {brkbar} can be used to escape |.
+ # But don't do attribute substitution on title -- we've already done it.
+ title = d.get('title')
+ if title:
+ d['title'] = chr(0) # Replace with unused character.
+ stag = subs_attrs(stag,d)
+ etag = subs_attrs(etag,d)
+ # Put the {title} back.
+ if title:
+ stag = map(lambda x: string.replace(x, chr(0), title), stag)
+ etag = map(lambda x: string.replace(x, chr(0), title), etag)
+ d['title'] = title
+ return (stag,etag)
+
+
+#---------------------------------------------------------------------------
+# Application code.
+#---------------------------------------------------------------------------
+# Constants
+# ---------
+APP_DIR = None # This file's directory.
+USER_DIR = None # ~/.asciidoc
+CONF_DIR = "/etc/asciidoc" # Global configuration files directory.
+HELP_FILE = 'help.conf'
+
+# Globals
+# -------
+document = Document() # The document being processed.
+config = Config() # Configuration file reader.
+reader = Reader() # Input stream line reader.
+writer = Writer() # Output stream line writer.
+paragraphs = Paragraphs() # Paragraph definitions.
+lists = Lists() # List definitions.
+blocks = DelimitedBlocks() # DelimitedBlock definitions.
+tables = Tables() # Table definitions.
+macros = Macros() # Macro definitions.
+calloutmap = CalloutMap() # Coordinates callouts and callout list.
+
+def asciidoc(backend, doctype, confiles, infile, outfile, options):
+ '''Convert AsciiDoc document to DocBook document of type doctype
+ The AsciiDoc document is read from file object src the translated
+ DocBook file written to file object dst.'''
+ try:
+ if doctype not in ('article','manpage','book'):
+ raise EAsciiDoc,'illegal document type'
+ if backend == 'linuxdoc' and doctype != 'article':
+ raise EAsciiDoc,'%s %s documents are not supported' \
+ % (backend,doctype)
+ document.backend = backend
+ if not os.path.exists(os.path.join(APP_DIR, backend+'.conf')) and not \
+ os.path.exists(os.path.join(CONF_DIR, backend+'.conf')):
+ warning('non-standard %s backend' % backend, linenos=False)
+ document.doctype = doctype
+ document.infile = infile
+ document.init_attrs()
+ # Set processing options.
+ for o in options:
+ if o == '-c': config.dumping = True
+ if o == '-s': config.header_footer = False
+ if o == '-v': config.verbose = True
+ # Check the infile exists.
+ if infile != '<stdin>' and not os.path.isfile(infile):
+ raise EAsciiDoc,'input file %s missing' % infile
+ if '-e' not in options:
+ # Load global configuration from system configuration directory.
+ config.load_all(CONF_DIR)
+ # Load global configuration files from asciidoc directory.
+ config.load_all(APP_DIR)
+ # Load configuration files from ~/.asciidoc if it exists.
+ if USER_DIR is not None:
+ config.load_all(USER_DIR)
+ # Load configuration files from document directory.
+ if infile != '<stdin>':
+ config.load_all(os.path.dirname(infile))
+ if infile != '<stdin>':
+ # Load implicit document specific configuration files if they exist.
+ config.load(os.path.splitext(infile)[0] + '.conf')
+ config.load(os.path.splitext(infile)[0] + '-' + backend + '.conf')
+ # If user specified configuration file(s) overlay the defaults.
+ if confiles:
+ for conf in confiles:
+ if os.path.isfile(conf):
+ config.load(conf)
+ else:
+ raise EAsciiDoc,'configuration file %s missing' % conf
+ document.init_attrs() # Add conf files.
+ # Check configuration for consistency.
+ config.validate()
+ # Build outfile name now all conf files have been read.
+ if outfile is None:
+ outfile = os.path.splitext(infile)[0] + '.' + backend
+ if config.outfilesuffix:
+ # Change file extension.
+ outfile = os.path.splitext(outfile)[0] + config.outfilesuffix
+ document.outfile = outfile
+ if config.dumping:
+ config.dump()
+ else:
+ reader.tabsize = config.tabsize
+ reader.open(infile)
+ try:
+ writer.newline = config.newline
+ writer.open(outfile)
+ try:
+ document.init_attrs() # Add file name related entries.
+ document.translate()
+ finally:
+ writer.close()
+ finally:
+ reader.closefile() # Keep reader state for postmortem.
+ except (KeyboardInterrupt, SystemExit):
+ print
+ except Exception,e:
+ # Cleanup.
+ if outfile and outfile != '<stdout>' and os.path.isfile(outfile):
+ os.unlink(outfile)
+ # Build and print error description.
+ msg = 'FAILED: '
+ if reader.cursor:
+ msg = msg + "%s: line %d: " % (reader.cursor[0],reader.cursor[1])
+ if isinstance(e,EAsciiDoc):
+ print_stderr(msg+str(e))
+ else:
+ print_stderr(msg+'unexpected error:')
+ print_stderr('-'*60)
+ traceback.print_exc(file=sys.stderr)
+ print_stderr('-'*60)
+ sys.exit(1)
+
+def usage(msg=''):
+ if msg:
+ print_stderr(msg)
+ show_help('default', sys.stderr)
+
+def show_help(topic, stream=sys.stdout):
+ '''Print help topic to stdout.'''
+ # Print [topic] section from help.conf files.
+ topics = OrderedDict()
+ load_sections(topics, HELP_FILE, CONF_DIR)
+ load_sections(topics, HELP_FILE, APP_DIR)
+ if USER_DIR is not None:
+ load_sections(topics, HELP_FILE, USER_DIR)
+ if len(topics) == 0:
+ print_stderr('no help topics found')
+ sys.exit(1)
+ n = 0
+ for k in topics.keys():
+ if re.match(re.escape(topic), k):
+ n += 1
+ lines = topics[k]
+ if n == 0:
+ print_stderr('help topic not found: %s' % topic)
+ print_stderr('available help topics: %s' % ', '.join(topics.keys()))
+ sys.exit(1)
+ elif n > 1:
+ print_stderr('ambiguous help topic: %s' % topic)
+ else:
+ for line in lines:
+ print >>stream, line
+
+def main():
+ if float(sys.version[:3]) < 2.3:
+ print_stderr('FAILED: Python 2.3 or better required.')
+ sys.exit(1)
+ # Locate the executable and configuration files directory.
+ global APP_DIR,USER_DIR
+ APP_DIR = os.path.dirname(realpath(sys.argv[0]))
+ USER_DIR = os.environ.get('HOME')
+ if USER_DIR is not None:
+ USER_DIR = os.path.join(USER_DIR,'.asciidoc')
+ if not os.path.isdir(USER_DIR):
+ USER_DIR = None
+ # Process command line options.
+ import getopt
+ try:
+ #DEPRECATED: --safe option.
+ opts,args = getopt.getopt(sys.argv[1:],
+ 'a:b:cd:ef:h:no:svw:',
+ ['attribute=','backend=','conf-file=','doctype=','dump-conf',
+ 'help=','no-conf','no-header-footer','out-file=','profile',
+ 'section-numbers','verbose','version','safe','unsafe'])
+ except getopt.GetoptError,e:
+ msg = str(e)
+ if re.search(r'^option (-h|--help) requires argument$', msg):
+ # It's OK not to supply help option argument.
+ show_help('default')
+ sys.exit(0)
+ else:
+ usage(msg)
+ sys.exit(1)
+ if len(args) > 1:
+ usage()
+ sys.exit(1)
+ backend = DEFAULT_BACKEND
+ doctype = DEFAULT_DOCTYPE
+ confiles = []
+ outfile = None
+ options = []
+ prof = False
+ for o,v in opts:
+ if o in ('--help','-h'):
+ if v:
+ show_help(v)
+ else:
+ show_help('default')
+ sys.exit(0)
+ if o == '--profile':
+ prof = True
+ if o == '--unsafe':
+ document.safe = False
+ if o == '--version':
+ print('asciidoc %s' % VERSION)
+ sys.exit(0)
+ if o in ('-b','--backend'):
+ backend = v
+ if o in ('-c','--dump-conf'):
+ options.append('-c')
+ if o in ('-d','--doctype'):
+ doctype = v
+ if o in ('-e','--no-conf'):
+ options.append('-e')
+ if o in ('-f','--conf-file'):
+ confiles.append(v)
+ if o in ('-n','--section-numbers'):
+ o = '-a'
+ v = 'numbered'
+ if o in ('-a','--attribute'):
+ e = parse_entry(v, allow_name_only=True)
+ if not e:
+ usage('Illegal -a option: %s' % v)
+ sys.exit(1)
+ k,v = e
+ # A @ suffix denotes don't override existing document attributes.
+ if v and v[-1] == '@':
+ document.attributes[k] = v[:-1]
+ else:
+ config.cmd_attrs[k] = v
+ if o in ('-o','--out-file'):
+ if v == '-':
+ outfile = '<stdout>'
+ else:
+ outfile = v
+ if o in ('-s','--no-header-footer'):
+ options.append('-s')
+ if o in ('-v','--verbose'):
+ options.append('-v')
+ if len(args) == 0 and len(opts) == 0:
+ usage()
+ sys.exit(1)
+ if len(args) == 0:
+ usage('No source file specified')
+ sys.exit(1)
+ if not backend:
+ usage('No --backend option specified')
+ sys.exit(1)
+ if args[0] == '-':
+ infile = '<stdin>'
+ else:
+ infile = args[0]
+ if infile == '<stdin>' and not outfile:
+ outfile = '<stdout>'
+ # Convert in and out files to absolute paths.
+ if infile != '<stdin>':
+ infile = os.path.abspath(infile)
+ if outfile and outfile != '<stdout>':
+ outfile = os.path.abspath(outfile)
+ # Do the work.
+ if prof:
+ import profile
+ profile.run("asciidoc('%s','%s',(),'%s',None,())"
+ % (backend,doctype,infile))
+ else:
+ asciidoc(backend, doctype, confiles, infile, outfile, options)
+ if document.has_errors:
+ sys.exit(1)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
+ except SystemExit:
+ raise
+ except:
+ print_stderr('%s: unexpected error: %s' %
+ (os.path.basename(sys.argv[0]), sys.exc_info()[1]))
+ print_stderr('-'*60)
+ traceback.print_exc(file=sys.stderr)
+ print_stderr('-'*60)
+ sys.exit(1)
diff --git a/doc/a2x.1 b/doc/a2x.1
new file mode 100644
index 0000000..4bf0ab3
--- /dev/null
+++ b/doc/a2x.1
@@ -0,0 +1,220 @@
+.\" Title: a2x
+.\" Author:
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\" Date: 09/11/2007
+.\" Manual:
+.\" Source:
+.\"
+.TH "A2X" "1" "09/11/2007" "" ""
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+a2x \- convert Asciidoc text file to PDF, XHTML, HTML Help, manpage or plain text
+.SH "SYNOPSIS"
+\fIa2x\fR [OPTIONS] FILE
+.sp
+.SH "DESCRIPTION"
+A DocBook toolchain wrapper script that translates an \fIAsciiDoc\fR text file \fIFILE\fR to PDF, XHTML (single page or chunked), man page, HTML Help or plain text formats. PDF, XHTML, man page and HTML Help formats are are generated using the asciidoc(1)/xsltproc(1)/DocBook XSL Stylesheets toolchain. Plain text is produced by passing asciidoc(1) generated HTML through lynx(1). The htmlhelp format option generates .hhp, .hhc and .html files suitable for compilation to an HTML Help .chm file.
+.sp
+.SH "OPTIONS"
+.PP
+\-a, \-\-attribute=ATTRIBUTE
+.RS 4
+Set
+asciidoc(1)
+attribute value (shortcut for
+\fI\-\-asciidoc\-opts="\-a ATTRIBUTE"\fR
+option). This option may be specified more than once.
+.RE
+.PP
+\-\-asciidoc\-opts=ASCIIDOC_OPTS
+.RS 4
+Additional
+asciidoc(1)
+options. This option may be specified more than once.
+.RE
+.PP
+\-\-copy
+.RS 4
+Copy distributed docbook\-xsl CSS stylesheet and the copying of distributed admonition and navigation icons to their respective destinations. Applies to xhtml, chunked, htmlhelp formats. The default behavior is to suppress copying.
+.RE
+.PP
+\-D, \-\-destination\-dir=PATH
+.RS 4
+Output directory. Defaults to source FILE directory.
+.RE
+.PP
+\-d, \-\-doctype=DOCTYPE
+.RS 4
+DocBook document type:
+\fIarticle\fR,
+\fImanpage\fR
+or
+\fIbook\fR. Default document type is
+\fIarticle\fR
+unless the format is
+\fImanpage\fR
+(in which case it defaults to
+\fImanpage\fR).
+.RE
+.PP
+\-f, \-\-format=FORMAT
+.RS 4
+Output format: chunked, htmlhelp, manpage, pdf, text or xhtml.
+.RE
+.PP
+\-h, \-\-help
+.RS 4
+Print command\-line syntax and program options to stdout.
+.RE
+.PP
+\-\-icons
+.RS 4
+Use admonition or navigation icon images in output documents. The default behavior is to use text in place of icons.
+.RE
+.PP
+\-\-icons\-dir=PATH
+.RS 4
+A path (relative to destination HTML files) containing admonition and navigation icons. Defaults to ./images/icons/. Applies to xhtml, chunked, htmlhelp formats.
+.RE
+.PP
+\-n, \-\-dry\-run
+.RS 4
+Don't do anything just print what would have been done.
+.RE
+.PP
+\-s, \-\-skip\-asciidoc
+.RS 4
+Skip asciidoc execution. This is useful for converting DocBook XML files not derived from
+\fIAsciiDoc\fR
+sources. Ignored if \-\-format=text.
+.RE
+.PP
+\-\-stylesheet=PATH
+.RS 4
+A path (relative to destination HTML files) specifying the docbook\-xsl CSS stylesheet file. Defaults to ./docbook\-xsl.css. Applies to xhtml, chunked, htmlhelp formats.
+.RE
+.PP
+\-v, \-\-verbose
+.RS 4
+Print operational details to stderr. A second \-v option applies the verbose option to toolchain commands.
+.RE
+.PP
+\-\-version
+.RS 4
+Print program version to stdout.
+.RE
+.PP
+\-\-xsltproc\-opts=XSLTPROC_OPTS
+.RS 4
+Additional xsltproc(1) options. This option may be specified more than once.
+.RE
+.SH "OUTPUT FILES"
+Output files are written to the directory specified by the \fI\-\-destination\-dir\fR option. If no \fI\-\-destination\-dir\fR option is set output files are written to the source FILE directory.
+.sp
+Output files have the same name as the source FILE but with an appropriate file name extension: .html for xhtml; .hhp for htmlhelp; .pdf for pdf; .text for text. By convention manpages have no .man extension (man page section number only). Chunked HTML directory names have a .chunked extension; chunked HTML Help directory names have a .htmlhelp extension.
+.sp
+Same named existing files are overwritten.
+.sp
+Intermediate output files are written to the source FILE directory and are not automatically deleted.
+.sp
+Intermediate DocBook XML files generated by \fIAsciiDoc\fR are only regenerated if out of date with respect to the \fIAsciiDoc\fR source FILE.
+.sp
+In addition to generating HTML files the xhtml, chunked and htmlhelp formats copy the DocBook XSL stylesheet plus admonition and navigation icons distributed with \fIAsciiDoc\fR to their respective destination locations. Existing stylesheets and icons are only copied if they are newer than the destination files or if the destination files are missing.
+.sp
+The xhtml format generates a single XHTML output page. The chunked format writes multiple per\-section HTML pages to a chunked directory in the destination directory. The chunked directory has the same name as the source FILE name plus a .chunked extension.
+.sp
+.SH "EXAMPLES"
+.PP
+a2x \-f pdf \-\-icons doc/quickstart.txt
+.RS 4
+Generates doc/quickstart.pdf with admonition icons.
+.RE
+.PP
+a2x \-f chunked \-D ../webpages guide.txt
+.RS 4
+Creates chunked directory
+\&../webpages/guide.chunked
+containing chunked HTML files. Also copies
+docbook\-xsl.css
+stylesheet to the
+\&../webpages/guide.chunked
+directory plus admonition and navigation icons to the
+\&../webpages/guide.chunked/images/icons
+directory.
+.RE
+.SH "REQUISITES"
+This script runs under the bash(1) shell and requires the following programs (which may or may not be prepackaged with your Linux distribution):
+.sp
+.PP
+Asciidoc
+.RS 4
+http://www.methods.co.nz/asciidoc/
+.RE
+.PP
+xsltproc
+.RS 4
+http://xmlsoft.org/XSLT/
+.RE
+.PP
+DocBook XSL Stylesheets
+.RS 4
+http://docbook.sourceforge.net/projects/xsl/
+.RE
+.PP
+FOP (for PDF file generation)
+.RS 4
+http://xmlgraphics.apache.org/fop/
+.RE
+.PP
+Lynx (for text file generation)
+.RS 4
+http://lynx.isc.org/
+.RE
+This version of a2x(1) has been tested on Ubuntu Linux 5.0.4 with the following toolchain components:
+.sp
+.RS 4
+\h'-04'\(bu\h'+03'bash 3.00.16.
+.RE
+.RS 4
+\h'-04'\(bu\h'+03'DocBook XSL Stylesheets 1.72.0 (with
+\fIAsciiDoc\fR
+drivers and patches).
+.RE
+.RS 4
+\h'-04'\(bu\h'+03'xsltproc (libxml 20627, libxslt 10120 and libexslt 813).
+.RE
+.RS 4
+\h'-04'\(bu\h'+03'FOP 0.20.5.
+.RE
+.RS 4
+\h'-04'\(bu\h'+03'lynx 2.8.5rel.1.
+.RE
+.SH "BUGS"
+.RS 4
+\h'-04'\(bu\h'+03'The odt output format is undocumented and experimental.
+.RE
+.RS 4
+\h'-04'\(bu\h'+03'See also the
+\fIAsciiDoc\fR
+distribution BUGS file.
+.RE
+.SH "AUTHOR"
+Written by Stuart Rackham, <srackham@methods.co.nz>
+.sp
+.SH "RESOURCES"
+SourceForge: http://sourceforge.net/projects/asciidoc/
+.sp
+Main web site: http://www.methods.co.nz/asciidoc/
+.sp
+.SH "COPYING"
+Copyright (C) 2002\-2007 Stuart Rackham. Free use of this software is granted under the terms of the GNU General Public License (GPL).
+.sp
+.SH "REFERENCES"
+.IP " 1." 4
+srackham@methods.co.nz
+.RS 4
+\%mailto:srackham@methods.co.nz
+.RE
diff --git a/doc/a2x.1.txt b/doc/a2x.1.txt
new file mode 100644
index 0000000..1645ef5
--- /dev/null
+++ b/doc/a2x.1.txt
@@ -0,0 +1,191 @@
+A2X(1)
+======
+Stuart Rackham <srackham@methods.co.nz>
+
+
+NAME
+----
+a2x - convert Asciidoc text file to PDF, XHTML, HTML Help, manpage or
+plain text
+
+
+SYNOPSIS
+--------
+'a2x' [OPTIONS] FILE
+
+
+DESCRIPTION
+-----------
+A DocBook toolchain wrapper script that translates an AsciiDoc text
+file 'FILE' to PDF, XHTML (single page or chunked), man page, HTML
+Help or plain text formats. PDF, XHTML, man page and HTML Help formats
+are are generated using the asciidoc(1)/xsltproc(1)/DocBook XSL
+Stylesheets toolchain. Plain text is produced by passing asciidoc(1)
+generated HTML through lynx(1). The htmlhelp format option
+generates .hhp, .hhc and .html files suitable for compilation to an
+HTML Help .chm file.
+
+
+OPTIONS
+-------
+-a, --attribute=ATTRIBUTE::
+ Set asciidoc(1) attribute value (shortcut for '--asciidoc-opts="-a
+ ATTRIBUTE"' option). This option may be specified more than once.
+
+--asciidoc-opts=ASCIIDOC_OPTS::
+ Additional asciidoc(1) options. This option may be specified more
+ than once.
+
+--copy::
+ Copy distributed docbook-xsl CSS stylesheet and the copying of
+ distributed admonition and navigation icons to their respective
+ destinations. Applies to xhtml, chunked, htmlhelp formats. The
+ default behavior is to suppress copying.
+
+-D, --destination-dir=PATH::
+ Output directory. Defaults to source FILE directory.
+
+-d, --doctype=DOCTYPE::
+ DocBook document type: 'article', 'manpage' or 'book'. Default
+ document type is 'article' unless the format is 'manpage' (in which
+ case it defaults to 'manpage').
+
+-f, --format=FORMAT::
+ Output format: chunked, htmlhelp, manpage, pdf, text or xhtml.
+
+-h, --help::
+ Print command-line syntax and program options to stdout.
+
+--icons::
+ Use admonition or navigation icon images in output documents. The
+ default behavior is to use text in place of icons.
+
+--icons-dir=PATH::
+ A path (relative to destination HTML files) containing admonition
+ and navigation icons. Defaults to ./images/icons/.
+ Applies to xhtml, chunked, htmlhelp formats.
+
+-n, --dry-run::
+ Don't do anything just print what would have been done.
+
+-s, --skip-asciidoc::
+ Skip asciidoc execution. This is useful for converting DocBook XML
+ files not derived from AsciiDoc sources. Ignored if --format=text.
+
+--stylesheet=PATH::
+ A path (relative to destination HTML files) specifying the
+ docbook-xsl CSS stylesheet file. Defaults to ./docbook-xsl.css.
+ Applies to xhtml, chunked, htmlhelp formats.
+
+-v, --verbose::
+ Print operational details to stderr.
+ A second -v option applies the verbose option to toolchain commands.
+
+--version::
+ Print program version to stdout.
+
+--xsltproc-opts=XSLTPROC_OPTS::
+ Additional xsltproc(1) options. This option may be specified more
+ than once.
+
+
+OUTPUT FILES
+------------
+Output files are written to the directory specified by the
+'--destination-dir' option. If no '--destination-dir' option is set
+output files are written to the source FILE directory.
+
+Output files have the same name as the source FILE but with an
+appropriate file name extension: .html for xhtml; .hhp for
+htmlhelp; .pdf for pdf; .text for text. By convention manpages have
+no .man extension (man page section number only). Chunked HTML
+directory names have a .chunked extension; chunked HTML Help directory
+names have a .htmlhelp extension.
+
+Same named existing files are overwritten.
+
+Intermediate output files are written to the source FILE directory and
+are not automatically deleted.
+
+Intermediate DocBook XML files generated by AsciiDoc are only
+regenerated if out of date with respect to the AsciiDoc source FILE.
+
+In addition to generating HTML files the xhtml, chunked and htmlhelp
+formats copy the DocBook XSL stylesheet plus admonition and navigation
+icons distributed with AsciiDoc to their respective destination
+locations. Existing stylesheets and icons are only copied if they are
+newer than the destination files or if the destination files are
+missing.
+
+The xhtml format generates a single XHTML output page. The chunked
+format writes multiple per-section HTML pages to a chunked directory
+in the destination directory. The chunked directory has the same name
+as the source FILE name plus a .chunked extension.
+
+
+EXAMPLES
+--------
+a2x -f pdf --icons doc/quickstart.txt::
+ Generates doc/quickstart.pdf with admonition icons.
+
+a2x -f chunked -D ../webpages guide.txt::
+ Creates chunked directory `../webpages/guide.chunked` containing
+ chunked HTML files. Also copies `docbook-xsl.css` stylesheet to the
+ `../webpages/guide.chunked` directory plus admonition and navigation
+ icons to the `../webpages/guide.chunked/images/icons` directory.
+
+
+REQUISITES
+----------
+This script runs under the bash(1) shell and requires the following
+programs (which may or may not be prepackaged with your Linux
+distribution):
+
+Asciidoc::
+ http://www.methods.co.nz/asciidoc/
+
+xsltproc::
+ http://xmlsoft.org/XSLT/
+
+DocBook XSL Stylesheets::
+ http://docbook.sourceforge.net/projects/xsl/
+
+FOP (for PDF file generation)::
+ http://xmlgraphics.apache.org/fop/
+
+Lynx (for text file generation)::
+ http://lynx.isc.org/
+
+This version of a2x(1) has been tested on Ubuntu Linux 5.0.4 with the
+following toolchain components:
+
+- bash 3.00.16.
+- DocBook XSL Stylesheets 1.72.0 (with AsciiDoc drivers and patches).
+- xsltproc (libxml 20627, libxslt 10120 and libexslt 813).
+- FOP 0.20.5.
+- lynx 2.8.5rel.1.
+
+
+BUGS
+----
+- The odt output format is undocumented and experimental.
+- See also the AsciiDoc distribution BUGS file.
+
+
+AUTHOR
+------
+Written by Stuart Rackham, <mailto:srackham@methods.co.nz[]>
+
+
+RESOURCES
+---------
+SourceForge: http://sourceforge.net/projects/asciidoc/[]
+
+Main web site: http://www.methods.co.nz/asciidoc/[]
+
+
+COPYING
+-------
+Copyright \(C) 2002-2007 Stuart Rackham. Free use of this software is
+granted under the terms of the GNU General Public License (GPL).
+
diff --git a/doc/article.txt b/doc/article.txt
new file mode 100644
index 0000000..e7aa5a3
--- /dev/null
+++ b/doc/article.txt
@@ -0,0 +1,124 @@
+The Article Title
+=================
+Author's Name <authors@email.address>
+v1.0, Dec 2003
+
+
+This is the optional preamble (an untitled section body). Useful for
+writing simple sectionless documents consisting only of a preamble.
+
+
+Abstract
+--------
+The optional abstract (one or more paragraphs) goes here.
+
+This document is an AsciiDoc article skeleton containing briefly
+annotated element placeholders plus a couple of example index entries
+and footnotes. The preface, appendix, bibliography, glossary and index
+section titles are significant ('specialsections').
+
+
+The First Section
+-----------------
+Article sections start at level 1 and can be nested up to four levels
+deep.
+footnote:[An example footnote.]
+indexterm:[Example index entry]
+
+And now for something completely different: ((monkeys)), lions and
+tigers (Bengal and Siberian) using the alternative syntax index
+entries.
+(((Big cats,Lions)))
+(((Big cats,Tigers,Bengal Tiger)))
+(((Big cats,Tigers,Siberian Tiger)))
+Note that multi-entry terms generate separate index entries.
+
+Here are a couple of image examples: an image:images/smallnew.png[]
+example inline image followed by an example block image:
+
+.Tiger block image
+image::images/tiger.png[Tiger image]
+
+Followed by an example table:
+
+.An example table
+`-----------------`--------------------------
+Option Description
+---------------------------------------------
+-a 'USER GROUP' Add 'USER' to 'GROUP'.
+-R 'GROUP' Disables access to 'GROUP'.
+---------------------------------------------
+
+[[X1]]
+Sub-section with Anchor
+~~~~~~~~~~~~~~~~~~~~~~~
+Sub-section at level 2.
+
+A Nested Sub-section
+^^^^^^^^^^^^^^^^^^^^
+Sub-section at level 3.
+
+Yet another nested Sub-section
+++++++++++++++++++++++++++++++
+Sub-section at level 4.
+
+This is the maximum sub-section depth supported by the distributed
+AsciiDoc configuration.
+footnote:[A second example footnote.]
+
+
+The Second Section
+------------------
+Article sections are at level 1 and can contain sub-sections nested up
+to four deep.
+
+An example link to anchor at start of the <<X1,first sub-section>>.
+indexterm:[Second example index entry]
+
+An example link to a bibliography entry <<taoup>>.
+
+Appendix A: Example Appendix
+----------------------------
+AsciiDoc article appendices are just just article sections with
+'specialsection' titles.
+
+Appendix Sub-section
+~~~~~~~~~~~~~~~~~~~~
+Appendix sub-section at level 2.
+
+
+
+Bibliography
+------------
+The bibliography list is an example of an AsciiDoc SimpleList, the
+AsciiDoc source list items are bulleted with a `+` character.
+
++ [[[taoup]]] Eric Steven Raymond. 'The Art of Unix
+ Programming'. Addison-Wesley. ISBN 0-13-142901-9.
++ [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
+ 'DocBook - The Definitive Guide'. O'Reilly & Associates. 1999.
+ ISBN 1-56592-580-7.
+
+
+
+Glossary
+--------
+Glossaries are optional. Glossaries entries are an example of AsciiDoc
+VariableList entries, the AsciiDoc source entry terms are terminated
+by the ":-" characters.
+
+A glossary term:-
+ The corresponding (indented) definition.
+
+A second glossary term:-
+ The corresponding (indented) definition.
+
+
+ifdef::backend-docbook[]
+Index
+-----
+////////////////////////////////////////////////////////////////
+The index is normally left completely empty, it's contents being
+generated automatically by the DocBook toolchain.
+////////////////////////////////////////////////////////////////
+endif::backend-docbook[]
diff --git a/doc/asciidoc-revhistory.xml b/doc/asciidoc-revhistory.xml
new file mode 100644
index 0000000..d7c7edb
--- /dev/null
+++ b/doc/asciidoc-revhistory.xml
@@ -0,0 +1,27 @@
+<revhistory>
+
+ <revision>
+ <revnumber>6.0.0</revnumber>
+ <date>January 2005</date>
+ <authorinitials>SJR</authorinitials>
+ <revremark>
+ AsciiDoc 6.0.0 additions and changes (see the
+ <ulink url="http://www.methods.co.nz/asciidoc/CHANGELOG.html">
+ AsciiDoc CHANGELOG</ulink>
+ for a full list of changes).
+ </revremark>
+ </revision>
+
+ <revision>
+ <revnumber>5.1.1</revnumber>
+ <date>2004-10-10</date>
+ <authorinitials>SJR</authorinitials>
+ <revremark>
+ AsciiDoc 5.1.1 additions and changes (see the
+ <ulink url="http://www.methods.co.nz/asciidoc/CHANGELOG.html">
+ AsciiDoc CHANGELOG</ulink>
+ for a full list of changes).
+ </revremark>
+ </revision>
+
+</revhistory>
diff --git a/doc/asciidoc.1 b/doc/asciidoc.1
new file mode 100644
index 0000000..58e359f
--- /dev/null
+++ b/doc/asciidoc.1
@@ -0,0 +1,154 @@
+.\" Title: asciidoc
+.\" Author:
+.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
+.\" Date: 09/11/2007
+.\" Manual:
+.\" Source:
+.\"
+.TH "ASCIIDOC" "1" "09/11/2007" "" ""
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+asciidoc \- converts an AsciiDoc text file to DocBook, HTML or LinuxDoc
+.SH "SYNOPSIS"
+\fIasciidoc\fR [OPTIONS] FILE
+.sp
+.SH "DESCRIPTION"
+The asciidoc(1) command translates the \fIAsciiDoc\fR text file \fIFILE\fR to a DocBook, HTML or LinuxDoc file. If \fIFILE\fR is \fI\-\fR then the standard input is used.
+.sp
+.SH "OPTIONS"
+.PP
+\-a, \-\-attribute=ATTRIBUTE
+.RS 4
+Define or delete document attribute.
+\fIATTRIBUTE\fR
+is formatted like
+\fINAME=VALUE\fR. Command\-line attributes take precedence over document and configuration file attributes. Alternate acceptable forms are
+\fINAME\fR
+(the
+\fIVALUE\fR
+defaults to an empty string);
+\fINAME!\fR
+(delete the
+\fINAME\fR
+attribute);
+\fINAME@\fR
+(do not override document or configuration file attributes). Values containing spaces should be enclosed in double\-quote characters. This option may be specified more than once.
+.RE
+.PP
+\-b, \-\-backend=BACKEND
+.RS 4
+Backend output file format:
+\fIdocbook\fR,
+\fIxhtml11\fR
+or
+\fIhtml4\fR. Defaults to
+\fIxhtml11\fR.
+.RE
+.PP
+\-f, \-\-conf\-file=CONF_FILE
+.RS 4
+Use configuration file
+\fICONF_FILE\fR.Configuration files processed in command\-line order (after implicit configuration files). This option may be specified more than once.
+.RE
+.PP
+\-d, \-\-doctype=DOCTYPE
+.RS 4
+Document type:
+\fIarticle\fR,
+\fImanpage\fR
+or
+\fIbook\fR. The
+\fIbook\fR
+document type is only supported by the
+\fIdocbook\fR
+backend. Default document type is
+\fIarticle\fR.
+.RE
+.PP
+\-c, \-\-dump\-conf
+.RS 4
+Dump configuration to stdout.
+.RE
+.PP
+\-h, \-\-help[=TOPIC]
+.RS 4
+Print help TOPIC.
+\fI\-\-help topics\fR
+will print a list of help topics,
+\-\-help syntax
+summarizes
+\fIAsciiDoc\fR
+syntax,
+\-\-help manpage
+prints the
+\fIAsciiDoc\fR
+manpage.
+.RE
+.PP
+\-e, \-\-no\-conf
+.RS 4
+Exclude implicitly loaded configuration files except for those named like the input file (\fIinfile.conf\fR
+and
+\fIinfile\-backend.conf\fR).
+.RE
+.PP
+\-s, \-\-no\-header\-footer
+.RS 4
+Suppress document header and footer output.
+.RE
+.PP
+\-o, \-\-out\-file=OUT_FILE
+.RS 4
+Write output to file
+\fIOUT_FILE\fR. Defaults to the base name of input file with
+\fIbackend\fR
+extension. If the input is stdin then the outfile defaults to stdout. If
+\fIOUT_FILE\fR
+is
+\fI\-\fR
+then the standard output is used.
+.RE
+.PP
+\-n, \-\-section\-numbers
+.RS 4
+Auto\-number HTML article section titles. Synonym for
+\fI\-a numbered\fR.
+.RE
+.PP
+\-\-unsafe
+.RS 4
+Disable safe mode. Safe mode is enabled by default, disabling it is potentially dangerous.
+.RE
+.PP
+\-v, \-\-verbose
+.RS 4
+Verbosely print processing information and configuration file checks to stderr.
+.RE
+.PP
+\-\-version
+.RS 4
+Print program version number.
+.RE
+.SH "BUGS"
+See the \fIAsciiDoc\fR distribution BUGS file.
+.sp
+.SH "AUTHOR"
+Written by Stuart Rackham, <srackham@methods.co.nz>
+.sp
+.SH "RESOURCES"
+SourceForge: http://sourceforge.net/projects/asciidoc/
+.sp
+Main web site: http://www.methods.co.nz/asciidoc/
+.sp
+.SH "COPYING"
+Copyright (C) 2002\-2007 Stuart Rackham. Free use of this software is granted under the terms of the GNU General Public License (GPL).
+.sp
+.SH "REFERENCES"
+.IP " 1." 4
+srackham@methods.co.nz
+.RS 4
+\%mailto:srackham@methods.co.nz
+.RE
diff --git a/doc/asciidoc.1.txt b/doc/asciidoc.1.txt
new file mode 100644
index 0000000..a8f5381
--- /dev/null
+++ b/doc/asciidoc.1.txt
@@ -0,0 +1,108 @@
+ASCIIDOC(1)
+===========
+Stuart Rackham <srackham@methods.co.nz>
+
+
+NAME
+----
+asciidoc - converts an AsciiDoc text file to DocBook, HTML or LinuxDoc
+
+
+SYNOPSIS
+--------
+'asciidoc' [OPTIONS] FILE
+
+
+DESCRIPTION
+-----------
+The asciidoc(1) command translates the AsciiDoc text file 'FILE' to a
+DocBook, HTML or LinuxDoc file. If 'FILE' is '-' then the standard
+input is used.
+
+
+OPTIONS
+-------
+-a, --attribute=ATTRIBUTE::
+ Define or delete document attribute. 'ATTRIBUTE' is formatted
+ like 'NAME=VALUE'. Command-line attributes take precedence
+ over document and configuration file attributes. Alternate
+ acceptable forms are 'NAME' (the 'VALUE' defaults to an empty
+ string); 'NAME!' (delete the 'NAME' attribute); 'NAME@' (do
+ not override document or configuration file attributes).
+ Values containing spaces should be enclosed in double-quote
+ characters. This option may be specified more than once.
+
+-b, --backend=BACKEND::
+ Backend output file format: 'docbook', 'xhtml11' or 'html4'.
+ Defaults to 'xhtml11'.
+
+-f, --conf-file=CONF_FILE::
+ Use configuration file 'CONF_FILE'.Configuration files
+ processed in command-line order (after implicit configuration
+ files). This option may be specified more than once.
+
+-d, --doctype=DOCTYPE::
+ Document type: 'article', 'manpage' or 'book'. The 'book'
+ document type is only supported by the 'docbook' backend.
+ Default document type is 'article'.
+
+-c, --dump-conf::
+ Dump configuration to stdout.
+
+-h, --help[=TOPIC]::
+ Print help TOPIC. '--help topics' will print a list of help
+ topics, `--help syntax` summarizes AsciiDoc syntax, `--help
+ manpage` prints the AsciiDoc manpage.
+
+-e, --no-conf::
+ Exclude implicitly loaded configuration files except for those
+ named like the input file ('infile.conf' and
+ 'infile-backend.conf').
+
+-s, --no-header-footer::
+ Suppress document header and footer output.
+
+-o, --out-file=OUT_FILE::
+ Write output to file 'OUT_FILE'. Defaults to the base name of
+ input file with 'backend' extension. If the input is stdin
+ then the outfile defaults to stdout. If 'OUT_FILE' is '-' then
+ the standard output is used.
+
+-n, --section-numbers::
+ Auto-number HTML article section titles.
+ Synonym for '-a numbered'.
+
+--unsafe::
+ Disable safe mode. Safe mode is enabled by default, disabling
+ it is potentially dangerous.
+
+-v, --verbose::
+ Verbosely print processing information and configuration file
+ checks to stderr.
+
+--version::
+ Print program version number.
+
+
+BUGS
+----
+See the AsciiDoc distribution BUGS file.
+
+
+AUTHOR
+------
+Written by Stuart Rackham, <mailto:srackham@methods.co.nz[]>
+
+
+RESOURCES
+---------
+SourceForge: http://sourceforge.net/projects/asciidoc/[]
+
+Main web site: http://www.methods.co.nz/asciidoc/[]
+
+
+COPYING
+-------
+Copyright \(C) 2002-2007 Stuart Rackham. Free use of this software is
+granted under the terms of the GNU General Public License (GPL).
+
diff --git a/doc/asciidoc.chm b/doc/asciidoc.chm
new file mode 100644
index 0000000..4be4113
--- /dev/null
+++ b/doc/asciidoc.chm
Binary files differ
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
new file mode 100644
index 0000000..5aad715
--- /dev/null
+++ b/doc/asciidoc.conf
@@ -0,0 +1,6 @@
+#
+# Customization for AsciiDoc documentation.
+#
+[specialwords]
+emphasizedwords=(?u)\\?\bAsciiDoc\b
+monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\)
diff --git a/doc/asciidoc.txt b/doc/asciidoc.txt
new file mode 100644
index 0000000..d54f66a
--- /dev/null
+++ b/doc/asciidoc.txt
@@ -0,0 +1,4772 @@
+AsciiDoc User Guide
+===================
+Stuart Rackham <srackham@methods.co.nz>
+:Author Initials: SJR
+
+AsciiDoc is a text document format for writing short documents,
+articles, books and UNIX man pages. AsciiDoc files can be translated
+to HTML and DocBook markups using the asciidoc(1) command. AsciiDoc
+is highly configurable: both the AsciiDoc source file syntax and the
+backend output markups (which can be almost any type of SGML/XML
+markup) can be customized and extended by the user.
+
+
+Introduction
+------------
+**********************************************************************
+This is an overly large document, it probably needs to be refactored
+into a Tutorial, FAQ, Quick Reference and Formal Reference.
+
+If you're new to AsciiDoc read this section and the <<X6,Getting
+Started>> section and take a look at the example AsciiDoc `*.txt`
+source files in the distribution `doc` directory.
+**********************************************************************
+
+Plain text is the most universal electronic document format, no matter
+what computing environment you use, you can always read and write
+plain text documentation. But for many applications plain text is not
+a viable presentation format. HTML, PDF and roff (roff is used for
+man pages) are the most widely used UNIX presentation formats.
+DocBook is a popular UNIX documentation markup format which can be
+translated to HTML, PDF and other presentation formats.
+
+AsciiDoc is a plain text human readable/writable document format that
+can be translated to DocBook or HTML using the asciidoc(1) command.
+You can then either use asciidoc(1) generated HTML directly or run
+asciidoc(1) DocBook output through your favorite DocBook toolchain or
+use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, man page,
+HTML and other presentation formats.
+
+The AsciiDoc format is a useful presentation format in its own right:
+AsciiDoc files are unencumbered by markup and are easily viewed,
+proofed and edited.
+
+AsciiDoc is light weight: it consists of a single Python script and a
+bunch of configuration files. Apart from asciidoc(1) and a Python
+interpreter, no other programs are required to convert AsciiDoc text
+files to DocBook or HTML. See <<X11,Example AsciiDoc Documents>>
+below.
+
+You write an AsciiDoc document the same way you would write a normal
+text document, there are no markup tags or arcane notations. Built-in
+AsciiDoc formatting rules have been kept to a minimum and are
+reasonably obvious.
+
+Text markup conventions tend to be a matter of (often strong) personal
+preference: if the default syntax is not to your liking you can define
+your own by editing the text based asciidoc(1) configuration files.
+You can create your own configuration files to translate AsciiDoc
+documents to almost any SGML/XML markup.
+
+asciidoc(1) comes with a set of configuration files to translate
+AsciiDoc articles, books or man pages to HTML or DocBook backend
+formats.
+
+.My AsciiDoc Itch
+**********************************************************************
+DocBook has emerged as the defacto standard Open Source documentation
+format. But DocBook is a complex language, the marked up text is
+difficult to read and even more difficult to write directly -- I found
+I was spending more time typing markup tags, consulting reference
+manuals and fixing syntax errors, than I was writing the
+documentation.
+
+**********************************************************************
+
+
+[[X6]]
+Getting Started
+---------------
+Installing AsciiDoc
+~~~~~~~~~~~~~~~~~~~
+See the `README` and `INSTALL` files for install prerequisites and
+procedures. Packagers take a look at <<X38,Appendix B: Packager
+Notes>>.
+
+[[X11]]
+Example AsciiDoc Documents
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+The best way to quickly get a feel for AsciiDoc is to view the
+AsciiDoc web site and/or distributed examples:
+
+- Take a look at the linked examples on the AsciiDoc web site home
+ page http://www.methods.co.nz/asciidoc/[]. Press the 'Page Source'
+ sidebar menu item to view corresponding AsciiDoc source.
+- Read the `*.txt` source files in the distribution `./doc` directory
+ in conjunction with the corresponding HTML and DocBook XML files.
+
+
+AsciiDoc Document Types
+-----------------------
+There are three types of AsciiDoc documents: article, book and
+manpage. All document types share the same AsciiDoc format with some
+minor variations.
+
+Use the asciidoc(1) `-d` (`--doctype`) option to specify the AsciiDoc
+document type -- the default document type is 'article'.
+
+By convention the `.txt` file extension is used for AsciiDoc document
+source files.
+
+article
+~~~~~~~
+Used for short documents, articles and general documentation. See the
+AsciiDoc distribution `./doc/article.txt` example.
+
+book
+~~~~
+Books share the same format as articles; in addition there is the
+option to add level 0 book part sections.
+
+Book documents will normally be used to produce DocBook output since
+DocBook processors can automatically generate footnotes, table of
+contents, list of tables, list of figures, list of examples and
+indexes.
+
+AsciiDoc markup supports standard DocBook frontmatter and backmatter
+<<X16,special sections>> (dedication, preface, bibliography, glossary,
+index, colophon) plus footnotes and index entries.
+
+.Example book documents
+Book::
+ The `./doc/book.txt` file in the AsciiDoc distribution.
+
+Multi-part book::
+ The `./doc/book-multi.txt` file in the AsciiDoc distribution.
+
+manpage
+~~~~~~~
+Used to generate UNIX manual pages. AsciiDoc manpage documents
+observe special header title and section naming conventions -- see the
+<<X1,Manpage Documents>> section for details.
+
+See also the asciidoc(1) man page source (`./doc/asciidoc.1.txt`) from
+the AsciiDoc distribution.
+
+
+[[X5]]
+AsciiDoc Backends
+-----------------
+The asciidoc(1) command translates an AsciiDoc formatted file to the
+backend format specified by the `-b` (`--backend`) command-line
+option. asciidoc(1) itself has little intrinsic knowledge of backend
+formats, all translation rules are contained in customizable cascading
+configuration files.
+
+AsciiDoc ships with the following predefined backend output formats:
+
+docbook
+~~~~~~~
+AsciiDoc generates the following DocBook document types: article, book
+and refentry (corresponding to the AsciiDoc 'article', 'book' and
+'manpage' document types).
+
+DocBook documents are not designed to be viewed directly. Most Linux
+distributions come with conversion tools (collectively called a
+toolchain) for <<X12,converting DocBook files>> to presentation
+formats such as Postscript, HTML, PDF, DVI, roff (the native man page
+format), HTMLHelp, JavaHelp and text.
+
+- The `--backend=docbook` command-line option produces DocBook XML.
+ You can produce the older DocBook SGML format using the
+ `--attribute=sgml` command-line option.
+- Use the optional <<X54,`encoding`>> attribute to set the character
+ set encoding.
+- Use the optional `imagesdir` attribute to prepend to the target file
+ name paths in image inline and block macros. Defaults to a blank
+ string.
+- The AsciiDoc 'Preamble' element generates a DocBook book 'preface'
+ element although it's more usual to use an explicit 'Preface'
+ special section (see the `./doc/book.txt` example book).
+
+[[X33]]
+xhtml11
+~~~~~~~
+The default asciidoc(1) backend is `xhtml11` which generates XHTML 1.1
+markup styled with CSS2. Default output file have a `.html` extension.
+'xhtml11' document generation is influenced by the following
+optional attributes (the default behavior is to generate XHTML with no
+section numbers, embedded CSS and no linked admonition icon images):
+
+numbered::
+ Adds section numbers to section titles.
+
+toc::
+ Adds a table of contents to the start of the document.
+
+ - JavaScript needs to be enabled in your browser for this to work.
+ - By default AsciiDoc automatically embeds the required `toc.js`
+ JavaScript in the output document -- use the 'linkcss' attribute
+ to link the script.
+ - The following example generates a numbered table of contents by
+ embedding the `toc.js` script in the `mydoc.html` output document
+ (to link the script to the output document use the 'linkcss' and
+ 'scriptsdir' attributes):
+
+ $ asciidoc -a toc -a numbered mydoc.txt
+
+toclevels::
+ Sets the number of title levels (1..4) reported in the table of
+ contents (see the 'toc' attribute above). Defaults to 2 and must be
+ used with the 'toc' attribute. Example usage:
+
+ $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt
+
+linkcss::
+ Link CSS stylesheets and JavaScripts (see the 'stylesdir' and
+ 'scriptsdir' attributes below). By default 'linkcss' is undefined in
+ which case stylesheets and scripts are automatically embedded in the
+ output document.
+
+stylesdir::
+ The name of the directory containing linked stylesheets. Defaults to
+ `.` (the same directory as the linking document).
+
+scriptsdir::
+ The name of the directory containing linked JavaScripts. Defaults to
+ `.` (the same directory as the linking document).
+
+[[X45]]
+icons::
+ Link admonition paragraph and admonition block icon images and badge
+ images. By default 'icons' is undefined and text is used in place of
+ icon images.
+
+[[X44]]
+iconsdir::
+ The name of the directory containing linked admonition and
+ navigation icons. Defaults to `./images/icons`.
+
+imagesdir::
+ This attribute is prepended to the target image file name paths in
+ image inline and block macros. Defaults to a blank string.
+
+theme::
+ Use alternative stylesheets (see <<X35,Stylesheets>>).
+
+badges::
+ Link badges ('XHTML 1.1', 'CSS' and 'Get Firefox!') in document
+ footers. By default badges are omitted ('badges' is undefined).
+
+NOTE: The path names of images, icons and scripts are relative to the
+output document not the source document.
+
+[[X54]]
+encoding::
+ Set the input and output document character set encoding. For
+ example the `--attribute=encoding=ISO-8859-1` command-line option
+ will set the character set encoding to `ISO-8859-1`.
+
+ - The default encoding is UTF-8.
+ - This attribute specifies the character set in the output document.
+ - The encoding name must correspond to a Python codec name or alias.
+ - The 'encoding' attribute can be set using an AttributeEntry inside
+ the document header but it must come at the start of the document
+ before the document title. For example:
+
+ :encoding: ISO-8859-1
+
+quirks::
+ Use the `xhtml11-quirks.css` stylesheet to work around IE6 browser
+ incompatibilities (this is the default behavior).
+
+[[X35]]
+Stylesheets
+^^^^^^^^^^^
+AsciiDoc XHTML output is styled using CSS2 stylesheets from the
+distribution `./stylesheets/` directory.
+
+[IMPORTANT]
+=====================================================================
+All browsers have CSS quirks, but Microsoft's IE6 has so many
+omissions and errors that the `xhtml11-quirks.css` stylesheet and
+`xhtml11-quirks.conf` configuration files are included during XHTML
+backend processing to to implement work-arounds for IE6. If you don't
+use IE6 then the quirks stylesheet and configuration files can be
+omitted using the `--attribute=quirks!` command-line option.
+=====================================================================
+
+Default 'xhtml11' stylesheets:
+
+`./stylesheets/xhtml11.css`::
+ The main stylesheet.
+
+`./stylesheets/xhtml11-manpage.css`::
+ Tweaks for manpage document type generation.
+
+`./stylesheets/xhtml11-quirks.css`::
+ Stylesheet modifications to work around IE6 browser
+ incompatibilities.
+
+Use the 'theme' attribute to select and alternative set of
+stylesheets. For example, the command-line option `-a theme=foo` will
+use stylesheets `foo.css`, `foo-manpage.css` and `foo-quirks.css`.
+
+
+html4
+~~~~~
+This backend generates plain (unstyled) HTML 4.01 Transitional markup.
+
+
+linuxdoc
+~~~~~~~~
+WARNING: The AsciiDoc linuxdoc backend is still distributed but is no
+longer being actively developed or tested with new AsciiDoc releases
+(the last supported release was AsciiDoc 6.0.3).
+
+- Tables are not supported.
+- Images are not supported.
+- Callouts are not supported.
+- Horizontal labeled lists are not supported.
+- Only article document types are allowed.
+- The Abstract section can consist only of a single paragraph.
+- An AsciiDoc Preamble is not allowed.
+- The LinuxDoc output format does not support multiple labels per
+ labeled list item although LinuxDoc conversion programs generally
+ output all the labels with a warning.
+- Don't apply character formatting to the `link` macro attributes,
+ LinuxDoc does not allow displayed link text to be formatted.
+
+The default output file name extension is `.sgml`.
+
+latex
+~~~~~
+An experimental LaTeX backend has been written for AsciiDoc by
+Benjamin Klum. A tutorial `./doc/latex-backend.html` is included in
+the AsciiDoc distribution which can also be viewed at
+http://www.methods.co.nz/asciidoc/latex-backend.html[].
+
+
+Document Structure
+------------------
+An AsciiDoc document consists of a series of <<X8,block elements>>
+starting with an optional document Header, followed by an optional
+Preamble, followed by zero or more document Sections.
+
+Almost any combination of zero or more elements constitutes a valid
+AsciiDoc document: documents can range from a single sentence to a
+multi-part book.
+
+Block Elements
+~~~~~~~~~~~~~~
+Block elements consist of one or more lines of text and may contain
+other block elements.
+
+The AsciiDoc block structure can be informally summarized
+footnote:[This is a rough structural guide, not a rigorous syntax
+definition] as follows:
+
+ Document ::= (Header?,Preamble?,Section*)
+ Header ::= (Title,(AuthorLine,RevisionLine?)?)
+ AuthorLine ::= (FirstName,(MiddleName?,LastName)?,EmailAddress?)
+ RevisionLine ::= (Revision?,Date)
+ Preamble ::= (SectionBody)
+ Section ::= (Title,SectionBody?,(Section)*)
+ SectionBody ::= ((BlockTitle?,Block)|BlockMacro)+
+ Block ::= (Paragraph|DelimitedBlock|List|Table)
+ List ::= (BulletedList|NumberedList|LabeledList|CalloutList)
+ BulletedList ::= (ListItem)+
+ NumberedList ::= (ListItem)+
+ CalloutList ::= (ListItem)+
+ LabeledList ::= (ItemLabel+,ListItem)+
+ ListItem ::= (ItemText,(List|ListParagraph|ListContinuation)*)
+ Table ::= (Ruler,TableHeader?,TableBody,TableFooter?)
+ TableHeader ::= (TableRow+,TableUnderline)
+ TableFooter ::= (TableRow+,TableUnderline)
+ TableBody ::= (TableRow+,TableUnderline)
+ TableRow ::= (TableData+)
+
+Where:
+
+- '?' implies zero or one occurrence, '+' implies one or more
+ occurrences, '*' implies zero or more occurrences.
+- All block elements are separated by line boundaries.
+- `BlockId`, `AttributeEntry` and `AttributeList` block elements (not
+ shown) can occur almost anywhere.
+- There are a number of document type and backend specific
+ restrictions imposed on the block syntax.
+- The following elements cannot contain blank lines: Header, Title,
+ Paragraph, ItemText.
+- A ListParagraph is a Paragraph with its 'listelement' option set.
+- A ListContinuation is a <<X15,list continuation element>>.
+
+Header
+~~~~~~
+The Header is optional but must start on the first line of the
+document and must begin with a document <<X17,title>>. Optional Author
+and Revision lines immediately follow the title. The header can be
+preceded by a CommentBlock or comment lines.
+
+The author line contains the author's name optionally followed by the
+author's email address. The author's name consists of a first name
+followed by optional middle and last names separated by white space.
+Multi-word first, middle and last names can be entered in the header
+author line using the underscore as a word separator. The email
+address comes last and must be enclosed in angle <> brackets. Author
+names cannot contain angle <> bracket characters.
+
+The optional document header revision line should immediately follow
+the author line. The revision line can be one of two formats:
+
+. A an alphanumeric document revision number followed by a date:
+ * The revision number and date must be separated by a comma.
+ * The revision number is optional but must contain at least one
+ numeric character.
+ * Any non-numeric characters preceding the first numeric character
+ will be dropped.
+. An RCS/CSV/SVN $Id$ marker.
+
+The document heading is separated from the remainder of the document
+by one or more blank lines.
+
+Here's an example AsciiDoc document header:
+
+ Writing Documentation using AsciiDoc
+ ====================================
+ Stuart Rackham <srackham@methods.co.nz>
+ v2.0, February 2003
+
+You can override or set header parameters by passing 'revision',
+'data', 'email', 'author', 'authorinitials', 'firstname' and
+'lastname' attributes using the asciidoc(1) `-a` (`--attribute`)
+command-line option. For example:
+
+ $ asciidoc -a date=2004/07/27 article.txt
+
+Attributes can also be added to the header for substitution in the
+header template with <<X18,Attribute Entry>> elements.
+
+Preamble
+~~~~~~~~
+The Preamble is an optional untitled section body between the document
+Header and the first Section title.
+
+Sections
+~~~~~~~~
+AsciiDoc supports five section levels 0 to 4 (although only book
+documents are allowed to contain level 0 sections). Section levels are
+delineated by the section <<X17,titles>>.
+
+Sections are translated using configuration file markup templates. To
+determine which configuration file template to use AsciiDoc first
+searches for special section titles in the <<X16,`[specialsections]`>>
+configuration entries, if not found it uses the `[sect<level>]`
+template.
+
+The `-n` (`--section-numbers`) command-line option auto-numbers HTML
+outputs (DocBook line numbering is handled automatically by the
+DocBook toolchain commands).
+
+Section IDs are auto-generated from section titles if the `sectids`
+attribute is defined (the default behavior). The primary purpose of
+this feature is to ensure persistence of table of contents links:
+missing section IDs are generated dynamically by the JavaScript TOC
+generator *after* the page is loaded. This means, for example, that if
+you go to a bookmarked dynamically generated TOC address the page will
+load but the browser will ignore the (as yet ungenerated) section ID.
+
+The IDs are generated by the following algorithm:
+
+- Replace all non-alphanumeric title characters with an underscore.
+- Strip leading or trailing underscores.
+- Convert to lowercase.
+- Prepend an underscore (so there's no possibility of name clashes
+ with existing document IDs).
+- A numbered suffix (`_2`, `_3` ...) is added if a same named
+ auto-generated section ID exists.
+
+For example the title 'Jim's House' would generate the ID
+`_jim_s_house`.
+
+[[X16]]
+Special Sections
+^^^^^^^^^^^^^^^^
+In addition to normal sections, documents can contain optional
+frontmatter and backmatter sections -- for example: preface,
+bibliography, table of contents, index.
+
+The AsciiDoc configuration file `[specialsections]` section specifies
+special section titles and the corresponding backend markup templates.
+
+`[specialsections]` entries are formatted like:
+
+ <pattern>=<name>
+
+`<pattern>` is a Python regular expression and `<name>` is the name of
+a configuration file markup template section. If the `<pattern>`
+matches an AsciiDoc document section title then the backend output is
+marked up using the `<name>` markup template (instead of the default
+`sect<level>` section template). The \{title} attribute value is set
+to the value of the matched regular expression group named 'title', if
+there is no 'title' group \{title} defaults to the the whole of the
+AsciiDoc section title.
+
+AsciiDoc comes preconfigured with the following special section
+titles:
+
+ Preface (book documents only)
+ Abstract (article documents only)
+ Dedication (book documents only)
+ Glossary
+ Bibliography|References
+ Colophon (book documents only)
+ Index
+ Appendix [A-Z][:.] <title>
+
+Inline Elements
+~~~~~~~~~~~~~~~
+<<X34,Inline document elements>> are used to markup character
+formatting and various types of text substitution. Inline elements and
+inline element syntax is defined in the asciidoc(1) configuration
+files.
+
+Here is a list of AsciiDoc inline elements in the (default) order in
+which they are processed:
+
+Special characters::
+ These character sequences escape special characters used by
+ the backend markup (typically "<", ">", and "&"). See
+ `[specialcharacters]` configuration file sections.
+
+Quotes::
+ Characters that markup words and phrases; usually for
+ character formatting. See `[quotes]` configuration file
+ sections.
+
+Special Words::
+ Word or word phrase patterns singled out for markup without
+ the need for further annotation. See `[specialwords]`
+ configuration file sections.
+
+Replacements::
+ Each Replacement defines a word or word phrase pattern to
+ search for along with corresponding replacement text. See
+ `[replacements]` configuration file sections.
+
+Attributes::
+ Document attribute names enclosed in braces (attribute
+ references) are replaced by the corresponding attribute value.
+
+Inline Macros::
+ Inline macros are replaced by the contents of parametrized
+ configuration file sections.
+
+
+Document Processing
+-------------------
+The AsciiDoc source document is read and processed as follows:
+
+1. The document 'Header' is parsed, header parameter values are
+ substituted into the configuration file `[header]` template section
+ which is then written to the output file.
+2. Each document 'Section' is processed and its constituent elements
+ translated to the output file.
+3. The configuration file `[footer]` template section is substituted
+ and written to the output file.
+
+When a block element is encountered asciidoc(1) determines the type of
+block by checking in the following order (first to last): (section)
+Titles, BlockMacros, Lists, DelimitedBlocks, Tables, AttributeEntrys,
+AttributeLists, BlockTitles, Paragraphs.
+
+The default paragraph definition `[paradef-default]` is last element
+to be checked.
+
+Knowing the parsing order will help you devise unambiguous macro, list
+and block syntax rules.
+
+Inline substitutions within block elements are performed in the
+following default order:
+
+1. Special characters
+2. Quotes
+3. Special words
+4. Replacements
+5. Attributes
+6. Inline Macros
+7. Passthroughs
+8. Replacements2
+
+The substitutions and substitution order performed on
+Title, Paragraph and DelimitedBlock elements is determined by
+configuration file parameters.
+
+
+Text Formatting
+---------------
+[[X51]]
+Quoted Text
+~~~~~~~~~~~
+Words and phrases can be formatted by enclosing inline text with
+quote characters:
+
+_Emphasized text_::
+ Word phrases \'enclosed in single quote characters' (acute
+ accents) or \_underline characters_ are emphasized.
+
+*Strong text*::
+ Word phrases \*enclosed in asterisk characters* are rendered
+ in a strong font (usually bold).
+
++Monospaced text+::
+ Word phrases \`enclosed in backtick characters` (grave
+ accents) or \+plus characters+ are rendered in a monospaced font.
+
+``Quoted text''::
+ Phrases \``enclosed with two grave accents to the left and two
+ acute accents to the right\'' are rendered in quotation marks.
+
+#Unquoted text#::
+ Placing \#hashes around text# does nothing, it is a mechanism
+ to allow inline attributes to be applied to otherwise
+ unformatted text (see example below).
+
+The alternative underline and plus characters, while marginally less
+readable, are arguably a better choice than the backtick and
+apostrophe characters as they are not normally used for, and so not
+confused with, punctuation.
+
+Quoted text can be prefixed with an <<X21,attribute list>>. Currently
+the only use made of this feature is to allow the font color,
+background color and size to be specified (XHTML/HTML only, not
+DocBook) using the first three positional attribute arguments. The
+first argument is the text color; the second the background color; the
+third is the font size. Colors are valid CSS colors and the font size
+is a number which treated as em units. Here are some examples:
+
+---------------------------------------------------------------------
+[red]#Red text#.
+[,yellow]*bold text on a yellow background*.
+[blue,#b0e0e6]+Monospaced blue text on a light blue background+
+[,,2]#Double sized text#.
+---------------------------------------------------------------------
+
+New quotes can be defined by editing asciidoc(1) configuration files.
+See the <<X7,Configuration Files>> section for details.
+
+.Quoted text properties
+- Quoting cannot be overlapped.
+- Different quoting types can be nested.
+- To suppress quoted text formatting place a backslash character
+ immediately in front of the leading quote character(s). In the case
+ of ambiguity between escaped and non-escaped text you will need to
+ escape both leading and trailing quotes, in the case of
+ multi-character quotes you may even need to escape individual
+ characters.
+- A configuration file `[quotes]` entry can be subsequently undefined
+ by setting it to a blank value.
+
+[[X52]]
+Constrained and Unconstrained Quotes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+There are actually two types of quotes:
+
+Constrained quotes
+++++++++++++++++++
+Quote text that must be bounded by white space, for example a phrase
+or a word. These are the most common type of quote and are the ones
+discussed previously.
+
+Unconstrained quotes
+++++++++++++++++++++
+Unconstrained quotes have no boundary constraints and can be placed
+anywhere within inline text. For consistency and to make them easier
+to remember unconstrained quotes are double-ups of the `_`, `*`, `+`
+and `#` constrained quotes:
+
+ __unconstrained emphasized text__
+ **unconstrained strong text**
+ ++unconstrained monospaced text++
+ ##unconstrained unquoted text##
+
+The following example emboldens the letter F:
+
+ **F**ile Open...
+
+[[X50]]
+Inline Passthroughs
+~~~~~~~~~~~~~~~~~~~
+This special text quoting mechanism passes inline text to the output
+document without the usual substitutions. There are two flavors:
+
+\+\++Triple-plus passthrough\+\++::
+ No change is made to the quoted text, it is passed verbatim to the
+ output document.
+
+\$$Double-dollar passthrough$$::
+ Special characters are escaped but no other changes are made.
+ This passthrough can be prefixed with inline attributes.
+
+Superscripts and Subscripts
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Put \^carets on either^ side of the text to be superscripted, put
+\~tildes on either side~ of text to be subscripted. For example, the
+following line:
+
+ e^{amp}#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
+ and ~some sub text~
+
+Is rendered like:
+
+e^{amp}#960;i^+1 = 0. H~2~O and x^10^. Some ^super text^
+and ~some sub text~
+
+Superscripts and subscripts are implemented as <<X52,unconstrained
+quotes>> so they can be escaped with a leading backslash and prefixed
+with with an attribute list.
+
+Line Breaks (HTML/XHTML)
+~~~~~~~~~~~~~~~~~~~~~~~~
+A plus character preceded by at least one space character at the end
+of a line forces a line break. It generates an HTML line break
+(`<br />`) tag. Line breaks are ignored when outputting to DocBook
+since it has no line break element.
+
+Rulers (HTML/XHTML)
+~~~~~~~~~~~~~~~~~~~
+A line of four or more apostrophe characters will generate an HTML
+ruler (`<hr />`) tag. Ignored when generating non-HTML output formats.
+
+Tabs
+~~~~
+By default tab characters input files will translated to 8 spaces. Tab
+expansion is set with the 'tabsize' entry in the configuration file
+`[miscellaneous]` section and can be overridden in the 'include' block macro
+by setting a 'tabsize' attribute in the macro's attribute list. For example:
+
+ include::addendum.txt[tabsize=2]
+
+The tab size can also be set using the attribute command-line option,
+for example `\--attribute=tabsize=4`
+
+Replacements
+~~~~~~~~~~~~
+The following replacements are defined in the default AsciiDoc
+configuration:
+
+ (C) copyright, (TM) trademark, (R) registered trademark,
+ -- em dash, ... ellipsis.
+
+Which are rendered as:
+
+(C) copyright, (TM) trademark, (R) registered trademark,
+-- em dash, ... ellipsis.
+
+The <<X7,Configuration Files>> section explains how to configure your
+own replacements.
+
+Special Words
+~~~~~~~~~~~~~
+Words defined in `[specialwords]` configuration file sections are
+automatically marked up without having to be explicitly notated.
+
+The <<X7,Configuration Files>> section explains how to add and replace
+special words.
+
+
+[[X17]]
+Titles
+------
+Document and section titles can be in either of two formats:
+
+Two line titles
+~~~~~~~~~~~~~~~
+A two line title consists of a title line, starting hard against the
+left margin, and an underline. Section underlines consist a repeated
+character pairs spanning the width of the preceding title (give or
+take up to three characters):
+
+The default title underlines for each of the document levels are:
+
+
+ Level 0 (top level): ======================
+ Level 1: ----------------------
+ Level 2: ~~~~~~~~~~~~~~~~~~~~~~
+ Level 3: ^^^^^^^^^^^^^^^^^^^^^^
+ Level 4 (bottom level): ++++++++++++++++++++++
+
+Examples:
+
+ Level One Section Title
+ -----------------------
+
+ Level 2 Subsection Title
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+
+[[X46]]
+One line titles
+~~~~~~~~~~~~~~~
+One line titles consist of a single line delimited on either side by
+one or more equals characters (the number of equals characters
+corresponds to the section level minus one). Here are some examples
+(levels 2 and 3 illustrate the optional trailing equals characters
+syntax):
+
+ = Document Title (level 0) =
+ == Section title (level 1) ==
+ === Section title (level 2) ===
+ ==== Section title (level 3) ====
+ ===== Section title (level 4) =====
+
+.Note
+- One or more spaces must fall between the title and the delimiters.
+- The trailing title delimiter is optional.
+- The one-line title syntax can be changed by editing the
+ configuration file `[titles]` section `sect0`...`sect4` entries.
+
+
+[[X42]]
+BlockTitles
+-----------
+A BlockTitle element is a single line beginning with a period followed
+by a title. The title is applied to the next Paragraph,
+DelimitedBlock, List, Table or BlockMacro. For example:
+
+........................
+.Notes
+- Note 1.
+- Note 2.
+........................
+
+is rendered as:
+
+.Notes
+- Note 1.
+- Note 2.
+
+
+[[X41]]
+BlockId Element
+---------------
+A 'BlockId' is a single line block element containing a unique
+identifier enclosed in double square brackets. It is used to assign an
+identifier to the ensuing block element for use by referring links. For
+example:
+
+ [[chapter-titles]]
+ Chapter titles can be ...
+
+The preceding example identifies the following paragraph so it can be
+linked from other location, for example with
+`\<<chapter-titles,chapter titles>>`.
+
+'BlockId' elements can be applied to Title, Paragraph, List,
+DelimitedBlock, Table and BlockMacro elements. The BlockId element is
+really just an AttributeList with a special syntax which sets the
+`\{id}` attribute for substitution in the subsequent block's markup
+template.
+
+The 'BlockId' element has the same syntax and serves a similar
+function to the <<X30,anchor inline macro>>.
+
+
+Paragraphs
+----------
+Paragraphs are terminated by a blank line, the end of file, or the
+start of a DelimitedBlock.
+
+Paragraph markup is specified by configuration file `[paradef*]`
+sections. AsciiDoc ships with the following predefined paragraph
+types:
+
+Default Paragraph
+~~~~~~~~~~~~~~~~~
+A Default paragraph (`[paradef-default]`) consists of one or more
+non-blank lines of text. The first line must start hard against the
+left margin (no intervening white space). The processing expectation
+of the default paragraph type is that of a normal paragraph of text.
+
+The 'verse' paragraph <<X23,style>> preserves line boundaries and is
+useful for lyrics and poems. For example:
+
+---------------------------------------------------------------------
+[verse]
+Consul *necessitatibus* per id,
+consetetur, eu pro everti postulant
+homero verear ea mea, qui.
+---------------------------------------------------------------------
+
+Renders:
+
+[verse]
+Consul *necessitatibus* per id,
+consetetur, eu pro everti postulant
+homero verear ea mea, qui.
+
+Literal Paragraph
+~~~~~~~~~~~~~~~~~
+A Literal paragraph (`[paradef-literal]`) consists of one or more
+lines of text, where the first line is indented by one or more space
+or tab characters. Literal paragraphs are rendered verbatim in a
+monospaced font usually without any distinguishing background or
+border. There is no text formatting or substitutions within Literal
+paragraphs apart from Special Characters and Callouts. For example:
+
+---------------------------------------------------------------------
+ Consul *necessitatibus* per id,
+ consetetur, eu pro everti postulant
+ homero verear ea mea, qui.
+---------------------------------------------------------------------
+
+Renders:
+
+ Consul *necessitatibus* per id,
+ consetetur, eu pro everti postulant
+ homero verear ea mea, qui.
+
+[[X28]]
+Admonition Paragraphs
+~~~~~~~~~~~~~~~~~~~~~
+'Tip', 'Note', 'Important', 'Warning' and 'Caution' paragraph
+definitions support the corresponding DocBook admonishment elements --
+just write a normal paragraph but place `NOTE:`, `TIP:`, `IMPORTANT:`,
+`WARNING:` or `CAUTION:` as the first word of the paragraph. For
+example:
+
+ NOTE: This is an example note.
+
+or the alternative syntax:
+
+ [NOTE]
+ This is an example note.
+
+Renders:
+
+NOTE: This is an example note.
+
+TIP: If your admonition is more than a single paragraph use an
+<<X22,admonition block>> instead.
+
+[[X47]]
+Admonition Icons and Captions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+NOTE: Admonition customization with `icons`, `iconsdir`, `icon` and
+`caption` attributes does not apply when generating DocBook output. If
+you are going the DocBook route then the <<X43,a2x(1)>> `--no-icons`
+and `--icons-dir` options can be used to set the appropriate XSL
+Stylesheets parameters.
+
+By default the asciidoc(1) `xhtml11` and `html4` backends generate
+text captions instead of icon image links. To generate links to icon
+images define the <<X45,`icons`>> attribute, for example using the `-a
+icons` command-line option.
+
+The <<X44,`iconsdir`>> attribute sets the location of linked icon
+images.
+
+You can override the default icon image using the `icon` attribute to
+specify the path of the linked image. For example:
+
+ [icon="./images/icons/wink.png"]
+ NOTE: What lovely war.
+
+Use the `caption` attribute to customize the admonition captions (not
+applicable to `docbook` backend). The following example suppresses the
+icon image and customizes the caption of a NOTE admonition (undefining
+the `icons` attribute with `icons=None` is only necessary if
+<<X45,admonition icons>> have been enabled):
+
+ [icons=None, caption="My Special Note"]
+ NOTE: This is my special note.
+
+This subsection also applies to <<X22,Admonition Blocks>>.
+
+
+Delimited Blocks
+----------------
+Delimited blocks are blocks of text enveloped by leading and trailing
+delimiter lines (normally a series of four or more repeated
+characters). The behavior of Delimited Blocks is specified by entries
+in configuration file `[blockdef*]` sections.
+
+Predefined Delimited Blocks
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+AsciiDoc ships with a number of predefined DelimitedBlocks (see the
+`asciidoc.conf` configuration file in the asciidoc(1) program
+directory):
+
+Predefined delimited block underlines:
+
+ CommentBlock: //////////////////////////
+ PassthroughBlock: ++++++++++++++++++++++++++
+ ListingBlock: --------------------------
+ LiteralBlock: ..........................
+ SidebarBlock: **************************
+ QuoteBlock: __________________________
+ ExampleBlock: ==========================
+ Filter blocks: code~~~~~~~~~~~~~~~~~~~~~~
+ source~~~~~~~~~~~~~~~~~~~~
+ music~~~~~~~~~~~~~~~~~~~~~
+
+The <<X56,code>>, <<X57,source>> and <<X58,music>> filter blocks are
+detailed in the <<X59,Filters>> section.
+
+.Default DelimitedBlock substitutions
+`-------------.------------.---------.---------.---------.---------
+ Passthrough Listing Literal Sidebar Quote
+-------------------------------------------------------------------
+Callouts No Yes Yes No No
+Attributes Yes No No Yes Yes
+Inline Macros Yes No No Yes Yes
+Quotes No No No Yes Yes
+Replacements No No No Yes Yes
+Special chars No Yes Yes Yes Yes
+Special words No No No Yes Yes
+-------------------------------------------------------------------
+
+Listing Blocks
+~~~~~~~~~~~~~~
+ListingBlocks are rendered verbatim in a monospaced font, they retain
+line and whitespace formatting and often distinguished by a background
+or border. There is no text formatting or substitutions within Listing
+blocks apart from Special Characters and Callouts. Listing blocks are
+often used for code and file listings.
+
+Here's an example:
+
+ --------------------------------------
+ #include <stdio.h>
+
+ int main() {
+ printf("Hello World!\n");
+ exit(0);
+ }
+ --------------------------------------
+
+Which will be rendered like:
+
+--------------------------------------
+#include <stdio.h>
+
+int main() {
+ printf("Hello World!\n");
+ exit(0);
+}
+--------------------------------------
+
+Literal Blocks
+~~~~~~~~~~~~~~
+LiteralBlocks behave just like LiteralParagraphs except you don't have
+to indent the contents.
+
+LiteralBlocks can be used to resolve list ambiguity. If the following
+list was just indented it would be processed as an ordered list (not
+an indented paragraph):
+
+---------------------------------------------------------------------
+....................
+1. Item 1
+2. Item 2
+....................
+---------------------------------------------------------------------
+
+Renders:
+....................
+1. Item 1
+2. Item 2
+....................
+
+The literal block has a 'verse' <<X23,style>> (useful for lyrics and
+poems). For example:
+
+---------------------------------------------------------------------
+[verse]
+......................................
+Consul *necessitatibus* per id,
+consetetur, eu pro everti postulant
+homero verear ea mea, qui.
+
+Qui in magna commodo, est labitur
+dolorum an. Est ne *magna primis
+adolescens*.
+......................................
+---------------------------------------------------------------------
+
+Renders:
+
+[verse]
+......................................
+Consul *necessitatibus* per id,
+consetetur, eu pro everti postulant
+homero verear ea mea, qui.
+
+Qui in magna commodo, est labitur
+dolorum an. Est ne *magna primis
+adolescens*.
+......................................
+
+SidebarBlocks
+~~~~~~~~~~~~~
+A sidebar is a short piece of text presented outside the narrative
+flow of the main text. The sidebar is normally presented inside a
+bordered box to set it apart from the main text.
+
+The sidebar body is treated like a normal section body.
+
+Here's an example:
+
+---------------------------------------------------------------------
+.An Example Sidebar
+************************************************
+Any AsciiDoc SectionBody element (apart from
+SidebarBlocks) can be placed inside a sidebar.
+************************************************
+---------------------------------------------------------------------
+
+Which will be rendered like:
+
+.An Example Sidebar
+************************************************
+Any AsciiDoc SectionBody element (apart from
+SidebarBlocks) can be placed inside a sidebar.
+************************************************
+
+[[X26]]
+Comment Blocks
+~~~~~~~~~~~~~~
+The contents of CommentBlocks are not processed; they are useful for
+annotations and for excluding new or outdated content that you don't
+want displayed. Here's and example:
+
+---------------------------------------------------------------------
+//////////////////////////////////////////
+CommentBlock contents are not processed by
+asciidoc(1).
+//////////////////////////////////////////
+---------------------------------------------------------------------
+
+See also <<X25,Comment Lines>>.
+
+Passthrough Blocks
+~~~~~~~~~~~~~~~~~~
+PassthroughBlocks are for backend specific markup, text is only
+subject to attribute and macro substitution. PassthroughBlock content
+will generally be backend specific. Here's an example:
+
+---------------------------------------------------------------------
+++++++++++++++++++++++++++++++++++++++
+<table border="1"><tr>
+ <td>Cell 1</td>
+ <td>Cell 2</td>
+</tr></table>
+++++++++++++++++++++++++++++++++++++++
+---------------------------------------------------------------------
+
+Quote Blocks
+~~~~~~~~~~~~
+QuoteBlocks are used for quoted passages of text. 'attribution' and
+'citetitle' named attributes specify the author and source of the
+quote (they are equivalent to positional attribute list entries 1 and
+2 respectively). Both attributes are optional and the block body is
+treated like a SectionBody. For example:
+
+---------------------------------------------------------------------
+[Bertrand Russell, The World of Mathematics (1956)]
+____________________________________________________________________
+A good notation has subtlety and suggestiveness which at times makes
+it almost seem like a live teacher.
+____________________________________________________________________
+---------------------------------------------------------------------
+
+Which is rendered as:
+
+[Bertrand Russell, The World of Mathematics (1956)]
+____________________________________________________________________
+A good notation has subtlety and suggestiveness which at times makes
+it almost seem like a live teacher.
+____________________________________________________________________
+
+In this example unquoted positional attributes have been used, the
+following quoted positional and named attributes are equivalent (if
+the attribute list contained commas then quoting would have been
+mandatory):
+
+ ["Bertrand Russell","The World of Mathematics (1956)"]
+ [attribution="Bertrand Russell",citetitle="The World of Mathematics (1956)"]
+
+You can render poems and lyrics with a combination of Quote and
+Literal blocks. For example:
+
+---------------------------------------------------------------------
+[William Blake,from Auguries of Innocence]
+_____________________________________________________________________
+[verse]
+.....................................................................
+To see a world in a grain of sand,
+And a heaven in a wild flower,
+Hold infinity in the palm of your hand,
+And eternity in an hour.
+.....................................................................
+_____________________________________________________________________
+---------------------------------------------------------------------
+
+Which is rendered as:
+
+[William Blake,from Auguries of Innocence]
+_____________________________________________________________________
+[verse]
+.....................................................................
+To see a world in a grain of sand,
+And a heaven in a wild flower,
+Hold infinity in the palm of your hand,
+And eternity in an hour.
+.....................................................................
+_____________________________________________________________________
+
+[[X48]]
+Example Blocks
+~~~~~~~~~~~~~~
+ExampleBlocks encapsulate the DocBook Example element and are used
+for, well, examples. Example blocks can be titled by preceding them
+with a 'BlockTitle'. DocBook toolchains normally number examples and
+generate a 'List of Examples' backmatter section.
+
+Example blocks are delimited by lines of equals characters and you can
+put any block elements apart from Titles, BlockTitles and Sidebars)
+inside an example block. For example:
+
+---------------------------------------------------------------------
+.An example
+=====================================================================
+Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+adolescens.
+=====================================================================
+---------------------------------------------------------------------
+
+Renders:
+
+.An example
+=====================================================================
+Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+adolescens.
+=====================================================================
+
+The title prefix that is automatically inserted by asciidoc(1) can be
+customized with the `caption` attribute (`xhtml11` and `html4`
+backends). For example
+
+---------------------------------------------------------------------
+[caption="Example 1: "]
+.An example with a custom caption
+=====================================================================
+Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+adolescens.
+=====================================================================
+---------------------------------------------------------------------
+
+[[X22]]
+Admonition Blocks
+~~~~~~~~~~~~~~~~~
+The ExampleBlock definition includes a set of admonition
+<<X23,styles>> (NOTE, TIP, IMPORTANT, WARNING, CAUTION) for generating
+admonition blocks (admonitions containing more than just a
+<<X28,simple paragraph>>). Just precede the ExampleBlock with an
+attribute list containing the admonition style name. For example:
+
+---------------------------------------------------------------------
+[NOTE]
+.A NOTE block
+=====================================================================
+Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+adolescens.
+
+. Fusce euismod commodo velit.
+. Vivamus fringilla mi eu lacus.
+ .. Fusce euismod commodo velit.
+ .. Vivamus fringilla mi eu lacus.
+. Donec eget arcu bibendum
+ nunc consequat lobortis.
+=====================================================================
+---------------------------------------------------------------------
+
+Renders:
+
+[NOTE]
+.A NOTE block
+=====================================================================
+Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+adolescens.
+
+. Fusce euismod commodo velit.
+. Vivamus fringilla mi eu lacus.
+ .. Fusce euismod commodo velit.
+ .. Vivamus fringilla mi eu lacus.
+. Donec eget arcu bibendum
+ nunc consequat lobortis.
+=====================================================================
+
+See also <<X47,Admonition Icons and Captions>>.
+
+
+Lists
+-----
+.List types
+- Bulleted lists. Also known as itemized or unordered lists.
+- Numbered lists. Also called ordered lists.
+- Labeled lists. Sometimes called variable or definition lists.
+- Callout lists (a list of callout annotations).
+
+.List behavior
+- Indentation is optional and does not determine nesting, indentation
+ does however make the source more readable.
+- A nested list must use a different syntax from its parent so that
+ asciidoc(1) can distinguish the start of a nested list.
+- By default lists of the same type can only be nested two deep; this
+ could be increased by defining new list definitions.
+- In addition to nested lists a list item will include immediately
+ following Literal paragraphs.
+- Use <<X15, List Item Continuation>> to include other block elements
+ in a list item.
+- The `listindex` <<X60,intrinsic attribute>> is the current list item
+ index (1..). If this attribute is not inside a list then it's value
+ is the number of items in the most recently closed list. Useful for
+ displaying the number of items in a list.
+
+Bulleted and Numbered Lists
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Bulleted list items start with a dash or an asterisk followed by a
+space or tab character. Bulleted list syntaxes are:
+
+...................
+- List item.
+* List item.
+...................
+
+Numbered list items start with an optional number or letter followed
+by a period followed by a space or tab character. List numbering is
+optional. Numbered list syntaxes are:
+.....................................................................
+. Integer numbered list item.
+1. Integer numbered list item with optional numbering.
+.. Lowercase letter numbered list item.
+a. Lowercase letter numbered list item with optional numbering.
+.....................................................................
+
+Here are some examples:
+---------------------------------------------------------------------
+- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ * Fusce euismod commodo velit.
+ * Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+ adolescens. Sit munere ponderum dignissim et. Minim luptatum et
+ vel.
+ * Vivamus fringilla mi eu lacus.
+ * Donec eget arcu bibendum nunc consequat lobortis.
+- Nulla porttitor vulputate libero.
+ . Fusce euismod commodo velit.
+ . Vivamus fringilla mi eu lacus.
+ .. Fusce euismod commodo velit.
+ .. Vivamus fringilla mi eu lacus.
+ . Donec eget arcu bibendum nunc consequat lobortis.
+- Praesent eget purus quis magna eleifend eleifend.
+ 1. Fusce euismod commodo velit.
+ a. Fusce euismod commodo velit.
+ b. Vivamus fringilla mi eu lacus.
+ c. Donec eget arcu bibendum nunc consequat lobortis.
+ 2. Vivamus fringilla mi eu lacus.
+ 3. Donec eget arcu bibendum nunc consequat lobortis.
+ 4. Nam fermentum mattis ante.
+---------------------------------------------------------------------
+
+Which render as:
+
+- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ * Fusce euismod commodo velit.
+ * Qui in magna commodo, est labitur dolorum an. Est ne magna primis
+ adolescens. Sit munere ponderum dignissim et. Minim luptatum et
+ vel.
+ * Vivamus fringilla mi eu lacus.
+ * Donec eget arcu bibendum nunc consequat lobortis.
+- Nulla porttitor vulputate libero.
+ . Fusce euismod commodo velit.
+ . Vivamus fringilla mi eu lacus.
+ .. Fusce euismod commodo velit.
+ .. Vivamus fringilla mi eu lacus.
+ . Donec eget arcu bibendum nunc consequat lobortis.
+- Praesent eget purus quis magna eleifend eleifend.
+ 1. Fusce euismod commodo velit.
+ a. Fusce euismod commodo velit.
+ b. Vivamus fringilla mi eu lacus.
+ c. Donec eget arcu bibendum nunc consequat lobortis.
+ 2. Vivamus fringilla mi eu lacus.
+ 3. Donec eget arcu bibendum nunc consequat lobortis.
+ 4. Nam fermentum mattis ante.
+
+Vertical Labeled Lists
+~~~~~~~~~~~~~~~~~~~~~~
+Labeled list items consist of one or more text labels followed the
+text of the list item.
+
+An item label begins a line with an alphanumeric character hard
+against the left margin and ends with a double colon `::` or
+semi-colon `;;`.
+
+The list item text consists of one or more lines of text starting on
+the line immediately following the label and can be followed by nested
+List or ListParagraph elements. Item text can be optionally indented.
+
+Here are some examples:
+---------------------------------------------------------------------
+Lorem::
+ Fusce euismod commodo velit.
+
+ Fusce euismod commodo velit.
+
+Ipsum::
+ Vivamus fringilla mi eu lacus.
+ * Vivamus fringilla mi eu lacus.
+ * Donec eget arcu bibendum nunc consequat lobortis.
+Dolor::
+ Donec eget arcu bibendum nunc consequat lobortis.
+ Suspendisse;;
+ A massa id sem aliquam auctor.
+ Morbi;;
+ Pretium nulla vel lorem.
+ In;;
+ Dictum mauris in urna.
+---------------------------------------------------------------------
+
+Which render as:
+
+Lorem::
+ Fusce euismod commodo velit.
+
+ Fusce euismod commodo velit.
+
+Ipsum::
+ Vivamus fringilla mi eu lacus.
+ * Vivamus fringilla mi eu lacus.
+ * Donec eget arcu bibendum nunc consequat lobortis.
+Dolor::
+ Donec eget arcu bibendum nunc consequat lobortis.
+ Suspendisse;;
+ A massa id sem aliquam auctor.
+ Morbi;;
+ Pretium nulla vel lorem.
+ In;;
+ Dictum mauris in urna.
+
+Horizontal Labeled Lists
+~~~~~~~~~~~~~~~~~~~~~~~~
+Horizontal labeled lists differ from vertical labeled lists in that
+the label and the list item sit side-by-side as opposed to the item
+under the label. Item text must begin on the same line as the label
+although you can begin item text on the next line if you follow the
+label with a backslash.
+
+The following horizontal list example also illustrates the omission
+of optional indentation:
+
+---------------------------------------------------------------------
+*Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
+labitur dolorum an. Est ne magna primis adolescens.
+
+ Fusce euismod commodo velit.
+
+*Ipsum*:: Vivamus fringilla mi eu lacus.
+- Vivamus fringilla mi eu lacus.
+- Donec eget arcu bibendum nunc consequat lobortis.
+
+*Dolor*:: \
+ - Vivamus fringilla mi eu lacus.
+ - Donec eget arcu bibendum nunc consequat lobortis.
+
+---------------------------------------------------------------------
+
+Which render as:
+
+*Lorem*:: Fusce euismod commodo velit. Qui in magna commodo, est
+labitur dolorum an. Est ne magna primis adolescens.
+
+ Fusce euismod commodo velit.
+
+*Ipsum*:: Vivamus fringilla mi eu lacus.
+- Vivamus fringilla mi eu lacus.
+- Donec eget arcu bibendum nunc consequat lobortis.
+
+*Dolor*:: \
+ - Vivamus fringilla mi eu lacus.
+ - Donec eget arcu bibendum nunc consequat lobortis.
+
+[WARNING]
+=====================================================================
+- Use vertical labeled lists in preference to horizontal labeled lists
+ -- current PDF toolchains do not make a good job of determining
+ the relative column widths.
+- If you are generating DocBook markup the horizontal labeled lists
+ should not be nested because the 'DocBook XML V4.2' DTD does not
+ permit nested informal tables (although <<X13,DocBook XSL
+ Stylesheets>> process them correctly).
+=====================================================================
+
+Question and Answer Lists
+~~~~~~~~~~~~~~~~~~~~~~~~~
+AsciiDoc comes pre-configured with a labeled list for generating
+DocBook question and answer (Q&A) lists (`??` label delimiter).
+Example:
+
+---------------------------------------------------------------------
+Question one??
+ Answer one.
+Question two??
+ Answer two.
+---------------------------------------------------------------------
+
+Renders:
+
+Question one??
+ Answer one.
+Question two??
+ Answer two.
+
+Glossary Lists
+~~~~~~~~~~~~~~
+AsciiDoc comes pre-configured with a labeled list (`:-` label
+delimiter) for generating DocBook glossary lists. Example:
+
+---------------------------------------------------------------------
+A glossary term:-
+ The corresponding definition.
+A second glossary term:-
+ The corresponding definition.
+---------------------------------------------------------------------
+
+For working examples see the `article.txt` and `book.txt` documents in
+the AsciiDoc `./doc` distribution directory.
+
+NOTE: To generate valid DocBook output glossary lists must be located
+in a glossary section.
+
+Bibliography Lists
+~~~~~~~~~~~~~~~~~~
+AsciiDoc comes with a predefined itemized list (`+` item bullet) for
+generating bibliography entries. Example:
+
+---------------------------------------------------------------------
++ [[[taoup]]] Eric Steven Raymond. 'The Art of UNIX
+ Programming'. Addison-Wesley. ISBN 0-13-142901-9.
++ [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
+ 'DocBook - The Definitive Guide'. O'Reilly & Associates.
+ 1999. ISBN 1-56592-580-7.
+---------------------------------------------------------------------
+
+The `[[[<reference>]]]` syntax is a bibliography entry anchor, it
+generates an anchor named `<reference>` and additionally displays
+`[<reference>]` at the anchor position. For example `[\[[taoup]]]`
+generates an anchor named `taoup` that displays `[taoup]` at the
+anchor position. Cite the reference from elsewhere your document using
+`\<<taoup>>`, this displays a hyperlink (`[taoup]`) to the
+corresponding bibliography entry anchor.
+
+For working examples see the `article.txt` and `book.txt` documents in
+the AsciiDoc `./doc` distribution directory.
+
+NOTE: To generate valid DocBook output bibliography lists must be
+located in a bibliography section.
+
+[[X15]]
+List Item Continuation
+~~~~~~~~~~~~~~~~~~~~~~
+To include subsequent block elements in list items (in addition to
+implicitly included nested lists and Literal paragraphs) place a
+separator line containing a single plus character between the list
+item and the ensuing list continuation element. Multiple block
+elements (excluding section Titles and BlockTitles) may be included in
+a list item using this technique. For example:
+
+Here's an example of list item continuation:
+
+---------------------------------------------------------------------
+1. List item one.
++
+List item one continued with a second paragraph followed by an
+Indented block.
++
+.................
+$ ls *.sh
+$ mv *.sh ~/tmp
+.................
++
+List item one continued with a third paragraph.
+
+2. List item two.
+
+ List item two literal paragraph (no continuation required).
+
+- Nested list (item one).
+
+ Nested list literal paragraph (no continuation required).
++
+Nested list appended list item one paragraph
+
+- Nested list item two.
+---------------------------------------------------------------------
+
+Renders:
+
+1. List item one.
++
+List item one continued with a second paragraph followed by a Listing
+block.
++
+.................
+$ ls *.sh
+$ mv *.sh ~/tmp
+.................
++
+List item one continued with a third paragraph.
+
+2. List item two.
+
+ List item two literal paragraph (no continuation required).
+
+- Nested list (item one).
+
+ Nested list literal paragraph (no continuation required).
++
+Nested list appended list item one paragraph
+
+- Nested list item two.
+
+
+[[X29]]
+List Block
+~~~~~~~~~~
+A List block is a special delimited block containing a list element.
+
+- All elements between in the List Block are part of the preceding
+ list item. In this respect the List block behaves like <<X15,List
+ Item Continuation>> except that list items contained within the
+ block do not require explicit `+` list item continuation lines:
+- The block delimiter is a single line containing two dashes.
+- Any block title or attributes are passed to the first element inside
+ the block.
+
+The List Block is useful for:
+
+1. Lists with long multi-element list items.
+2. Nesting a list within a parent list item (by default nested lists
+ follow the preceding list item).
+
+Here's an example of a nested list block:
+
+---------------------------------------------------------------------
+.Nested List Block
+1. List item one.
++
+This paragraph is part of the preceding list item
++
+--
+a. This list is nested and does not require explicit item continuation.
+
+This paragraph is part of the preceding list item
+
+b. List item b.
+
+This paragraph belongs to list item b.
+--
++
+This paragraph belongs to item 1.
+
+2. Item 2 of the outer list.
+---------------------------------------------------------------------
+
+Renders:
+
+.Nested List Block
+1. List item one.
++
+This paragraph is part of the preceding list item
++
+--
+a. This list is nested and does not require explicit item continuation.
+
+This paragraph is part of the preceding list item
+
+b. List item b.
+
+This paragraph belongs to list item b.
+--
++
+This paragraph belongs to item 1.
+
+2. Item 2 of the outer list.
+
+
+Footnotes
+---------
+The shipped AsciiDoc configuration includes the `\footnote:[<text>]`
+inline macro for generating footnotes. The footnote text can span
+multiple lines. Example footnote:
+
+ A footnote footnote:[An example footnote.]
+
+Which renders:
+
+A footnote footnote:[An example footnote.]
+
+Footnotes are primarily useful when generating DocBook output --
+DocBook conversion programs render footnote outside the primary text
+flow.
+
+
+Indexes
+-------
+The shipped AsciiDoc configuration includes the inline macros for
+generating document index entries.
+
+`\indexterm:[<primary>,<secondary>,<tertiary>]`::
+`\(((<primary>,<secondary>,<tertiary>)))`::
+ This inline macro generates an index term (the <secondary> and
+ <tertiary> attributes are optional). For example
+ `\indexterm:[Tigers,Big cats]` (or, using the alternative syntax
+ `\(((Tigers,Big cats)))`. Index terms that have secondary and
+ tertiary entries also generate separate index terms for the
+ secondary and tertiary entries. The index terms appear in the
+ index, not the primary text flow.
+
+`\indexterm2:[<primary>]`::
+`\((<primary>))`::
+ This inline macro generates an index term that appears in both the
+ index and the primary text flow. The `<primary>` should not be
+ padded to the left or right with white space characters.
+
+For working examples see the `article.txt` and `book.txt` documents in
+the AsciiDoc `./doc` distribution directory.
+
+NOTE: Index entries only really make sense if you are generating
+DocBook markup -- DocBook conversion programs automatically generate
+an index at the point an 'Index' section appears in source document.
+
+
+Callouts
+--------
+Callouts are a mechanism for annotating verbatim text (source code,
+computer output and user input for example). Callout markers are
+placed inside the annotated text while the actual annotations are
+presented in a callout list after the annotated text. Here's an
+example:
+
+---------------------------------------------------------------------
+.MS-DOS directory listing
+.....................................................
+10/17/97 9:04 <DIR> bin
+10/16/97 14:11 <DIR> DOS \<1>
+10/16/97 14:40 <DIR> Program Files
+10/16/97 14:46 <DIR> TEMP
+10/17/97 9:04 <DIR> tmp
+10/16/97 14:37 <DIR> WINNT
+10/16/97 14:25 119 AUTOEXEC.BAT \<2>
+ 2/13/94 6:21 54,619 COMMAND.COM \<2>
+10/16/97 14:25 115 CONFIG.SYS \<2>
+11/16/97 17:17 61,865,984 pagefile.sys
+ 2/13/94 6:21 9,349 WINA20.386 \<3>
+.....................................................
+
+\<1> This directory holds MS-DOS.
+\<2> System startup code for DOS.
+\<3> Some sort of Windows 3.1 hack.
+---------------------------------------------------------------------
+
+Which renders:
+
+.MS-DOS directory listing
+.....................................................................
+10/17/97 9:04 <DIR> bin
+10/16/97 14:11 <DIR> DOS <1>
+10/16/97 14:40 <DIR> Program Files
+10/16/97 14:46 <DIR> TEMP
+10/17/97 9:04 <DIR> tmp
+10/16/97 14:37 <DIR> WINNT
+10/16/97 14:25 119 AUTOEXEC.BAT <2>
+ 2/13/94 6:21 54,619 COMMAND.COM <2>
+10/16/97 14:25 115 CONFIG.SYS <2>
+11/16/97 17:17 61,865,984 pagefile.sys
+ 2/13/94 6:21 9,349 WINA20.386 <3>
+.....................................................................
+
+<1> This directory holds MS-DOS.
+<2> System startup code for DOS.
+<3> Some sort of Windows 3.1 hack.
+
+.Explanation
+- The callout marks are whole numbers enclosed in angle brackets that
+ refer to an item index in the following callout list.
+- By default callout marks are confined to LiteralParagraphs,
+ LiteralBlocks and ListingBlocks (although this is a configuration
+ file option and can be changed).
+- Callout list item numbering is fairly relaxed -- list items can
+ start with `<n>`, `n>` or `>` where `n` is the optional list item
+ number (in the latter case list items starting with a single `>`
+ character are implicitly numbered starting at one).
+- Callout lists should not be nested -- start list items hard against
+ the left margin.
+- If you want to present a number inside angle brackets you'll need to
+ escape it with a backslash to prevent it being interpreted as a
+ callout mark.
+
+NOTE: To include callout icons in PDF files generated by
+<<X43,a2x(1)>> you need to use the `--icons` command-line option.
+
+Implementation Notes
+~~~~~~~~~~~~~~~~~~~~
+Callout marks are generated by the 'callout' inline macro while
+callout lists are generated using the 'callout' list definition. The
+'callout' macro and 'callout' list are special in that they work
+together. The 'callout' inline macro is not enabled by the normal
+'macros' substitutions option, instead it has its own 'callouts'
+substitution option.
+
+The following attributes are available during inline callout macro
+substitution:
+
+`\{index}`::
+ The callout list item index inside the angle brackets.
+`\{coid}`::
+ An identifier formatted like `CO<listnumber>-<index>` that
+ uniquely identifies the callout mark. For example `CO2-4`
+ identifies the fourth callout mark in the second set of callout
+ marks.
+
+The `\{coids}` attribute can be used during callout list item
+substitution -- it is a space delimited list of callout IDs that refer
+to the explanatory list item.
+
+Including callouts in included code
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+You can annotate working code examples with callouts -- just remember
+to put the callouts inside source code comments. This example displays
+the `test.py` source file (containing a single callout) using the
+<<X57,Source Code Highlighter Filter>>:
+
+.AsciiDoc source
+---------------------------------------------------------------------
+ [python]
+ source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ include::test.py[]
+ source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ \<1> Print statement.
+---------------------------------------------------------------------
+
+.Included `test.py` source
+---------------------------------------------------------------------
+print 'Hello World!' # \<1>
+---------------------------------------------------------------------
+
+
+Macros
+------
+Macros are a mechanism for substituting parametrized text into output
+documents.
+
+Macros have a 'name', a single 'target' argument and an 'attribute
+list'. The default syntax is `<name>:<target>[<attributelist>]` (for
+inline macros) and `<name>::<target>[<attributelist>]` (for block
+macros). Here are some examples:
+
+ http://www.methods.co.nz/asciidoc/index.html[Asciidoc home page]
+ include::chapt1.txt[tabsize=2]
+ mailto:srackham@methods.co.nz[]
+
+.Macro behavior
+- `<name>` is the macro name. It can only contain letters, digits or
+ dash characters and cannot start with a dash.
+- The optional `<target>` cannot contain white space characters.
+- `<attributelist>` is a <<X21,list of attributes>> enclosed in square
+ brackets.
+- The attribute list is mandatory even if it contains no attributes.
+- Expansion of non-system macro references can be escaped by
+ prefixing a backslash character.
+- Block macro attribute reference substitution is performed prior to
+ macro expansion.
+- The substitutions performed prior to Inline macro macro expansion
+ are determined by the inline context.
+- Macros are processed in the order they appear in the configuration
+ file(s).
+- Calls to inline macros can be nested inside different inline macros
+ (an inline macro call cannot contain a nested call to itself).
+
+Inline Macros
+~~~~~~~~~~~~~
+Inline Macros occur in an inline element context. Predefined Inline
+macros include 'URLs', 'image' and 'link' macros.
+
+URLs
+^^^^
+Standard http, https, ftp, file, mailto and callto URLs are rendered
+using predefined inline macros.
+
+The default AsciiDoc inline macro syntax is very similar to a URL: all
+you need to do is append an attribute list containing an optional
+caption immediately following the URL. If no caption text is provided
+the URL itself is displayed.
+
+Here are some examples:
+
+ http://www.methods.co.nz/asciidoc/[The AsciiDoc home page]
+ mailto:joe.bloggs@foobar.com[email Joe Bloggs]
+ mailto:joe.bloggs@foobar.com[]
+ callto:joe.bloggs[]
+
+Which are rendered:
+
+http://www.methods.co.nz/asciidoc/[The AsciiDoc home page]
+
+mailto:joe.bloggs@foobar.com[email Joe Bloggs]
+
+mailto:joe.bloggs@foobar.com[]
+
+callto:joe.bloggs[]
+
+TIP: If the `<target>` necessitates space characters they should be
+replaced by `%20`. For example `large%20image.png`.
+
+Internal Cross References
+^^^^^^^^^^^^^^^^^^^^^^^^^
+Two AsciiDoc inline macros are provided for creating hypertext links
+within an AsciiDoc document. You can use either the standard macro
+syntax or the (preferred) alternative.
+
+[[X30]]
+anchor
+++++++
+Used to specify hypertext link targets:
+
+ [[<id>,<xreflabel>]]
+ anchor:<id>[<xreflabel>]
+
+The `<id>` is a unique identifier that must begin with a letter. The
+optional `<xreflabel>` is the text to be displayed by captionless
+'xref' macros that refer to this anchor. The optional `<xreflabel>` is
+only really useful when generating DocBook output. Example anchor:
+
+ [[X1]]
+
+You may have noticed that the syntax of this inline element is the
+same as that of the <<X41,BlockId block element>>, this is no
+coincidence since they are functionally equivalent.
+
+xref
+++++
+Creates a hypertext link to a document anchor.
+
+ <<<id>,<caption>>>
+ xref:<id>[<caption>]
+
+The `<id>` refers to an existing anchor `<id>`. The optional
+`<caption>` is the link's displayed text. Example:
+
+ <<X21,attribute lists>>
+
+If `<caption>` is not specified then the displayed text is
+auto-generated:
+
+- The AsciiDoc `xhtml11` backend displays the `<id>` enclosed in
+ square brackets.
+- If DocBook is produced the DocBook toolchain is responsible for the
+ displayed text which will normally be the referenced figure, table
+ or section title number followed by the element's title text.
+
+Here is an example:
+
+---------------------------------------------------------------------
+[[tiger_image]]
+.Tyger tyger
+image::tiger.png[]
+
+This can be seen in <<tiger_image>>.
+---------------------------------------------------------------------
+
+Linking to Local Documents
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+Hypertext links to files on the local filesystem are specified using
+the 'link' inline macro.
+
+ link:<target>[<caption>]
+
+The 'link' macro generates relative URLs. The link macro `<target>` is
+the target file name (relative to the file system location of the
+referring document). The optional `<caption>` is the link's displayed
+text. If `<caption>` is not specified then `<target>` is displayed.
+Example:
+
+ link:downloads/foo.zip[download foo.zip]
+
+You can use the `<filename>#<id>` syntax to refer to an anchor within
+a target document but this usually only makes sense when targeting
+HTML documents.
+
+Images can serve as hyperlinks using the <<X9,`image` macro>>.
+
+[[X9]]
+Images
+^^^^^^
+Inline images are inserted into the output document using the 'image'
+macro. The inline syntax is:
+
+ image:<target>[<attributes>]
+
+The contents of the image file `<target>` is displayed. To display the
+image its file format must be supported by the target backend
+application. HTML and DocBook applications normally support PNG or JPG
+files.
+
+`<target>` file name paths are relative to the location of the
+referring document.
+
+[[X55]]
+.Image macro attributes
+- The optional first positional attribute list entry specifies the
+ alternative text which is displayed if the output application is
+ unable to process the image file. For example:
+
+ image:images/logo.png[Company Logo]
+
+- The optional `width` and `height` named attributes scale the image
+ size and can be used in any combination. The following example
+ scales the previous example to a height of 32 pixels:
+
+ image:images/logo.png["Company Logo",height=32]
+
+- The optional `link` named attribute is used to link the image to
+ an external document. The following example links a screenshot
+ thumbnail to a full size version:
+
+ image:screen-thumbnail.png[height=32,link="screen.png"]
+
+Block Macros
+~~~~~~~~~~~~
+A Block macro reference must be contained in a single line separated
+either side by a blank line or a block delimiter.
+
+Block macros behave just like Inline macros, with the following
+differences:
+
+- They occur in a block context.
+- The default syntax is `<name>::<target>[<attributelist>]` (two
+ colons, not one).
+- Markup template section names end in `-blockmacro` instead of
+ `-inlinemacro`.
+
+Block Identifier
+^^^^^^^^^^^^^^^^
+The Block Identifier macro sets the `id` attribute and has the same
+syntax as the <<X30,anchor inline macro>> since it performs
+essentially the same function -- block templates employ the `id`
+attribute as a block link target. For example:
+
+ [[X30]]
+
+This is equivalent to the `[id="X30"]` block attribute list.
+
+[[X49]]
+Images
+^^^^^^
+Formal titled images are inserted into the output document using the
+'image' macro. The syntax is:
+
+ image::<target>[<attributes>]
+
+The block `image` macro has the same <<X55,macro attributes>> as its
+<<X9,inline counterpart>>.
+
+Images can be titled by preceding the `image` macro with a
+'BlockTitle'. DocBook toolchains normally number examples and
+generate a 'List of Figures' backmatter section.
+
+For example:
+
+ .Main circuit board
+ image::images/layout.png[J14P main circuit board]
+
+`xhtml11` and `html4` backends precede the title with a `Figure :`
+prefix. You can customize this prefix with the `caption` attribute.
+For example:
+
+ .Main circuit board
+ [caption="Figure 2:"]
+ image::images/layout.png[J14P main circuit board]
+
+[[X25]]
+Comment Lines
+^^^^^^^^^^^^^
+Single lines starting with two forward slashes hard up against the
+left margin are treated as comments and are stripped from the output.
+Comment lines have been implemented as a block macro and are only
+valid in a block context -- they are not treated as comments inside
+paragraphs or delimited blocks. Example comment line:
+
+ // This is a comment.
+
+See also <<X26,Comment Blocks>>.
+
+
+System Macros
+~~~~~~~~~~~~~
+System macros are block macros that perform a predefined task which is
+hardwired into the asciidoc(1) program.
+
+- You can't escape system macros with a leading backslash character
+ (as you can with other macros).
+- The syntax and tasks performed by system macros is built into
+ asciidoc(1) so they don't appear in configuration files. You can
+ however customize the syntax by adding entries to a configuration
+ file `[macros]` section.
+
+Include Macros
+^^^^^^^^^^^^^^
+The `include` and `include1` system macros to include the contents of
+a named file into the source document.
+
+The `include` macro includes a file as if it were part of the parent
+document -- tabs are expanded and system macros processed. The
+contents of `include1` files are not subject to tab expansion or
+system macro processing nor are attribute or lower priority
+substitutions performed. The `include1` macro's main use is to include
+verbatim embedded CSS or scripts into configuration file headers.
+Example:
+
+------------------------------------
+ include::chapter1.txt[tabsize=4]
+------------------------------------
+
+.Include macro behavior
+- If the included file name is specified with a relative path then the
+ path is relative to the location of the referring document.
+- Include macros can appear inside configuration files.
+- Files included from within `DelimitedBlocks` are read to completion
+ to avoid false end-of-block underline termination.
+- File inclusion is limited to a depth of 5 to catch recursive loops.
+- Attribute references are expanded inside the include `target`; if an
+ an attribute is undefined then the included file is silently
+ skipped.
+- The 'tabsize' macro attribute sets the the number of space
+ characters to be used for tab expansion in the included file.
+
+Conditional Inclusion Macros
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Lines of text in the source document can be selectively included or
+excluded from processing based on the the existence (or not) of a
+document attribute. There are two forms of conditional inclusion
+macro usage, the first includes document text between the `ifdef` and
+`endif` macros if a document attribute is defined:
+
+ ifdef::<attribute>[]
+ :
+ endif::<attribute>[]
+
+The second for includes document text between the `ifndef` and `endif`
+macros if the attribute is not defined:
+
+ ifndef::<attribute>[]
+ :
+ endif::<attribute>[]
+
+`<attribute>` is an attribute name which is optional in the trailing
+`endif` macro.
+
+Take a look at the `*.conf` configuration files in the AsciiDoc
+distribution for examples of conditional inclusion macro usage.
+
+.Two types of conditional inclusion
+*********************************************************************
+Conditional inclusion macros are evaluated when they are read, but
+there is another type of conditional inclusion based on attribute
+references, the latter being evaluated when the output file is
+written.
+
+These examples illustrate the two forms of conditional inclusion. The
+only difference between them is that the first is evaluated at program
+load time while the second is evaluated when the output is written:
+
+ ifdef::world[]
+ Hello World!
+ endif::world[]
+
+ {world#}Hello World!
+
+In this example when the `\{world#}` conditional attribute reference
+is evaluates to a zero length string if `world` is defined; if `world`
+is not defined the whole line is dropped.
+
+The subtle difference between the two types of conditional inclusion
+has implications for AsciiDoc configuration files: AsciiDoc has to
+read the configuration files *before* reading the source document,
+this is necessary because the AsciiDoc source syntax is mostly defined
+by the configuration files. This means that any lines of markup
+enveloped by conditional inclusion macros will be included or excluded
+*before* the attribute entries in the AsciiDoc document header are
+read, so setting related attributes in the AsciiDoc source document
+header will have no effect. If you need to control configuration file
+markup inclusion with attribute entries in the AsciiDoc source file
+header you need to use attribute references to control inclusion
+instead of conditional inclusion macros (attribute references are
+substituted at the time the output is written rather than at program
+startup).
+
+*********************************************************************
+
+eval, sys and sys2 System Macros
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+These block macros exhibit the same behavior as their same named
+<<X24, system attribute references>>. The difference is that system
+macros occur in a block macro context whereas system attributes are
+confined to an inline context where attribute substitution is enabled.
+
+The following example displays a long directory listing inside a
+literal block:
+
+ ------------------
+ sys::[ls -l *.txt]
+ ------------------
+
+Template System Macro
+^^^^^^^^^^^^^^^^^^^^^
+The `template` block macro allows the inclusion of one configuration
+file template section within another. The following example includes
+the `[admonitionblock]` section in the `[admonitionparagraph]`
+section:
+
+ [admonitionparagraph]
+ template::[admonitionblock]
+
+.Template macro behavior
+- The `\template::[]` macro is useful for factoring configuration file
+ markup template section content but can be included in any section.
+- `\template::[]` macros cannot be nested.
+- `\template::[]` macro expansion is applied to all sections
+ after all configuration files have been read.
+
+
+Macro Definitions
+~~~~~~~~~~~~~~~~~
+Each entry in the configuration `[macros]` section is a macro
+definition which can take one of the following forms:
+
+`<pattern>=<name>`::
+ Inline macro definition.
+`<pattern>=#<name>`::
+ Block macro definition.
+`<pattern>=+<name>`::
+ System macro definition.
+`<pattern>`::
+ Delete the existing macro with this `<pattern>`.
+
+`<pattern>` is a Python regular expression and `<name>` is the name of
+a markup template. If `<name>` is omitted then it is the value of the
+regular expression match group 'name'.
+
+.Here's what happens during macro substitution
+- Each contextually relevant macro 'pattern' from the `[macros]`
+ section is matched against the input source line.
+- If a match is found the text to be substituted is loaded from a
+ configuration markup template section named like
+ `<name>-inlinemacro` or `<name>-blockmacro` (depending on the macro
+ type).
+- Global and macro attribute list attributes are substituted in the
+ macro's markup template.
+- The substituted template replaces the macro reference in the output
+ document.
+
+
+Tables
+------
+Tables are the most complex AsciiDoc elements and this section is
+quite long. footnote:[The current table syntax is overly complicated
+and unwieldy to edit, hopefully a more usable syntax will appear in
+future versions of AsciiDoc.]
+
+NOTE: AsciiDoc generates nice HTML tables, but the current crop of
+DocBook toolchains render tables with varying degrees of success. Use
+tables only when really necessary.
+
+Example Tables
+~~~~~~~~~~~~~~
+The following annotated examples are all you'll need to start creating
+your own tables.
+
+The only non-obvious thing you'll need to remember are the column stop
+characters:
+
+- Backtick (`) -- align left.
+- Single quote (') -- align right.
+- Period (.) -- align center.
+
+Simple table:
+
+---------------------------------------------------------------------
+ `---`---
+ 1 2
+ 3 4
+ 5 6
+ --------
+---------------------------------------------------------------------
+
+Output:
+
+`---`---
+1 2
+3 4
+5 6
+--------
+
+Table with title, header and footer:
+
+---------------------------------------------------------------------
+ .An example table
+ [grid="all"]
+ '---------.--------------
+ Column 1 Column 2
+ -------------------------
+ 1 Item 1
+ 2 Item 2
+ 3 Item 3
+ -------------------------
+ 6 Three items
+ -------------------------
+---------------------------------------------------------------------
+
+Output:
+
+.An example table
+[grid="all"]
+`-----------.--------------
+Column 1 Column 2
+---------------------------
+1 Item 1
+2 Item 2
+3 Item 3
+---------------------------
+6 Three items
+---------------------------
+
+Four columns totaling 15% of the 'pagewidth', CSV data:
+
+---------------------------------------------------------------------
+[frame="all"]
+````~15
+1,2,3,4
+a,b,c,d
+A,B,C,D
+~~~~~~~~
+---------------------------------------------------------------------
+
+Output:
+
+[frame="all"]
+````~15
+1,2,3,4
+a,b,c,d
+A,B,C,D
+~~~~~~~~
+
+A table with a numeric ruler and externally sourced CSV data:
+
+---------------------------------------------------------------------
+ [frame="all", grid="all"]
+ .15`20`25`20`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ID,Customer Name,Contact Name,Customer Address,Phone
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ include::customers.csv[]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------------------
+
+Renders:
+
+[frame="all", grid="all"]
+.15`20`25`20`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ID,Customer Name,Contact Name,Customer Address,Phone
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+include::customers.csv[]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+AsciiDoc Table Block Elements
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This sub-section details the AsciiDoc table format.
+
+ Table ::= (Ruler,Header?,Body,Footer?)
+ Header ::= (Row+,Underline)
+ Footer ::= (Row+,Underline)
+ Body ::= (Row+,Underline)
+ Row ::= (Data+)
+
+A table is terminated when the table underline is followed by a blank
+line or an end of file. Table underlines which separate table headers,
+bodies and footers should not be followed by a blank line.
+
+Ruler
+^^^^^
+The first line of the table is called the 'Ruler'. The Ruler specifies
+which configuration file table definition to use, column widths,
+column alignments and the overall table width.
+
+There are two ruler formats:
+
+Character ruler::
+ The column widths are determined by the number of table fill
+ characters between column stop characters.
+Numeric ruler::
+ The column widths are specified numerically. If a column width
+ is omitted the previous width is used. In the degenerate case
+ of no widths being specified columns are allocated equal
+ widths.
+
+The ruler format can be summarized as:
+
+ ruler ::= ((colstop,colwidth?,fillchar*)+, fillchar+, tablewidth?
+
+- The 'ruler' starts with a column stop character (designating the
+ start of the first column).
+- Column stop characters specify the start and alignment of each
+ column:
+ * Backtick (`) -- align left.
+ * Single quote (') -- align right.
+ * Period (.) -- align center.
+- In the case of 'fixed' format tables the ruler column widths specify
+ source row data column boundaries.
+- The optional 'tablewidth' is a number representing the size of the
+ output table relative to the 'pagewidth'. If 'tablewidth' is less
+ than one then it is interpreted as a fraction of the page width; if
+ it is greater than one then it is interpreted as a percentage of
+ the page width. If 'tablewidth' is not specified then the table
+ occupies the full 'pagewidth' (numeric rulers) or the relative width
+ of the ruler compared to the 'textwidth' (character rulers).
+
+Row and Data Elements
+^^^^^^^^^^^^^^^^^^^^^
+Each table row consists of a line of text containing the same number
+of 'Data' items as there are columns in the table,
+
+Lines ending in a backslash character are continued on the next line.
+
+Each 'Data' item is an AsciiDoc substitutable string. The substitutions
+performed are specified by the 'subs' table definition entry. Data
+cannot contain AsciiDoc block elements.
+
+The format of the row is determined by the table definition 'format'
+value:
+
+fixed::
+ Row data items are assigned by chopping the row up at ruler column
+ width boundaries.
+
+csv::
+ Data items are assigned the parsed CSV (Comma Separated Values)
+ data.
+
+dsv::
+ The DSV (Delimiter Separated Values) format is a common UNIX tabular
+ text file format.
+ - The separator character is a colon (although this can be set to
+ any letter using the 'separator' table attribute).
+ - Common C-style backslash escapes are supported.
+ - Blank lines are skipped.
+
+Underline
+^^^^^^^^^
+A table 'Underline' consists of a line of three or more 'fillchar'
+characters which are end delimiters for table header, footer and body
+sections.
+
+Attribute List
+^^^^^^^^^^^^^^
+The following optional table attributes can be specified in an
+<<X21,AttributeList>> preceding the table:
+
+separator::
+ The default DSV format colon separator can be changed using the
+ 'separator' attribute. For example: `[separator="|"]`.
+
+frame::
+ Defines the table border and can take the following values: 'topbot'
+ (top and bottom), 'all' (all sides), 'none' and 'sides' (left and
+ right sides). The default value is 'topbot'.
+
+grid::
+ Defines which ruler lines are drawn between table rows and columns.
+ The 'grid' attribute value can be any of the following values:
+ 'none', 'cols', 'rows' and 'all'. The default value is 'none'. For
+ example `[frame="all", grid="none"]`.
+
+format, tablewidth::
+ See <<X37,Markup Attributes>> below.
+
+You can also use an AttributeList to override the following table
+definition and ruler parameters: 'format', 'subs', 'tablewidth'.
+
+[[X37]]
+Markup Attributes
+^^^^^^^^^^^^^^^^^
+The following attributes are automatically available inside table tag
+and markup templates.
+
+cols::
+ The number of columns in the table.
+
+colalign::
+ Column alignment assumes one of three values ('left', 'right' or
+ 'center'). The value is determined by the corresponding ruler column
+ stop character (only valid inside 'colspec', `headdata`, `bodydata`
+ and `footdata` tags).
+
+colwidth::
+ The output column widths are calculated integers (only valid inside
+ 'colspec', `headdata`, `bodydata` and `footdata` tags).
+
+colnumber::
+ The table column number starting at 1 (only valid inside 'colspec',
+ `headdata`, `bodydata` and `footdata` tags).
+
+format::
+ The table definition 'format' value (can be overridden with
+ attribute list entry).
+
+tablewidth::
+ The ruler 'tablewidth' value (can be overridden with attribute list
+ entry).
+
+pagewidth::
+ The 'pagewidth' miscellaneous configuration option.
+
+pageunits::
+ The 'pageunits' miscellaneous configuration option.
+
+The 'colwidth' value is calculated as (`N` is the ruler column width
+number and `M` is the sum of the ruler column widths):
+
+ ( N / M ) * pagewidth
+
+If the ruler 'tablewidth' was specified the column width is multiplied
+again by this value.
+
+There is one exception: character rulers that have no 'pagewidth'
+specified. In this case the 'colwidth' value is calculated as (where
+`N` is the column character width measured on the table ruler):
+
+ ( N / textwidth ) * pagewidth
+
+The following attributes are available to the table markup template:
+
+comspecs::
+ Expands to N substituted 'comspec' tags where N is the number of
+ columns.
+
+headrows, footrows, bodyrows::
+ These references expand to sets of substituted header, footer and
+ body rows as defined by the corresponding row and data configuration
+ parameters.
+
+rows::
+ Experimental attribute (number of source lines in table) available
+ in table markup templates (used by experimental LaTeX backend).
+
+
+[[X1]]
+Manpage Documents
+-----------------
+Sooner or later, if you program for a UNIX environment, you're going
+to have to write a man page.
+
+By observing a couple of additional conventions you can compose
+AsciiDoc files that will translate to a DocBook refentry (man page)
+document. The resulting DocBook file can then be translated to the
+native roff man page format (or other formats).
+
+For example, the `asciidoc.1.txt` file in the AsciiDoc distribution
+`./doc` directory was used to generate both the
+`asciidoc.1.css-embedded.html` HTML file the `asciidoc.1` roff
+formatted `asciidoc(1)` man page.
+
+.Viewing and printing manpage files
+**********************************************************************
+Use the `man(1)` command to view the manpage file (you must include a
+file path even if it's only `./` otherwise `man(1)` will look for the
+file in the system manpage locations):
+
+ $ man ./asciidoc.1
+
+To print a high quality man page to a postscript printer:
+
+ $ groff -mandoc -Tps asciidoc.1 | lpr
+
+**********************************************************************
+
+To find out more about man pages view the `man(7)` manpage
+(`man 7 man` command).
+
+
+Document Header
+~~~~~~~~~~~~~~~
+A document Header is mandatory. The title line contains the man page
+name followed immediately by the manual section number in brackets,
+for example 'ASCIIDOC(1)'. The title name should not contain white
+space and the manual section number is a single digit optionally
+followed by a single character.
+
+The NAME Section
+~~~~~~~~~~~~~~~~
+The first manpage section is mandatory, must be titled 'NAME' and must
+contain a single paragraph (usually a single line) consisting of a
+list of one or more comma separated command name(s) separated from the
+command purpose by a dash character. The dash must have at least one
+white space character on either side. For example:
+
+ printf, fprintf, sprintf - print formatted output
+
+The SYNOPSIS Section
+~~~~~~~~~~~~~~~~~~~~
+The second manpage section is mandatory and must be titled 'SYNOPSIS'.
+
+
+[[X7]]
+Configuration Files
+-------------------
+AsciiDoc source file syntax and output file markup is largely
+controlled by a set of cascading, text based, configuration files. At
+runtime The AsciiDoc default configuration files are combined with
+optional user and document specific configuration files.
+
+Configuration File Format
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Configuration files contain named sections. Each section begins with a
+section name in square brackets []. The section body consists of the
+lines of text between adjacent section headings.
+
+- Section names consist of one or more alphanumeric, underscore or
+ dash characters and cannot begin or end with a dash.
+- Lines starting with a hash character "#" are treated as comments and
+ ignored.
+- Same named sections and section entries override previously loaded
+ sections and section entries (this is sometimes referred to as
+ 'cascading'). Consequently, downstream configuration files need
+ only contain those sections and section entries that need to be
+ overridden.
+
+TIP: When creating custom configuration files you only need to include
+the sections and entries that differ from the default configuration.
+
+TIP: The best way to learn about configuration files is to read the
+default configuration files in the AsciiDoc distribution in
+conjunction with asciidoc(1) output files. You can view configuration
+file load sequence by turning on the asciidoc(1) `-v` (`--verbose`)
+command-line option.
+
+Markup Template Sections
+~~~~~~~~~~~~~~~~~~~~~~~~
+Markup template sections supply backend markup for translating
+AsciiDoc elements. Since the text is normally backend dependent
+you'll find these sections in the backend specific configuration
+files. A markup template section body can contain:
+
+- Backend markup
+- Attribute references
+- System macro calls.
+- A document content placeholder
+
+The document content placeholder is a single | character and is
+replaced by text from the source element. Use the `\{brvbar}`
+attribute reference if you need a literal | character in the template.
+
+Special Sections
+~~~~~~~~~~~~~~~~
+AsciiDoc reserves the following predefined special section names for
+specific purposes:
+
+miscellaneous::
+ Configuration options that don't belong anywhere else.
+attributes::
+ Attribute name/value entries.
+specialcharacters::
+ Special characters reserved by the backend markup.
+tags::
+ Backend markup tags.
+quotes::
+ Definitions for quoted inline character formatting.
+specialwords::
+ Lists of words and phrases singled out for special markup.
+replacements, replacements2::
+ Find and replace substitution definitions.
+specialsections::
+ Used to single out special section names for specific markup.
+macros::
+ Macro syntax definitions.
+titles::
+ Heading, section and block title definitions.
+paradef*::
+ Paragraph element definitions.
+blockdef*::
+ DelimitedBlock element definitions.
+listdef*::
+ List element definitions.
+tabledef*::
+ Table element definitions.
+
+Each line of text in a special section is a 'section entry'. Section
+entries share the following syntax:
+
+'name=value'::
+ The entry value is set to 'value'.
+'name='::
+ The entry value is set to a zero length string.
+'name'::
+ The entry is undefined (deleted from the configuration).
+
+.Section entry behavior
+- All equals characters inside the `name` must be escaped with a
+ backslash character. If you want the `name` to end in a backslash
+ then you need to place two backslashes at the end of the name.
+- `name` and `value` are stripped of leading and trailing white space.
+- Attribute names, tag entry names and markup template section names
+ consist of one or more alphanumeric, underscore or dash characters.
+ Names should not begin or end with a dash.
+- A blank configuration file section (one without any entries) deletes
+ any preceding section with the same name (applies to non-markup
+ template sections).
+
+
+Miscellaneous
+^^^^^^^^^^^^^
+The optional `[miscellaneous]` section specifies the following
+`name=value` options:
+
+newline::
+ Output file line termination characters. Can include any
+ valid Python string escape sequences. The default value is
+ `\r\n` (carriage return, line feed). Should not be quoted or
+ contain explicit spaces (use `\x20` instead). For example:
+
+ $ asciidoc -a 'newline=\n' -b docbook mydoc.txt
+
+outfilesuffix::
+ The default extension for the output file, for example
+ `outfilesuffix=.html`. Defaults to backend name.
+tabsize::
+ The number of spaces to expand tab characters, for example
+ `tabsize=4`. Defaults to 8. A 'tabsize' of zero suppresses tab
+ expansion (useful when piping included files through block
+ filters). Included files can override this option using the
+ 'tabsize' attribute.
+textwidth, pagewidth, pageunits::
+ These global table related options are documented in the
+ <<X4,Table Configuration File Definitions>> sub-section.
+
+NOTE: `[miscellaneous]` configuration file entries can be set using
+the asciidoc(1) `-a` (`--attribute`) command-line option.
+
+Titles
+^^^^^^
+sectiontitle::
+ Two line section title pattern. The entry value is a Python
+ regular expression containing the named group 'title'.
+
+underlines::
+ A comma separated list of document and section title underline
+ character pairs starting with the section level 0 and ending
+ with section level 4 underline. The default setting is:
+
+ underlines="==","--","~~","^^","++"
+
+sect0...sect4::
+ One line section title patterns. The entry value is a Python
+ regular expression containing the named group 'title'.
+
+blocktitle::
+ <<X42,BlockTitle element>> pattern. The entry value is a
+ Python regular expression containing the named group 'title'.
+
+subs::
+ A comma separated list of substitutions that are performed on
+ the document header and section titles. Defaults to 'normal'
+ substitution.
+
+Tags
+^^^^
+The `[tags]` section contains backend tag definitions (one per
+line). Tags are used to translate AsciiDoc elements to backend
+markup.
+
+An AsciiDoc tag definition is formatted like
+`<tagname>=<starttag>|<endtag>`. For example:
+
+ emphasis=<em>|</em>
+
+In this example asciidoc(1) replaces the | character with the
+emphasized text from the AsciiDoc input file and writes the result to
+the output file.
+
+Use the `\{brvbar}` attribute reference if you need to include a | pipe
+character inside tag text.
+
+Attributes Section
+^^^^^^^^^^^^^^^^^^
+The optional `[attributes]` section contains predefined attributes.
+
+If the attribute value requires leading or trailing spaces then the
+text text should be enclosed in double-quote (") characters.
+
+To delete a attribute insert a name only entry in a downstream
+configuration file or use the asciidoc(1) `--attribute=name!`
+command-line option (the attribute name is suffixed with a ! character
+to delete it).
+
+Special Characters
+^^^^^^^^^^^^^^^^^^
+The `[specialcharacters]` section specifies how to escape characters
+reserved by the backend markup. Each translation is specified on a
+single line formatted like:
+
+ special_character=translated_characters
+
+Special characters are normally confined to those that resolve
+markup ambiguity (in the case of SGML/XML markups the ampersand, less
+than and greater than characters). The following example causes all
+occurrences of the `<` character to be replaced by `&lt;`.
+
+ <=&lt;
+
+Quoted Text
+^^^^^^^^^^^
+Quoting is used primarily for text formatting. The `[quotes]` section
+defines AsciiDoc quoting characters and their corresponding backend
+markup tags. Each section entry value is the name of a of a `[tags]`
+section entry. The entry name is the character (or characters) that
+quote the text. The following examples are taken from AsciiDoc
+configuration files:
+
+ [quotes]
+ _=emphasis
+
+ [tags]
+ emphasis=<em>|</em>
+
+You can specify the left and right quote strings separately by
+separating them with a | character, for example:
+
+ ``|''=quoted
+
+Omitting the tag will disable quoting, for example, if you don't want
+superscripts or subscripts put the following in a custom configuration
+file or edit the global `asciidoc.conf` configuration file:
+
+ [quotes]
+ ^=
+ ~=
+
+<<X52,Unconstrained quotes>> are differentiated by prefixing the tag
+name with a hash character, for example:
+
+ __=#emphasis
+
+.Quoted text behavior
+- Quote characters must be non-alphanumeric.
+- To minimize quoting ambiguity try not to use the same quote
+ characters in different quote types.
+
+Special Words
+^^^^^^^^^^^^^
+The `[specialwords]` section is used to single out words and phrases
+that you want to consistently format in some way throughout your
+document without having to repeatedly specify the markup. The name of
+each entry corresponds to a markup template section and the entry
+value consists of a list of words and phrases to be marked up. For
+example:
+
+ [specialwords]
+ strongwords=NOTE: IMPORTANT:
+
+ [strongwords]
+ <strong>{words}</strong>
+
+The examples specifies that any occurrence of `NOTE:` or `IMPORTANT:`
+should appear in a bold font.
+
+Words and word phrases are treated as Python regular expressions: for
+example, the word `^NOTE:` would only match `NOTE:` if appeared at
+the start of a line.
+
+AsciiDoc comes with three built-in Special Word types:
+'emphasizedwords', 'monospacedwords' and 'strongwords', each has a
+corresponding (backend specific) markup template section. Edit the
+configuration files to customize existing Special Words and to add new
+ones.
+
+.Special word behavior
+- Word list entries must be separated by space characters.
+- Word list entries with embedded spaces should be enclosed in quotation (")
+ characters.
+- A `[specialwords]` section entry of the form
+ `name=word1{nbsp}[word2...]` adds words to existing `name` entries.
+- A `[specialwords]` section entry of the form `name` undefines
+ (deletes) all existing `name` words.
+- Since word list entries are processed as Python regular expressions
+ you need to be careful to escape regular expression special
+ characters.
+- By default Special Words are substituted before Inline Macros, this
+ may lead to undesirable consequences. For example the special word
+ `foobar` would be expanded inside the macro call
+ `\http://www.foobar.com[]`. A possible solution is to emphasize
+ whole words only by defining the word using regular expression
+ characters, for example `\bfoobar\b`.
+- If the first matched character of a special word is a backslash then
+ the remaining characters are output without markup i.e. the
+ backslash can be used to escape special word markup. For example
+ the special word `\\?\b[Tt]en\b` will mark up the words `Ten` and
+ `ten` only if they are not preceded by a backslash.
+
+[[X10]]
+Replacements
+^^^^^^^^^^^^
+`[replacements]` and `[replacements2]` configuration file entries
+specify find and replace text and are formatted like:
+
+ find_pattern=replacement_text
+
+The find text can be a Python regular expression; the replace text can
+contain Python regular expression group references.
+
+Use Replacement shortcuts for often used macro references, for
+example (the second replacement allows us to backslash escape the
+macro name):
+
+ NEW!=image:./images/smallnew.png[New!]
+ \\NEW!=NEW!
+
+.Replacement behavior
+- The built-in replacements can be escaped with a backslash.
+- If the find or replace text has leading or trailing spaces then the
+ text should be enclosed in quotation (") characters.
+- Since the find text is processed as a regular expression you need to
+ be careful to escape regular expression special characters.
+- Replacements are performed in the same order they appear in the
+ configuration file replacements section.
+
+[[X27]]
+Configuration File Names and Locations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Configuration files have a `.conf` file name extension; they are
+loaded implicitly (using predefined file names and locations) or
+explicitly (using the asciidoc(1) `-f` (`--conf-file`) command-line
+option).
+
+Implicit configuration files are loaded from the following directories
+in the following order:
+
+1. The `/etc/asciidoc` directory (if it exists).
+2. The directory containing the asciidoc executable.
+3. The user's `$HOME/.asciidoc` directory (if it exists).
+4. The directory containing the AsciiDoc source file.
+
+The following implicit configuration files from each of the above
+locations are loaded in the following order:
+
+1. `asciidoc.conf`
+2. `<backend>.conf`
+3. `<backend>-<doctype>.conf`
+
+Where `<backend>` and `<doctype>` are values specified by the
+asciidoc(1) `-b` (`--backend`) and `-d` (`--doctype`) command-line
+options.
+
+Finally, configuration files named like the source file will be
+automatically loaded if they are found in the source file directory.
+For example if the source file is `mydoc.txt` and the
+`--backend=html4` option is used then asciidoc(1) will look for
+`mydoc.conf` and `mydoc-html4.conf` in that order.
+
+Implicit configuration files that don't exist will be silently
+skipped.
+
+The user can explicitly specify additional configuration files using
+the asciidoc(1) `-f` (`--conf-file`) command-line option. The `-f`
+option can be specified multiple times, in which case configuration
+files will be processed in the order they appear on the command-line.
+
+For example, when we translate our AsciiDoc document `mydoc.txt` with:
+
+ $ asciidoc -f extra.conf mydoc.txt
+
+Configuration files (if they exist) will be processed in the following
+order:
+
+1. First default global configuration files from the asciidoc program
+ directory are loaded:
+
+ asciidoc.conf
+ xhtml11.conf
+
+2. Then, from the users home `~/.asciidoc` directory. This is were
+ you put customization specific to your own asciidoc documents:
+
+ asciidoc.conf
+ xhtml11.conf
+ xhtml11-article.conf
+
+3. Next from the source document project directory (the first three
+ apply to all documents in the directory, the last two are specific
+ to the mydoc.txt document):
+
+ asciidoc.conf
+ xhtml11.conf
+ xhtml11-article.conf
+ mydoc.conf
+ mydoc-xhtml11.conf
+
+4. Finally the file specified by the `-f` command-line option is
+ loaded:
+
+ extra.conf
+
+TIP: Use the asciidoc(1) `-v` (`--verbose`) command-line option to see
+which configuration files are loaded and the order in which they are
+loaded.
+
+
+Document Attributes
+-------------------
+A document attribute is comprised of a 'name' and a textual 'value'
+and is used for textual substitution in AsciiDoc documents and
+configuration files. An attribute reference (an attribute name
+enclosed in braces) is replaced by its corresponding attribute
+value.
+
+There are four sources of document attributes (from highest to lowest
+precedence):
+
+- Command-line attributes.
+- AttributeEntry, AttributeList, Macro and BlockId elements.
+- Configuration file `[attributes]` sections.
+- Intrinsic attributes.
+
+Within each of these divisions the last processed entry takes
+precedence.
+
+IMPORTANT: If an attribute is not defined then the line containing the
+attribute reference is dropped. This property is used extensively in
+AsciiDoc configuration files to facilitate conditional markup
+generation.
+
+
+[[X18]]
+Attribute Entries
+-----------------
+The `AttributeEntry` block element allows document attributes to be
+assigned within an AsciiDoc document. Attribute entries are added to
+the global document attributes dictionary. The attribute name/value
+syntax is a single line like:
+
+ :<name>: <value>
+
+For example:
+
+ :Author Initials: JB
+
+This will set an attribute reference `\{authorinitials}` to the value
+'JB' in the current document.
+
+To delete (undefine) an attribute use the following syntax:
+
+ :<name>!:
+
+.AttributeEntry properties
+- The attribute entry line begins with colon -- no white space allowed
+ in left margin.
+- AsciiDoc converts the `<name>` to a legal attribute name (lower
+ case, alphanumeric and dash characters only -- all other characters
+ deleted). This allows more reader friendly text to be used.
+- Leading and trailing white space is stripped from the `<value>`.
+- If the `<value>` is blank then the corresponding attribute value is
+ set to an empty string.
+- Special characters in the entry `<value>` are substituted. To
+ include special characters use the predefined `\{gt}`, `\{lt}`,
+ `\{amp}` attribute references.
+- Attribute references contained in the entry `<value>` will be
+ expanded.
+- By default AttributeEntry values are substituted for
+ `specialcharacters` and `attributes` (see above), if you want a
+ different AttributeEntry substitution set the `attributeentry-subs`
+ attribute.
+- Attribute entries in the document Header are available for header
+ markup template substitution.
+- Attribute elements override configuration file and intrinsic
+ attributes but do not override command-line attributes.
+
+Here's another example:
+
+---------------------------------------------------------------------
+AsciiDoc User Manual
+====================
+:Author: Stuart Rackham
+:Email: srackham@methods.co.nz
+:Date: April 23, 2004
+:Revision: 5.1.1
+:Key words: linux, ralink, debian, wireless
+:Revision history:
+---------------------------------------------------------------------
+
+Which creates these attributes:
+
+ {author}, {firstname}, {lastname}, {authorinitials}, {email},
+ {date}, {revision}, {keywords}, {revisionhistory}
+
+The preceding example is equivalent to the standard AsciiDoc two line
+document header. Actually it's a little bit different with the
+addition of the `\{keywords}` and `\{revisionhistory}` attributes
+footnote:[The existence of a `\{revisionhistory}` attribute causes a
+revision history file (if it exists) to be included in DocBook
+outputs. If a file named like `\{docname}-revhistory.xml` exists in
+the document's directory then it will be added verbatim to the DocBook
+header (see the `./doc/asciidoc-revhistory.xml` example that comes
+with the AsciiDoc distribution).].
+
+
+[[X21]]
+Attribute Lists
+---------------
+An attribute list is a comma separated list of attribute values. The
+entire list is enclosed in square brackets. Attribute lists are used
+to pass parameters to macros, blocks and inline quotes.
+
+The list consists of zero or more positional attribute values followed
+by zero or more named attribute values. Here are three examples:
+
+ [Hello]
+ [Bertrand Russell, The World of Mathematics (1956)]
+ ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
+
+Attribute lists are evaluated as a list of Python function arguments.
+If this fails or any of the items do not evaluate to a string a number
+or None then all list items are treated as string literals.
+
+.Attribute list properties
+- List attributes take precedence over existing attributes.
+- List attributes can only be referenced in configuration file markup
+ templates and tags, they are not available inside the document.
+- Attribute references are allowed inside attribute lists.
+- If the list contains any named attributes the all string attribute
+ values must be quoted.
+- Setting a named attribute to `None` undefines the attribute.
+- Positional attributes are referred to as `\{1}`,`\{2}`,`\{3}`,...
+- Attribute `\{0}` refers to the entire list (excluding the enclosing
+ square brackets).
+- If an attribute named `options` is present it is processed as a
+ comma separated list of attributes with zero length string values.
+ For example `[options="opt1,opt2,opt3"]` is equivalent to
+ `[opt1="",opt2="",opt2=""]`.
+
+Macro Attribute lists
+~~~~~~~~~~~~~~~~~~~~~
+Macros calls are suffixed with an attribute list. The list may be
+empty but it cannot be omitted. List entries are used to pass
+attribute values to macro markup templates.
+
+AttributeList Element
+~~~~~~~~~~~~~~~~~~~~~
+An attribute list on a line by itself constitutes an 'AttributeList'
+block element, its function is to parametrize the following block
+element. The list attributes are passed to the next block element for
+markup template substitution.
+
+
+Attribute References
+--------------------
+An attribute references is an attribute name (possibly followed by an
+additional parameters) enclosed in braces. When an attribute
+reference is encountered it is evaluated and replaced by its
+corresponding text value. If the attribute is undefined the line
+containing the attribute is dropped.
+
+There are three types of attribute reference: 'Simple', 'Conditional'
+and 'System'.
+
+.Attribute reference behavior
+- You can suppress attribute reference expansion by placing a
+ backslash character immediately in front of the opening brace
+ character.
+- By default attribute references are not expanded in
+ LiteralParagraphs, ListingBlocks or LiteralBlocks.
+
+Simple Attributes References
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Simple attribute references take the form `\{<name>}`. If the
+attribute name is defined its text value is substituted otherwise the
+line containing the reference is dropped from the output.
+
+Conditional Attribute References
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Additional parameters are used in conjunction with the attribute name
+to calculate a substitution value. Conditional attribute references
+take the following forms:
+
+`\{<name>=<value>}`::
+ `<value>` is substituted if the attribute `<name>` is
+ undefined otherwise its value is substituted. `<value>` can
+ contain simple attribute references.
+
+`\{<name>?<value>}`::
+ `<value>` is substituted if the attribute `<name>` is defined
+ otherwise an empty string is substituted. `<value>` can
+ contain simple attribute references.
+
+`\{<name>!<value>}`::
+ `<value>` is substituted if the attribute `<name>` is
+ undefined otherwise an empty string is substituted. `<value>`
+ can contain simple attribute references.
+
+`\{<name>#<value>}`::
+ `<value>` is substituted if the attribute `<name>` is defined
+ otherwise the undefined attribute entry causes the containing
+ line to be dropped. `<value>` can contain simple attribute
+ references.
+
+`\{<name>%<value>}`::
+ `<value>` is substituted if the attribute `<name>` is not
+ defined otherwise the containing line is dropped. `<value>`
+ can contain simple attribute references.
+
+`\{<name>@<regexp>:<value1>[:<value2>]}`::
+ `<value1>` is substituted if the value of attribute `<name>`
+ matches the regular expression `<regexp>` otherwise `<value2>`
+ is substituted. If attribute `<name>` is not defined the
+ containing line is dropped. If `<value2>` is omitted an empty
+ string is assumed. The values and the regular expression can
+ contain simple attribute references. To embed colons in the
+ values or the regular expression escape them with backslashes.
+
+`\{<name>$<regexp>:<value1>[:<value2>]}`::
+ Same behavior as the previous ternary attribute except for
+ the following cases:
+
+ `\{<name>$<regexp>:<value>}`;;
+ Substitutes `<value>` if `<name>` matches `<regexp>`
+ otherwise the result is undefined and the containing
+ line is dropped.
+
+ `\{<name>$<regexp>::<value>}`;;
+ Substitutes `<value>` if `<name>` does not match
+ `<regexp>` otherwise the result is undefined and the
+ containing line is dropped.
+
+Conditional attribute examples
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Conditional attributes are mainly used in AsciiDoc configuration
+files -- see the distribution `.conf` files for examples.
+
+Attribute equality test::
+ If `\{backend}` is `docbook` or `xhtml11` the example evaluates to
+ ``DocBook or XHTML backend'' otherwise it evaluates to ``some other
+ backend'':
+
+ {backend@docbook|xhtml11:DocBook or XHTML backend:some other backend}
+
+Attribute value map::
+ This example maps the `frame` attribute values [`topbot`, `all`,
+ `none`, `sides`] to [`hsides`, `border`, `void`, `vsides`]:
+
+ {frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}
+
+
+[[X24]]
+System Attribute References
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+System attribute references generate the attribute text value by
+executing a predefined action that is parametrized by a single
+argument. The syntax is `{<action>:<argument>}`.
+
+`\{eval:<expression>}`::
+ Substitutes the result of the Python `<expression>`. If
+ `<expression>` evaluates to `None` or `False` the reference is
+ deemed undefined and the line containing the reference is
+ dropped from the output. If the expression evaluates to
+ `True` the attribute evaluates to an empty string. In all
+ remaining cases the attribute evaluates to a string
+ representation of the `<expression>` result.
+
+`\{include:<filename>}`::
+ Substitutes contents of the file named `<filename>`.
+ - The included file is read at the time of attribute
+ substitution.
+ - If the file does not exist a warning is emitted and the line
+ containing the reference is dropped from the output file.
+ - Tabs are expanded based on the current 'tabsize'.
+
+`\{sys:<command>}`::
+ Substitutes the stdout generated by the execution of the shell
+ `<command>`.
+
+`\{sys2:<command>}`::
+ Substitutes the stdout and stderr generated by the execution
+ of the shell `<command>`.
+
+.System reference behavior
+- System attribute arguments can contain non-system attribute
+ references.
+- Closing brace characters inside system attribute arguments must be
+ escaped them with a backslash.
+
+[[X60]]
+Intrinsic Attributes
+--------------------
+Intrinsic attributes are simple attributes that are created
+automatically from AsciiDoc document header parameters, asciidoc(1)
+command-line arguments, execution parameters along with attributes
+defined in the default configuration files. Here's the list of
+predefined intrinsic attributes:
+
+ {asciidoc-dir} the asciidoc(1) application directory
+ {asciidoc-version} the version of asciidoc(1)
+ {author} author's full name
+ {authored} empty string '' if {author} or {email} defined,
+ {authorinitials} author initials (from document header)
+ {backend-<backend>} empty string ''
+ {<backend>-<doctype>} empty string ''
+ {backend} document backend specified by `-b` option
+ {basebackend-<base>} empty string ''
+ {basebackend} html or docbook
+ {brvbar} broken vertical bar (|) character
+ {date} document date (from document header)
+ {docname} document file name without extension
+ {doctitle} document title (from document header)
+ {doctype-<doctype>} empty string ''
+ {doctype} document type specified by `-d` option
+ {email} author's email address (from document header)
+ {empty} empty string ''
+ {filetype-<fileext>} empty string ''
+ {filetype} output file name file extension
+ {firstname} author first name (from document header)
+ {gt} greater than (>) character
+ {id} running block id generated by BlockId elements
+ {indir} document input directory name (note 1)
+ {infile} input file name (note 1)
+ {lastname} author last name (from document header)
+ {listindex} the list index (1..) of the most recent list item
+ {localdate} the current date
+ {localtime} the current time
+ {lt} less than (<) character
+ {manname} manpage name (defined in NAME section)
+ {manpurpose} manpage (defined in NAME section)
+ {mantitle} document title minus the manpage volume number
+ {manvolnum} manpage volume number (1..8) (from document header)
+ {middlename} author middle name (from document header)
+ {outdir} document output directory name (note 1)
+ {outfile} output file name (note 1)
+ {revision} document revision number (from document header)
+ {sectnum} section number (in section titles)
+ {title} section title (in titled elements)
+ {user-dir} the ~/.asciidoc directory (if it exists)
+ {verbose} defined as '' if --verbose command option specified
+
+.NOTES
+1. Intrinsic attributes are global so avoid defining custom attributes
+ with the same names.
+
+2. `\{infile}`, `\{outdir}`, `\{infile}`, `\{indir}` attributes are
+ effectively read-only (you can set them but it won't affect the
+ input or output file paths).
+
+3. See also the <<X33,xhtml11>> subsection for attributes that relate
+ to AsciiDoc XHTML file generation.
+
+4. The entries that translate to blank strings are designed to be used
+ for conditional text inclusion. You can also use the `ifdef`,
+ `ifndef` and `endif` System macros for conditional inclusion.
+ footnote:[Conditional inclusion using `ifdef` and `ifndef` macros
+ differs from attribute conditional inclusion in that the former
+ occurs when the file is read while the latter occurs when the
+ contents are written.]
+
+
+Block Element Definitions
+-------------------------
+The syntax and behavior of Paragraph, DelimitedBlock, List and Table
+block elements is determined by block definitions contained in
+<<X7,AsciiDoc configuration file>> sections.
+
+Each definition consists of a section title followed by one or more
+section entries. Each entry defines a block parameter controlling some
+aspect of the block's behavior. Here's an example:
+
+---------------------------------------------------------------------
+[blockdef-listing]
+delimiter=^-{4,}$
+template=listingblock
+presubs=specialcharacters,callouts
+---------------------------------------------------------------------
+
+AsciiDoc Paragraph, DelimitedBlock, List and Table block elements
+share a common subset of configuration file parameters:
+
+delimiter::
+ A Python regular expression that matches the first line of a block
+ element -- in the case of DelimitedBlocks it also matches the last
+ line. Table elements don't have an explicit delimiter -- they
+ synthesize their delimiters at runtime.
+
+template::
+ The name of the configuration file markup template section that will
+ envelope the block contents. The pipe | character is substituted for
+ the block contents. List elements use a set of (list specific) tag
+ parameters instead of a single template.
+
+options::
+ A comma delimited list of element specific option names.
+
+subs, presubs, postsubs::
+ * 'presubs' and 'postsubs' are lists of comma separated substitutions that are
+ performed on the block contents. 'presubs' is applied first,
+ 'postsubs' (if specified) second.
+
+ * 'subs' is an alias for 'presubs'.
+
+ * If a 'filter' is allowed (Paragraphs and DelimitedBlocks) and has
+ been specified then 'presubs' and 'postsubs' substitutions are
+ performed before and after the filter is run respectively.
+
+ * Allowed values: 'specialcharacters', 'quotes', 'specialwords',
+ 'replacements', 'macros', 'attributes', 'callouts'.
+
+ * The following composite values are also allowed:
+
+ 'none';;
+ No substitutions.
+ 'normal';;
+ The following substitutions:
+ 'specialcharacters','quotes','attributes','specialwords',
+ 'replacements','macros','passthroughs'.
+ 'verbatim';;
+ 'specialcharacters' and 'callouts' substitutions.
+
+ * 'normal' and 'verbatim' substitutions can be redefined by with
+ `subsnormal` and `subsverbatim` entries in a configuration file
+ `[misc]` section.
+
+ * The substitutions are processed in the order in which they are
+ listed and can appear more than once.
+
+filter::
+ This optional entry specifies an executable shell command for
+ processing block content (Paragraphs and DelimitedBlocks). The
+ filter command can contain attribute references.
+
+posattrs::
+ Optional comma separated list of positional attribute names. This
+ list maps positional attributes (in the block's <<X21,attribute
+ list>>) to named block attributes. The following example, from the
+ QuoteBlock definition, maps the first and section positional
+ attributes:
+
+ posattrs=attribution,citetitle
+
+style::
+ This optional parameter specifies the default style name.
+
+
+<stylename>-style::
+ Optional style definition (see <<X23,Styles>> below).
+
+The following block parameters behave like document attributes and can
+be set in block attribute lists and style definitions: 'template',
+'options', 'subs', 'presubs', 'postsubs', 'filter'.
+
+[[X23]]
+Styles
+~~~~~~
+A style is a set of block attributes bundled as a single named
+attribute. The following example defines a style named 'verbatim':
+
+ verbatim-style=template="literalblock",subs="verbatim",font="monospaced"
+
+All style parameter names must be suffixed with `-style` and the style
+parameter value is in the form of a list of <<X21,named attributes>>.
+
+Paragraphs
+~~~~~~~~~~
+Paragraph translation is controlled by `[paradef*]` configuration file
+section entries. Users can define new types of paragraphs and modify
+the behavior of existing types by editing AsciiDoc configuration
+files.
+
+Here is the shipped Default paragraph definition:
+
+--------------------------------------------------------------------
+[paradef-default]
+delimiter=(?P<text>\S.*)
+template=paragraph
+--------------------------------------------------------------------
+
+The Default paragraph definition has a couple of special properties:
+
+1. It must exist and be defined in a configuration file section named
+ `[paradef-default]`.
+2. Irrespective of its position in the configuration files default
+ paragraph document matches are attempted only after trying all
+ other paragraph types.
+
+Paragraph specific block parameter notes:
+
+delimiter::
+ This regular expression must contain the named group 'text' which
+ matches the text on the first line. Paragraphs are terminated by a
+ blank line, the end of file, or the start of a DelimitedBlock.
+
+options::
+ The only allowable option is 'listelement'. The 'listelement'
+ option specifies that paragraphs of this type will automatically be
+ considered part of immediately preceding list items.
+
+.Paragraph processing proceeds as follows:
+1. The paragraph text is aligned to the left margin.
+2. Optional 'presubs' inline substitutions are performed on the
+ paragraph text.
+3. If a filter command is specified it is executed and the paragraph
+ text piped to its standard input; the filter output replaces the
+ paragraph text.
+4. Optional 'postsubs' inline substitutions are performed on the
+ paragraph text.
+5. The paragraph text is enveloped by the paragraph's markup template
+ and written to the output file.
+
+Delimited Blocks
+~~~~~~~~~~~~~~~~
+DelimitedBlock specific block definition notes:
+
+options::
+ Allowed values are:
+
+ 'sectionbody';;
+ The block contents are processed as a SectionBody.
+
+ 'skip';;
+ The block is treated as a comment (see 'CommentBlocks').
+
+ 'list';;
+ The block is a <<X29,list block>>.
+
+'presubs', 'postsubs' and 'filter' entries are meaningless when
+'sectionbody', 'skip' or 'list' options are set.
+
+DelimitedBlock processing proceeds as follows:
+
+1. Optional 'presubs' substitutions are performed on the block
+ contents.
+2. If a filter is specified it is executed and the block's contents
+ piped to its standard input. The filter output replaces the block
+ contents.
+3. Optional 'postsubs' substitutions are performed on the block
+ contents.
+4. The block contents is enveloped by the block's markup template and
+ written to the output file.
+
+TIP: Attribute expansion is performed on the block filter command
+before it is executed, this is useful for passing arguments to the
+filter.
+
+Lists
+~~~~~
+List behavior and syntax is determined by `[listdef*]` configuration
+file sections. The user can change existing list behavior and add new
+list types by editing configuration files.
+
+List specific block definition notes:
+
+type::
+ This is either 'bulleted','numbered','labeled' or 'callout'.
+
+delimiter::
+ A Python regular expression that matches the first line of a
+ list element entry. This expression must contain the named
+ group 'text' which matches text in the first line.
+
+subs::
+ Substitutions that are performed on list item text and terms.
+
+listtag::
+ The name of the tag that envelopes the List.
+
+itemtag::
+ The name of the tag that envelopes the ListItem.
+
+texttag::
+ The name of the tag that envelopes the list item text.
+
+labeltag::
+ The name of the tag that envelopes a variable list label.
+
+entrytag::
+ The name of the tag that envelopes a labeled list entry.
+
+The tag entries map the AsciiDoc list structure to backend markup; see
+the AsciiDoc distribution `.conf` configuration files for examples.
+
+Tables
+~~~~~~
+Table behavior and syntax is determined by `[tabledef*]` configuration
+file sections. The user can change existing list behavior and add new
+list types by editing configuration files.
+
+Table specific block definition notes:
+
+fillchar::
+ A single character that fills table ruler and underline
+ lines.
+
+subs::
+ Substitutions performed on table data items.
+
+format::
+ The source row data format ('fixed', 'csv' or 'dsv').
+
+comspec::
+ The table 'comspec' tag definition.
+
+headrow, footrow, bodyrow::
+ Table header, footer and body row tag definitions. 'headrow' and
+ 'footrow' table definition entries default to 'bodyrow' if
+ they are undefined.
+
+headdata, footdata, bodydata::
+ Table header, footer and body data tag definitions. 'headdata' and
+ 'footdata' table definition entries default to 'bodydata' if they
+ are undefined.
+
+[[X4]]
+Table behavior is also influenced by the following `[miscellaneous]`
+configuration file entries:
+
+textwidth::
+ The page width (in characters) of the source text. This setting is
+ compared to the the table ruler width when calculating the relative
+ size of character ruler tables on the output page.
+
+pagewidth::
+ This integer value is the printable width of the output media. Used
+ to calculate 'colwidth' and 'tablewidth' substitution values.
+
+pageunits::
+ The units of width in output markup width attribute values.
+
+.Table definition behavior
+- The output markup generation is specifically designed to work with
+ the HTML and CALS (DocBook) table models, but should be adaptable to
+ most XML table schema.
+- Table definitions can be ``mixed in'' from multiple cascading
+ configuration files.
+- New table definitions inherit the default table definition
+ ('[tabledef-default]') so you only need to override those conf file
+ entries that require modification when defining a new table type.
+
+
+[[X59]]
+Filters
+-------
+Filters are external shell commands used to process Paragraph and
+DelimitedBlock content; they are specified in configuration file
+Paragraph and DelimitedBlock definitions.
+
+There's nothing special about the filters, they're just standard UNIX
+filters: they read text from the standard input, process it, and write
+to the standard output.
+
+Attribute substitution is performed on the filter command prior to
+execution -- attributes can be used to pass parameters from the
+AsciiDoc source document to the filter.
+
+WARNING: Filters can potentially generate unsafe output. Before
+installing a filter you should verify that it can't be coerced into
+generating malicious output or exposing sensitive information.
+
+NOTE: Filter functionality is currently only available on POSIX
+platforms (this includes Cygwin).
+
+Filter Search Paths
+~~~~~~~~~~~~~~~~~~~
+If the filter command does not specify a directory path then
+asciidoc(1) searches for the command:
+
+- First it looks in the user's `$HOME/.asciidoc/filters` directory.
+- Next the `/etc/asciidoc/filters` directory is searched.
+- Then it looks in the asciidoc(1) `./filters` directory.
+- Finally it relies on the executing shell to search the environment
+ search path (`$PATH`).
+
+Filter Configuration Files
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+Filters are normally accompanied by a configuration file
+containing a filter Paragraph or filter DelimitedBlock
+definition and corresponding markup templates.
+
+By convention delimiters belonging to DelimitedBlock filters
+distributed with AsciiDoc consist of a word (normally a noun
+identifying the block content) followed by four or more tilde
+characters.
+
+asciidoc(1) auto-loads all `.conf` files found in the filter search
+paths (see previous section).
+
+[[X56]]
+Code Filter
+~~~~~~~~~~~
+AsciiDoc comes with a simple minded for highlighting source code
+keywords and comments. See also the
+`./filters/code-filter-readme.txt` file.
+
+NOTE: This filter primarily to demonstrate how to write a filter --
+it's much to simplistic to be passed off as a code syntax highlighter.
+If you want a full featured multi-language highlighter use the
+<<X57,Source Code Highlighter Filter>>.
+
+ .Code filter example
+ [python]
+ code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ''' A multi-line
+ comment.'''
+ def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+ code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Outputs:
+
+.Code filter example
+[python]
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+''' A multi-line
+ comment.'''
+def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[[X57]]
+Source Code Highlighter Filter
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+A
+http://www.methods.co.nz/asciidoc/source-highlight-filter.html[source
+code highlighter filter] can be found in the AsciiDoc distribution
+`./filters` directory. It uses
+http://www.gnu.org/software/src-highlite/[GNU source-highlight] to
+generate nicely formatted source code for most common programming
+languages.
+
+[[X58]]
+Music Filter
+~~~~~~~~~~~~
+A http://www.methods.co.nz/asciidoc/music-filter.html[music filter] is
+included in the distribution `./filters` directory. It translates
+music in http://lilypond.org/[LilyPond] or
+http://abcnotation.org.uk/[ABC] notation to standard Western classical
+notation in the form of a trimmed PNG image which is automatically
+inserted into the output document.
+
+
+[[X12]]
+Converting DocBook to other file formats
+----------------------------------------
+DocBook files are validated, parsed and translated by a combination of
+applications collectively called a DocBook 'tool chain'. The function
+of a tool chain is to read the DocBook markup (produced by AsciiDoc)
+and transform it to a presentation format (for example HTML, PDF, HTML
+Help).
+
+A wide range of user output format requirements coupled with a choice
+of available tools and stylesheets results in many valid tool chain
+combinations.
+
+The DocBook toolchain currently used for processing AsciiDoc
+documentation is <<X40,xsltproc(1)>>, <<X14,FOP>> and <<X13,DocBook
+XSL Stylesheets>>. These tools are freely available for Linux and
+Windows systems.
+
+.Why Generate HTML via DocBook?
+**********************************************************************
+AsciiDoc produces nicely styled HTML directly without requiring a
+DocBook toolchain but there are also advantages in going the DocBook
+route:
+
+- HTML from DocBook includes automatically generated indexes, tables
+ of contents, footnotes, lists of figures and tables.
+- DocBook toolchains can also (optionally) generate separate (chunked)
+ linked HTML pages for each document section.
+- Toolchain processing performs link and document validity checks.
+
+On the other hand, HTML output directly from AsciiDoc is much faster,
+can be used in situations where there is no suitable DocBook toolchain
+and can produce highly customized output (see the
+http://www.methods.co.nz/asciidoc/[AsciiDoc website] for example).
+
+**********************************************************************
+
+If you require output formats other than HTML you would feed
+AsciiDoc's DocBook output to a DocBook toolchain. The distributed PDF
+documents have been generated in this way.
+
+The toolchain processing steps are:
+
+. Convert AsciiDoc (`\*.txt`) documents to DocBook XML (`*.xml`)
+ using AsciiDoc.
+. Convert DocBook XML documents to HTML, XSL-FO or HTML Help files
+ using <<X13,DocBook XSL Stylesheets>> and the `xsltproc(1)` XML
+ parser.
+. Convert the XSL-FO (`\*.fo`) files to PDF using FOP and HTML Help
+ source (`\*.hhp`) files to HTML Help (`*.chm`) files using the
+ Microsoft HTML Help Compiler.
+
+TIP: These steps can be automated by using the AsciiDoc <<X43,a2x(1)>>
+toolchain wrapper command.
+
+.Lazy DocBook Conversion
+**********************************************************************
+Depending on your Linux distribution toolchain installation can be a
+mission for users used to a GUI environment, even more so under
+Microsoft Windows. So you may like to try the
+http://www.xmlmind.com/foconverter/[XMLmind FO Converter], it contains
+a GUI 'XSL Utility' which makes a creditable job of converting
+AsciiDoc generated DocBook files to RTF, HTML and Open Document
+formats. The 'FO Converter Personal Edition' can be used free of
+charge and a Windows installer is available and there is also a UNIX
+version. Thanks to Matthew Marshall for this tip.
+
+**********************************************************************
+
+[[X43]]
+a2x Toolchain Wrapper
+~~~~~~~~~~~~~~~~~~~~~
+One of the biggest hurdles for new users seems to be using a DocBook
+XML toolchain. a2x(1) can help -- it's a toolchain wrapper command that
+will generate XHTML (chunked and unchunked), PDF, man page, HTML Help
+and text file outputs from an AsciiDoc text file. a2x(1) does all the
+grunt work associated with generating and sequencing the toolchain
+commands and managing intermediate and output files. a2x(1) also
+optionally deploys admonition and navigation icons and a CSS
+stylesheet. See the `a2x(1)` man page for more details. All you need
+is <<X40,xsltproc(1)>>, <<X13,DocBook XSL Stylesheets>> and optionally
+<<X14,FOP>> (if you want PDF) or lynx(1) (if you want text).
+
+The following example generates `doc/quickstart.pdf` from the AsciiDoc
+`doc/quickstart.txt` source file:
+
+ $ a2x -f pdf --icons doc/quickstart.txt
+
+See the a2x(1) man page for details.
+
+TIP: Use the `--verbose` command-line option to view executed
+toolchain commands.
+
+
+Toolchain Components
+~~~~~~~~~~~~~~~~~~~~
+AsciiDoc::
+ Converts AsciiDoc (`\*.txt`) files to DocBook XML (`*.xml`) files.
+
+[[X13]]
+http://docbook.sourceforge.net/projects/xsl/[DocBook XSL Stylesheets]::
+ These are a set of XSL stylesheets containing rules for converting
+ DocBook XML documents to HTML, XSL-FO, manpage and HTML Help
+ files. The stylesheets are used in conjunction with an XML parser
+ such as `xsltproc(1)`.
+
+[[X40]]
+http://www.xmlsoft.org[xsltproc]::
+ `xsltproc` is a command line XML parser for applying XSLT
+ stylesheets (in our case the DocBook XSL Stylesheets) to XML
+ documents.
+
+FOP::
+ The Apache Formatting Objects Processor converts XSL-FO (`*.fo`)
+ files to PDF files (see the <<X14,FOP section>>).
+
+Microsoft Help Compiler::
+ The Microsoft HTML Help Compiler (`hhc.exe`) is a command-line
+ tool that converts HTML Help source files to a single HTML Help
+ (`*.chm`) file. It runs on MS Windows platforms and can be
+ downloaded from http://www.microsoft.com[].
+
+[[X31]]
+AsciiDoc DocBook XSL Drivers
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+You will have noticed that the distributed PDF, HTML and HTML Help
+documentation files (for example `./doc/asciidoc.html`) are not the
+plain outputs produced using the default DocBook XSL Stylesheets
+configuration. This is because they have been processed using
+customized DocBook XSL Stylesheet drivers along with (in the case of
+HTML outputs) the custom `./stylesheets/docbook.css` CSS stylesheet.
+
+You'll find the customized DocBook XSL drivers along with additional
+documentation in the distribution `./docbook-xsl` directory. The
+examples that follow are executed from the distribution documentation
+(`./doc`) directory.
+
+`common.xsl`::
+ Shared driver parameters. This file is not used directly but is
+ included in all the following drivers.
+
+`chunked.xsl`::
+ Generate chunked XHTML (separate HTML pages for each document
+ section) in the `./doc/chunked` directory. For example:
+
+ $ python ../asciidoc.py -b docbook asciidoc.txt
+ $ xsltproc --nonet ../docbook-xsl/chunked.xsl asciidoc.xml
+
+`fo.xsl`::
+ Generate XSL Formatting Object (`*.fo`) files for subsequent PDF
+ file generation using FOP. For example:
+
+ $ python ../asciidoc.py -b docbook article.txt
+ $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
+ $ fop.sh article.fo article.pdf
+
+`htmlhelp.xsl`::
+ Generate Microsoft HTML Help source files for the MS HTML Help
+ Compiler in the `./doc/htmlhelp` directory. This example is run on
+ MS Windows from a Cygwin shell prompt:
+
+ $ python ../asciidoc.py -b docbook asciidoc.txt
+ $ xsltproc --nonet ../docbook-xsl/htmlhelp.xsl asciidoc.xml
+ $ c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe htmlhelp.hhp
+
+`manpage.xsl`::
+ Generate a `roff(1)` format UNIX man page from a DocBook XML
+ 'refentry' document. This example generates an `asciidoc.1` man
+ page file:
+
+ $ python ../asciidoc.py -d manpage -b docbook asciidoc.1.txt
+ $ xsltproc --nonet ../docbook-xsl/manpage.xsl asciidoc.1.xml
+
+`xhtml.xsl`::
+ Convert a DocBook XML file to a single XHTML file. For example:
+
+ $ python ../asciidoc.py -b docbook asciidoc.txt
+ $ xsltproc --nonet ../docbook-xsl/xhtml.xsl asciidoc.xml > asciidoc.html
+
+If you want to see how the complete documentation set is processed
+take a look at the A-A-P script `./doc/main.aap`.
+
+
+[[X14]]
+FOP
+~~~
+XSL Stylesheets can be used to generate FO (Formatting Object) files,
+which in turn can be used to produce PDF files using the Apache
+Formatting Object Processor program (FOP). The FOP home page is at
+http://xml.apache.org/fop/[].
+
+As of version 0.20.5 installation and configuration of FOP is a manual
+process. You also need a working Java Runtime to run FOP. You'll find
+FOP and Java installation information in the appendices.
+
+TIP: Once you've got FOP installed use the AsciiDoc <<X43,a2x(1)>> toolchain
+wrapper to generate PDF files from AsciiDoc source.
+
+
+Generating Plain Text Files
+---------------------------
+AsciiDoc does not have a text backend (for most purposes AsciiDoc
+source text is fine), however you can convert AsciiDoc text files to
+formatted text using the AsciiDoc <<X43,a2x(1)>> toolchain wrapper
+utility.
+
+
+XML and Character Sets
+----------------------
+The default XML character set `UTF-8` is used when AsciiDoc generates
+DocBook files but this can be changed by setting the `xmldecl` entry
+in the `[attributes]` section of the `docbook.conf` file or by
+composing your own configuration file `[header]` section).
+
+TIP: If you get an 'undefined entity' error when processing DocBook
+files you'll may find that you've used an undefined HTML character
+entity. An easy (although inelegant) fix is to use the character's
+character code instead of its symbolic name (for example use `&#160;`
+instead of `&nbsp;`).
+
+If your system has been configured with an XML catalog you may find a
+number of entity sets are already automatically included.
+
+PDF Fonts
+~~~~~~~~~
+The Adobe PDF Specification states that the following 14 fonts should
+be available to every PDF reader: Helvetica (normal, bold, italic,
+bold italic), Times (normal, bold, italic, bold italic), Courier
+(normal, bold, italic, bold italic), Symbol and ZapfDingbats.
+Non-standard fonts should be embedded in the distributed document.
+
+
+[[X36]]
+Help Commands
+-------------
+The asciidoc(1) command has a `\--help` option which prints help topics
+to stdout. The default topic summarizes asciidoc(1) usage:
+
+ $ asciidoc --help
+
+To print a list of help topics:
+
+ $ asciidoc --help=topics
+
+To print a help topic specify the topic name as a command argument.
+Help topic names can be shortened so long as they are not ambiguous.
+Examples:
+
+ $ asciidoc --help=manpage
+ $ asciidoc -hm # Short version of previous example.
+ $ asciidoc --help=syntax
+ $ asciidoc -hs # Short version of previous example.
+
+Customizing Help
+~~~~~~~~~~~~~~~~
+To change, delete or add your own help topics edit a `help.conf` file.
+The <<X27,file location>> will depend on whether you want the topics
+to apply to all users, to a single user or to a single project.
+
+Help topics are stored `help.conf` text files. The help topic files
+have the same named section format as other <<X7,configuration
+files>>. The `help.conf` files are stored in the same locations and
+loaded in the same order as other configuration files.
+
+When the a `\--help` command-line option is specified AsciiDoc loads
+the `help.conf` files and then prints the contents of the section
+whose name matches the help topic name. If a topic name is not
+specified `default` is used. If a matching help file section is not
+found a list of available topics is printed.
+
+
+Tips and Tricks
+---------------
+
+Know Your Editor
+~~~~~~~~~~~~~~~~
+Writing AsciiDoc documents will be a whole lot more pleasant if you
+know your favorite text editor. Learn how to indent and reformat text
+blocks, paragraphs, lists and sentences. <<X20,Tips for 'vim' users>>
+follow.
+
+[[X20]]
+Vim Commands for Formatting AsciiDoc
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Text Wrap Paragraphs
+^^^^^^^^^^^^^^^^^^^^
+Use the vim `:gq` command to reformat paragraphs. Setting the
+'textwidth' sets the right text wrap margin; for example:
+
+ :set textwidth=70
+
+To reformat a paragraph:
+
+1. Position the cursor at the start of the paragraph.
+2. Type `gq}`.
+
+Execute `:help gq` command to read about the vim gq command.
+
+[TIP]
+=====================================================================
+- Assign the `gq}` command to the Q key with the `nnoremap Q gq}`
+ command or put it in your `\~/.vimrc` file to so it's always
+ available (see the <<X61, Example \~/.vimrc file>>).
+- Put `set` commands in your `\~/.vimrc` file so you don't have to
+ enter them manually <<X61, Example \~/.vimrc file>>).
+- The Vim website (http://www.vim.org[]) has a wealth of resources,
+ including scripts for automated spell checking and ASCII Art
+ drawing.
+
+=====================================================================
+
+Format Lists
+^^^^^^^^^^^^
+The `gq` command can also be used to format bulleted and numbered
+lists. First you need to set the `comments` and `formatoptions` (see
+the <<X61, Example \~/.vimrc file>>).
+
+Now you can format simple lists that use dash, asterisk, period and
+plus bullets along with numbered ordered lists:
+
+1. Position the cursor at the start of the list.
+2. Type `gq}`.
+
+Indent Paragraphs
+^^^^^^^^^^^^^^^^^
+Indent whole paragraphs by indenting the fist line with the desired
+indent and then executing the `gq}` command.
+
+[[X61]]
+Example \~/.vimrc File
+^^^^^^^^^^^^^^^^^^^^^
+---------------------------------------------------------------------
+" Show tabs and trailing characters.
+set listchars=tab:»·,trail:·
+set list
+
+" Don't highlight searched text.
+highlight clear Search
+
+" Don't move to matched text while search pattern is being entered.
+set noincsearch
+
+" Q command to reformat paragraphs and list.
+nnoremap Q gq}
+
+" W command to delete trailing white space and Dos-returns and to expand tabs
+" to spaces.
+nnoremap W :%s/[\r \t]\+$//<CR>:set et<CR>:retab!<CR>
+
+autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES
+ \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2
+ \ textwidth=70 wrap formatoptions=tcqn
+ \ comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
+---------------------------------------------------------------------
+
+Troubleshooting
+~~~~~~~~~~~~~~~
+- The asciidoc(1) `-v` (`--verbose`) command-line option displays the
+ order of configuration file loading and warns of potential
+ configuration file problems.
+- Not all valid AsciiDoc documents produce valid backend markup. Read
+ the <<X5,AsciiDoc Backends>> section if AsciiDoc output is rejected
+ as non-conformant by a backend processor.
+
+Gotchas
+~~~~~~~
+Incorrect character encoding::
+ If you get an error message like `\'UTF-8' codec can't decode ...`
+ then you source file contains invalid UTF-8 characters -- set the
+ AsciiDoc <<X54,encoding attribute>> for the correct character set
+ (typically ISO-8859-1 (Latin-1) for European languages).
+
+Misinterpreted text formatting::
+ If text in your document is incorrectly interpreted as formatting
+ instructions you can suppress formatting by placing a backslash
+ character immediately in front of the leading quote character(s).
+ For example in the following line the backslash prevents text
+ between the two asterisks from being output in a strong (bold)
+ font:
+
+ Add `\*.cs` files and `*.resx` files.
+
+Overlapping text formatting::
+ Overlapping text formatting will generate illegal overlapping
+ markup tags which will result in downstream XML parsing errors.
+ Here's an example:
+
+ Some *strong markup _that overlaps* emphasized markup_.
+
+Ambiguous underlines::
+ A DelimitedBlock can immediately follow paragraph without an
+ intervening blank line, but be careful, a single line paragraph
+ underline may be misinterpreted as a section title underline
+ resulting in a ``closing block delimiter expected'' error.
+
+Ambiguous ordered list items::
+ Lines beginning with numbers at the end of sentences will be
+ interpreted as ordered list items. The following example
+ (incorrectly) begins a new list with item number 1999:
+
+ He was last sighted in
+ 1999. Since then things have moved on.
++
+The 'list item out of sequence' warning makes it unlikely that this
+problem will go unnoticed.
+
+Escaping inside DSV table data::
+ Delimiter separated text uses C style backslash escape sequences.
+ If you want to enter a backslash (for example, to escape AsciiDoc
+ text formatting or an inline macro) you need to escape it by
+ entering two backslashes.
+
+Special characters in attribute values::
+ Special character substitution precedes attribute substitution so
+ if attribute values contain special characters you may, depending
+ on the substitution context, need to escape the special characters
+ yourself. For example:
+
+ $ asciidoc -a 'companyname=Bill &amp; Ben' mydoc.txt
+
+Macro attribute lists::
+ If named attribute list entries are present then all string
+ attribute values must be quoted. For example:
+
+ ["Desktop screenshot",width=32]
+
+Combining Separate Documents
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+You have a number of stand-alone AsciiDoc documents that you want to
+process as a single document. Simply processing them with a series of
+`include` macros won't work, because instead of starting at level 1
+the section levels of the combined document start at level 0 (the
+document title level).
+
+The solution is to redefine the title underlines so that document and
+section titles are pushed down one level.
+
+. Push the standard title underlines down one level by defining a new
+ level 0 underline in a custom configuration file. For example
+ `combined.conf`:
+
+ [titles]
+ underlines="__","==","--","~~","^^"
+
+. If you use single line titles you'll need to make corresponding
+ adjustments to the `[titles]` section `sect0`...`sect4` entries.
+
+. Create a top level wrapper document. For example `combined.txt`:
++
+---------------------------------------------------------------------
+ Combined Document Title
+ _______________________
+
+ include::document1.txt[]
+
+ include::document2.txt[]
+
+ include::document3.txt[]
+---------------------------------------------------------------------
+
+. Process the wrapper document. For example:
+
+ $ asciidoc --conf-file=combined.conf combined.txt
+
+Actually the `--conf-file` option is unnecessary as asciidoc(1)
+automatically looks for a same-named `.conf` file.
+
+- The combined document title uses the newly defined level 0 underline
+ (underscore characters).
+- Put a blank line between the `include` macro lines to ensure the
+ title of the included document is not seen as part of the last
+ paragraph of the previous document.
+- You won't want document Headers (Author and Revision lines) in the
+ included files -- conditionally exclude them if they are necessary
+ for stand-alone processing.
+
+Processing Document Sections Separately
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+You have divided your AsciiDoc document into separate files (one per top level
+section) which are combined and processed with the following top level
+document:
+
+---------------------------------------------------------------------
+ Combined Document Title
+ =======================
+ Joe Bloggs
+ v1.0, 12-Aug-03
+
+ include::section1.txt[]
+
+ include::section2.txt[]
+
+ include::section3.txt[]
+---------------------------------------------------------------------
+
+You also want to process the section files as separate documents.
+This is easy because asciidoc(1) will quite happily process
+`section1.txt`, `section2.txt` and `section3.txt` separately.
+
+If you want to promote the section levels up one level, so the
+document is processed just like a stand-alone document, then pop the
+section underline definition up one level:
+
+ [titles]
+ underlines="--","~~","^^","++","__"
+
+The last `"__"` underline is a dummy that won't actually be used but
+is necessary to legitimize the underline definition.
+
+This is just the reverse of the technique used for combining separate
+documents explained in the previous section.
+
+Processing Document Chunks
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+asciidoc(1) can be used as a filter, so you can pipe chunks of text
+through it. For example:
+
+ $ echo 'Hello *World!*' | asciidoc -s -
+ <p>Hello <strong>World!</strong></p>
+
+The `-s` (`--no-header-footer`) command-line option suppresses header
+and footer output and is useful if the processed output is to be
+included in another file.
+
+Badges in HTML Page Footers
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+See the `[footer]` section in the AsciiDoc distribution `xhtml11.conf`
+configuration file.
+
+Pretty Printing AsciiDoc Output
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If the indentation and layout of the asciidoc(1) output is not to your
+liking you can:
+
+1. Change the indentation and layout of configuration file markup
+ template sections. The `\{empty}` glossary entry is useful for
+ outputting trailing blank lines in markup templates.
+
+2. Or use Dave Raggett's excellent 'HTML Tidy' program to tidy
+ asciidoc(1) output. Example:
+
+ $ asciidoc -b docbook -o - mydoc.txt | tidy -indent -xml >mydoc.xml
+
+'HTML Tidy' can be downloaded from http://tidy.sourceforge.net/[]
+
+Supporting Minor DocBook DTD Variations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The conditional inclusion of DocBook SGML markup at the end of the
+distribution `docbook.conf` file illustrates how to support minor DTD
+variations. The included sections override corresponding entries from
+preceding sections.
+
+Shipping Stand-alone AsciiDoc Source
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Reproducing presentation documents from someone else's source has one
+major problem: unless your configuration files are the same as the
+creator's you won't get the same output.
+
+The solution is to create a single backend specific configuration file
+using the asciidoc(1) `-c` (`--dump-conf`) command-line option. You
+then ship this file along with the AsciiDoc source document plus the
+`asciidoc.py` script. The only end user requirement is that they have
+Python installed (and of course that they consider you a trusted
+source). This example creates a composite HTML configuration
+file for `mydoc.txt`:
+
+ $ asciidoc -cb xhtml11 mydoc.txt > mydoc-xhtml11.conf
+
+Ship `mydoc.txt`, `mydoc-html.conf`, and `asciidoc.py`. With
+these three files (and a Python interpreter) the recipient can
+regenerate the HMTL output:
+
+ $ ./asciidoc.py -eb xhtml11 mydoc.txt
+
+The `-e` (`--no-conf`) option excludes the use of implicit
+configuration files, ensuring that only entries from the
+`mydoc-html.conf` configuration are used.
+
+Inserting Blank Space
+~~~~~~~~~~~~~~~~~~~~~
+Adjust your style sheets to add the correct separation between block
+elements. Inserting blank paragraphs containing a single non-breaking
+space character `\{nbsp}` works but is an ad hoc solution compared
+to using style sheets.
+
+Closing Open Sections
+~~~~~~~~~~~~~~~~~~~~~
+You can close off section tags up to level `N` by calling the
+`\eval::[Section.setlevel(N)]` system macro. This is useful if you
+want to include a section composed of raw markup. The following
+example includes a DocBook glossary division at the top section level
+(level 0):
+
+---------------------------------------------------------------------
+ ifdef::backend-docbook[]
+
+ eval::[Section.setlevel(0)]
+
+ +++++++++++++++++++++++++++++++
+ <glossary>
+ <title>Glossary</title>
+ <glossdiv>
+ ...
+ </glossdiv>
+ </glossary>
+ +++++++++++++++++++++++++++++++
+ endif::backend-docbook[]
+---------------------------------------------------------------------
+
+
+Validating Output Files
+~~~~~~~~~~~~~~~~~~~~~~~
+Use `xmllint(1)` to check the AsciiDoc generated markup is both well
+formed and valid. Here are some examples:
+
+ $ xmllint --nonet --noout --valid docbook-file.xml
+ $ xmllint --nonet --noout --valid xhtml11-file.html
+ $ xmllint --nonet --noout --valid --html html4-file.html
+
+The `--valid` option checks the file is valid against the document
+type's DTD, if the DTD is not installed in your system's catalog then
+it will be fetched from its Internet location. If you omit the
+`--valid` option the document will only be checked that it is well
+formed.
+
+
+Glossary
+--------
+[[X8]] Block element:-
+ An AsciiDoc block element is a document entity composed of one or
+ more whole lines of text.
+
+[[X34]] Inline element:-
+ AsciiDoc inline elements occur within block element textual
+ content, they perform formatting and substitution tasks.
+
+Formal element:-
+ An AsciiDoc block element that has a BlockTitle. Formal elements
+ are normally listed in front or back matter, for example lists of
+ tables, examples and figures.
+
+Verbatim element:-
+ The word verbatim indicates that white space and line breaks in
+ the source document are to be preserved in the output document.
+
+
+Appendix A: Migration Notes
+---------------------------
+[[X53]]
+Version 7 to version 8
+~~~~~~~~~~~~~~~~~~~~~~
+- A new set of quotes has been introduced which may match inline text
+ in existing documents -- if they do you'll need to escape the
+ matched text with backslashes.
+- The index entry inline macro syntax has changed -- if your documents
+ include indexes you may need to edit them.
+- Replaced a2x(1) `\--no-icons` and `\--no-copy` options with their
+ negated equivalents: `\--icons` and `\--copy` respectively. The
+ default behavior has also changed -- the use of icons and copying of
+ icon and CSS files must be specified explicitly with the `\--icons`
+ and `\--copy` options.
+
+The rationale for the changes can be found in the AsciiDoc
+`CHANGELOG`.
+
+NOTE: If you want to disable unconstrained quotes, the new alternative
+constrained quotes syntax and the new index entry syntax then you can
+define the attribute `asciidoc7compatible` (for example by using the
+`-a asciidoc7compatible` command-line option).
+
+[[X32]]
+Version 6 to version 7
+~~~~~~~~~~~~~~~~~~~~~~
+The changes that affect the most users relate to renamed and
+deprecated backends and command-line syntax:
+
+. The 'html' backend has been renamed 'html4'.
+. The 'xhtml' backend has been deprecated to 'xhtml-deprecated' (use
+ the new 'xhtml11' backend in preference).
+. The use of CSS specific `css` and `css-embedded` backends has been
+ dropped in favor of using attributes (see the table below and
+ <<X33,xhtml backend attributes>>).
+. Deprecated features that emitted warnings in prior versions are no
+ longer tolerated.
+. The command-line syntax for deleting (undefining) an attribute has
+ changed from `-a ^name` to `-a name!`.
+
+.Equivalent command-line syntax
+[grid="all"]
+```~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Version 6 (old),Version 7 (new),Version 7 (backward compatible)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-b html,-b html4,-b html4
+-b css,-b xhtml11 -a linkcss -a icons,-b xhtml-deprecated -a css -a linkcss -a icons
+-b css-embedded,-b xhtml11 -a icons,-b xhtml-deprecated -a css -a icons
+-b xhtml,-b xhtml11,-b xhtml-deprecated
+-b docbook-sgml,-b docbook -a sgml,-b docbook -a sgml
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you've customized version 6 distribution stylesheets then you'll
+need to either bring them in line with the new
+`./stylesheets/xhtml11*.css` class and id names or stick with the
+backward compatible `xhtml-deprecated` backend.
+
+Changes to configuration file syntax:
+
+. To undefine an attribute in the `[attributes]` section use `name!`
+ instead of `name` (`name` now sets that attribute to a blank
+ string).
+
+
+[[X38]]
+Appendix B: Packager Notes
+---------------------------
+Read the `README` and `INSTALL` files (in the distribution root
+directory) for install prerequisites and procedures.
+
+The distribution `install.sh` shell script is the canonical
+installation procedure and is the definitive installation description.
+Here's a summary of the installation procedure:
+
+- Unpack entire distribution tarball to `/usr/share/asciidoc/`.
+- Move `asciidoc.py` to `/usr/bin/`; rename to `asciidoc`; if
+ necessary modify shebang line; ensure executable permissions are
+ set.
+- Move `a2x` to `/usr/bin/`; if necessary modify shebang line; ensure
+ executable permissions are set.
+- Move the `./*.conf` files to `/etc/asciidoc/`.
+- Move `./filters/{\*.conf,*.py}` to `/etc/asciidoc/filters/`.
+- Move `./docbook-xsl/*.xsl` to `/etc/asciidoc/docbook-xsl/`.
+- Copy `./stylesheets/*.css` to `/etc/asciidoc/stylesheets/`.
+- Copy `./javascripts/*.js` to `/etc/asciidoc/javascripts/`.
+- Copy `./images/icons/*` to `/etc/asciidoc/images/icons/`
+ (recursively including the `icons` subdirectory and its contents).
+- Compress the asciidoc(1) and ax2(1) man pages (`./doc/*.1`) with
+ gzip(1) and move them to `/usr/share/man/man1/`.
+- If Vim is installed then install Vim syntax and filetype detection
+ files.
+
+Leaving stylesheets and images in `/usr/share/asciidoc/` ensures the
+docs and example website are not broken.
+
+
+[[X39]]
+Appendix C: AsciiDoc Safe Mode
+------------------------------
+AsciiDoc 'safe mode' skips potentially dangerous sections in AsciiDoc
+source files by inhibiting the execution of arbitrary code or the
+inclusion of arbitrary files.
+
+The safe mode is enabled by default and can only be disabled using the
+asciidoc(1) `--unsafe` command-line option.
+
+.Safe mode constraints
+- `eval`, `sys` and `sys2` executable attributes and block macros are
+ not executed.
+- `\include::<filename>[]` and `\include1::<filename>[]` block macro
+ files must reside inside the parent file's directory.
+- `\{include:<filename>}` executable attribute files must reside
+ inside the source document directory.
+- Passthrough Blocks are dropped.
+
+[WARNING]
+=====================================================================
+The safe mode is not designed to protect against unsafe AsciiDoc
+configuration files. Be especially careful when:
+
+1. Implementing filters.
+2. Implementing elements that don't escape special characters.
+3. Accepting configuration files from untrusted sources.
+=====================================================================
+
+
+Appendix D: Installing FOP on Windows
+-------------------------------------
+. Download latest FOP distribution from http://xml.apache.org/fop/[].
+. Unzip to `C:\bin`.
+. Edit the distribution `fop.bat` file and put it in the search
+ `PATH`:
+
+ set LOCAL_FOP_HOME=C:\bin\fop-0.20.5\
+
+. Download the JIMI image processing library from
+ http://java.sun.com/products/jimi/[].
+. Extract the `JimiProClasses.jar` library from the JIMI distribution
+ and copy to the FOP `./lib` directory.
+. Edit the distribution `fop.bat` file again and add the JIMI library
+ to `LOCALCLASSPATH`:
+
+ set LOCALCLASSPATH=%LOCALCLASSPATH%;%LIBDIR%\JimiProClasses.jar
+
+. You should now be able to run FOP from a DOS prompt -- execute
+ it without arguments to get a list of command options:
+
+ > fop.bat
+
+
+Appendix E: Installing FOP on Linux
+-----------------------------------
+Here's how I installed FOP on Fedora Core 1:
+
+. Download latest FOP distribution from http://xml.apache.org/fop/[].
+. Install the FOP distribution:
+
+ $ su
+ # cd /usr/local/lib
+ # unzip ~srackham/tmp/fop-0.20.5-bin.zip
+ # cp /usr/local/lib/fop-0.20.5/fop.sh /usr/local/bin
+ # chmod +x /usr/local/bin/fop.sh
+
+. Edit the FOP start script `fop.sh` adding this line to the start of
+ the script:
+
+ FOP_HOME=/usr/local/lib/fop-0.20.5
+
+. Download the JIMI image processing library from
+ http://java.sun.com/products/jimi/[].
+. Extract the `JimiProClasses.jar` library from the JIMI distribution
+ and copy to the FOP `lib` directory.
+
+ # cp ~srackham/tmp/JimiProClasses.jar /usr/local/lib/fop-0.20.5/lib/
+
+. You should now be able to run FOP from a DOS prompt -- execute
+ it without arguments to get a list of command options:
+
+ $ fop.sh
+
+
+Appendix F: Installing Java on Windows
+--------------------------------------
+First check that Java is not already installed:
+
+. Open a DOS 'Command Prompt' window.
+. Enter this command:
+
+ java -version
+
+You should see something like this:
+
+---------------------------------------------------------------------
+java version "1.4.2_01"
+Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
+Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
+---------------------------------------------------------------------
+
+If you don't Java is not installed and you need to:
+
+. Download the Java Runtime (JRE) for Windows from
+ http://java.sun.com[].
+. Install using the instructions on the download page.
+
+
+Appendix G: Installing Java on Linux
+------------------------------------
+Check Java is not already installed by entering the following command:
+
+ $ java -version
+
+You should see something like this:
+
+ java version "1.4.2_01"
+ Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
+ Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
+
+If it's not already set you will need to set the `JAVA_HOME`
+environment variable. For example on Kubuntu Breezy put the following
+line into `/etc/profile`:
+
+ export JAVA_HOME=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/
+
+
+Appendix H: Using AsciiDoc with non-English Languages
+-----------------------------------------------------
+AsciiDoc can process UTF-8 character sets but there are some things
+you need to be aware of:
+
+- <<X28,Admonition>> captions, <<X48,example block>> title prefixes,
+ table title prefixes and <<X49,image block>> title prefixes default
+ to English. You can customize these captions and prefixes with the
+ `caption` attribute. Alternatively you could override the related
+ AsciiDoc configuration file entries with a custom configuration
+ file.
++
+NOTE: The `caption` attribute only applies if you are using the
+`xhtml11` or `html4` backends -- if you are going the DocBook route
+you will need to configure the XSL Stylesheets for your language.
+
+- Some character sets display double-width characters (for example
+ Japanese). As far as <<X17,title underlines>> are concerned they
+ should be treated as single character. If you think this looks
+ untidy so you may prefer to use the <<X46,single line title>>
+ format.
+
+
+Appendix I: ASCIIMathML Support
+-------------------------------
+http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML] is
+a clever JavaScript written by Peter Jipsen that transforms
+mathematical formulae written in plain text to standard mathematical
+notation on an HTML page.
+
+To enable ASCIIMathML support on the `xhtml11` backend include the `-a
+asciimath` command-line option. Here's what the `asciimath` attribute
+does:
+
+- Embeds the `ASCIIMathML.js` script in the output document (links it
+ if `-a linkcss` has been specified).
+- Escapes ASCIIMathML delimiters.
+
+When entering ASCIIMathML formulas you *must* enclose them inside
+<<X50,double-dollar passthroughs>> (this is necessary because
+ASCIIMathML characters clash with AsciiDoc formatting characters). The
+double-dollar passthrough has the bonus of also escaping special
+characters so the output document is valid XHTML. You can see an
+ASCIIMathML example at
+http://www.methods.co.nz/asciidoc/asciimath.html[], the same example
+can be found in the AsciiDoc distribution `./doc` directory.
+
+[NOTE]
+=====================================================================
+- See the
+ http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
+ website for ASCIIMathML documentation and the latest version.
+- If you use Mozilla you need to install the
+ http://www.mozilla.org/projects/mathml/fonts/[required math fonts].
+- If you use Microsoft Internet Explorer 6 you need to install
+ http://www.dessci.com/en/products/mathplayer/[MathPlayer].
+=====================================================================
+
+
+Appendix J: Vim Syntax Highlighter
+----------------------------------
+The AsciiDoc `./vim/` distribution directory contains Vim syntax
+highlighter and filetype detection scripts for AsciiDoc. Syntax
+highlighting makes it much easier to spot AsciiDoc syntax errors.
+
+If Vim is installed on your system the AsciiDoc installer
+(`install.sh`) will automatically install the vim scripts in the Vim
+global configuration directory (`/etc/vim`).
+
+You can also turn on syntax highlighting by adding the following line
+to the end of you AsciiDoc source files:
+
+ // vim: set syntax=asciidoc:
+
+NOTE: Dag Wieers has implemented an alternative Vim syntax file for
+AsciiDoc which can be found here
+http://svn.rpmforge.net/svn/trunk/tools/asciidoc-vim/[].
+
+NOTE: Emacs users: The http://xpt.sourceforge.net/[*Nix Power Tools
+project] has released an
+http://xpt.sourceforge.net/tools/doc-mode/[AsciiDoc syntax highlighter
+for emacs].
+
+Limitations
+~~~~~~~~~~~
+The current implementation does a reasonable job but on occasions gets
+things wrong. This list of limitations also discusses how to work
+around the problems:
+
+- Indented lists with preceding blank lines are sometimes mistaken
+ for literal (indented) paragraphs. You can work around this by
+ deleting the preceding blank line, or inserting a space in the
+ preceding blank lines, or putting a list continuation character
+ (`+`) in the preceding blank line.
+
+- Nested text formatting is highlighted according to the outer format.
+
+- Text formatting is not highlighted inside titles or attribute lists.
+
+- Most escaped inline elements will be highlighted.
+
+- Unterminated quotes are highlighted, for example `'tis` would be
+ seen as the start of emphasized text. In this case work-around would
+ be to comment out `asciidocEmphasized2` and use the
+ (`asciidocEmphasized`) underscored for emphasis. As a damage control
+ measure quoted patterns always terminate at a blank line. This
+ problem is usually ameliorated by the fact that characters such as
+ `\~`, `+`, `^` and `_` will normally occur inside monospaced quotes
+ (unless they are used for quoting), for example `~/projects`.
+
+- If a closing block delimiter is not preceded by a blank line it is
+ sometimes mistaken for a title underline. A workaround is to insert
+ a blank line before the closing delimiter.
+
+- If a list block delimiter is mistaken for a title underline precede
+ it with a blank line.
+
+- Tables are terminated by a blank line -- use a space character on
+ blank lines within your table.
+
+- Lines within a paragraph beginning with a period will be highlighted
+ as block titles. For example:
+
+ .chm file.
++
+To work around this restriction move the last word of the previous
+line to the start of the current (although words starting with a
+period should probably be quoted monospace which would also get around
+the problem).
+
+TIP: Sometimes incorrect highlighting is caused by preceding lines
+that appear blank but contain white space characters.
+
diff --git a/doc/asciimath.txt b/doc/asciimath.txt
new file mode 100644
index 0000000..a2e5c38
--- /dev/null
+++ b/doc/asciimath.txt
@@ -0,0 +1,47 @@
+ASCIIMathML Formulae
+====================
+
+http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML] is
+a clever JavaScript written by Peter Jipsen that transforms
+mathematical formulae written in plain text to standard mathematical
+notation on an HTML page. See 'Appendix I' in the AsciiDoc User Guide
+for more details.
+
+The AsciiDoc `xhtml11` backend supports ASCIIMathML -- it links the
+ASCIIMathML script and escapes ASCIIMathML delimiters and special
+characters to yield valid XHTML. To use ASCIIMathML:
+
+1. Include the `-a asciimath` command-line option when you run
+ `asciidoc(1)`.
+2. Enclose ASCIIMathML formulas inside double-dollar passthroughs.
+
+Here's the link:asciimath.txt[AsciiDoc source] that generated this
+page.
+
+.NOTE
+- If the formulas don't appear to be correct you probably need to
+ install the correct math fonts (see the
+ http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
+ website for details).
+- See the link:latexmath.html[LaTeXMathML page] if you prefer to use
+ LaTeX math formulas.
+
+A list of formulas with a mixture of formatting:
+
+- $$`[[a,b],[c,d]]((n),(k))`$$
+- $$`x/x={(1,if x!=0),(text{undefined},if x=0):}`$$
+- $$`d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h`$$
+- Red [red]$$`sum_(i=1)\^n i=(n(n+1))/2`$$ and [blue]*bold
+ $$`int_0\^(pi/2) sinx\ dx=1`$$*
+- [,,1.5]## 1.5 times normal size $$`(a,b]={x in RR : a < x <= b}`$$##
+- A [,,2]##big## [blue]##blue## formula [blue,,2]$$`x^2+y_1+z_12^34`$$.
+- [green,yellow,4]$$`x^2+y_1+z_12^34`$$
+
+*********************************************************************
+The first three terms factor to give
+[red]$$$(x+b/(2a))^2=(b^2)/(4a^2)-c/a$$$. Now we take square roots on
+both sides and get [red]$$$x+b/(2a)=+-sqrt((b^2)/(4a^2)-c/a)$$$.
+Finally we move the [red]$$$b/(2a)$$$ to the right and simplify to get
+the two solutions: [red]*$$`x_(1,2)=(-b+-sqrt(b^2-4ac))/(2a)`$$*.
+*********************************************************************
+
diff --git a/doc/book-multi.txt b/doc/book-multi.txt
new file mode 100644
index 0000000..9c44a0d
--- /dev/null
+++ b/doc/book-multi.txt
@@ -0,0 +1,159 @@
+Multi-Part Book Title Goes Here
+===============================
+Author's Name
+v1.0, Dec 2003
+
+
+Dedication
+==========
+The optional dedication goes here.
+
+This document is an AsciiDoc multi-part book skeleton containing
+briefly annotated element placeholders plus a couple of example index
+entries and footnotes. Books are normally used to generate DocBook
+markup and the preface, appendix, bibliography, glossary and index
+section titles are significant ('specialsections').
+
+NOTE: Multi-part books differ from all other AsciiDoc document formats
+in that top level sections (dedication, preface, book parts,
+appendices, bibliography, glossary, index) must be level zero headings
+(not level one).
+
+
+Preface
+=======
+The optional book preface goes here at section level zero.
+
+Preface Sub-section
+~~~~~~~~~~~~~~~~~~~
+NOTE: Preface and appendix subsections start out of sequence at level
+2 (level 1 is skipped). This only applies to multi-part book
+documents.
+
+
+
+The First Part of the Book
+==========================
+
+The First Chapter
+-----------------
+Chapters can be grouped by preceeding them with a level 0 Book Part
+title.
+
+Book chapters are at level 1 and can contain sub-sections nested up to
+three deep.
+footnote:[An example footnote.]
+indexterm:[Example index entry]
+
+It's also worth noting that a book part can have it's own preface,
+bibliography, glossary and index. Chapters can have their own
+bibliography, glossary and index.
+
+And now for something completely different: ((monkeys)), lions and
+tigers (Bengal and Siberian) using the alternative syntax index
+entries.
+(((Big cats,Lions)))
+(((Big cats,Tigers,Bengal Tiger)))
+(((Big cats,Tigers,Siberian Tiger)))
+Note that multi-entry terms generate separate index entries.
+
+Here are a couple of image examples: an image:images/smallnew.png[]
+example inline image followed by an example block image:
+
+.Tiger block image
+image::images/tiger.png[Tiger image]
+
+Followed by an example table:
+
+.An example table
+`-----------------`--------------------------
+Option Description
+---------------------------------------------
+-a 'USER GROUP' Add 'USER' to 'GROUP'.
+-R 'GROUP' Disables access to 'GROUP'.
+---------------------------------------------
+
+[[X1]]
+Sub-section with Anchor
+~~~~~~~~~~~~~~~~~~~~~~~
+Sub-section at level 2.
+
+Chapter Sub-section
+^^^^^^^^^^^^^^^^^^^
+Sub-section at level 3.
+
+Chapter Sub-section
++++++++++++++++++++
+Sub-section at level 4.
+
+This is the maximum sub-section depth supported by the distributed
+AsciiDoc configuration.
+footnote:[A second example footnote.]
+
+
+The Second Chapter
+------------------
+An example link to anchor at start of the <<X1,first sub-section>>.
+indexterm:[Second example index entry]
+
+An example link to a bibliography entry <<taoup>>.
+
+
+
+The Second Part of the Book
+===========================
+
+The First Chapter of the Second Part
+------------------------------------
+Chapters grouped into book parts are at level 1 and can contain
+sub-sections.
+
+
+
+Appendix A: Example Appendix
+============================
+One or more optional appendixes go here at section level zero.
+
+Appendix Sub-section
+~~~~~~~~~~~~~~~~~~~
+NOTE: Preface and appendix subsections start out of sequence at level
+2 (level 1 is skipped). This only applies to multi-part book
+documents.
+
+
+
+Bibliography
+============
+The bibliography list is an example of an AsciiDoc SimpleList, the
+AsciiDoc source list items are bulleted with a `+` character. The
+first entry in this example has an anchor.
+
++ [[[taoup]]] Eric Steven Raymond. 'The Art of Unix Programming'.
+ Addison-Wesley. ISBN 0-13-142901-9.
+
++ [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
+ 'DocBook - The Definative Guide'. O'Reilly & Associates. 199.
+ ISBN 1-56592-580-7.
+
+
+
+Glossary
+========
+Glossaries are optional. Glossaries are an example of an AsciiDoc
+VariableList, the AsciiDoc glossary entry terms are terminated
+by the `:-` characters.
+
+A glossary term:-
+ The corresponding (indented) definition.
+
+A second glossary term:-
+ The corresponding (indented) definition.
+
+
+
+Index
+=====
+////////////////////////////////////////////////////////////////
+The index is normally left completely empty, it's contents are
+generated automatically by the DocBook toolchain.
+////////////////////////////////////////////////////////////////
diff --git a/doc/book.txt b/doc/book.txt
new file mode 100644
index 0000000..04aff61
--- /dev/null
+++ b/doc/book.txt
@@ -0,0 +1,133 @@
+Book Title Goes Here
+====================
+Author's Name
+v1.0, Dec 2003
+
+
+Dedication
+----------
+Optional dedication.
+
+This document is an AsciiDoc book skeleton containing briefly
+annotated example elements plus a couple of example index entries and
+footnotes.
+
+Books are normally used to generate DocBook markup and the titles of
+the preface, appendix, bibliography, glossary and index sections are
+significant ('specialsections').
+
+
+Preface
+-------
+Optional preface.
+
+Preface Sub-section
+~~~~~~~~~~~~~~~~~~~
+Preface sub-section body.
+
+
+The First Chapter
+-----------------
+Chapters can contain sub-sections nested up to three deep.
+footnote:[An example footnote.]
+indexterm:[Example index entry]
+
+Chapters can have their own bibliography, glossary and index.
+
+And now for something completely different: ((monkeys)), lions and
+tigers (Bengal and Siberian) using the alternative syntax index
+entries.
+(((Big cats,Lions)))
+(((Big cats,Tigers,Bengal Tiger)))
+(((Big cats,Tigers,Siberian Tiger)))
+Note that multi-entry terms generate separate index entries.
+
+Here are a couple of image examples: an image:images/smallnew.png[]
+example inline image followed by an example block image:
+
+.Tiger block image
+image::images/tiger.png[Tiger image]
+
+Followed by an example table:
+
+.An example table
+`-----------------`--------------------------
+Option Description
+---------------------------------------------
+-a 'USER GROUP' Add 'USER' to 'GROUP'.
+-R 'GROUP' Disables access to 'GROUP'.
+---------------------------------------------
+
+[[X1]]
+Sub-section with Anchor
+~~~~~~~~~~~~~~~~~~~~~~~
+Sub-section at level 2.
+
+Chapter Sub-section
+^^^^^^^^^^^^^^^^^^^
+Sub-section at level 3.
+
+Chapter Sub-section
++++++++++++++++++++
+Sub-section at level 4.
+
+This is the maximum sub-section depth supported by the distributed
+AsciiDoc configuration.
+footnote:[A second example footnote.]
+
+
+The Second Chapter
+------------------
+An example link to anchor at start of the <<X1,first sub-section>>.
+indexterm:[Second example index entry]
+
+An example link to a bibliography entry <<taoup>>.
+
+
+The Third Chapter
+-----------------
+Book chapters are at level 1 and can contain sub-sections.
+
+
+Appendix A: Example Appendix
+----------------------------
+One or more optional appendixes go here at section level 1.
+
+Appendix Sub-section
+~~~~~~~~~~~~~~~~~~~
+Sub-section body.
+
+
+Bibliography
+------------
+The bibliography list is an example of an AsciiDoc SimpleList, the
+AsciiDoc source list items are bulleted with a `+` character. The
+first entry in this example has an anchor.
+
++ [[[taoup]]] Eric Steven Raymond. 'The Art of Unix Programming'.
+ Addison-Wesley. ISBN 0-13-142901-9.
+
++ [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
+ 'DocBook - The Definative Guide'. O'Reilly & Associates. 199.
+ ISBN 1-56592-580-7.
+
+
+Glossary
+--------
+Glossaries are optional. Glossaries are an example of an AsciiDoc
+VariableList, the AsciiDoc glossary entry terms are terminated
+by the `:-` characters.
+
+A glossary term:-
+ The corresponding (indented) definition.
+
+A second glossary term:-
+ The corresponding (indented) definition.
+
+
+Index
+-----
+////////////////////////////////////////////////////////////////
+The index is normally left completely empty, it's contents being
+generated automatically by the DocBook toolchain.
+////////////////////////////////////////////////////////////////
diff --git a/doc/customers.csv b/doc/customers.csv
new file mode 100644
index 0000000..40ceffc
--- /dev/null
+++ b/doc/customers.csv
@@ -0,0 +1,18 @@
+"AROUT","Around the Horn","Thomas Hardy","120 Hanover Sq.
+London","(171) 555-7788"
+"BERGS","Berglunds snabbkop","Christina Berglund","Berguvsvagen 8
+Lulea","0921-12 34 65"
+"BLAUS","Blauer See Delikatessen","Hanna Moos","Forsterstr. 57
+Mannheim","0621-08460"
+"BLONP","Blondel pere et fils","Frederique Citeaux","24, place Kleber
+Strasbourg","88.60.15.31"
+"BOLID","Bolido Comidas preparadas","Martin Sommer","C/ Araquil, 67
+Madrid","(91) 555 22 82"
+"BONAP","Bon app'","Laurence Lebihan","12, rue des Bouchers
+Marseille","91.24.45.40"
+"BOTTM","Bottom-Dollar Markets","Elizabeth Lincoln","23 Tsawassen Blvd.
+Tsawassen","(604) 555-4729"
+"BSBEV","B's Beverages","Victoria Ashworth","Fauntleroy Circus
+London","(171) 555-1212"
+"CACTU","Cactus Comidas para llevar","Patricio Simpson","Cerrito 333
+Buenos Aires","(1) 135-5555"
diff --git a/doc/docbook-xsl.css b/doc/docbook-xsl.css
new file mode 120000
index 0000000..c1cd3b9
--- /dev/null
+++ b/doc/docbook-xsl.css
@@ -0,0 +1 @@
+../stylesheets/docbook-xsl.css \ No newline at end of file
diff --git a/doc/faq.txt b/doc/faq.txt
new file mode 100644
index 0000000..4cd46e7
--- /dev/null
+++ b/doc/faq.txt
@@ -0,0 +1,172 @@
+AsciiDoc Frequently Asked Questions
+===================================
+
+An embryonic AsciiDoc FAQ.
+
+
+== How can I include non-breaking space characters?
+
+The predefined `\{nbsp}` attribute reference will be replaced by a
+non-breaking space character.
+
+
+== How do I include spaces in URL addresses?
+
+URL inline macro targets (addresses) cannot contain white space
+characters. If you need spaces encode them as `%20`. For example:
+
+ image:large%20image.png[]
+ http://www.foo.bar.com/an%20example%20document.html[]
+
+
+== Why does AsciiDoc give me a ``malformed author'' error?
+
+This is normally because there are more than three names (up to three
+are expected: first name, middle name and last name). For example,
+this author line would result in an error:
+
+ Vincent Willem van Gogh
+
+You can enter multi-word first, middle and last names in the author
+line using the underscore as a word separator. For example:
+
+ Vincent Willem van_Gogh
+
+You could also resolve the problem by replacing the author line with
+explicit attribute entries:
+
+ :First name: Vincent
+ :Middle name: Willem
+ :Last name: Van Gogh
+
+== How can I escape AsciiDoc markup?
+
+Most AsciiDoc inline elements can be suppressed by preceding them with
+a backslash character. These elements include:
+
+- Attribute references.
+- Text formatting.
+- Quoting,
+- 'URLs', 'image' and 'link' macros.
+- Replacements.
+- Special words.
+
+In some cases you may need to escape both left and right quotes (see
+the 'AsciiDoc User Guide').
+
+
+== How can I escape a labeled list entry?
+
+Two colons or semicolons in a paragraph may be confused with a labeled
+list entry. Use the predefined `\{two_colons}` and `\{two_semicolons}`
+to suppress this behavior, for example:
+
+ Qui in magna commodo{two_colons} est labitur dolorum an. Est ne
+ magna primis adolescens.
+
+Will be rendered as:
+
+Qui in magna commodo{two_colons} est labitur dolorum an. Est ne
+magna primis adolescens.
+
+
+== How can I disable a quoted text substitution?
+
+Omitting the tag will disable quoting. For example, if you don't want
+superscripts or subscripts then put the following in a custom
+configuration file or edit the global `asciidoc.conf` configuration
+file:
+
+---------------------------------------------------------------------
+[quotes]
+^=
+~=
+---------------------------------------------------------------------
+
+
+== I have a paragraph containing some funky URLs, is the a way to suppress AsciiDoc substitutions in the URL address?
+
+You can selectively choose which substitutions to perform by setting
+the 'subs' attribute at the start of a block. For example:
+
+---------------------------------------------------------------------
+[subs="macros"]
+~subscripts~ and ^superscripts^ quotes won't be substituted.
+Nor will the non-alphanumeric characters in the following URL:
+http://host/~user/file#_anchor_tag_str_[]
+---------------------------------------------------------------------
+
+
+== How can I customize the \{localdate} format?
+
+The default format for the `\{localdate}` attribute is the ISO 8601
+`yyyy-mm-dd` format. You can change this format by explicitly setting
+the `\{localdate}` attribute. For example by setting it using the
+asciidoc(1) `-a` command-line option:
+
+ $ asciidoc -a localdate=`date +%d-%d-%Y` mydoc.txt
+
+You could also set it by adding an Attribute Entry to your souce
+document, for example:
+
+ :localdate: {sys: date +%Y-%m-%d}
+
+Since it's set using an executable attribute you'll also need to
+include the `--unsafe` option when you run asciidoc).
+
+
+== Why doesn't AsciiDoc support strike through text?
+
+The reason it's not in the distribution is that DocBook does not have
+provision for strike through text and one of the AsciiDoc design goals
+is that AsciiDoc markup should be applicable to all output formats.
+
+Strike through is normally used to mark deleted text -- a more
+comprehensive way to manage document revisions is to use a version
+control system such as Subversion. You can also use the AsciiDoc
+'CommentLines' and 'CommentBlocks' to retain revised text in the
+source document.
+
+If you really need strike through text for (X)HTML outputs then adding
+the following to a configuration file will allow you to quote strike
+through text with hyphen characters:
+
+---------------------------------------------------------------------
+ ifdef::basebackend-html[]
+
+ [quotes]
+ -=strikethrough
+
+ [tags]
+ strikethrough=<span style="text-decoration: line-through;">|</span>
+
+ endif::basebackend-html[]
+---------------------------------------------------------------------
+
+
+== Where can I find examples of commands used to build output documents?
+
+The User Guide has some. You could also look at `./doc/main.aap` in
+the AsciiDoc distribution, it has all the commands used to build the
+AsciiDoc documentation (even if you don't use A-A-P you'll still find
+it useful).
+
+
+== How can I place a backslash character in front of an attribute reference without escaping the reference?
+
+Use the predefined `\{backslash}` attribute reference instead of an
+actual backslash, for example if the `\{projectname}` attribute has
+the value `foobar` then:
+
+ d:\data{backslash}{projectname}
+
+would be rendered as:
+
+ d:\data\foobar
+
+
+== Why have you used the DocBook <simpara> element instead of <para>?
+
+`<simpara>` is really the same as `<para>` except it can't contain
+block elements which more closely matches the AsciiDoc paragraph
+semantics.
diff --git a/doc/images b/doc/images
new file mode 120000
index 0000000..5e67573
--- /dev/null
+++ b/doc/images
@@ -0,0 +1 @@
+../images \ No newline at end of file
diff --git a/doc/latex-backend.txt b/doc/latex-backend.txt
new file mode 100644
index 0000000..4f36323
--- /dev/null
+++ b/doc/latex-backend.txt
@@ -0,0 +1,193 @@
+LaTeX backend for Asciidoc
+==========================
+Benjamin Klum <benjamin.klum@gmail.com>
+v1.0, June 2006
+
+== Introduction
+
+
+LaTeX backend is a configuration file for Stuart Rackham's http://www.methods.co.nz/asciidoc/[Asciidoc]. It generates high-level LaTeX markup from Asciidoc documents. LaTeX is a document preparation system for TeX which in turn is a popular typesetting system. It is well known for producing excellently typesetted high quality printouts, especially suited for scientific text.
+
+== Tutorial
+Getting a ready-to-print document from an Asciidoc document using the LaTeX backend involves at least two steps:
+
+1. Conversion of the Asciidoc document into a LaTeX document (this is done by Asciidoc using the LaTeX backend)
+2. Conversion of the LaTeX document into a PDF document (this is done by the TeX system)
+
+Try to create a PDF document from the Asciidoc document `article.txt` which resides in the `doc` directory of Asciidoc:
+
+.. Make a copy of `article.txt` in a directory of your choice, let's call it `latex-test`.
+.. Make sure that all images referenced in `article.txt` exist in `latex-test`. Brute force approach: Copy the whole `images` directory from Asciidoc directory into `latex-test`.
+.. Change directory to `latex-test` and type following commands:
++
+ asciidoc --unsafe --backend=latex article.txt
+ pdflatex article.tex
++
+.. Now there should be a file `article.pdf` in the `latex-test` directory.
+
+[IMPORTANT]
+==============================
+- Asciidoc has to be started in 'unsafe mode' when using LaTeX backend.
+- Note that some special LaTeX packages are necessary, see <<packageRequirements,here>>.
+==============================
+
+== General notes
+
+=== Quality of LaTeX output
+High-level LaTeX is not very straightforward to generate. Therefore there's no guarantee that the generated output is valid and compiles successfully. At all, this backend should be considered as rather experimental. You should have been already in touch with LaTeX in order to use the backend effectively because LaTeX compilation errors can be really nasty.
+
+Nevertheless good results can be achieved by using LaTeX backend. Try for example to compile Stuart Rackham's Asciidoc documentation, a rather large document. It should compile without problems. However, the code filter might have to be reconfigured for the code filter example to work.
+
+=== Configuration file customization
+Like every other Asciidoc backend the LaTeX backend can be customized easily to fit the user's needs. Actually it is very important to have this option since LaTeX doesn't have a companion language like CSS which allows to put styling information in a separate file. Read more about the LaTeX backend configuration file <<configurationFile,here>>.
+
+=== Output optimization
+The LaTeX output is optimized for creating PDF documents using 'pdflatex'.
+
+[[unicodeSupport]]
+=== Unicode support
+Unfortunately TeX/LaTeX does not have native unicode support. The package 'ucs' adds elementary unicode support by introducing UTF-8 input encoding recognition and by defining lookup tables which contain the corresponding LaTeX commands for unicode characters. But these lookup tables are far from being complete. When a unicode character is found which is not defined in the lookup tables an error is raised by the TeX/LaTeX compiler. Note that TeX/LaTeX compilation errors caused by missing unicode character definitions are not fatal, that means the result is probably readable but undefined unicode characters are replaced with `[U+...]`. You may (de)activate the recognition of escaped unicode characters. See the <<latex-recognize-escaped-unicode>> backend option.
+
+== Backend specific features
+
+=== Special sections
+
+LaTeX backend supports the following special sections and replaces them with corresponding LaTeX commands or environments:
+
+- Abstract (only for document type 'article')
+- Dedication (only for document type 'book')
+- Index
+- Bibliography (only when the attribute 'latex-use-bibliography-environment' is set)
+- Appendix
+- Contents
+
+[[internalCrossReferences]]
+=== Internal cross references
+
+Macros for internal cross references have been extended by the attribute 'style'.
+
+ xref:<id>[<caption>, style=<style>]
+
+or
+
+ <<<id>,<caption>,<style>>>
+
+
+The additional attribute 'style' can have following values:
+
+page::
+Let's LaTeX print the page number of the referenced anchor.
+
+ref::
+Let's LaTeX print the number of the section, subsection, figure, table or theorem the referenced anchor resides.
+
+autoref::
+Let's LaTeX print the number of the section, subsection, figure, table or theorem the referenced anchor resides preceded with a contextual label.
+
+cite::
+Let's LaTeX interprete this reference as a reference to a bibliography entry. If the attribute 'latex-use-bibliography-environment' is set, references with 'cite' style as well as their corresponding bibliography anchors are presented as automatically generated numbers.
+
+If the 'style' attribute is not set the reference is printed the common way.
+
+
+=== Options
+LaTeX document generation is influenced by the following attributes:
+
+latex-table-rowlimit::
+The maximum number of rows for typesetting tables using the 'tabular' environment. If a table has more rows than 'latex-table-rowlimit', 'longtable' environment is used instead of 'tabular' environment. 'longtable' environment supports tables spanning over several pages.
+
+latex-use-bibliography-environment::
+If 'latex-use-bibliography-environment' is defined, 'thebibliography' environment is used for the bibliography section. As a result bibliography entries are automatically numbered. Note that this works only if the bibliography section contains exclusively bibliography list items which start with a bibliography entry ([[[...]]]). Otherwise a TeX/LaTeX compilation error will occur. In order to display bibliography references correctly their 'style' attribute must be set to 'cite'. For more information see <<internalCrossReferences,Internal cross references>>.
+
+latex-indent-paragraphs::
+If 'latex-indent-paragraphs' is defined, the first line of paragraphs will be indented. By default LaTeX backend prevents paragraph indentation and prints paragraphs with preceding vertical space.
+
+[[latex-recognize-escaped-unicode]] latex-recognize-escaped-unicode::
+If 'latex-recognize-escaped-unicode' is defined, escaped unicode characters (e.g. `$${amp}#960;$$` or `$${amp}#x3C0;$$`) will be recognized. This can lead to LaTeX compilation errors since LaTeX unicode support is only rudimentary. For more information see <<unicodeSupport, Unicode support>>.
+
+latex-use-custom-list-items::
+If 'latex-use-custom-list-items' is defined, lists will be bulleted or enumerated the way you have typed them in the original Asciidoc document. That means, `*` turns into a circle bullet, `-` turns into a dash, `.` turns into a number and `..` turns into a letter. Otherwise LaTeX will use different bullets and enumeration characters depending on the level of nesting.
+
+latex-use-colored-tables::
+If 'latex-use-colored-tables' is defined, tables will be printed colored.
+
+latex-use-running-title-headings::
+If 'latex-use-running-title-headings' is defined, 'pagestyle' will be set to 'headings' which results in running titles in the head.
+
+latex-use-colored-sidebar-blocks::
+If 'latex-use-colored-sidebar-blocks' is defined, sidebar block content will be put in a color box instead of being indented by a vertical bar.
+
+icons::
+Link admonition paragraph and admonition block icon images and badge images. By default icons is undefined and text is used in place of icon images.
+
+encoding::
+Set the input and output document character set encoding. Currently `ISO-8859-1` and `UTF-8` are supported.
+
+== Requirements
+
+=== General
+
+The following software is necessary for using the LaTeX backend:
+
+- An up-to-date version of http://www.methods.co.nz/asciidoc/[Asciidoc]
+- An up-to-date TeX distribution, e.g.:
+ * http://www.miktex.org/[MiKTeX] for Windows
+ * http://www.tug.org/tetex/[teTeX] for Linux
+
+[[packageRequirements]]
+=== TeX/LaTeX Package requirements
+
+LaTeX backend makes use of some LaTeX specialities which don't belong to a minimal TeX/LaTeX distribution. However, I took special care not to employ exotic packages. Hence the following packages should be available in most package repositories. The table is not complete yet because I don't know the package names for all TeX distributions.
+
+[separator='|',frame="all",grid="all"]
+`````___________________________________________________________1
+Speciality | MiKTeX package name | teTeX package name | TeX Live package name | Description
+______________________________________________________________
+KOMA-Script | koma-script | | | LaTeX backend uses the document classes 'scrartcl' and 'scrbook' as well as some other specialities defined in the 'KOMA-Script' package, e.g. the commands `\\addmargin{}` and `\minisec{}`.
+xcolor.sty | xcolor | | | Used to produce colored boxes and tables.
+colortbl.sty | colortbl | | | Used to produce colored tables.
+type1ec.sty | cm-super | | | Enables high quality fonts for PDF output.
+hyperref.sty | hyperref | | | Extensive support for hypertext in PDF documents.
+enumerate.sty | tools | | | When 'latex-use-custom-list-items' is defined this package is used for determining the enumeration character.
+graphicx.sty | graphics | | | Used for including images.
+longtable.sty | tools | | | Enables page spanning tables.
+ucs.sty | unicode | | | Enables support for unicode characters.
+textcomp | ltxbase | | | Used for printing various symbols like arrows. Should be already installed.
+alltt | ltxbase | | | Used in literal-like blocks for retaining line and whitespace formatting. Should be already installed.
+listings.sty | listings | | | Used for listing blocks.
+
+_______________________________________________________________
+
+[[configurationFile]]
+== About the LaTeX backend configuration file
+An important note for people who want to adapt the LaTeX backend configuration file to their own needs:
+
+LaTeX markup has a lot of special characters, most importantly `\`, `{`, `}`. In order to make things less complicated, I changed the default substitution order (see entry 'subsnormal' in the `[miscellaneous]` section). In contrast to the backends 'docbook' and 'xhtml11', the 'specialcharacters' substitution is applied very late. As a result all special characters produced by 'quotes', 'specialwords', 'replacements', 'attributes' and 'macros' become escaped at the end. If you don't want special characters in the corresponding sections to get escaped, you've to use following symbols instead of the special characters.
+
+- `$$!..backslash..!$$` instead of `\`
+- `$$!..braceleft..!$$` instead of `{`
+- `$$!..braceright..!$$` instead of `}`
+
+
+For more special characters take a look in the `[replacements2]` sections. `[replacements2]` section is responsible for replacing the symbols with their corresponding special characters.
+
+
+== Ideas
+
+=== Code listing block
+
+For creating highlighted code listings I suggest the use of http://www.andre-simon.de/[Highlight] or http://www.gnu.org/software/src-highlite/[GNU Source Highlight]. Both are suited for use as Asciidoc filters.
+
+== Known Bugs
+
+- Sometimes LaTeX backend handles things differently from the default backends
+- A lot of little bugs
+
+== Todo List
+
+- Remove bugs
+- Support for 'grid' attribute in tables
+- Better looking tables
+- Option for squeezing output (smaller lists)
+- Support for different languages (That would be a nice feature for Asciidoc in general)
+- Option for switching titlepage on and off \ No newline at end of file
diff --git a/doc/latexmath.txt b/doc/latexmath.txt
new file mode 100644
index 0000000..e050da1
--- /dev/null
+++ b/doc/latexmath.txt
@@ -0,0 +1,35 @@
+LaTeXMathML Formulae
+====================
+
+http://www.maths.nottingham.ac.uk/personal/drw/lm.html[LaTeXMathML]
+capability has been added to AsciiDoc for users who are more familar
+with or prefer LaTeX math formulas to the
+http://www.methods.co.nz/asciidoc/asciimath.html[ASCIIMathML]
+notation.
+
+'LaTeXMathML' is a derivative of
+http://www.methods.co.nz/asciidoc/asciimath.html[ASCIIMathML] -- in
+terms of usage the only difference it that you use the `latexmath`
+attribute instead of the `asciimath` attribute.
+
+Here's the link:latexmath.txt[AsciiDoc source] that generated this
+page.
+
+Some example 'LaTeXMathML' formulas:
+
+- $$$R_x = 10.0 \times \sin(R_\phi)$$$
+
+- [,,2]##$$$\sum_{n=1}^\infty \frac{1}{2^n}$$$##
+
+- $$$\lim_{x\to\infty} f(x) = k \choose r + \frac ab \sum_{n=1}^\infty
+ a_n + \displaystyle{ \left\{ \frac{1}{13} \sum_{n=1}^\infty b_n
+ \right\} }$$$
+
+- $$$\$\alpha + \$\beta = \$(\alpha + \beta)$$$
+
+- $$$\begin{eqnarray} x & = & \frac{-7 \pm \sqrt{49 - 24}}{6} \\ & = &
+ -2 \textrm{ or } -\frac13. \end{eqnarray}$$$
+
+- $$$\displaystyle{ V_i = C_0 - C_3
+ \frac{C_1\cos(\theta_i+C_3)}{C_4+C_1\cos(\theta_i+C_2)} }$$$
+
diff --git a/doc/main.aap b/doc/main.aap
new file mode 100644
index 0000000..562f9e8
--- /dev/null
+++ b/doc/main.aap
@@ -0,0 +1,250 @@
+#####################################################################
+#
+# A-A-P file for making AsciiDoc distribution documents.
+# (you can obtain A-A-P from http://www.a-a-p.org)
+#
+# Stuart Rackham <srackham@methods.co.nz>
+#####################################################################
+
+VERS = 8.2.3
+DATE = 12 September 2007
+
+#####################################################################
+# Programs used by this script.
+#####################################################################
+
+# If python is not in your executable search path you may have to
+# tweak these locations. Note also that this script is in the distribution
+# ./doc directory and a number of paths are relative.
+
+## Older or alternative rules and actions have been commented out but not
+# deleted.
+
+@if OSTYPE == 'mswin':
+ ASCIIDOC = python ..\asciidoc.py -a revision=$(VERS)@ -a date="$(DATE)@"
+ HHC = "C:\Program Files\HTML Help Workshop\hhc.exe"
+ FOP = fop.bat
+@else:
+ ASCIIDOC = python ../asciidoc.py -a revision=$(VERS)@ -a date="$(DATE)@"
+ @if os.uname()[0][:6] == 'CYGWIN':
+ HHC = "c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe"
+ :syseval which fop.bat | :assign FOP
+ @else:
+ HHC =
+ :syseval which fop.sh | :assign FOP
+
+:syseval which jw | :assign JW # Converts DocBook SGML to PDF.
+:syseval which lynx | :assign LYNX # Converts HTML to text.
+:syseval which xmllint | :assign XMLLINT # Validates XML.
+
+## xsltproc(1) is used instead of xmlto(1).
+#XMLTO = xmlto
+ASPELL = aspell
+XSLTPROC = xsltproc
+
+ROOT = asciidoc asciidoc.1
+INFILES = $*(ROOT).txt
+CHUNK_DIR = ./asciidoc.chunked
+HTMLHELP_DIR = ./asciidoc.htmlhelp
+HTMLHELP_FILE = asciidoc
+OUTFILES = $*(ROOT).html $*(ROOT).css.html $*(ROOT).css-embedded.html \
+ asciidoc.pdf asciidoc.1.man a2x.1.man \
+ article.html book.html book-multi.html asciidoc.xml asciidoc.1.xml \
+ ../BUGS ../CHANGELOG ../README ../INSTALL \
+ latex-backend.html \
+ ${HTMLHELP_FILE}.chm \
+ $CHUNK_DIR/index.html \
+ article.pdf \
+ source-highlight-filter.pdf \
+ music-filter.pdf
+
+
+#####################################################################
+# Filetype build rules.
+#####################################################################
+
+:rule %.text : %.txt
+ # Convert AsciiDoc to HTML then use lynx(1) to convert HTML to text.
+ @if _no.OSTYPE != 'posix':
+ :print WARNING: non-POSIX environment: skipping $target file generation
+ @elif not _no.LYNX:
+ :print WARNING: lynx(1) unavailable: skipping $target file generation
+ @else:
+ opt = -f ../text.conf
+ @if source_list[0] == 'asciidoc.1.txt':
+ opt += -d manpage
+ @else:
+ opt += -n
+ :sys $ASCIIDOC $opt -b html4 -o - $source | \
+ lynx -dump -stdin > $target
+
+## The preceding rule makes a better job of producing plain text.
+#:rule %.text : %.xml
+# :sys $XMLTO txt $source
+
+:rule %.css.html : %.txt
+ opt =
+ @if source_list[0] == 'asciidoc.1.txt':
+ opt += -d manpage
+ @else:
+ opt += -n
+ opt += -a toc -a toclevels=2 -a scriptsdir=../javascripts
+ :sys $ASCIIDOC $opt -b xhtml11 -a linkcss -a icons -a stylesdir=../stylesheets -o $target $(source[0])
+ @if _no.XMLLINT:
+ :sys $XMLLINT --nonet --noout --valid $target
+ @else:
+ :print WARNING: xmllint(1) unavailable: skipping validation
+
+:rule %.css-embedded.html : %.txt
+ opt =
+ @if source_list[0] == 'asciidoc.1.txt':
+ opt += -d manpage
+ @else:
+ opt += -n
+ opt += -a toc -a toclevels=2
+ :sys $ASCIIDOC -b xhtml11 $opt -o $target $(source[0])
+ @if _no.XMLLINT:
+ :sys $XMLLINT --nonet --noout --valid $target
+ @else:
+ :print WARNING: xmllint(1) unavailable: skipping validation
+
+:rule %.xml : %.txt
+ opt =
+ @if source_list[0] in ('asciidoc.1.txt','a2x.1.txt'):
+ opt += -d manpage
+ @else:
+ opt += -n
+ :sys $ASCIIDOC $opt -b docbook $(source[0])
+ @if _no.XMLLINT:
+ :sys $XMLLINT --nonet --noout --valid $target
+ @else:
+ :print WARNING: xmllint(1) unavailable: skipping validation
+
+:rule %.sgml : %.txt
+ opt =
+ @if source_list[0] in ('asciidoc.1.txt','a2x.1.txt'):
+ opt += -d manpage
+ :sys $ASCIIDOC $opt -b docbook-sgml $(source[0])
+
+:rule %.html: %.xml
+# :sys $XMLTO xhtml-nochunks $source
+ :sys $XSLTPROC --nonet --stringparam admon.textlabel 0 --stringparam html.stylesheet ./docbook-xsl.css ../docbook-xsl/xhtml.xsl $source >$target
+
+## Generate plain HTML from DocBook XML using the preceeding rule.
+#:rule %.html : %.txt
+# opt =
+# @if source_list[0] == 'asciidoc.1.txt':
+# opt += -d manpage
+# @else:
+# opt += -n
+# :sys $ASCIIDOC $opt -b xhtml $(source[0])
+
+:rule %.man : %.xml
+ :sys $XSLTPROC --nonet ../docbook-xsl/manpage.xsl $source
+ :sys touch $target # Dummy target.
+
+## Generate manpage from XML using preceeding rule.
+#:rule %.man : %.sgml
+# :sys $JW -b man $(match).sgml
+# :sys touch $target # Dummy target.
+
+:rule %.fo: %.xml
+ :sys $XSLTPROC --nonet --stringparam admon.textlabel 0 ../docbook-xsl/fo.xsl $source >$target
+
+# Try PDF generators in order of preference.
+@if _no.FOP:
+ :rule %.pdf: %.fo
+ :sys $FOP $source $target
+@elif _no.JW:
+ :rule %.pdf: %.sgml
+ :sys $JW -b pdf $source
+@else:
+ :rule %.pdf:
+ :print WARNING: PDF processor unavailable: skipping $target file generation
+
+## jw(1) renders better PDF than xmlto(1) (see preceeding rule).
+#:rule %.pdf : %.xml
+# :sys $XMLTO pdf $source
+
+
+#####################################################################
+# Explicit file generation (cases that don't fit the rules).
+#####################################################################
+
+asciidoc.1.html: asciidoc.1.txt
+ :sys $ASCIIDOC -d manpage -b html4 $source
+ @if _no.XMLLINT:
+ :sys $XMLLINT --nonet --noout --valid --html $target
+ @else:
+ :print WARNING: xmllint(1) unavailable: skipping validation
+
+# User Guide 'chunked' into linked HTML pages.
+$CHUNK_DIR/index.html: asciidoc.xml
+ :mkdir {f} $CHUNK_DIR
+ :del {f} {q} $CHUNK_DIR/*.html
+ :sys $XSLTPROC --nonet --stringparam base.dir $CHUNK_DIR/ --stringparam html.stylesheet ../docbook-xsl.css ../docbook-xsl/chunked.xsl $source
+
+# HTML Help formatted User Guide.
+$HTMLHELP_DIR/index.html: asciidoc.xml
+ :mkdir {f} $HTMLHELP_DIR
+ :del {f} {q} $HTMLHELP_DIR/*.html
+ :sys $XSLTPROC --nonet --stringparam admon.textlabel 0 --stringparam base.dir $HTMLHELP_DIR/ --stringparam html.stylesheet ../docbook-xsl.css --stringparam htmlhelp.hhp ${HTMLHELP_FILE}.hhp --stringparam htmlhelp.chm ${HTMLHELP_FILE}.chm ../docbook-xsl/htmlhelp.xsl $source
+
+${HTMLHELP_FILE}.chm: $HTMLHELP_DIR/index.html
+ @if _no.HHC:
+ :sys {f} "$HHC" ${HTMLHELP_FILE}.hhp
+ @else:
+ :print WARNING: HTMLHelp compiler unavailable: skipping asciidoc.chm file generation
+
+# Book template.
+book.html: book.txt
+ :sys $ASCIIDOC -d book -b docbook $source
+# :sys $XMLTO xhtml-nochunks book.xml
+ :sys $XSLTPROC --nonet --stringparam html.stylesheet ./docbook-xsl.css ../docbook-xsl/xhtml.xsl book.xml >$target
+
+# Multi-part book template.
+book-multi.html: book-multi.txt
+ :sys $ASCIIDOC -d book -b docbook $source
+# :sys $XMLTO xhtml-nochunks book-multi.xml
+ :sys $XSLTPROC --nonet --stringparam html.stylesheet ./docbook-xsl.css ../docbook-xsl/xhtml.xsl book-multi.xml >$target
+
+../BUGS: ../BUGS.text
+ # Make BUGS.text and copy to BUGS.
+ :copy ../BUGS.text ../BUGS
+
+../CHANGELOG: ../CHANGELOG.text
+ # Make CHANGELOG.text and copy to CHANGELOG.
+ :copy ../CHANGELOG.text ../CHANGELOG
+
+../README: ../README.text
+ # Make README.text and copy to README.
+ :copy ../README.text ../README
+
+../INSTALL: ../INSTALL.text
+ # Make INSTALL.text and copy to INSTALL.
+ :copy ../INSTALL.text ../INSTALL
+
+asciimath.html: asciimath.txt
+ :sys $ASCIIDOC -a asciimath $source
+ # No xmllint(1) checking -- fails on embedded JavaScript.
+
+latexmath.html: latexmath.txt
+ :sys $ASCIIDOC -a latexmath $source
+ # No xmllint(1) checking -- fails on embedded JavaScript.
+
+
+#####################################################################
+# Build commands.
+#####################################################################
+
+all: $OUTFILES
+
+clean:
+ :del {f} $OUTFILES
+ :del {f} *.bak # Remove aspell backups.
+
+spell: $INFILES ../CHANGELOG.txt ../README.txt ../BUGS.txt ../INSTALL.txt \
+ a2x.1.txt
+ # Interactively spell check all files.
+ @for s in source_list:
+ :sys {i} $ASPELL check -p asciidoc.dict $s
diff --git a/doc/music-filter.txt b/doc/music-filter.txt
new file mode 100644
index 0000000..5900ec7
--- /dev/null
+++ b/doc/music-filter.txt
@@ -0,0 +1,157 @@
+Music Filter
+============
+
+The AsciiDoc distribution includes a Music Block filter that
+translates music in http://lilypond.org/[LilyPond] or
+http://abcnotation.org.uk/[ABC] notation to standard classical
+notation in the form of a trimmed PNG image which is automatically
+inserted into the AsciiDoc output document (see the <<X1,examples
+below>>).
+
+Actually the filter (`./filters/music2png.py`) can be used outside
+AsciiDoc to convert LilyPond or ABC music files to PNG images.
+Execute the following command to see how to use it:
+
+ $ ./filters/music2png.py --help
+
+The Music Filter can be used as a model for filters that convert a
+block of text into a file that is linked or embedded into the AsciiDoc
+output document.
+
+[[X1]]
+[caption="Example 1: "]
+.Music Block containing ABC notation
+=====================================================================
+
+This Music Block:
+
+---------------------------------------------------------------------
+[music1.png]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+T:The Butterfly
+R:slip jig
+C:Tommy Potts
+H:Fiddle player Tommy Potts made this tune from two older slip jigs,
+H:one of which is called "Skin the Peelers" in Roche's collection.
+D:Bothy Band: 1975.
+M:9/8
+K:Em
+vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
+|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
+|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------------------
+
+Renders:
+
+[music1.png]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+T:The Butterfly
+R:slip jig
+C:Tommy Potts
+H:Fiddle player Tommy Potts made this tune from two older slip jigs,
+H:one of which is called "Skin the Peelers" in Roche's collection.
+H:This version by Peter Cooper.
+D:Bothy Band: 1975.
+M:9/8
+K:Em
+vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
+|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
+|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+=====================================================================
+
+
+[[X2]]
+[caption="Example 2: "]
+.Music Block containing LilyPond notation
+=====================================================================
+This example contains LilyPond musical markup, it uses the 'link'
+attribute so you can click on the music image to display the source
+notation. The `music2.ly` source file is automatically created and
+retained by the `music2png.py` filter when the `-m` option is used.
+
+---------------------------------------------------------------------
+["music2.png", "ly", link="music2.ly"]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+\version "2.10.0"
+\paper {
+ ragged-right = ##t
+}
+{
+ \time 3/4
+ \clef bass
+ c2 e4 g2. f4 e d c2 r4
+}
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------------------
+
+Renders:
+
+["music2.png", "ly", link="music2.ly"]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+\version "2.10.0"
+\paper {
+ ragged-right = ##t
+}
+{
+ \time 3/4
+ \clef bass
+ c2 e4 g2. f4 e d c2 r4
+}
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+=====================================================================
+
+NOTE: If you get an error processing the above example it may be that
+it is not compatible with your version of LilyPond. Use the LilyPond
+`convert-ly(1)` utility to update the source to the version that you
+are using.
+
+
+Using the Filter
+----------------
+Insert a delimited Music Block containing valid ABC notation into your
+AsciiDoc document:
+
+- The Music Block delimiter is the word `music` followed by four or
+ more tilde characters.
+- The Music Block attribute list must contain a file name for the PNG
+ output image file followed by the input format (either 'abc' for ABC
+ or 'ly' for LilyPond). If the format is omitted ABC notation is
+ assumed.
+- The filter invokes `music2png` with the `-m` option so that music
+ images will only be regenerated if the block content has changed.
+- The optional named block attributes 'link', 'width' and 'height' are
+ also available (see link:userguide.html#X55[Image macro attributes]
+ in the AsciiDoc User Guide).
+
+
+Limitations
+-----------
+- The `asciidoc(1)` output file cannot be `-` (stdout), you must
+ output to a named file.
+- If the music image file is linked to the output document then the
+ image file name in the Music Block attribute list should be a
+ relative path name relative to the AsciiDoc output file.
+
+
+Installation
+------------
+In addition to AsciiDoc you will need to have installed:
+
+- http://lilypond.org/web/[LilyPond] (most Linux distributions include
+ this package).
+- http://www.imagemagick.org[ImageMagick] (most Linux distributions
+ include this package).
+
+Test the music filter it by converting the test file to HTML with AsciiDoc:
+
+ $ asciidoc -v ./filters/music-filter-test.txt
+ $ firefox ./filters/music-filter-test.html &
+
+The filter was developed and tested on Xubuntu Linux using LilyPond
+2.10.5 and ImageMagick 6.2.4.
+
+NOTE: The filter does not work with LilyPond 2.2.6 because it did not
+generate the requested output file name correctly (2.6.3 does not have
+a problem).
diff --git a/doc/source-highlight-filter.txt b/doc/source-highlight-filter.txt
new file mode 100644
index 0000000..eba9cae
--- /dev/null
+++ b/doc/source-highlight-filter.txt
@@ -0,0 +1,174 @@
+Source Code Highlight Filter
+============================
+
+The AsciiDoc distribution includes a source code syntax highlight
+filter (`source-highlight-filter.conf`) which uses
+http://www.gnu.org/software/src-highlite/[GNU source-highlight]. GNU
+source-highlight generates nicely formatted source code for most
+common programming languages.
+
+
+Examples
+--------
+
+[caption="Example 1: "]
+.Python code snippet
+=====================================================================
+This source-highlight filtered block:
+
+---------------------------------------------------------------------
+[python]
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+''' A multi-line
+ comment.'''
+def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------------------
+
+Renders this highlighted source code:
+
+[python]
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+''' A multi-line
+ comment.'''
+def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+=====================================================================
+
+
+[caption="Example 2: "]
+.Ruby code snippet with line numbering
+=====================================================================
+This source-highlight filtered block:
+
+---------------------------------------------------------------------
+[ruby,numbered]
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Useful Ruby base class extensions.
+#
+
+class Array
+
+ # Execute a block passing it corresponding items in
+ # +self+ and +other_array+.
+ # If self has less items than other_array it is repeated.
+
+ def cycle(other_array) # :yields: item, other_item
+ other_array.each_with_index do |item, index|
+ yield(self[index % self.length], item)
+ end
+ end
+
+end
+
+if $0 == __FILE__
+ # Array#cycle test
+ # true => 0
+ # false => 1
+ # true => 2
+ # false => 3
+ # true => 4
+ puts 'Array#cycle test'
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
+ puts "#{a.inspect} => #{b.inspect}"
+ end
+end
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+---------------------------------------------------------------------
+
+Renders this highlighted source code:
+
+[ruby,numbered]
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Useful Ruby base class tension's.
+#
+
+class Array
+
+ # Execute a block passing it corresponding items in
+ # +self+ and +other_array+.
+ # If self has less items than other_array it is repeated.
+
+ def cycle(other_array) # :yields: item, other_item
+ other_array.each_with_index do |item, index|
+ yield(self[index % self.length], item)
+ end
+ end
+
+end
+
+if $0 == __FILE__
+ # Array#cycle test
+ # true => 0
+ # false => 1
+ # true => 2
+ # false => 3
+ # true => 4
+ puts 'Array#cycle test'
+ [true, false].cycle([0, 1, 2, 3, 4]) do |a, b|
+ puts "#{a.inspect} => #{b.inspect}"
+ end
+end
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+=====================================================================
+
+
+Installation
+------------
+As a prerequisite you will have installed and tested
+http://www.gnu.org/software/src-highlite/[GNU source-highlight] (most
+distributions have this package).
+
+Test the filter by converting the test file to HTML with AsciiDoc:
+
+ $ asciidoc -v ./filters/source-highlight-filter-test.txt
+ $ firefox ./filters/source-highlight-filter-test.html &
+
+DocBook Output Definition file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+NOTE: As of Source-highlight 2.3 the AsciiDoc DocBook output
+definition file has been included in the Source-highlight distribution
+so you can skip this section if you have version 2.3 or greater.
+
+Source-highlight 2.2 and below do not ship with DocBook output
+definition files. If you want to generate DocBook instead of HTML the
+following simple DocBook output definition file will do the trick:
+
+---------------------------------------------------------------------
+extension "xml"
+
+bold "<emphasis role=\"strong\">$text</emphasis>"
+italics "<emphasis>$text</emphasis>"
+
+translations
+"&" "&amp;"
+"<" "&lt;"
+">" "&gt;"
+end
+---------------------------------------------------------------------
+
+To install it:
+
+1. Name it `docbook.outlang` and copy it to the `source-highlight`
+ configuration files directory (typically
+ `/usr/local/share/source-highlight/`).
+2. Add the following line to
+ `/usr/local/share/source-highlight/outlang.map`:
+
+ docbook = docbook.outlang
+
+
diff --git a/docbook-xsl/asciidoc-docbook-xsl.txt b/docbook-xsl/asciidoc-docbook-xsl.txt
new file mode 100644
index 0000000..0ce7b93
--- /dev/null
+++ b/docbook-xsl/asciidoc-docbook-xsl.txt
@@ -0,0 +1,96 @@
+AsciiDoc DocBook XSL Stylesheets Notes
+======================================
+
+*********************************************************************
+All current AsciiDoc PDF and manpage documentation has been generated
+using *DocBook XSL Stylesheets version 1.72.0*, these notes and
+patches relate to this version. The version of FOP used is 0.20.5 (I
+did try FOP 0.93 under Ubuntu 6.10, but got a Java exception which I
+didn't pursue).
+
+*********************************************************************
+
+My tools of choice for converting AsciiDoc generated DocBook files to
+PDF and manpage files are xsltproc(1), FOP and DocBook XSL
+Stylesheets. Output file customisation is achieved by tweaking the
+DocBook XSL stylesheets. I've tried to keep customization to a minimum
+and confine it to the separate XSL driver files in the distribution
+`./docbook-xsl/` directory (see the User Guide for details).
+
+To polish some rough edges I've written some patches for the DocBook
+XSL stylesheets -- you don't need them but they're documented below
+and included in the distribution `./docbook-xsl/` directory.
+
+
+Manually upgrading Debian to the latest DocBook XSL stylesheets
+---------------------------------------------------------------
+The DocBook XSL Stylesheets distribution is just a directory full of
+text files and you can switch between releases by changing the
+directory name in the system XML catalog.
+
+To upgrade to the latest docbook-xsl stylesheets without having to
+wait for the Debian `docbook-xsl` package:
+
+- Download the latest docbook-xsl tarball from
+ http://sourceforge.net/projects/docbook/[].
+
+- Unzip the tarball to `/usr/share/xml/docbook/stylesheet/`:
+
+ $ cd /usr/share/xml/docbook/stylesheet
+ $ sudo tar -xzf /tmp/docbook-xsl-1.72.0.tar.gz
+
+- Edit `/etc/xml/docbook-xsl.xml` catalog and replace occurences of
+ the current stylesheets directory with the new one (in our example
+ it would be `/usr/share/xml/docbook/stylesheet/docbook-xsl-1.72.0`.
+
+ $ cd /etc/xml/
+ $ sudo cp -p docbook-xsl.xml docbook-xsl.xml.ORIG
+ $ sudo vi docbook-xsl.xml
+
+- Apply optional patches (see below).
+
+
+Patches to DocBook XSL Stylesheets
+----------------------------------
+NOTE: You'll find the patch files in the AsciiDoc distribution archive
+`./docbook-xsl/` directory.
+
+Shade Literal Block Patch
+~~~~~~~~~~~~~~~~~~~~~~~~~
+The processing expectation for AsciiDoc LiteralBlocks and
+LiteralParagraphs is that they are not shaded. The
+`shaded-literallayout.patch` was devised to allow AciiDoc Listing
+blocks to be shaded while leaving Literal paragraphs and Literal
+blocks unshaded (the default DocBook XSL Stylesheets behavior is to
+shade all verbatim elements).
+
+The patch implements a `shade.literallayout` XSL parameter so that
+shading in literal elements could be disabled while other verbatim
+elements are left shaded (by setting the XSL `shade.verbatim`
+parameter).
+
+The relevant patch file is `shaded-literallayout.patch` and it can be
+applied from the DocBook XSL Stylesheets directory:
+
+ $ cd /usr/share/xml/docbook/stylesheet/docbook-xsl-1.72.0
+ $ sudo patch -p0 < /tmp/shaded-literallayout.patch
+
+/////////////////////////////////////////////////////////////////////
+Manpage spurious .sp patch
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+IMPORTANT: *Don't apply this patch*. It was designed for docbook-xsl
+1.69.1 (the previous version of docbook-xsl used with AsciiDoc) and
+does not work with 1.72.0. I don't think it's necessary with
+docbook-xsl 1.72.0.
+
+Standalone `simpara` and some nested `title` DocBook elements generate
+`.sp` groff markup without a preceding newline, the `manpage-sp.patch`
+fixes this as well as stripping out extra blank lines generated by
+some `.sp` markup elements.
+
+The patch can be applied from the DocBook XSL Stylesheets directory
+with the following command:
+
+ # patch -p0 < manpage-sp.patch
+
+/////////////////////////////////////////////////////////////////////
diff --git a/docbook-xsl/chunked.xsl b/docbook-xsl/chunked.xsl
new file mode 100644
index 0000000..9af8def
--- /dev/null
+++ b/docbook-xsl/chunked.xsl
@@ -0,0 +1,19 @@
+<!--
+ Generates chunked XHTML documents from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+<xsl:import href="common.xsl"/>
+<xsl:param name="base.dir" select="'./chunked/'"/>
+<xsl:param name="html.stylesheet" select="'./docbook-xsl.css'"/>
+<xsl:param name="navig.graphics.path">../images/icons/</xsl:param>
+<xsl:param name="admon.graphics.path">../images/icons/</xsl:param>
+<xsl:param name="callout.graphics.path" select="'../images/icons/callouts/'"/>
+</xsl:stylesheet>
diff --git a/docbook-xsl/common.xsl b/docbook-xsl/common.xsl
new file mode 100644
index 0000000..fdbfb08
--- /dev/null
+++ b/docbook-xsl/common.xsl
@@ -0,0 +1,61 @@
+<!--
+ Inlcuded in xhtml.xsl, xhtml.chunked.xsl, htmlhelp.xsl.
+ Contains common XSL stylesheets parameters.
+ Output documents styled by docbook.css.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="html.stylesheet" select="'./docbook-xsl.css'"/>
+
+<xsl:param name="htmlhelp.chm" select="'htmlhelp.chm'"/>
+<xsl:param name="htmlhelp.hhc.section.depth" select="5"/>
+
+<xsl:param name="suppress.navigation" select="0"/>
+<xsl:param name="navig.graphics.extension" select="'.png'"/>
+<xsl:param name="navig.graphics" select="0"/>
+<xsl:param name="navig.graphics.path">./images/icons/</xsl:param>
+<xsl:param name="navig.showtitles">0</xsl:param>
+
+<xsl:param name="shade.verbatim" select="0"/>
+<xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="border">0</xsl:attribute>
+ <xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="admon.graphics" select="1"/>
+<xsl:param name="admon.graphics.path">./images/icons/</xsl:param>
+<xsl:param name="admon.graphics.extension" select="'.png'"/>
+<xsl:param name="admon.style">
+ <xsl:text>margin-left: 0; margin-right: 10%;</xsl:text>
+</xsl:param>
+<xsl:param name="admon.textlabel" select="1"/>
+
+<xsl:param name="callout.defaultcolumn" select="'60'"/>
+<xsl:param name="callout.graphics.extension" select="'.png'"/>
+<xsl:param name="callout.graphics" select="'1'"/>
+<xsl:param name="callout.graphics.number.limit" select="'10'"/>
+<xsl:param name="callout.graphics.path" select="'./images/icons/callouts/'"/>
+<xsl:param name="callout.list.table" select="'1'"/>
+
+<xsl:param name="base.dir" select="'./xhtml/'"/>
+<xsl:param name="chunk.first.sections" select="0"/>
+<xsl:param name="chunk.quietly" select="0"/>
+<xsl:param name="chunk.section.depth" select="1"/>
+<xsl:param name="chunk.toc" select="''"/>
+<xsl:param name="chunk.tocs.and.lots" select="0"/>
+
+<xsl:param name="html.cellpadding" select="'4px'"/>
+<xsl:param name="html.cellspacing" select="''"/>
+
+<xsl:param name="table.borders.with.css" select="1"/>
+<xsl:param name="table.cell.border.color" select="''"/>
+
+<xsl:param name="table.cell.border.style" select="'solid'"/>
+<xsl:param name="table.cell.border.thickness" select="'1px'"/>
+<xsl:param name="table.footnote.number.format" select="'a'"/>
+<xsl:param name="table.footnote.number.symbols" select="''"/>
+<xsl:param name="table.frame.border.color" select="'#527bbd'"/>
+<xsl:param name="table.frame.border.style" select="'solid'"/>
+<xsl:param name="table.frame.border.thickness" select="'2px'"/>
+<xsl:param name="tablecolumns.extension" select="'1'"/>
+
+</xsl:stylesheet>
diff --git a/docbook-xsl/fo.xsl b/docbook-xsl/fo.xsl
new file mode 100644
index 0000000..37e1de4
--- /dev/null
+++ b/docbook-xsl/fo.xsl
@@ -0,0 +1,112 @@
+<!--
+ Generates single FO document from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ See xsl-stylesheets/fo/param.xsl for all parameters.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<xsl:param name="fop.extensions" select="1" />
+<xsl:param name="variablelist.as.blocks" select="1" />
+
+<xsl:param name="paper.type" select="'A4'"/>
+<!--
+<xsl:param name="paper.type" select="'USletter'"/>
+-->
+<xsl:param name="hyphenate">false</xsl:param>
+<!-- justify, left or right -->
+<xsl:param name="alignment">left</xsl:param>
+
+<xsl:param name="body.font.family" select="'serif'"/>
+<xsl:param name="body.font.master">12</xsl:param>
+<xsl:param name="body.font.size">
+ <xsl:value-of select="$body.font.master"/><xsl:text>pt</xsl:text>
+</xsl:param>
+
+<xsl:param name="body.margin.bottom" select="'0.5in'"/>
+<xsl:param name="body.margin.top" select="'0.5in'"/>
+<xsl:param name="bridgehead.in.toc" select="0"/>
+
+<!-- Default fetches image from Internet (long timeouts) -->
+<xsl:param name="draft.watermark.image" select="''"/>
+
+<!-- Sets title to body text indent -->
+<xsl:param name="title.margin.left">
+ <xsl:choose>
+ <xsl:when test="$passivetex.extensions != 0">0pt</xsl:when>
+ <xsl:otherwise>-12pt</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:param name="page.margin.bottom" select="'0.25in'"/>
+<xsl:param name="page.margin.inner">
+ <xsl:choose>
+ <xsl:when test="$double.sided != 0">0.75in</xsl:when>
+ <xsl:otherwise>0.5in</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+<xsl:param name="page.margin.outer">
+ <xsl:choose>
+ <xsl:when test="$double.sided != 0">0.5in</xsl:when>
+ <xsl:otherwise>0.5in</xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:param name="page.margin.top" select="'0.5in'"/>
+<xsl:param name="page.orientation" select="'portrait'"/>
+<xsl:param name="page.width">
+ <xsl:choose>
+ <xsl:when test="$page.orientation = 'portrait'">
+ <xsl:value-of select="$page.width.portrait"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$page.height.portrait"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:param>
+
+<xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-size">10pt</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="admon.graphics" select="1"/>
+<xsl:param name="admon.textlabel" select="1"/>
+<xsl:attribute-set name="admonition.title.properties">
+ <xsl:attribute name="font-size">14pt</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="keep-with-next.within-column">always</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="sidebar.properties" use-attribute-sets="formal.object.properties">
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">1pt</xsl:attribute>
+ <xsl:attribute name="border-color">silver</xsl:attribute>
+ <xsl:attribute name="background-color">#ffffee</xsl:attribute>
+ <xsl:attribute name="padding-left">12pt</xsl:attribute>
+ <xsl:attribute name="padding-right">12pt</xsl:attribute>
+ <xsl:attribute name="padding-top">6pt</xsl:attribute>
+ <xsl:attribute name="padding-bottom">6pt</xsl:attribute>
+ <xsl:attribute name="margin-left">0pt</xsl:attribute>
+ <xsl:attribute name="margin-right">12pt</xsl:attribute>
+ <xsl:attribute name="margin-top">6pt</xsl:attribute>
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:param name="callout.graphics" select="'1'"/>
+
+<xsl:param name="shade.literallayout" select="0"/>
+<xsl:param name="shade.verbatim" select="1"/>
+<xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
+</xsl:attribute-set>
+
+</xsl:stylesheet>
diff --git a/docbook-xsl/htmlhelp.xsl b/docbook-xsl/htmlhelp.xsl
new file mode 100644
index 0000000..b9b18af
--- /dev/null
+++ b/docbook-xsl/htmlhelp.xsl
@@ -0,0 +1,17 @@
+<!--
+ Generates chunked HTML Help HTML documents from DocBook XML source using
+ DocBook XSL stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>
+<xsl:import href="common.xsl"/>
+<xsl:param name="base.dir" select="'./htmlhelp/'"/>
+<xsl:param name="htmlhelp.hhp" select="'asciidoc.hhp'"/>
+<xsl:param name="suppress.navigation" select="1"/>
+</xsl:stylesheet>
diff --git a/docbook-xsl/manpage-sp.patch b/docbook-xsl/manpage-sp.patch
new file mode 100644
index 0000000..8a51c84
--- /dev/null
+++ b/docbook-xsl/manpage-sp.patch
@@ -0,0 +1,41 @@
+diff -u ./manpages.ORIG/block.xsl ./manpages/block.xsl
+--- ./manpages.ORIG/block.xsl 2005-11-30 17:31:23.135642494 +1300
++++ ./manpages/block.xsl 2005-11-30 17:35:59.368886010 +1300
+@@ -37,7 +37,7 @@
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="normalize-space($content)"/>
+- <xsl:text>.sp&#10;</xsl:text>
++ <xsl:text>&#10;.sp&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="address|literallayout|programlisting|screen|synopsis">
+@@ -56,7 +56,7 @@
+ <xsl:when test="parent::caption|parent::entry|parent::para|
+ parent::td|parent::th" /> <!-- do nothing -->
+ <xsl:otherwise>
+- <xsl:text>.sp&#10;</xsl:text>
++ <xsl:text>&#10;.sp&#10;</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>.nf&#10;</xsl:text>
+diff -u ./manpages.ORIG/param.xsl ./manpages/param.xsl
+--- ./manpages.ORIG/param.xsl 2005-11-30 17:31:23.164638883 +1300
++++ ./manpages/param.xsl 2005-11-30 17:58:14.345174391 +1300
+@@ -47,6 +47,16 @@
+ <substitution oldstring="&#xA;&#xA;." newstring="&#xA;."/>
+ <!-- * remove any .sp occurences that directly follow a .PP -->
+ <substitution oldstring=".PP&#xA;.sp" newstring=".PP"/>
++
++ <!-- * remove any .sp occurences that directly preceed a .SH -->
++ <substitution oldstring=".sp&#xA;.SH" newstring=".SH"/>
++ <!-- * remove any .sp occurences that directly preceed a .TP -->
++ <substitution oldstring=".sp&#xA;.TP" newstring=".TP"/>
++ <!-- * remove any .sp occurences that directly preceed a .SS -->
++ <substitution oldstring=".sp&#xA;.SS" newstring=".SS"/>
++ <!-- * remove any .sp occurences that directly preceed a .sp -->
++ <substitution oldstring=".sp&#xA;.sp" newstring=".sp"/>
++
+ <!-- * squeeze multiple newlines after start of no-fill (verbatim) env. -->
+ <substitution oldstring=".nf&#xA;&#xA;" newstring=".nf&#xA;"/>
+ <!-- * an apostrophe at the beginning of a line gets interpreted as a -->
diff --git a/docbook-xsl/manpage.xsl b/docbook-xsl/manpage.xsl
new file mode 100644
index 0000000..6f7d333
--- /dev/null
+++ b/docbook-xsl/manpage.xsl
@@ -0,0 +1,28 @@
+<!--
+ Generates single roff manpage document from DocBook XML source using DocBook
+ XSL stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+
+<!-- Only render the link text -->
+<xsl:template match="ulink">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:value-of select="$content"/>
+</xsl:template>
+
+<!-- Don't automatically generate the REFERENCES section -->
+<xsl:template name="format.links.list">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/docbook-xsl/shaded-literallayout.patch b/docbook-xsl/shaded-literallayout.patch
new file mode 100644
index 0000000..e88ff98
--- /dev/null
+++ b/docbook-xsl/shaded-literallayout.patch
@@ -0,0 +1,32 @@
+diff -u fo.ORIG/param.xsl fo/param.xsl
+--- fo.ORIG/param.xsl 2005-11-30 19:22:15.992409173 +1300
++++ fo/param.xsl 2005-11-30 11:25:40.000000000 +1300
+@@ -669,6 +669,7 @@
+ </xsl:attribute-set>
+ <xsl:param name="segmentedlist.as.table" select="0"/>
+ <xsl:param name="shade.verbatim" select="0"/>
++<xsl:param name="shade.literallayout" select="0"/>
+
+ <xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
+diff -u fo.ORIG/verbatim.xsl fo/verbatim.xsl
+--- fo.ORIG/verbatim.xsl 2005-11-30 19:22:15.944415115 +1300
++++ fo/verbatim.xsl 2005-11-30 11:26:12.000000000 +1300
+@@ -105,7 +105,7 @@
+ <xsl:choose>
+ <xsl:when test="@class='monospaced'">
+ <xsl:choose>
+- <xsl:when test="$shade.verbatim != 0">
++ <xsl:when test="$shade.literallayout != 0">
+ <fo:block id="{$id}"
+ white-space-collapse='false'
+ white-space-treatment='preserve'
+@@ -128,7 +128,7 @@
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+- <xsl:when test="$shade.verbatim != 0">
++ <xsl:when test="$shade.literallayout != 0">
+ <fo:block id="{$id}"
+ wrap-option='no-wrap'
+ white-space-collapse='false'
diff --git a/docbook-xsl/xhtml.xsl b/docbook-xsl/xhtml.xsl
new file mode 100644
index 0000000..b5413b7
--- /dev/null
+++ b/docbook-xsl/xhtml.xsl
@@ -0,0 +1,14 @@
+<!--
+ Generates single XHTML document from DocBook XML source using DocBook XSL
+ stylesheets.
+
+ NOTE: The URL reference to the current DocBook XSL stylesheets is
+ rewritten to point to the copy on the local disk drive by the XML catalog
+ rewrite directives so it doesn't need to go out to the Internet for the
+ stylesheets. This means you don't need to edit the <xsl:import> elements on
+ a machine by machine basis.
+-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+<xsl:import href="common.xsl"/>
+</xsl:stylesheet>
diff --git a/docbook.conf b/docbook.conf
new file mode 100644
index 0000000..5686847
--- /dev/null
+++ b/docbook.conf
@@ -0,0 +1,597 @@
+#
+# docbook.conf
+#
+# Asciidoc configuration file.
+# Default docbook backend.
+#
+
+[miscellaneous]
+outfilesuffix=.xml
+# Printable page width in pts.
+pagewidth=380
+pageunits=pt
+
+[attributes]
+basebackend=docbook
+basebackend-docbook=
+
+[replacements]
+# Line break markup is dropped (there is no DocBook line break tag).
+(?m)^(.*)\s\+$=\1
+ifdef::asciidoc7compatible[]
+# Superscripts.
+\^(.+?)\^=<superscript>\1</superscript>
+# Subscripts.
+~(.+?)~=<subscript>\1</subscript>
+endif::asciidoc7compatible[]
+
+[ruler-blockmacro]
+# Only applies to HTML so don't output anything.
+
+[image-inlinemacro]
+<inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="{imagesdir=}{target}"{width? contentwidth="{width}pt"}{height? contentdepth="{height}pt"}/>
+ </imageobject>
+ <textobject><phrase>{1={target}}</phrase></textobject>
+</inlinemediaobject>
+
+[image-blockmacro]
+<figure{id? id="{id}"}><title>{title}</title>
+{title%}<informalfigure{id? id="{id}"}>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="{imagesdir=}{target}"{width? contentwidth="{width}pt"}{height? contentdepth="{height}pt"}/>
+ </imageobject>
+ <textobject><phrase>{1={target}}</phrase></textobject>
+</mediaobject>
+{title#}</figure>
+{title%}</informalfigure>
+
+[indexterm-inlinemacro]
+# Inline index term.
+# Generate separate index entries for primary, secondary and tertiary
+# descriptions.
+# Primary only.
+{2%}<indexterm>
+{2%} <primary>{1}</primary>
+{2%}</indexterm>
+# Primary and secondary.
+{2#}{3%}<indexterm>
+{2#}{3%} <primary>{1}</primary><secondary>{2}</secondary>
+{2#}{3%}</indexterm>
+{2#}{3%}<indexterm>
+{2#}{3%} <primary>{2}</primary>
+{2#}{3%}</indexterm>
+# Primary, secondary and tertiary.
+{3#}<indexterm>
+ <primary>{1}</primary><secondary>{2}</secondary><tertiary>{3}</tertiary>
+{3#}</indexterm>
+{3#}<indexterm>
+ <primary>{2}</primary><secondary>{3}</secondary>
+{3#}</indexterm>
+{3#}<indexterm>
+ <primary>{3}</primary>
+{3#}</indexterm>
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+<indexterm>
+ <primary>{1}</primary>
+</indexterm>
+{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+<footnote><simpara>{0}</simpara></footnote>
+
+[callout-inlinemacro]
+# Inline callout.
+<co id="{coid}"/>
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ilist=<itemizedlist{id? id="{id}"}>{title?<title>{title}</title>}|</itemizedlist>
+ilistitem=<listitem>|</listitem>
+ilisttext=<simpara>|</simpara>
+olist=<orderedlist{id? id="{id}"}>{title?<title>{title}</title>}|</orderedlist>
+olist2=<orderedlist{id? id="{id}"} numeration="loweralpha">|</orderedlist>
+olistitem=<listitem>|</listitem>
+olisttext=<simpara>|</simpara>
+vlist=<variablelist{id? id="{id}"}>{title?<title>{title}</title>}|</variablelist>
+vlistentry=<varlistentry>|</varlistentry>
+vlistterm=<term>|</term>
+vlisttext=<simpara>|</simpara>
+vlistitem=<listitem>|</listitem>
+# Horizontal labeled list (implemented with two column table).
+# Hardwired column widths to 30%,70% because the current crop of PDF
+# generators do not auto calculate column widths.
+hlist=<{title?table}{title!informaltable}{id? id="{id}"} tabstyle="{style=hlabeledlist}" pgwide="0" frame="none" colsep="0" rowsep="0">{title?<title>{title}</title>}<tgroup cols="2"><colspec colwidth="{1=3}*"/><colspec colwidth="{2=7}*"/><tbody valign="top">|</tbody></tgroup><{title?/table}{title!/informaltable}>
+hlistentry=<row>|</row>
+hlisttext=<simpara>|</simpara>
+hlistterm=<entry><simpara>|</simpara></entry>
+hlistitem=<entry>|</entry>
+
+# Question and Answer list.
+qlist=<qandaset{id? id="{id}"}>{title?<title>{title}</title>}|</qandaset>
+qlistentry=<qandaentry>|</qandaentry>
+qlistterm=<question><simpara>|</simpara></question>
+qlistitem=<answer>|</answer>
+qlisttext=<simpara>|</simpara>
+# Bibliography list.
+blist=|
+blistitem=<bibliomixed>|</bibliomixed>
+blisttext=<bibliomisc>|</bibliomisc>
+# Glossary list.
+glist=|
+glistentry=<glossentry>|</glossentry>
+glistterm=<glossterm>|</glossterm>
+glistitem=<glossdef>|</glossdef>
+glisttext=<simpara>|</simpara>
+# Callout list.
+colist=<calloutlist{id? id="{id}"}>{title?<title>{title}</title>}|</calloutlist>
+colistitem=<callout arearefs="{coids}">|</callout>
+colisttext=<simpara>|</simpara>
+
+# Quoted text
+emphasis=<emphasis>|</emphasis>
+strong=<emphasis role="strong">|</emphasis>
+monospaced=<literal>|</literal>
+quoted={amp}#8220;|{amp}#8221;
+unquoted=|
+subscript=<subscript>|</subscript>
+superscript=<superscript>|</superscript>
+
+# $$ inline passthrough.
+$$passthrough=|
+
+# Inline macros
+[http-inlinemacro]
+<ulink url="{name}:{target}">{0={name}:{target}}</ulink>
+[https-inlinemacro]
+<ulink url="{name}:{target}">{0={name}:{target}}</ulink>
+[ftp-inlinemacro]
+<ulink url="{name}:{target}">{0={name}:{target}}</ulink>
+[file-inlinemacro]
+<ulink url="{name}:{target}">{0={name}:{target}}</ulink>
+[mailto-inlinemacro]
+<ulink url="{name}:{target}">{0={target}}</ulink>
+[callto-inlinemacro]
+<ulink url="{name}:{target}">{0={target}}</ulink>
+[link-inlinemacro]
+<ulink url="{target}">{0={target}}</ulink>
+# anchor:id[text]
+[anchor-inlinemacro]
+<anchor id="{target}" xreflabel="{0=[{target}]}"/>
+# [[id,text]]
+[anchor2-inlinemacro]
+<anchor id="{1}" xreflabel="{2=[{1}]}"/>
+# [[[id]]]
+[anchor3-inlinemacro]
+<anchor id="{1}" xreflabel="[{1}]"/>[{1}]
+# xref:id[text]
+[xref-inlinemacro]
+<link linkend="{target}">{0}</link>
+{2%}<xref linkend="{target}"/>
+# <<id,text>>
+[xref2-inlinemacro]
+<link linkend="{1}">{2}</link>
+{2%}<xref linkend="{1}"/>
+
+
+# Special word macros
+[emphasizedwords]
+<emphasis>{words}</emphasis>
+[monospacedwords]
+<literal>{words}</literal>
+[strongwords]
+<emphasis role="strong">{words}</emphasis>
+
+# Paragraph substitution.
+[paragraph]
+<formalpara{id? id="{id}"}><title>{title}</title><para>
+{title%}<simpara{id? id="{id}"}>
+|
+{title%}</simpara>
+{title#}</para></formalpara>
+{empty}
+
+[admonitionparagraph]
+<{name}{id? id="{id}"}><simpara>|</simpara></{name}>
+
+[literalparagraph]
+# The literal block employs the same markup.
+template::[literalblock]
+
+[verseparagraph]
+template::[verseblock]
+
+# Delimited blocks.
+[literalblock]
+<example><title>{title}</title>
+<literallayout{id? id="{id}"} class="{font=monospaced}">
+|
+</literallayout>
+{title#}</example>
+
+[listingblock]
+<example><title>{title}</title>
+<screen>
+|
+</screen>
+{title#}</example>
+
+[verseblock]
+<formalpara{id? id="{id}"}><title>{title}</title><para>
+{title%}<literallayout{id? id="{id}"}>
+{title#}<literallayout>
+|
+</literallayout>
+{title#}</para></formalpara>
+
+[sidebarblock]
+<sidebar{id? id="{id}"}>
+<title>{title}</title>
+|
+</sidebar>
+
+[passthroughblock]
+|
+
+[quoteblock]
+# The epigraph element may be more appropriate than blockquote.
+<blockquote{id? id="{id}"}>
+<title>{title}</title>
+# Include attribution only if either {attribution} or {citetitle} are defined.
+{attribution#}<attribution>
+{attribution%}{citetitle#}<attribution>
+{attribution}
+<citetitle>{citetitle}</citetitle>
+{attribution#}</attribution>
+{attribution%}{citetitle#}</attribution>
+|
+</blockquote>
+
+[exampleblock]
+<{title?example}{title!informalexample}{id? id="{id}"}>
+<title>{title}</title>
+|
+</{title?example}{title!informalexample}>
+
+[admonitionblock]
+<{name}{id? id="{id}"}>
+<title>{title}</title>
+|
+</{name}>
+
+# Tables.
+[tabledef-default]
+template=table
+colspec=<colspec colwidth="{colwidth}{pageunits}" align="{colalign}"/>
+bodyrow=<row>|</row>
+bodydata=<entry>|</entry>
+
+[table]
+<{title?table}{title!informaltable}{id? id="{id}"} pgwide="0"
+frame="{frame=topbot}"
+{grid%rowsep="0" colsep="0"}
+rowsep="{grid@none|cols:0:1}" colsep="{grid@none|rows:0:1}"
+>
+<title>{title}</title>
+<tgroup cols="{cols}">
+{colspecs}
+{headrows#}<thead>
+{headrows}
+{headrows#}</thead>
+{footrows#}<tfoot>
+{footrows}
+{footrows#}</tfoot>
+<tbody>
+{bodyrows}
+</tbody>
+</tgroup>
+</{title?table}{title!informaltable}>
+
+[specialsections]
+ifdef::doctype-article[]
+^Abstract$=sect-abstract
+endif::doctype-article[]
+
+ifdef::doctype-book[]
+^Colophon$=sect-colophon
+^Dedication$=sect-dedication
+^Preface$=sect-preface
+endif::doctype-book[]
+
+^Index$=sect-index
+^(Bibliography|References)$=sect-bibliography
+^Glossary$=sect-glossary
+^Appendix [A-Z][:.](?P<title>.*)$=sect-appendix
+
+# Special sections.
+[sect-preface]
+<preface{id? id="{id}"}>
+<title>{title}</title>
+|
+</preface>
+
+[sect-index]
+<index{id? id="{id}"}>
+<title>{title}</title>
+|
+</index>
+
+[sect-bibliography]
+<bibliography{id? id="{id}"}>
+<title>{title}</title>
+|
+</bibliography>
+
+[sect-glossary]
+<glossary{id? id="{id}"}>
+<title>{title}</title>
+|
+</glossary>
+
+[sect-appendix]
+<appendix{id? id="{id}"}>
+<title>{title}</title>
+|
+</appendix>
+
+
+[header-declarations]
+<?xml version="1.0" encoding="{encoding}"?>
+<!DOCTYPE {doctype-article?article}{doctype-book?book}{doctype-manpage?refentry} PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+#-------------------------
+# article document type
+#-------------------------
+ifdef::doctype-article[]
+
+[header]
+template::[header-declarations]
+
+<article lang="en">
+{doctitle#}<articleinfo>
+ <title>{doctitle}</title>
+ <date>{date}</date>
+ {authored#}<author>
+ <firstname>{firstname}</firstname>
+ <othername>{middlename}</othername>
+ <surname>{lastname}</surname>
+ <affiliation><address><email>{email}</email></address></affiliation>
+ {authored#}</author>
+ <authorinitials>{authorinitials}</authorinitials>
+
+# If file named like source document with -revhistory.xml suffix exists
+# include it as the document history, otherwise use current revision.
+{revisionhistory#}{include:{docdir}/{docname}-revhistory.xml}
+{revisionhistory%}<revhistory><revision><revnumber>{revision}</revnumber><date>{date}</date>{authorinitials?<authorinitials>{authorinitials}</authorinitials>}{revremark?<revremark>{revremark}</revremark>}</revision></revhistory>
+
+ <corpname>{companyname}</corpname>
+{doctitle#}</articleinfo>
+
+[footer]
+</article>
+
+[preamble]
+# Untitled elements between header and first section title.
+|
+
+[sect-abstract]
+<abstract{id? id="{id}"}>
+|
+</abstract>
+
+[sect1]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+[sect2]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+[sect3]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+[sect4]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+endif::doctype-article[]
+
+#-------------------------
+# manpage document type
+#-------------------------
+ifdef::doctype-manpage[]
+
+[replacements]
+# The roff format does not substitute special characters so just print them as
+# text.
+\(C\)=(C)
+\(TM\)=(TM)
+
+[header]
+template::[header-declarations]
+<refentry>
+<refmeta>
+<refentrytitle>{mantitle}</refentrytitle>
+<manvolnum>{manvolnum}</manvolnum>
+</refmeta>
+<refnamediv>
+ <refname>{manname}</refname>
+ <refpurpose>{manpurpose}</refpurpose>
+</refnamediv>
+
+[footer]
+</refentry>
+
+# Section macros
+[sect-synopsis]
+<refsynopsisdiv{id? id="{id}"}>
+|
+</refsynopsisdiv>
+
+[sect1]
+<refsect1{id? id="{id}"}>
+<title>{title}</title>
+|
+</refsect1>
+
+[sect2]
+<refsect2{id? id="{id}"}>
+<title>{title}</title>
+|
+</refsect2>
+
+[sect3]
+<refsect3{id? id="{id}"}>
+<title>{title}</title>
+|
+</refsect3>
+
+endif::doctype-manpage[]
+
+#-------------------------
+# book document type
+#-------------------------
+ifdef::doctype-book[]
+
+[header]
+template::[header-declarations]
+
+<book lang="en">
+{doctitle#}<bookinfo>
+ <title>{doctitle}</title>
+ <date>{date}</date>
+ {authored#}<author>
+ <firstname>{firstname}</firstname>
+ <othername>{middlename}</othername>
+ <surname>{lastname}</surname>
+ <affiliation><address><email>{email}</email></address></affiliation>
+ {authored#}</author>
+ <authorinitials>{authorinitials}</authorinitials>
+
+# If file named like source document with -revhistory.xml suffix exists
+# include it as the document history, otherwise use current revision.
+{revisionhistory#}{include:{docdir}/{docname}-revhistory.xml}
+{revisionhistory%}<revhistory><revision><revnumber>{revision}</revnumber><date>{date}</date>{authorinitials?<authorinitials>{authorinitials}</authorinitials>}{revremark?<revremark>{revremark}</revremark>}</revision></revhistory>
+
+ <corpname>{companyname}</corpname>
+{doctitle#}</bookinfo>
+
+[footer]
+</book>
+
+[preamble]
+# Preamble is not allowed in DocBook book so wrap it in a preface.
+<preface{id? id="{id}"}>
+<title>Preface</title>
+|
+</preface>
+
+[sect-dedication]
+<dedication{id? id="{id}"}>
+|
+</dedication>
+
+[sect-colophon]
+<colophon{id? id="{id}"}>
+|
+</colophon>
+
+[sect0]
+<part{id? id="{id}"}>
+<title>{title}</title>
+|
+</part>
+
+[sect1]
+<chapter{id? id="{id}"}>
+<title>{title}</title>
+|
+</chapter>
+
+[sect2]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+[sect3]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+[sect4]
+<section{id? id="{id}"}>
+<title>{title}</title>
+|
+</section>
+
+endif::doctype-book[]
+
+ifdef::sgml[]
+#
+# Optional DocBook SGML.
+#
+# Most of the differences between DocBook XML and DocBook SGML boils
+# down to the empty element syntax: SGML does not like the XML empty
+# element <.../> syntax, use <...> instead.
+#
+[miscellaneous]
+outfilesuffix=.sgml
+
+[header-declarations]
+<!DOCTYPE {doctype-article?article}{doctype-book?book}{doctype-manpage?refentry} PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
+
+[tabledef-default]
+colspec=<colspec colwidth="{colwidth}{pageunits}" align="{colalign}">
+
+[image-inlinemacro]
+<inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="{imagesdir=}{target}"{width? width="{width}pt"}{height? depth="{height}pt"}>
+ </imageobject>
+ <textobject><phrase>{1={target}}</phrase></textobject>
+</inlinemediaobject>
+
+[image-blockmacro]
+<figure><title>{title}</title>
+{title%}<informalfigure>
+<mediaobject>
+ <imageobject>
+ <imagedata fileref="{imagesdir=}{target}"{width? width="{width}pt"}{height? depth="{height}pt"}>
+ </imageobject>
+ <textobject><phrase>{1={target}}</phrase></textobject>
+</mediaobject>
+{title#}</figure>
+{title%}</informalfigure>
+
+# Inline macros
+[xref-inlinemacro]
+<link linkend="{target}">{0}</link>
+{2%}<xref linkend="{target}">
+[xref2-inlinemacro]
+# <<id,text>>
+<link linkend="{1}">{2}</link>
+{2%}<xref linkend="{1}">
+[anchor-inlinemacro]
+<anchor id="{target}" xreflabel="{0=[{target}]}">
+[anchor2-inlinemacro]
+# [[id,text]]
+<anchor id="{1}" xreflabel="{2=[{1}]}">
+
+endif::sgml[]
diff --git a/examples/website/ASCIIMathML.js b/examples/website/ASCIIMathML.js
new file mode 120000
index 0000000..35e168b
--- /dev/null
+++ b/examples/website/ASCIIMathML.js
@@ -0,0 +1 @@
+../../javascripts/ASCIIMathML.js \ No newline at end of file
diff --git a/examples/website/CHANGELOG.txt b/examples/website/CHANGELOG.txt
new file mode 120000
index 0000000..e7697d8
--- /dev/null
+++ b/examples/website/CHANGELOG.txt
@@ -0,0 +1 @@
+../../CHANGELOG.txt \ No newline at end of file
diff --git a/examples/website/INSTALL.txt b/examples/website/INSTALL.txt
new file mode 120000
index 0000000..480a136
--- /dev/null
+++ b/examples/website/INSTALL.txt
@@ -0,0 +1 @@
+../../INSTALL.txt \ No newline at end of file
diff --git a/examples/website/LaTeXMathML.js b/examples/website/LaTeXMathML.js
new file mode 120000
index 0000000..abf5064
--- /dev/null
+++ b/examples/website/LaTeXMathML.js
@@ -0,0 +1 @@
+../../javascripts/LaTeXMathML.js \ No newline at end of file
diff --git a/examples/website/README-website.txt b/examples/website/README-website.txt
new file mode 100644
index 0000000..e707741
--- /dev/null
+++ b/examples/website/README-website.txt
@@ -0,0 +1,29 @@
+AsciiDoc Website
+================
+
+The AsciiDoc website source is included in the AsciiDoc distribution
+(in `./examples/website/`) as an example of using AsciiDoc to build a
+website.
+
+A simple shell script (`./examples/website/build-website.sh`) will
+build the site's web pages -- just set the `LAYOUT` variable to the
+desired layout.
+
+Website Layouts
+---------------
+The website layout is determined by the layout configuration file
+(`layout1.conf` or `layout2.conf`) and corresponding layout CSS file
+(`layout1.css` or `layout2.css`). The example website comes with the
+following layouts:
+
+`----------`----------------------------------------------
+Layout Description
+----------------------------------------------------------
+layout1 Table based layout (this is the default layout)
+layout2 CSS based simulated frames layout
+----------------------------------------------------------
+
+The default tables based layout (layout1) works with most modern
+browsers.
+
+NOTE: The simulated frames layout (layout2) does not work with IE6.
diff --git a/examples/website/README.txt b/examples/website/README.txt
new file mode 120000
index 0000000..9f5b20d
--- /dev/null
+++ b/examples/website/README.txt
@@ -0,0 +1 @@
+../../README.txt \ No newline at end of file
diff --git a/examples/website/a2x.1.txt b/examples/website/a2x.1.txt
new file mode 120000
index 0000000..e858182
--- /dev/null
+++ b/examples/website/a2x.1.txt
@@ -0,0 +1 @@
+../../doc/a2x.1.txt \ No newline at end of file
diff --git a/examples/website/asciidoc-docbook-xsl.txt b/examples/website/asciidoc-docbook-xsl.txt
new file mode 120000
index 0000000..623a19f
--- /dev/null
+++ b/examples/website/asciidoc-docbook-xsl.txt
@@ -0,0 +1 @@
+../../docbook-xsl/asciidoc-docbook-xsl.txt \ No newline at end of file
diff --git a/examples/website/asciimath.txt b/examples/website/asciimath.txt
new file mode 120000
index 0000000..db78bf8
--- /dev/null
+++ b/examples/website/asciimath.txt
@@ -0,0 +1 @@
+../../doc/asciimath.txt \ No newline at end of file
diff --git a/examples/website/build-website.sh b/examples/website/build-website.sh
new file mode 100755
index 0000000..a27ed92
--- /dev/null
+++ b/examples/website/build-website.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+VERS="8.1.0"
+DATE="2006-10-22"
+
+# Leave the desired layout uncommented.
+LAYOUT=layout1 # Tables based layout.
+#LAYOUT=layout2 # CSS based simulated frames layout.
+
+ASCIIDOC_HTML="python ../../asciidoc.py --unsafe --backend=xhtml11 --conf-file=${LAYOUT}.conf --attribute icons --attribute iconsdir=./images/icons --attribute=badges --attribute=revision=$VERS --attribute=date=$DATE"
+
+$ASCIIDOC_HTML -a index-only index.txt
+$ASCIIDOC_HTML -a toc -a numbered userguide.txt
+$ASCIIDOC_HTML -d manpage manpage.txt
+$ASCIIDOC_HTML downloads.txt
+$ASCIIDOC_HTML latex-backend.txt
+$ASCIIDOC_HTML README.txt
+$ASCIIDOC_HTML INSTALL.txt
+$ASCIIDOC_HTML CHANGELOG.txt
+$ASCIIDOC_HTML README-website.txt
+$ASCIIDOC_HTML support.txt
+$ASCIIDOC_HTML source-highlight-filter.txt
+$ASCIIDOC_HTML music-filter.txt
+$ASCIIDOC_HTML a2x.1.txt
+$ASCIIDOC_HTML asciimath.txt
diff --git a/examples/website/customers.csv b/examples/website/customers.csv
new file mode 120000
index 0000000..5e8a33c
--- /dev/null
+++ b/examples/website/customers.csv
@@ -0,0 +1 @@
+../../doc/customers.csv \ No newline at end of file
diff --git a/examples/website/downloads.txt b/examples/website/downloads.txt
new file mode 100644
index 0000000..83cde0e
--- /dev/null
+++ b/examples/website/downloads.txt
@@ -0,0 +1,79 @@
+Download and Install AsciiDoc
+=============================
+
+See the link:README.html[README] and link:INSTALL.html[INSTALL] pages
+for install prerequisites and procedures.
+
+
+[[X2]]
+Distribution Archives
+---------------------
+These distribution archives are also available, along with previous
+AsciiDoc versions, at the SourceForge
+http://sourceforge.net/projects/asciidoc/[]):
+
+link:asciidoc-{revision}.tar.gz[]::
+ A tarball distribution of the latest version of AsciiDoc for *NIX
+ platforms.
+
+link:asciidoc-{revision}.zip[]::
+ A Zip distribution of the latest version of AsciiDoc for Microsoft
+ Windows users (UNIX users should use the tarball since includes
+ symbolic links to eliminate file duplication).
+
+
+[[X1]]
+Prepackaged Versions
+--------------------
+The following platform specific packages are available:
+
+*Debian GNU/Linux*::
+ If you use Debian or a Debian based distribution there's an
+ http://packages.debian.org/asciidoc[AsciiDoc Debian package]
+ available. Thanks to mailto:stone@debian.org[Fredrik Steen] who
+ built and maintains the Debian AsciiDoc package.
+
+*Gentoo Linux*::
+ If you use Gentoo Linux there's a
+ http://packages.gentoo.org/packages/?category=app-text;name=asciidoc[Gentoo
+ AsciiDoc package] available. Thanks to
+ mailto:brandon@ifup.org[Brandon Philips] for writing the ebuild.
+
+*Fedora Linux*::
+ With help from Terje Røsten, Chris Wright added asciidoc to Fedora
+ Extras which is available in the default installation. To install
+ asciidoc execute the following command:
+
+ $ yum install asciidoc
+
+*Slackware Linux*::
+ John Calixto has created a Slackware package for AsciiDoc which can
+ be downloaded from http://linuxpackages.net/[].
+
+*Ark Linux*::
+ mailto:bero@arklinux.org[Bernhard Rosenkraenzer] added AsciiDoc to
+ Ark Linux -- the package is available from the Ark Linux repository
+ at http://arklinux.osuosl.org/dockyard-devel/[], so Ark Linux users
+ should just run `apt-get install asciidoc`.
+
+*T2 Linux*::
+ mailto:cw@ixplanet.de[Christian Wiese] added AsciiDoc to the
+ http://www.t2-project.org/[T2 Linux] repository at
+ http://svn.exactcode.de/t2/trunk/package/textproc/asciidoc/[]. To
+ build and install the package on a T2 system, run
+ `./scripts/Emerge-Pkg asciidoc` from within your T2 source directory
+ (default: `/usr/src/t2-src`).
+
+*Red Hat Enterprise Linux, Fedora and CentOS packages*::
+ Dag Wieers has built AsciiDoc RPMs for a number of Red Hat based
+ distributions, they can be downloaded from
+ http://dag.wieers.com/rpm/packages/asciidoc/[].
+
+
+See also link:userguide.html#X38[Packager Notes] in the 'AsciiDoc User
+Guide'.
+
+Copying
+-------
+Copyright (C) 2002-2007 Stuart Rackham. Free use of AsciiDoc is
+granted under the terms of the GNU General Public License (GPL).
diff --git a/examples/website/faq.txt b/examples/website/faq.txt
new file mode 120000
index 0000000..257ca12
--- /dev/null
+++ b/examples/website/faq.txt
@@ -0,0 +1 @@
+../../doc/faq.txt \ No newline at end of file
diff --git a/examples/website/images b/examples/website/images
new file mode 120000
index 0000000..5fa6987
--- /dev/null
+++ b/examples/website/images
@@ -0,0 +1 @@
+../../images \ No newline at end of file
diff --git a/examples/website/index.txt b/examples/website/index.txt
new file mode 100644
index 0000000..571ec49
--- /dev/null
+++ b/examples/website/index.txt
@@ -0,0 +1,197 @@
+AsciiDoc Home Page
+==================
+
+.{date}: AsciiDoc {revision} Released
+************************************************************************
+This release includes auto-generated section IDs, addresses quite a
+few niggles and includes one bug fix. I've also added an
+link:faq.html[FAQ page] to website.
+
+Read the link:CHANGELOG.html[CHANGELOG] for a full description of
+additions and changes.
+
+mailto:srackham@methods.co.nz['Stuart Rackham']
+************************************************************************
+
+Introduction
+------------
+AsciiDoc is a text document format for writing short documents,
+articles, books and UNIX man pages. AsciiDoc files can be translated
+to HTML and DocBook markups using the asciidoc(1) command.
+
+AsciiDoc is highly configurable: both the AsciiDoc source file syntax
+and the backend output markups (which can be almost any type of
+SGML/XML markup) can be customized and extended by the user.
+
+TIP: The pages you are reading were written using AsciiDoc, to view
+the corresponding AsciiDoc source click on the *Page Source* menu item
+in the left hand margin.
+
+
+Overview and Examples
+---------------------
+You write an AsciiDoc document the same way you would write a
+normal text document, there are no markup tags or weird format
+notations. AsciiDoc files are designed to be viewed, edited and
+printed directly or translated to other presentation formats using
+the asciidoc(1) command.
+
+The asciidoc(1) command translates AsciiDoc files to HTML, XHTML and
+DocBook markups. DocBook can be post-processed to presentation
+formats such as HTML, PDF, roff, and Postscript using readily
+available Open Source tools.
+
+Example Articles
+~~~~~~~~~~~~~~~~
+- This version of the
+ link:asciidoc.css-embedded.html[AsciiDoc User Guide]
+ was generated by AsciiDoc from
+ link:asciidoc.txt[this AsciiDoc file].
+
+- Here's the link:asciidoc.html[same document] created by first
+ generating DocBook markup using AsciiDoc and then converting the
+ DocBook markup to HTML using 'DocBook XSL Stylesheets'.
+
+- The User Guide again, this time a
+ link:chunked/index.html[chunked version].
+
+- This link:article.txt[AsciiDoc article template] produced
+ this link:article.html[HTML file] and this
+ link:article.pdf[PDF file] via DocBook markup generated by AsciiDoc.
+
+- This link:asciidoc.pdf[PDF formatted User Guide] was generated from
+ asciidoc(1) DocBook output using `xsltproc(1)`, DocBook XSL
+ Stylesheets and FOP.
+
+- Here's a Windows link:asciidoc.chm[HTML Help version] of the User
+ Guide.
+
+Example Books
+~~~~~~~~~~~~~
+AsciiDoc markup supports all the standard DocBook frontmatter and
+backmatter sections (dedication, preface, bibliography, glossary,
+index, colophon) plus footnotes and index entries.
+
+Book::
+ This link:book.txt[AsciiDoc book's] DocBook output
+ produced link:book.html[this HTML file] using the
+ 'DocBook XSL Stylesheets'.
+
+Multi-part book::
+ This link:book-multi.txt[multi-part AsciiDoc book's]
+ DocBook output produced link:book-multi.html[this HTML file]
+ using the 'DocBook XSL Stylesheets'.
+
+Example UNIX Man Pages
+~~~~~~~~~~~~~~~~~~~~~~
+HTML formatted AsciiDoc man pages
+link:asciidoc.1.css-embedded.html[with stylesheets] and
+link:asciidoc.1.html[without stylesheets] were generated by AsciiDoc
+from link:asciidoc.1.txt[this file].
+
+This link:asciidoc.1[roff formatted man page] was generated from
+asciidoc(1) DocBook output using `xsltproc(1)` and DocBook XSL
+Stylesheets.
+
+Example Web Site
+~~~~~~~~~~~~~~~~
+The link:README-website.html[AsciiDoc website] is included in the
+AsciiDoc distribution (in `./examples/website/`) as example website
+built using AsciiDoc. See `./examples/website/README-website.txt`.
+
+
+Music Filter
+------------
+A link:music-filter.html[music filter] is included in the distribution
+`./filters/` directory. It translates music in
+http://lilypond.org/[LilyPond] or http://abcnotation.org.uk/[ABC]
+notation to standard classical notation
+
+
+Source Code Highlight Filter
+----------------------------
+A link:source-highlight-filter.html[source code highlight filter] is
+included in the distribution `./filters/` directory.
+
+
+[[X3]]
+Mathematical Formulae
+---------------------
+You can include mathematical formulae in your AsciiDoc documents using
+link:asciimath.html[ASCIIMathML] or link:latexmath.html[LaTeXMathML]
+notation.
+
+
+Vim Syntax Highlighter
+----------------------
+An AsciiDoc syntax highlighter for the Vim text editor is included in
+the AsciiDoc distribution (see 'Appendix J' of the 'AsciiDoc User
+Guide' for details).
+
+.Syntax highlighter screenshot
+image::images/highlighter.png[height=250,caption="",link="images/highlighter.png"]
+
+Dag Wieers has implemented an alternative Vim syntax file for AsciiDoc
+which can be found here
+http://svn.rpmforge.net/svn/trunk/tools/asciidoc-vim/[].
+
+
+[[X2]]
+Resources
+---------
+- Check the link:downloads.html[Downloads page] for packaged versions
+ of AsciiDoc.
+- Thomas Berker has written an
+ http://liksom.info/blog/?q=node/114[AsciiDoc Cheatsheet].
+- The http://www.wikimatrix.org/[WikiMatrix] website has an excellent
+ http://www.wikimatrix.org/syntax.php[web page] that compares the
+ various Wiki markup syntaxes. An interesting attempt at Wiki markup
+ standardization is http://www.wikicreole.org/[CREOLE].
+- The http://xpt.sourceforge.net/[*Nix Power Tools project] has
+ released an http://xpt.sourceforge.net/tools/doc-mode/[AsciiDoc
+ syntax highlighter for Emacs].
+- Franck Pommereau has written
+ http://www.univ-paris12.fr/lacl/pommereau/soft/asciidoctest.html[Asciidoctest],
+ a program that doctests snippets of Python code within your Asciidoc
+ documents.
+- The http://remips.sourceforge.net/[ReMIPS] project website has been
+ built using AsciiDoc.
+- Here are some link:asciidoc-docbook-xsl.html[DocBook XSL Stylesheets
+ Notes].
+- Karl Mowatt-Wilson has developed an http://ikiwiki.info/[ikiwiki]
+ plugin for AsciiDoc which he uses to render
+ http://mowson.org/karl[his website]. The plugin is available
+ http://www.mowson.org/karl/colophon/[here] and there is some
+ discussion of the ikiwiki integration
+ http://ikiwiki.info/users/KarlMW/discussion/[here].
+
+[[X1]]
+LaTeX Backend
+-------------
+An experimental LaTeX backend has been written for AsciiDoc by
+Benjamin Klum. Benjamin has done a superhuman job (I admit it, I
+didn't think this was doable due to AsciiDoc's SGML/XML bias).
+
+Here's link:latex-backend.html[Benjamin's documentation].
+
+
+Projects using AsciiDoc
+-----------------------
+Here are some projects I know of, if you know of more drop me a line
+and I'll add them to the list.
+
+- The Linux kernel
+ http://www.kernel.org/pub/software/scm/git/docs/git.html[git source
+ code management system].
+- Some documentation about git by Nico Schottelius (in German)
+ http://nico.schotteli.us/papers/linux/git-firmen/[].
+- The http://www.netpromi.com/kirbybase_ruby.html[KirbyBase for Ruby]
+ database management system manual.
+- The http://www.selenic.com/mercurial/[Mercurial distributed SCM]
+ uses asciidoc for its man pages.
+- Pascal Rapaz has written a Python script to automate AsciiDoc
+ website generation. You can find it at
+ http://www.rapazp.ch/opensource/tools/asciidoc.html[].
+- The http://xpt.sourceforge.net/[*Nix Power Tools project] uses
+ AsciiDoc for documentation and has released an Emacs syntax
+ highlighter (see <<X2,Resources>> above).
diff --git a/examples/website/latex-backend.txt b/examples/website/latex-backend.txt
new file mode 120000
index 0000000..91275e3
--- /dev/null
+++ b/examples/website/latex-backend.txt
@@ -0,0 +1 @@
+../../doc/latex-backend.txt \ No newline at end of file
diff --git a/examples/website/latexmath.txt b/examples/website/latexmath.txt
new file mode 120000
index 0000000..3abb0bc
--- /dev/null
+++ b/examples/website/latexmath.txt
@@ -0,0 +1 @@
+../../doc/latexmath.txt \ No newline at end of file
diff --git a/examples/website/layout1.conf b/examples/website/layout1.conf
new file mode 100644
index 0000000..5e9ae98
--- /dev/null
+++ b/examples/website/layout1.conf
@@ -0,0 +1,160 @@
+#
+# AsciiDoc website.
+# Three division table based layout (layout1).
+#
+# +-----------------------------------------------------+
+# | #layout-banner |
+# +--------------+--------------------------------------+
+# | | |
+# | | |
+# | #layout-menu | #layout-content |
+# | | |
+# | | |
+# | | |
+# +--------------+--------------------------------------+
+#
+# - The #layout-menu and #layout-content divisions are contained in a
+# two cell table.
+# I would be nice to use pure CSS for the layout but the table is better for
+# this layout because:
+#
+# * The column widths automatically size to fit column width (specifically
+# the #layout-menu)
+# * The column heights automatically size to the tallest.
+#
+# - The #layout-content division is a container for AsciiDoc page documents.
+# - Documents rendered in the #layout-content use the standard AsciiDoc
+# xhtml11 backend stylesheets.
+
+[specialwords]
+emphasizedwords=(?u)\\?\bAsciiDoc\b
+monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\)
+
+[header]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding}" />
+<meta name="generator" content="AsciiDoc {asciidoc-version}" />
+ifdef::index-only[]
+<meta name="description" content="Text based document generation" />
+<meta name="keywords" content="text to HTML, text to DocBook, text to XML, AsciiDoc" />
+endif::index-only[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}.css" type="text/css" />
+{doctype-manpage}<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-manpage.css" type="text/css" />
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-quirks.css" type="text/css" />
+<link rel="stylesheet" href="{stylesdir=.}/layout1.css" type="text/css" />
+ifdef::toc[]
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function()\{generateToc({toclevels=2})\}
+/*]]>*/
+</script>
+<script type="text/javascript" src="{scriptsdir=.}/toc.js"></script>
+endif::toc[]
+ifdef::asciimath[]
+<script type="text/javascript" src="{scriptsdir=.}/ASCIIMathML.js"></script>
+endif::asciimath[]
+ifdef::latexmath[]
+<script type="text/javascript" src="{scriptsdir=.}/LaTeXMathML.js"></script>
+endif::latexmath[]
+<title>{doctitle}</title>
+</head>
+<body>
+<div id="layout-banner">
+ <div id="layout-title">AsciiDoc</div>
+ <div id="layout-description">Text based document generation</div>
+</div>
+<table>
+<tr valign="top">
+<td id="layout-menu">
+ <div>&#187;<a href="index.html">Home</a></div>
+ <div>&#187;<a href="manpage.html">Man&nbsp;Page</a></div>
+ <div>&#187;<a href="userguide.html">User&nbsp;Guide</a></div>
+ <div>&#187;<a href="a2x.1.html">a2x</a></div>
+ <div>&#187;<a href="README.html">README</a></div>
+ <div>&#187;<a href="CHANGELOG.html">ChangeLog</a></div>
+ <div>&#187;<a href="INSTALL.html">Installation</a></div>
+ <div>&#187;<a href="downloads.html">Downloads</a></div>
+ <div>&#187;<a href="faq.html">FAQ</a></div>
+ <div>&#187;<a href="support.html">Support</a></div>
+ <div id="page-source">&#187;<a href="{eval:os.path.basename('{infile}')}">Page&nbsp;Source</a></div>
+</td>
+<td>
+<div id="layout-content">
+# Article, book header.
+ifndef::doctype-manpage[]
+<div id="header">
+<h1>{doctitle}</h1>
+<span id="author">{author}</span><br />
+<span id="email"><tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt></span><br />
+{authored}<span id="revision">version {revision}{date?,}</span>
+{authored}{date}
+</div>
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+endif::doctype-manpage[]
+# Man page header.
+ifdef::doctype-manpage[]
+<div id="header">
+<h1>
+{doctitle} Manual Page
+</h1>
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>{manname} -
+ {manpurpose}
+</p>
+</div>
+</div>
+endif::doctype-manpage[]
+
+[footer]
+<div id="footer">
+<div id="footer-text">
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</div>
+ifdef::badges[]
+<div id="footer-badges">
+ifdef::textonly[]
+Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a>
+and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
+endif::textonly[]
+ifndef::textonly[]
+<a href="http://validator.w3.org/check?uri=referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://www.w3.org/Icons/valid-xhtml11"
+ alt="Valid XHTML 1.1!" />
+</a>
+<a href="http://jigsaw.w3.org/css-validator/check/referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://jigsaw.w3.org/css-validator/images/vcss"
+ alt="Valid CSS!" />
+</a>
+<a href="http://www.mozilla.org/products/firefox/">
+ <img style="border:none; width:110px; height:32px;"
+ src="http://www.spreadfirefox.com/community/images/affiliates/Buttons/110x32/safer.gif"
+ alt="Get Firefox!" />
+</a>
+endif::textonly[]
+</div>
+endif::badges[]
+</div>
+</div>
+</td>
+</tr>
+</table>
+</body>
+</html>
diff --git a/examples/website/layout1.css b/examples/website/layout1.css
new file mode 100644
index 0000000..8ae10e9
--- /dev/null
+++ b/examples/website/layout1.css
@@ -0,0 +1,65 @@
+body {
+ background-color: white;
+ margin: 1%;
+}
+
+h1 {
+ margin-top: 0.5em;
+}
+
+#layout-banner {
+ background-color: #73a0c5;
+ color: white;
+ font-family: sans-serif;
+ text-align: left;
+ padding: 0.8em 20px;
+}
+
+#layout-title {
+ font-family: monospace;
+ font-size: 3.5em;
+ font-weight: bold;
+ letter-spacing: 0.2em;
+ margin: 0;
+}
+
+#layout-description {
+ font-size: 1.2em;
+ letter-spacing: 0.1em;
+}
+
+#layout-menu {
+ background-color: #f4f4f4;
+ border-right: 3px solid #eeeeee;
+ padding-top: 0.8em;
+ padding-left: 20px;
+ padding-right: 0.8em;
+ font-size: 1.1em;
+ font-family: sans-serif;
+ font-weight: bold;
+}
+#layout-menu a {
+ line-height: 2em;
+ margin-left: 0.5em;
+}
+#layout-menu a:link, #layout-menu a:visited, #layout-menu a:hover {
+ color: #527bbd;
+ text-decoration: none;
+}
+#layout-menu a:hover {
+ color: navy;
+ text-decoration: none;
+}
+#layout-menu #page-source {
+ border-top: 2px solid silver;
+ margin-top: 0.2em;
+}
+
+#layout-content {
+ margin-left: 1.0em;
+}
+
+@media print {
+ #layout-banner { display: none; }
+ #layout-menu { display: none; }
+}
diff --git a/examples/website/layout2.conf b/examples/website/layout2.conf
new file mode 100644
index 0000000..7a2972c
--- /dev/null
+++ b/examples/website/layout2.conf
@@ -0,0 +1,158 @@
+#
+# AsciiDoc website.
+# Three division CSS based layout (layout2).
+#
+# Simulated frames using CSS (fixed banner and menu, scrolling content).
+# NOTE: This layout does not work with IE6.
+#
+# +-----------------------------------------------------+
+# | #layout-banner |
+# +--------------+--------------------------------------+
+# | | |
+# | | |
+# | #layout-menu | #layout-content |
+# | | |
+# | | |
+# | | |
+# +--------------+--------------------------------------+
+#
+# Each of the three divisions is enclosed in a same-named *-box division
+# which position and size the layout.
+#
+# - The #layout-content division is a container for AsciiDoc page documents.
+# - Documents rendered in the #layout-content use the standard AsciiDoc
+# xhtml11 backend stylesheets.
+
+[specialwords]
+emphasizedwords=(?u)\\?\bAsciiDoc\b
+monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\)
+
+[header]
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding}" />
+<meta name="generator" content="AsciiDoc {asciidoc-version}" />
+ifdef::index-only[]
+<meta name="description" content="Text based document generation" />
+<meta name="keywords" content="text to HTML, text to DocBook, text to XML, AsciiDoc" />
+endif::index-only[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}.css" type="text/css" />
+{doctype-manpage}<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-manpage.css" type="text/css" />
+ifdef::quirks[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-quirks.css" type="text/css" />
+endif::quirks[]
+<link rel="stylesheet" href="{stylesdir=.}/layout2.css" type="text/css" />
+ifdef::toc[]
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function()\{generateToc({toclevels=2})\}
+/*]]>*/
+</script>
+<script type="text/javascript" src="{scriptsdir=.}/toc.js"></script>
+endif::toc[]
+ifdef::asciimath[]
+<script type="text/javascript" src="{scriptsdir=.}/ASCIIMathML.js"></script>
+endif::asciimath[]
+ifdef::latexmath[]
+<script type="text/javascript" src="{scriptsdir=.}/LaTeXMathML.js"></script>
+endif::latexmath[]
+<title>{doctitle}</title>
+</head>
+<body>
+<div id="layout-banner-box">
+<div id="layout-banner">
+ <div id="layout-title">AsciiDoc</div>
+ <div id="layout-description">Text based document generation</div>
+</div>
+</div>
+<div id="layout-menu-box">
+<div id="layout-menu">
+ <div>&#187;<a href="index.html">Home</a></div>
+ <div>&#187;<a href="manpage.html">Man&nbsp;Page</a></div>
+ <div>&#187;<a href="userguide.html">User&nbsp;Guide</a></div>
+ <div>&#187;<a href="a2x.1.html">a2x</a></div>
+ <div>&#187;<a href="README.html">README</a></div>
+ <div>&#187;<a href="CHANGELOG.html">ChangeLog</a></div>
+ <div>&#187;<a href="downloads.html">Downloads</a></div>
+ <div>&#187;<a href="faq.html">FAQ</a></div>
+ <div>&#187;<a href="support.html">Support</a></div>
+ <div id="page-source">&#187;<a href="{eval:os.path.basename('{infile}')}">Page&nbsp;Source</a></div>
+</div>
+</div>
+<div id="layout-content-box">
+<div id="layout-content">
+# Article, book header.
+ifndef::doctype-manpage[]
+<div id="header">
+<h1>{doctitle}</h1>
+<span id="author">{author}</span><br />
+<span id="email"><tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt></span><br />
+{authored}<span id="revision">version {revision}{date?,}</span>
+{authored}{date}
+</div>
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+endif::doctype-manpage[]
+# Man page header.
+ifdef::doctype-manpage[]
+<div id="header">
+<h1>
+{doctitle} Manual Page
+</h1>
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>{manname} -
+ {manpurpose}
+</p>
+</div>
+</div>
+endif::doctype-manpage[]
+
+[footer]
+<div id="footer">
+<div id="footer-text">
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</div>
+ifdef::badges[]
+<div id="footer-badges">
+ifdef::textonly[]
+Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a>
+and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
+endif::textonly[]
+ifndef::textonly[]
+<a href="http://validator.w3.org/check?uri=referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://www.w3.org/Icons/valid-xhtml11"
+ alt="Valid XHTML 1.1!" />
+</a>
+<a href="http://jigsaw.w3.org/css-validator/check/referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://jigsaw.w3.org/css-validator/images/vcss"
+ alt="Valid CSS!" />
+</a>
+<a href="http://www.mozilla.org/products/firefox/">
+ <img style="border:none; width:110px; height:32px;"
+ src="http://www.spreadfirefox.com/community/images/affiliates/Buttons/110x32/safer.gif"
+ alt="Get Firefox!" />
+</a>
+endif::textonly[]
+</div>
+endif::badges[]
+</div>
+</div>
+</div>
+</body>
+</html>
diff --git a/examples/website/layout2.css b/examples/website/layout2.css
new file mode 100644
index 0000000..bff3245
--- /dev/null
+++ b/examples/website/layout2.css
@@ -0,0 +1,93 @@
+body {
+ margin: 0;
+}
+
+#layout-banner-box {
+ position: fixed;
+ top: 0px;
+ left: 0px;
+ width: 100%;
+ height: 110px;
+ z-index: 2;
+ background-color: #73a0c5;
+}
+
+#layout-menu-box {
+ position: fixed;
+ left: 0px;
+ top: 110px;
+ width: 175px;
+ height: 100%;
+ z-index: 1;
+ background-color: #f4f4f4;
+}
+
+#layout-content-box {
+ position: relative;
+ margin-top: 110px;
+ margin-left: 175px;
+ background-color: white;
+}
+
+h1 {
+ margin-top: 0.5em;
+}
+
+#layout-banner {
+ color: white;
+ font-family: sans-serif;
+ text-align: left;
+ padding: 0.8em 20px;
+}
+
+#layout-title {
+ font-family: monospace;
+ font-size: 3.5em;
+ font-weight: bold;
+ letter-spacing: 0.2em;
+ margin: 0;
+}
+
+#layout-description {
+ font-size: 1.2em;
+ letter-spacing: 0.1em;
+}
+
+#layout-menu {
+ height: 100%;
+ border-right: 3px solid #eeeeee;
+ padding-top: 0.8em;
+ padding-left: 20px;
+ padding-right: 0.8em;
+ font-size: 1.0em;
+ font-family: sans-serif;
+ font-weight: bold;
+}
+#layout-menu a {
+ line-height: 2em;
+ margin-left: 0.5em;
+}
+#layout-menu a:link, #layout-menu a:visited, #layout-menu a:hover {
+ color: #527bbd;
+ text-decoration: none;
+}
+#layout-menu a:hover {
+ color: navy;
+ text-decoration: none;
+}
+#layout-menu #page-source {
+ border-top: 2px solid silver;
+ margin-top: 0.2em;
+}
+
+#layout-content {
+ padding-top: 0.2em;
+ padding-left: 1.0em;
+ padding-right: 0.4em;
+}
+
+@media print {
+ #layout-banner-box { display: none; }
+ #layout-menu-box { display: none; }
+ #layout-content-box { margin-top: 0; margin-left: 0; }
+}
diff --git a/examples/website/manpage.txt b/examples/website/manpage.txt
new file mode 120000
index 0000000..e45b347
--- /dev/null
+++ b/examples/website/manpage.txt
@@ -0,0 +1 @@
+../../doc/asciidoc.1.txt \ No newline at end of file
diff --git a/examples/website/music-filter.txt b/examples/website/music-filter.txt
new file mode 120000
index 0000000..301df55
--- /dev/null
+++ b/examples/website/music-filter.txt
@@ -0,0 +1 @@
+../../doc/music-filter.txt \ No newline at end of file
diff --git a/examples/website/music1.abc b/examples/website/music1.abc
new file mode 100644
index 0000000..19e05e7
--- /dev/null
+++ b/examples/website/music1.abc
@@ -0,0 +1,12 @@
+T:The Butterfly
+R:slip jig
+C:Tommy Potts
+H:Fiddle player Tommy Potts made this tune from two older slip jigs,
+H:one of which is called "Skin the Peelers" in Roche's collection.
+H:This version by Peter Cooper.
+D:Bothy Band: 1975.
+M:9/8
+K:Em
+vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
+|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
+|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
diff --git a/examples/website/music1.png b/examples/website/music1.png
new file mode 100644
index 0000000..af6e05e
--- /dev/null
+++ b/examples/website/music1.png
Binary files differ
diff --git a/examples/website/music2.ly b/examples/website/music2.ly
new file mode 100644
index 0000000..aa8c962
--- /dev/null
+++ b/examples/website/music2.ly
@@ -0,0 +1,9 @@
+\version "2.10.0"
+\paper {
+ ragged-right = ##t
+}
+{
+ \time 3/4
+ \clef bass
+ c2 e4 g2. f4 e d c2 r4
+}
diff --git a/examples/website/music2.png b/examples/website/music2.png
new file mode 100644
index 0000000..5be6ae4
--- /dev/null
+++ b/examples/website/music2.png
Binary files differ
diff --git a/examples/website/source-highlight-filter.txt b/examples/website/source-highlight-filter.txt
new file mode 120000
index 0000000..eb67d23
--- /dev/null
+++ b/examples/website/source-highlight-filter.txt
@@ -0,0 +1 @@
+../../doc/source-highlight-filter.txt \ No newline at end of file
diff --git a/examples/website/support.txt b/examples/website/support.txt
new file mode 100644
index 0000000..5c242d4
--- /dev/null
+++ b/examples/website/support.txt
@@ -0,0 +1,8 @@
+AsciiDoc Support
+================
+
+- mailto:asciidoc-discuss-owner@metaperl.com[Terrence Brannon] has set
+ up the
+ http://metaperl.com/cgi-bin/mailman/listinfo/asciidoc-discuss[asciidoc-discuss]
+ mailing list.
+- The author can be emailed at mailto:srackham@methods.co.nz[].
diff --git a/examples/website/toc.js b/examples/website/toc.js
new file mode 120000
index 0000000..b0bb490
--- /dev/null
+++ b/examples/website/toc.js
@@ -0,0 +1 @@
+../../javascripts/toc.js \ No newline at end of file
diff --git a/examples/website/userguide.txt b/examples/website/userguide.txt
new file mode 120000
index 0000000..5bfa64f
--- /dev/null
+++ b/examples/website/userguide.txt
@@ -0,0 +1 @@
+../../doc/asciidoc.txt \ No newline at end of file
diff --git a/examples/website/xhtml11-manpage.css b/examples/website/xhtml11-manpage.css
new file mode 120000
index 0000000..badca88
--- /dev/null
+++ b/examples/website/xhtml11-manpage.css
@@ -0,0 +1 @@
+../../stylesheets/xhtml11-manpage.css \ No newline at end of file
diff --git a/examples/website/xhtml11-quirks.css b/examples/website/xhtml11-quirks.css
new file mode 120000
index 0000000..215c109
--- /dev/null
+++ b/examples/website/xhtml11-quirks.css
@@ -0,0 +1 @@
+../../stylesheets/xhtml11-quirks.css \ No newline at end of file
diff --git a/examples/website/xhtml11.css b/examples/website/xhtml11.css
new file mode 120000
index 0000000..2cc7acb
--- /dev/null
+++ b/examples/website/xhtml11.css
@@ -0,0 +1 @@
+../../stylesheets/xhtml11.css \ No newline at end of file
diff --git a/filters/code-filter-readme.txt b/filters/code-filter-readme.txt
new file mode 100644
index 0000000..d007d80
--- /dev/null
+++ b/filters/code-filter-readme.txt
@@ -0,0 +1,37 @@
+AsciiDoc Code Filter
+====================
+
+This simple minded filter highlights source code keywords and
+comments.
+
+NOTE: The filter is to demonstrate how to write a filter -- it's much
+to simplistic to be passed off as a code syntax highlighter. If you
+want a full featured highlighter use the 'source highlighter filter.
+
+
+Files
+-----
+code-filter.py::
+ The filter Python script.
+code-filter.conf::
+ The AsciiDoc filter configuration file.
+code-filter-test.txt::
+ Short AsciiDoc document to test the filter.
+
+
+Installation
+------------
+The code filter is installed in the distribution `filters` directory
+as part of the standard AsciiDoc install.
+
+Test it on the `code-filter-test.txt` file:
+
+ $ asciidoc -v code-filter-test.txt
+ $ firefox code-filter-test.txt &
+
+
+Help
+----
+Execute the filter with the help option:
+
+ $ ./code-filter.py --help
diff --git a/filters/code-filter-test-c++.txt b/filters/code-filter-test-c++.txt
new file mode 100644
index 0000000..9ba67c2
--- /dev/null
+++ b/filters/code-filter-test-c++.txt
@@ -0,0 +1,7 @@
+The connect.cc Source File
+--------------------------
+
+[language="C++"]
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+include1::../../connect/utils.cc[]
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/filters/code-filter-test.txt b/filters/code-filter-test.txt
new file mode 100644
index 0000000..95b15b7
--- /dev/null
+++ b/filters/code-filter-test.txt
@@ -0,0 +1,15 @@
+Code Filter Test
+================
+
+[python]
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+''' A multi-line
+ comment.'''
+def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+code~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/filters/code-filter.conf b/filters/code-filter.conf
new file mode 100644
index 0000000..6220e4d
--- /dev/null
+++ b/filters/code-filter.conf
@@ -0,0 +1,15 @@
+#
+# AsciiDoc code filter configuration file.
+#
+# Documented in code-filter-readme.txt
+#
+
+[blockdef-code]
+# The leading 'code' is optional for backward compatibility, may be mandatory
+# in future versions.
+delimiter=^(code)?~{4,}$
+template=listingblock
+presubs=none
+postsubs=callouts
+filter=code-filter.py -b {basebackend} -l {language}
+posattrs=language
diff --git a/filters/code-filter.py b/filters/code-filter.py
new file mode 100755
index 0000000..59d5e6c
--- /dev/null
+++ b/filters/code-filter.py
@@ -0,0 +1,239 @@
+#!/usr/bin/env python
+'''
+NAME
+ code-filter - AsciiDoc filter to highlight language keywords
+
+SYNOPSIS
+ code-filter -b backend -l language [ -t tabsize ]
+ [ --help | -h ] [ --version | -v ]
+
+DESCRIPTION
+ This filter reads source code from the standard input, highlights language
+ keywords and comments and writes to the standard output.
+
+ The purpose of this program is to demonstrate how to write an AsciiDoc
+ filter -- it's much to simplistic to be passed off as a code syntax
+ highlighter. Use the 'source-highlight-filter' instead.
+
+
+OPTIONS
+ --help, -h
+ Print this documentation.
+
+ -b
+ Backend output file format: 'docbook', 'linuxdoc', 'html', 'css'.
+
+ -l
+ The name of the source code language: 'python', 'ruby', 'c++', 'c'.
+
+ -t tabsize
+ Expand source tabs to tabsize spaces.
+
+ --version, -v
+ Print program version number.
+
+BUGS
+ - Code on the same line as a block comment is treated as comment.
+ Keywords inside literal strings are highlighted.
+ - There doesn't appear to be an easy way to accomodate linuxdoc so
+ just pass it through without markup.
+
+AUTHOR
+ Written by Stuart Rackham, <srackham@methods.co.nz>
+
+URLS
+ http://sourceforge.net/projects/asciidoc/
+ http://www.methods.co.nz/asciidoc/
+
+COPYING
+ Copyright (C) 2002-2006 Stuart Rackham. Free use of this software is
+ granted under the terms of the GNU General Public License (GPL).
+'''
+
+import os, sys, re, string
+
+VERSION = '1.1.2'
+
+# Globals.
+language = None
+backend = None
+tabsize = 8
+keywordtags = {
+ 'html':
+ ('<strong>','</strong>'),
+ 'css':
+ ('<strong>','</strong>'),
+ 'docbook':
+ ('<emphasis role="strong">','</emphasis>'),
+ 'linuxdoc':
+ ('','')
+}
+commenttags = {
+ 'html':
+ ('<i>','</i>'),
+ 'css':
+ ('<i>','</i>'),
+ 'docbook':
+ ('<emphasis>','</emphasis>'),
+ 'linuxdoc':
+ ('','')
+}
+keywords = {
+ 'python':
+ ('and', 'del', 'for', 'is', 'raise', 'assert', 'elif', 'from',
+ 'lambda', 'return', 'break', 'else', 'global', 'not', 'try', 'class',
+ 'except', 'if', 'or', 'while', 'continue', 'exec', 'import', 'pass',
+ 'yield', 'def', 'finally', 'in', 'print'),
+ 'ruby':
+ ('__FILE__', 'and', 'def', 'end', 'in', 'or', 'self', 'unless',
+ '__LINE__', 'begin', 'defined?' 'ensure', 'module', 'redo', 'super',
+ 'until', 'BEGIN', 'break', 'do', 'false', 'next', 'rescue', 'then',
+ 'when', 'END', 'case', 'else', 'for', 'nil', 'retry', 'true', 'while',
+ 'alias', 'class', 'elsif', 'if', 'not', 'return', 'undef', 'yield'),
+ 'c++':
+ ('asm', 'auto', 'bool', 'break', 'case', 'catch', 'char', 'class',
+ 'const', 'const_cast', 'continue', 'default', 'delete', 'do', 'double',
+ 'dynamic_cast', 'else', 'enum', 'explicit', 'export', 'extern',
+ 'false', 'float', 'for', 'friend', 'goto', 'if', 'inline', 'int',
+ 'long', 'mutable', 'namespace', 'new', 'operator', 'private',
+ 'protected', 'public', 'register', 'reinterpret_cast', 'return',
+ 'short', 'signed', 'sizeof', 'static', 'static_cast', 'struct',
+ 'switch', 'template', 'this', 'throw', 'true', 'try', 'typedef',
+ 'typeid', 'typename', 'union', 'unsigned', 'using', 'virtual', 'void',
+ 'volatile', 'wchar_t', 'while')
+}
+block_comments = {
+ 'python': ("'''","'''"),
+ 'ruby': None,
+ 'c++': ('/*','*/')
+}
+inline_comments = {
+ 'python': '#',
+ 'ruby': '#',
+ 'c++': '//'
+}
+
+def print_stderr(line):
+ sys.stderr.write(line+os.linesep)
+
+def sub_keyword(mo):
+ '''re.subs() argument to tag keywords.'''
+ word = mo.group('word')
+ if word in keywords[language]:
+ stag,etag = keywordtags[backend]
+ return stag+word+etag
+ else:
+ return word
+
+def code_filter():
+ '''This function does all the work.'''
+ global language, backend
+ inline_comment = inline_comments[language]
+ blk_comment = block_comments[language]
+ if blk_comment:
+ blk_comment = (re.escape(block_comments[language][0]),
+ re.escape(block_comments[language][1]))
+ stag,etag = commenttags[backend]
+ in_comment = 0 # True if we're inside a multi-line block comment.
+ tag_comment = 0 # True if we should tag the current line as a comment.
+ line = sys.stdin.readline()
+ while line:
+ line = string.rstrip(line)
+ line = string.expandtabs(line,tabsize)
+ # Escape special characters.
+ line = string.replace(line,'&','&amp;')
+ line = string.replace(line,'<','&lt;')
+ line = string.replace(line,'>','&gt;')
+ # Process block comment.
+ if blk_comment:
+ if in_comment:
+ if re.match(r'.*'+blk_comment[1]+r'$',line):
+ in_comment = 0
+ else:
+ if re.match(r'^\s*'+blk_comment[0]+r'.*'+blk_comment[1],line):
+ # Single line block comment.
+ tag_comment = 1
+ elif re.match(r'^\s*'+blk_comment[0],line):
+ # Start of multi-line block comment.
+ tag_comment = 1
+ in_comment = 1
+ else:
+ tag_comment = 0
+ if tag_comment:
+ if line: line = stag+line+etag
+ else:
+ if inline_comment:
+ pos = string.find(line,inline_comment)
+ else:
+ pos = -1
+ if pos >= 0:
+ # Process inline comment.
+ line = re.sub(r'\b(?P<word>\w+)\b',sub_keyword,line[:pos]) \
+ + stag + line[pos:] + etag
+ else:
+ line = re.sub(r'\b(?P<word>\w+)\b',sub_keyword,line)
+ sys.stdout.write(line + os.linesep)
+ line = sys.stdin.readline()
+
+def usage(msg=''):
+ if msg:
+ print_stderr(msg)
+ print_stderr('Usage: code-filter -b backend -l language [ -t tabsize ]')
+ print_stderr(' [ --help | -h ] [ --version | -v ]')
+
+def main():
+ global language, backend, tabsize
+ # Process command line options.
+ import getopt
+ opts,args = getopt.getopt(sys.argv[1:],
+ 'b:l:ht:v',
+ ['help','version'])
+ if len(args) > 0:
+ usage()
+ sys.exit(1)
+ for o,v in opts:
+ if o in ('--help','-h'):
+ print __doc__
+ sys.exit(0)
+ if o in ('--version','-v'):
+ print('code-filter version %s' % (VERSION,))
+ sys.exit(0)
+ if o == '-b': backend = v
+ if o == '-l':
+ v = string.lower(v)
+ if v == 'c': v = 'c++'
+ language = v
+ if o == '-t':
+ try:
+ tabsize = int(v)
+ except:
+ usage('illegal tabsize')
+ sys.exit(1)
+ if tabsize <= 0:
+ usage('illegal tabsize')
+ sys.exit(1)
+ if backend is None:
+ usage('backend option is mandatory')
+ sys.exit(1)
+ if not keywordtags.has_key(backend):
+ usage('illegal backend option')
+ sys.exit(1)
+ if language is None:
+ usage('language option is mandatory')
+ sys.exit(1)
+ if not keywords.has_key(language):
+ usage('illegal language option')
+ sys.exit(1)
+ # Do the work.
+ code_filter()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except (KeyboardInterrupt, SystemExit):
+ pass
+ except:
+ print_stderr("%s: unexpected exit status: %s" %
+ (os.path.basename(sys.argv[0]), sys.exc_info()[1]))
+ # Exit with previous sys.exit() status or zero if no sys.exit().
+ sys.exit(sys.exc_info()[1])
diff --git a/filters/music-filter-test.txt b/filters/music-filter-test.txt
new file mode 100644
index 0000000..c27ed96
--- /dev/null
+++ b/filters/music-filter-test.txt
@@ -0,0 +1,40 @@
+Music Filter Test
+=================
+
+Details of the filter can be found in `./doc/music-filter.txt`.
+
+
+A tune generated from ABC notation
+----------------------------------
+
+[music1.png]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+T:The Butterfly
+R:slip jig
+C:Tommy Potts
+H:Fiddle player Tommy Potts made this tune from two older slip jigs,
+H:one of which is called "Skin the Peelers" in Roche's collection.
+D:Bothy Band: 1975.
+M:9/8
+K:Em
+vB2(E G2)(E F3)|B2(E G2)(E F)ED|vB2(E G2)(E F3)|(B2d) d2(uB A)FD:|
+|:(vB2c) (e2f) g3|(uB2d) (g2e) (dBA)|(B2c) (e2f) g2(ua|b2a) (g2e) (dBA):|
+|:~B3 (B2A) G2A|~B3 BA(uB d)BA|~B3 (B2A) G2(A|B2d) (g2e) (dBA):|
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+
+A fragment generated from LilyPond source
+------------------------------------------
+
+["music2.png", "ly", link="music2.ly"]
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+\version "2.6.3"
+\paper {
+ raggedright = ##t
+}
+{
+ \time 3/4
+ \clef bass
+ c2 e4 g2. f4 e d c2 r4
+}
+music~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/filters/music-filter.conf b/filters/music-filter.conf
new file mode 100644
index 0000000..d20c091
--- /dev/null
+++ b/filters/music-filter.conf
@@ -0,0 +1,30 @@
+#
+# AsciiDoc music filter configuration file.
+#
+# Documented in music-filter.txt in AsciiDoc distribution
+# ./examples/website/ directory.
+#
+
+[blockdef-music]
+delimiter=^music~{4,}$
+template=music-block
+presubs=none
+filter=music2png.py {verbose?-v} -m -f {format=abc} -o "{outdir}/{target}" -
+posattrs=target,format
+
+ifdef::basebackend-html[]
+[music-block]
+<div class="musicblock">
+<a id="{id}"></a>
+<div class="title">{title}</div>
+<div class="content">
+<a href="{link}">
+<img style="border-width: 0;" src="{target}" alt="{target}"{width? width="{width}"}{height? height="{height}"} />
+{link#}</a>
+</div></div>
+endif::basebackend-html[]
+
+ifdef::basebackend-docbook[]
+[music-block]
+template::[image-blockmacro]
+endif::basebackend-docbook[]
diff --git a/filters/music2png.py b/filters/music2png.py
new file mode 100755
index 0000000..4473c62
--- /dev/null
+++ b/filters/music2png.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python
+'''
+NAME
+ music2png - Converts textual music notation to classically notated PNG file
+
+SYNOPSIS
+ music2png [options] INFILE
+
+DESCRIPTION
+ This filter reads LilyPond or ABC music notation text from the input file
+ INFILE (or stdin if INFILE is -), converts it to classical music notation
+ and writes it to a trimmed PNG image file.
+
+ This script is a wrapper for LilyPond and ImageMagick commands.
+
+OPTIONS
+ -f FORMAT
+ The INFILE music format. 'abc' for ABC notation, 'ly' for LilyPond
+ notation.
+
+ -o OUTFILE
+ The file name of the output file. If not specified the output file is
+ named like INFILE but with a .png file name extension.
+
+ -m
+ Skip if the PNG output file is newer that than the INFILE. When
+ INFILE is - (stdin) previously retained input is compared.
+
+ -v
+ Verbosely print processing information to stderr.
+
+ --help, -h
+ Print this documentation.
+
+ --version
+ Print program version number.
+
+SEE ALSO
+ lilypond(1), abc2ly(1), convert(1)
+
+AUTHOR
+ Written by Stuart Rackham, <srackham@methods.co.nz>
+
+COPYING
+ Copyright (C) 2006 Stuart Rackham. Free use of this software is
+ granted under the terms of the GNU General Public License (GPL).
+'''
+
+import os, sys
+
+VERSION = '0.1.0'
+
+# Globals.
+verbose = False
+
+class EApp(Exception): pass # Application specific exception.
+
+def print_stderr(line):
+ sys.stderr.write(line + os.linesep)
+
+def print_verbose(line):
+ if verbose:
+ print_stderr(line)
+
+def run(cmd):
+ global verbose
+ if not verbose:
+ cmd += ' 2>/dev/null'
+ print_verbose('executing: %s' % cmd)
+ if os.system(cmd):
+ raise EApp, 'failed command: %s' % cmd
+
+def music2png(format, infile, outfile, modified):
+ '''Convert ABC notation in file infile to cropped PNG file named outfile.'''
+ outfile = os.path.abspath(outfile)
+ outdir = os.path.dirname(outfile)
+ if not os.path.isdir(outdir):
+ raise EApp, 'directory does not exist: %s' % outdir
+ basefile = os.path.splitext(outfile)[0]
+ abc = basefile + '.abc'
+ ly = basefile + '.ly'
+ temps = [ basefile + ext for ext in ('.abc', '.ly', '.ps', '.midi') ]
+ # Don't delete files that already exist.
+ temps = [ f for f in temps if not os.path.exists(f) ]
+ skip = False
+ if infile == '-':
+ lines = sys.stdin.readlines()
+ if format == 'abc':
+ f = abc
+ else:
+ f = ly
+ if modified:
+ if f in temps:
+ del temps[temps.index(f)] # Don't delete previous source.
+ if os.path.isfile(outfile) and os.path.isfile(f):
+ old = open(f, 'r').readlines()
+ skip = lines == old
+ if not skip:
+ open(f, 'w').writelines(lines)
+ else:
+ if not os.path.isfile(infile):
+ raise EApp, 'input file does not exist: %s' % infile
+ if modified and os.path.isfile(outfile):
+ skip = os.path.getmtime(infile) <= os.path.getmtime(outfile)
+ if skip:
+ print_verbose('skipped: no change: %s' % outfile)
+ return
+ saved_pwd = os.getcwd()
+ os.chdir(outdir)
+ try:
+ if format == 'abc':
+ run('abc2ly --beams=None "%s"' % abc)
+ run('lilypond --png "%s"' % ly)
+ finally:
+ os.chdir(saved_pwd)
+ # Chop the bottom 75 pixels off to get rid of the page footer.
+ run('convert "%s" -gravity South -crop 1000x10000+0+75 "%s"' % (outfile, outfile))
+ # Trim all blank areas from sides, top and bottom.
+ run('convert "%s" -trim "%s"' % (outfile, outfile))
+ for f in temps:
+ if os.path.isfile(f):
+ print_verbose('deleting: %s' % f)
+ os.remove(f)
+
+def usage(msg=''):
+ if msg:
+ print_stderr(msg)
+ print_stderr('\n'
+ 'usage:\n'
+ ' music2png [options] INFILE\n'
+ '\n'
+ 'options:\n'
+ ' -f FORMAT\n'
+ ' -o OUTFILE\n'
+ ' -m\n'
+ ' -v\n'
+ ' --help\n'
+ ' --version')
+
+def main():
+ # Process command line options.
+ global verbose
+ format = None
+ outfile = None
+ modified = False
+ import getopt
+ opts,args = getopt.getopt(sys.argv[1:], 'f:o:mhv', ['help','version'])
+ for o,v in opts:
+ if o in ('--help','-h'):
+ print __doc__
+ sys.exit(0)
+ if o =='--version':
+ print('music2png version %s' % (VERSION,))
+ sys.exit(0)
+ if o == '-f': format = v
+ if o == '-o': outfile = v
+ if o == '-m': modified = True
+ if o == '-v': verbose = True
+ if len(args) != 1:
+ usage()
+ sys.exit(1)
+ infile = args[0]
+ if format is None:
+ usage('FORMAT must be specified')
+ sys.exit(1)
+ if format not in ('abc', 'ly'):
+ usage('invalid FORMAT')
+ sys.exit(1)
+ if outfile is None:
+ if infile == '-':
+ usage('OUTFILE must be specified')
+ sys.exit(1)
+ outfile = os.path.splitext(infile)[0] + '.png'
+ # Do the work.
+ music2png(format, infile, outfile, modified)
+ # Print something to suppress asciidoc 'no output from filter' warnings.
+ if infile == '-':
+ sys.stdout.write(' ')
+
+if __name__ == "__main__":
+ try:
+ main()
+ except SystemExit:
+ raise
+ except KeyboardInterrupt:
+ sys.exit(1)
+ except Exception, e:
+ print_stderr("%s: %s" % (os.path.basename(sys.argv[0]), str(e)))
+ sys.exit(1)
diff --git a/filters/source-highlight-filter-test.txt b/filters/source-highlight-filter-test.txt
new file mode 100644
index 0000000..9c6ba57
--- /dev/null
+++ b/filters/source-highlight-filter-test.txt
@@ -0,0 +1,19 @@
+Source Hightlight Filter Test
+=============================
+
+Details of the filter can be found in
+`./doc/source-highlight-filter.txt`.
+
+[python]
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+''' A multi-line
+ comment.'''
+def sub_word(mo):
+ ''' Single line comment.'''
+ word = mo.group('word') # Inline comment
+ if word in keywords[language]:
+ return quote + word + quote
+ else:
+ return word
+source~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
diff --git a/filters/source-highlight-filter.conf b/filters/source-highlight-filter.conf
new file mode 100644
index 0000000..fc1dcf3
--- /dev/null
+++ b/filters/source-highlight-filter.conf
@@ -0,0 +1,33 @@
+#
+# AsciiDoc source code highlight filter configuration file.
+#
+# Documented in source-hightlight-filter.txt in AsciiDoc distribution
+# ./examples/website/ directory.
+#
+# Requires GNU source-highlight
+# http://www.gnu.org/software/src-highlite/source-highlight.html
+#
+
+[blockdef-source-highlight]
+# The old ^ delimiter is for backward compatibility, may be removed from
+# in future versions.
+delimiter=(^source~{4,}$)|(^\^{4,}$)
+template=source-highlight-block
+presubs=none
+postsubs=callouts
+filter=source-highlight -f {backend-xhtml11?xhtml}{backend-html4?html}{backend-docbook?docbook} -s {language} {src_numbered?--line-number} {src_tab?--tab={src_tab}}
+posattrs=language,src_numbered,src_tab
+
+[source-highlight-block]
+template::[listingblock]
+
+# Customized listingblock block for xhtml11 to ensure valid XHTML1.1.
+ifdef::backend-xhtml11[]
+[source-highlight-block]
+<div class="listingblock">
+<a id="{id}"></a>
+<div class="title">{caption=Example: }{title}</div>
+<div class="content">
+|
+</div></div>
+endif::backend-xhtml11[]
diff --git a/help.conf b/help.conf
new file mode 100644
index 0000000..03b66de
--- /dev/null
+++ b/help.conf
@@ -0,0 +1,202 @@
+# AsciiDoc help file.
+#
+# INI section format, each section contains a topic.
+# Displayed with 'asciidoc --help sectionname' command.
+#
+
+#
+# Default help topic.
+#
+[default]
+
+Man page: asciidoc --help manpage
+Syntax: asciidoc --help syntax
+
+[manpage]
+
+NAME
+
+ asciidoc - converts an AsciiDoc text file to DocBook, HTML or LinuxDoc
+
+SYNOPSIS
+
+ asciidoc [OPTIONS] FILE
+
+DESCRIPTION
+
+ The asciidoc(1) command translates the AsciiDoc text file FILE to a
+ DocBook, HTML or LinuxDoc file. If FILE is - then the standard input
+ is used.
+
+OPTIONS
+
+ -a, --attribute=ATTRIBUTE
+ Define or delete document attribute. ATTRIBUTE is formatted
+ like NAME=VALUE. Command-line attributes take precedence over
+ document and configuration file attributes. Alternate
+ acceptable forms are NAME (the VALUE defaults to an empty
+ string); NAME! (delete the NAME attribute); NAME@ (do not
+ override document or configuration file attributes). Values
+ containing spaces should be enclosed in double-quote
+ characters. Multiple instances allowed.
+
+ -b, --backend=BACKEND
+ Backend output file format: docbook, xhtml11 or html4. Defaults
+ to xhtml11.
+
+ -f, --conf-file=CONF_FILE
+ Use configuration file CONF_FILE. Multiple instances allowed.
+ Configuration files processed in command-line order (after
+ implicit configuration files).
+
+ -d, --doctype=DOCTYPE
+ Document type: article, manpage or book. The book document type
+ is only supported by the docbook backend. Default document type
+ is article.
+
+ -c, --dump-conf
+ Dump configuration to stdout.
+
+ -h, --help[=TOPIC]
+ Print help TOPIC. --help topics will print a list of help
+ topics, --help syntax summarises AsciiDoc syntax, --help
+ manpage prints the AsciiDoc manpage.
+
+ -e, --no-conf
+ Exclude implicitly loaded configuration files except for those
+ named like the input file (infile.conf and
+ infile-backend.conf).
+
+ -s, --no-header-footer
+ Suppress document header and footer output.
+
+ -o, --out-file=OUT_FILE
+ Write output to file OUT_FILE. Defaults to the base name of
+ input file with backend extension. If the input is stdin then
+ the outfile defaults to stdout. If OUT_FILE is - then the
+ standard output is used.
+
+ -n, --section-numbers
+ Auto-number HTML article section titles. Synonym for -a
+ numbered.
+
+ --unsafe
+ Disable safe mode. Safe mode is enabled by default, disabling
+ it is potentially dangerous.
+
+ -v, --verbose
+ Verbosely print processing information and configuration file
+ checks to stderr.
+
+ --version
+ Print program version number.
+
+BUGS
+
+ See the AsciiDoc distribution BUGS file.
+
+AUTHOR
+
+ Written by Stuart Rackham, <srackham@methods.co.nz>
+
+RESOURCES
+
+ SourceForge: http://sourceforge.net/projects/asciidoc/
+
+ Main web site: http://www.methods.co.nz/asciidoc/
+
+COPYING
+
+ Copyright (C) 2002-2007 Stuart Rackham. Free use of this software is
+ granted under the terms of the GNU General Public License (GPL).
+
+[syntax]
+
+AsciiDoc Markup Syntax Summary
+==============================
+
+A summary of the most often used markup.
+For a complete reference see the 'AsciiDoc User Guide'.
+
+Text formatting
+---------------
+ *bold text* (boldface font)
+ _emphasized text_ (normally italics)
+ 'emphasized text'
+ +monospaced text+ (proportional font)
+ `monospaced text`
+
+Document links
+--------------
+ [[id]] (define link target)
+ <<id,caption>> (link to target id)
+ link:filename#id[caption] (link to external HTML file)
+
+URLs
+----
+ http:address[caption] (link to web page)
+ mailto:address[caption] (link to mail recipient)
+
+Images
+------
+ image:filename[caption] (inline image)
+ image::filename[caption] (block image)
+
+Document header
+---------------
+
+ The Document Title
+ ==================
+ author <email> (optional)
+ revision, date (optional)
+
+Section title underlines
+------------------------
+ Level 0 (document title): ======================
+ Level 1: ----------------------
+ Level 2: ~~~~~~~~~~~~~~~~~~~~~~
+ Level 3: ^^^^^^^^^^^^^^^^^^^^^^
+ Level 4 (bottom level): ++++++++++++++++++++++
+
+Delimited blocks
+----------------
+Delimiters must begin at left margin.
+
+ -------------------
+ listing block
+ -------------------
+
+ ...................
+ literal block
+ ...................
+
+ *******************
+ sidebar block
+ *******************
+
+ [author, source] (optional)
+ ___________________
+ quote block
+ ___________________
+
+ ===================
+ example block
+ ===================
+
+ ///////////////////
+ comment block
+ ///////////////////
+
+More block elements
+-------------------
+ [attributes list] (Note 1)
+ .Block title (Note 1)
+ // Comment line (Note 1)
+ include::filename[] (Note 1)
+
+Note 1: Begin at the left margin.
+
+More inline elements
+--------------------
+ footnote:[footnote text] (document footnote)
+
diff --git a/html4.conf b/html4.conf
new file mode 100644
index 0000000..2a8d9e1
--- /dev/null
+++ b/html4.conf
@@ -0,0 +1,358 @@
+#
+# html4.conf
+#
+# Asciidoc configuration file.
+# html backend for generation of legacy HTML 4 markup.
+#
+
+[miscellaneous]
+outfilesuffix=.html
+# Screen width in pixels.
+pagewidth=800
+pageunits=
+
+[attributes]
+basebackend=html
+basebackend-html=
+
+[replacements]
+# Line break.
+(?m)^(.*)\s\+$=\1<br />
+ifdef::asciidoc7compatible[]
+# Superscripts.
+\^(.+?)\^=<sup>\1</sup>
+# Subscripts.
+~(.+?)~=<sub>\1</sub>
+endif::asciidoc7compatible[]
+
+[ruler-blockmacro]
+<hr />
+
+[image-inlinemacro]
+<a href="{link}">
+ <img src="{imagesdir=}{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"}/>
+{link#}</a>
+
+[image-blockmacro]
+<a name="{id}"></a>
+<a href="{link}">
+ <img src="{imagesdir=}{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"}/>
+{link#}</a>
+<p><b>{caption=Figure: }{title}</b></p>
+
+[indexterm-inlinemacro]
+# Inline index term.
+{empty}
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+<br />[{0}]<br />
+
+[callout-inlinemacro]
+# Inline callout.
+<b>({index})</b>
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ilist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ul>|</ul>
+ilistitem=<li>|</li>
+ilisttext=<p>|</p>
+olist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+olist2={id?<a name="{id}"></a>}<ol type="a">|</ol>
+olistitem=<li>|</li>
+olisttext=<p>|</p>
+vlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<dl>|</dl>
+vlistentry=|
+vlistterm=<dt>|</dt>
+vlistitem=<dd>|</dd>
+vlisttext=<p>|</p>
+# Horizontal labeled list.
+hlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<table cellpadding="4">|</table>
+hlistentry=<tr valign="top">|</tr>
+hlisttext=|
+hlistterm=<td{1? width="{1}%"}>|</td>
+hlistitem=<td{2? width="{2}%"}>|</td>
+# Question and Answer list.
+qlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+qlistentry=<li>|</li>
+qlistterm=<p><em>|</em></p>
+qlistitem=|
+qlisttext=<p>|</p>
+# Callout list.
+colist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+colistitem=<li>|</li>
+colisttext=<p>|</p>
+
+# Quoted text.
+emphasis=<em{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</em>
+strong=<strong{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</strong>
+monospaced=<tt{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</tt>
+quoted={0?<span style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?">}{amp}#8220;|{amp}#8221;{0?</span>}
+unquoted={0?<span style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?">}|{0?</span>}
+superscript=<sup{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</sup>
+subscript=<sub{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</sub>
+
+# $$ inline passthrough.
+passthrough=<span{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</span>
+
+# Inline macros
+[http-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[https-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[ftp-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[file-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[mailto-inlinemacro]
+<a href="{name}:{target}">{0={target}}</a>
+[callto-inlinemacro]
+<a href="{name}:{target}">{0={target}}</a>
+[link-inlinemacro]
+<a href="{target}">{0={target}}</a>
+# anchor:id[text]
+[anchor-inlinemacro]
+<a name="{target}"></a>
+# [[id,text]]
+[anchor2-inlinemacro]
+<a name="{1}"></a>
+# [[[id]]]
+[anchor3-inlinemacro]
+<a name="{1}"></a>[{1}]
+# xref:id[text]
+[xref-inlinemacro]
+<a href="#{target}">{0=[{target}]}</a>
+# <<id,text>>
+[xref2-inlinemacro]
+<a href="#{1}">{2=[{1}]}</a>
+
+# Special word substitution.
+[emphasizedwords]
+<em>{words}</em>
+[monospacedwords]
+<tt>{words}</tt>
+[strongwords]
+<strong>{words}</strong>
+
+# Paragraph substitution.
+[paragraph]
+<p>{id?<a name="{id}"></a>}{title?<b>{title}</b><br />}
+|
+</p>
+
+[literalparagraph]
+# The literal block employs the same markup.
+template::[literalblock]
+
+[verseparagraph]
+# The verse block employs the same markup.
+template::[verseblock]
+
+[admonitionparagraph]
+<a name="{id}"></a>
+<p><b>{caption}:</b> |</p>
+
+# Delimited blocks.
+[passthroughblock]
+|
+
+[listingblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
+<pre>
+|
+</pre>
+</td></tr></table>
+
+[literalblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+<pre>
+|
+</pre>
+
+[verseblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+# Font inheritance broken in IE6.
+<pre style="font-family: inherit;">
+|
+</pre>
+
+[sidebarblock]
+<a name="{id}"></a>
+<table frame="border" bgcolor="#ffffee" width="80%" cellpadding="15">
+<tr><td>
+<p><em>{title}</em></p>
+|
+</td></tr></table>
+
+[quoteblock]
+<a name="{id}"></a>
+<blockquote>
+<p><b>{title}</b></p>
+|
+<p align="right">
+<em>{citetitle}</em><br />
+&#8212; {attribution}
+</p>
+</blockquote>
+
+[exampleblock]
+<a name="{id}"></a>
+<p><b>{caption=Example: }{title}</b></p>
+<table frame="border" bgcolor="white" width="80%" cellpadding="15">
+<tr><td>
+|
+</td></tr></table>
+
+[admonitionblock]
+<a name="{id}"></a>
+<table frame="void" bgcolor="white" width="80%" cellpadding="8">
+<tr valign="top"><td><p><b>{caption}</b></p></td><td>
+<p><b>{title}</b></p>
+|
+</td></tr></table>
+
+# Bibliography list.
+# Same as numbered list.
+[listdef-bibliography]
+listtag=olist
+itemtag=olistitem
+texttag=olisttext
+
+# Glossary list.
+# Same as labeled list.
+[listdef-glossary]
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+# Tables.
+[tabledef-default]
+template=table
+bodyrow=<tr>|</tr>
+headdata=<th align="{colalign}" width="{colwidth}{pageunits}">|</th>
+footdata=<td align="{colalign}" width="{colwidth}{pageunits}"><strong>|</strong></td>
+bodydata=<td align="{colalign}" width="{colwidth}{pageunits}" valign="top">|</td>
+
+[table]
+<p><b>{caption=Table: }</b>{title}</p>
+<a name="{id}"></a>
+<table rules="{grid=none}"
+frame="{frame%hsides}"
+frame="{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}"
+cellspacing="0" cellpadding="4">
+{headrows#}<thead>
+{headrows}
+{headrows#}</thead>
+{footrows#}<tfoot>
+{footrows}
+{footrows#}</tfoot>
+<tbody>
+{bodyrows}
+</tbody>
+</table>
+
+[preamble]
+# Untitled elements between header and first section title.
+<a name="{id}"></a>
+|
+
+[sect0]
+{doctype-manpage%}<hr />
+<h1>{id?<a name="{id}"></a>}{title}</h1>
+|
+
+[sect1]
+{doctype-manpage%}<hr />
+<h2>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h2>
+|
+
+[sect2]
+<h3>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h3>
+|
+
+[sect3]
+<h4>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h4>
+|
+
+[sect4]
+<h5>{id?<a name="{id}"></a>}{title}</h5>
+|
+
+[footer]
+<p></p>
+<p></p>
+<hr /><p><small>
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</small></p>
+</body>
+</html>
+
+#-------------------------
+# article document type
+#-------------------------
+ifndef::doctype-manpage[]
+
+[header]
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}">
+<meta name="generator" content="AsciiDoc {asciidoc-version}">
+<title>{doctitle}</title>
+</head>
+<body>
+<h1>{doctitle}</h1>
+<p>
+<strong>{author}</strong><br />
+<tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt><br />
+version {revision}{date?,}
+{date}
+</p>
+
+endif::doctype-manpage[]
+
+#-------------------------
+# manpage document type
+#-------------------------
+ifdef::doctype-manpage[]
+
+[tags]
+# This is more inline with man page convention.
+emphasis=<b>|</b>
+vlistterm=<dt><b>|</b></dt>
+
+[header]
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}">
+<meta name="generator" content="AsciiDoc {asciidoc-version}">
+<title>{mantitle}</title>
+</head>
+<body>
+<hr />
+<h1>
+ {doctitle} Manual Page
+</h1>
+<hr />
+<h2>NAME</h2>
+<p>{manname} -
+ {manpurpose}
+</p>
+
+[sect-synopsis]
+template::[sect1]
+
+endif::doctype-manpage[]
diff --git a/images/highlighter.png b/images/highlighter.png
new file mode 100644
index 0000000..ad1090b
--- /dev/null
+++ b/images/highlighter.png
Binary files differ
diff --git a/images/icons/README b/images/icons/README
new file mode 100644
index 0000000..f12b2a7
--- /dev/null
+++ b/images/icons/README
@@ -0,0 +1,5 @@
+Replaced the plain DocBook XSL admonition icons with Jimmac's DocBook
+icons (http://jimmac.musichall.cz/ikony.php3). I dropped transparency
+from the Jimmac icons to get round MS IE and FOP PNG incompatibilies.
+
+Stuart Rackham
diff --git a/images/icons/callouts/1.png b/images/icons/callouts/1.png
new file mode 100644
index 0000000..7d47343
--- /dev/null
+++ b/images/icons/callouts/1.png
Binary files differ
diff --git a/images/icons/callouts/10.png b/images/icons/callouts/10.png
new file mode 100644
index 0000000..997bbc8
--- /dev/null
+++ b/images/icons/callouts/10.png
Binary files differ
diff --git a/images/icons/callouts/11.png b/images/icons/callouts/11.png
new file mode 100644
index 0000000..ce47dac
--- /dev/null
+++ b/images/icons/callouts/11.png
Binary files differ
diff --git a/images/icons/callouts/12.png b/images/icons/callouts/12.png
new file mode 100644
index 0000000..31daf4e
--- /dev/null
+++ b/images/icons/callouts/12.png
Binary files differ
diff --git a/images/icons/callouts/13.png b/images/icons/callouts/13.png
new file mode 100644
index 0000000..14021a8
--- /dev/null
+++ b/images/icons/callouts/13.png
Binary files differ
diff --git a/images/icons/callouts/14.png b/images/icons/callouts/14.png
new file mode 100644
index 0000000..64014b7
--- /dev/null
+++ b/images/icons/callouts/14.png
Binary files differ
diff --git a/images/icons/callouts/15.png b/images/icons/callouts/15.png
new file mode 100644
index 0000000..0d65765
--- /dev/null
+++ b/images/icons/callouts/15.png
Binary files differ
diff --git a/images/icons/callouts/2.png b/images/icons/callouts/2.png
new file mode 100644
index 0000000..5d09341
--- /dev/null
+++ b/images/icons/callouts/2.png
Binary files differ
diff --git a/images/icons/callouts/3.png b/images/icons/callouts/3.png
new file mode 100644
index 0000000..ef7b700
--- /dev/null
+++ b/images/icons/callouts/3.png
Binary files differ
diff --git a/images/icons/callouts/4.png b/images/icons/callouts/4.png
new file mode 100644
index 0000000..adb8364
--- /dev/null
+++ b/images/icons/callouts/4.png
Binary files differ
diff --git a/images/icons/callouts/5.png b/images/icons/callouts/5.png
new file mode 100644
index 0000000..4d7eb46
--- /dev/null
+++ b/images/icons/callouts/5.png
Binary files differ
diff --git a/images/icons/callouts/6.png b/images/icons/callouts/6.png
new file mode 100644
index 0000000..0ba694a
--- /dev/null
+++ b/images/icons/callouts/6.png
Binary files differ
diff --git a/images/icons/callouts/7.png b/images/icons/callouts/7.png
new file mode 100644
index 0000000..472e96f
--- /dev/null
+++ b/images/icons/callouts/7.png
Binary files differ
diff --git a/images/icons/callouts/8.png b/images/icons/callouts/8.png
new file mode 100644
index 0000000..5e60973
--- /dev/null
+++ b/images/icons/callouts/8.png
Binary files differ
diff --git a/images/icons/callouts/9.png b/images/icons/callouts/9.png
new file mode 100644
index 0000000..a0676d2
--- /dev/null
+++ b/images/icons/callouts/9.png
Binary files differ
diff --git a/images/icons/caution.png b/images/icons/caution.png
new file mode 100644
index 0000000..cb9d5ea
--- /dev/null
+++ b/images/icons/caution.png
Binary files differ
diff --git a/images/icons/example.png b/images/icons/example.png
new file mode 100644
index 0000000..bba1c00
--- /dev/null
+++ b/images/icons/example.png
Binary files differ
diff --git a/images/icons/home.png b/images/icons/home.png
new file mode 100644
index 0000000..37a5231
--- /dev/null
+++ b/images/icons/home.png
Binary files differ
diff --git a/images/icons/important.png b/images/icons/important.png
new file mode 100644
index 0000000..1096c23
--- /dev/null
+++ b/images/icons/important.png
Binary files differ
diff --git a/images/icons/next.png b/images/icons/next.png
new file mode 100644
index 0000000..64e126b
--- /dev/null
+++ b/images/icons/next.png
Binary files differ
diff --git a/images/icons/note.png b/images/icons/note.png
new file mode 100644
index 0000000..841820f
--- /dev/null
+++ b/images/icons/note.png
Binary files differ
diff --git a/images/icons/prev.png b/images/icons/prev.png
new file mode 100644
index 0000000..3e8f12f
--- /dev/null
+++ b/images/icons/prev.png
Binary files differ
diff --git a/images/icons/tip.png b/images/icons/tip.png
new file mode 100644
index 0000000..a3a029d
--- /dev/null
+++ b/images/icons/tip.png
Binary files differ
diff --git a/images/icons/up.png b/images/icons/up.png
new file mode 100644
index 0000000..2db1ce6
--- /dev/null
+++ b/images/icons/up.png
Binary files differ
diff --git a/images/icons/warning.png b/images/icons/warning.png
new file mode 100644
index 0000000..0b0c419
--- /dev/null
+++ b/images/icons/warning.png
Binary files differ
diff --git a/images/smallnew.png b/images/smallnew.png
new file mode 100644
index 0000000..c0c0662
--- /dev/null
+++ b/images/smallnew.png
Binary files differ
diff --git a/images/tiger.png b/images/tiger.png
new file mode 100644
index 0000000..332b11f
--- /dev/null
+++ b/images/tiger.png
Binary files differ
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..9cc8c55
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# AsciiDoc canonical installer/uninstaller.
+# Definative packager's guide.
+# Documented in INSTALL file.
+#
+# NOTE: If you change the CONFDIR (the global asciidoc(1) configuration file
+# directory) then you will also need to change the CONF_DIR constant definition
+# values in both a2x and asciiidoc.py scripts.
+
+CONFDIR=/etc/asciidoc
+BINDIR=/usr/local/bin
+MANDIR=/usr/local/man
+VIM_CONFDIR=/etc/vim
+
+if [ `basename $0` = uninstall.sh ]; then
+ rm $BINDIR/asciidoc
+ rm $BINDIR/a2x
+ rm $MANDIR/man1/asciidoc.1
+ rm $MANDIR/man1/a2x.1
+ rm -rf $CONFDIR
+ rm -f $VIM_CONFDIR/syntax/asciidoc.vim
+ rm -f $VIM_CONFDIR/ftdetect/asciidoc_filetype.vim
+else
+ install asciidoc.py $BINDIR/asciidoc
+ install a2x $BINDIR/a2x
+ install -d $MANDIR/man1
+ install doc/*.1 $MANDIR/man1
+ install -d $CONFDIR/filters \
+ $CONFDIR/docbook-xsl \
+ $CONFDIR/stylesheets \
+ $CONFDIR/javascripts \
+ $CONFDIR/images/icons/callouts
+ install -m 644 *.conf $CONFDIR
+ install filters/*.py $CONFDIR/filters
+ install -m 644 filters/*.conf $CONFDIR/filters
+ install -m 644 docbook-xsl/*.xsl $CONFDIR/docbook-xsl
+ install -m 644 stylesheets/*.css $CONFDIR/stylesheets
+ install -m 644 javascripts/*.js $CONFDIR/javascripts
+ install -m 644 images/icons/callouts/* $CONFDIR/images/icons/callouts
+ install -m 644 images/icons/README images/icons/*.png $CONFDIR/images/icons
+ if [ -d $VIM_CONFDIR ]; then
+ install -d $VIM_CONFDIR/syntax
+ install -m 644 vim/syntax/asciidoc.vim \
+ $VIM_CONFDIR/syntax/asciidoc.vim
+ install -d $VIM_CONFDIR/ftdetect
+ install -m 644 vim/ftdetect/asciidoc_filetype.vim \
+ $VIM_CONFDIR/ftdetect/asciidoc_filetype.vim
+ fi
+fi
+
+# vim: set et ts=4 sw=4 sts=4:
diff --git a/javascripts/ASCIIMathML.js b/javascripts/ASCIIMathML.js
new file mode 100644
index 0000000..489b312
--- /dev/null
+++ b/javascripts/ASCIIMathML.js
@@ -0,0 +1,938 @@
+/*
+ASCIIMathML.js
+==============
+This file contains JavaScript functions to convert ASCII math notation
+to Presentation MathML. The conversion is done while the (X)HTML page
+loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
+Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
+Just add the next line to your (X)HTML page with this file in the same folder:
+This is a convenient and inexpensive solution for authoring MathML.
+
+Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
+Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
+For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
+If you use it on a webpage, please send the URL to jipsen@chapman.edu
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License (at http://www.gnu.org/copyleft/gpl.html)
+for more details.
+*/
+
+var checkForMathML = true; // check if browser can display MathML
+var notifyIfNoMathML = true; // display note if no MathML capability
+var alertIfNoMathML = false; // show alert box if no MathML capability
+var mathcolor = ""; // change it to "" (to inherit) or any other color
+var mathfontfamily = "serif"; // change to "" to inherit (works in IE)
+ // or another family (e.g. "arial")
+var displaystyle = true; // puts limits above and below large operators
+var showasciiformulaonhover = true; // helps students learn ASCIIMath
+var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
+var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
+var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$";
+var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1`
+ // for IE this works only in <!-- -->
+//var separatetokens;// has been removed (email me if this is a problem)
+var isIE = document.createElementNS==null;
+
+if (document.getElementById==null)
+ alert("This webpage requires a recent browser such as\
+\nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
+
+// all further global variables start with "AM"
+
+function AMcreateElementXHTML(t) {
+ if (isIE) return document.createElement(t);
+ else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
+}
+
+function AMnoMathMLNote() {
+ var nd = AMcreateElementXHTML("h3");
+ nd.setAttribute("align","center")
+ nd.appendChild(AMcreateElementXHTML("p"));
+ nd.appendChild(document.createTextNode("To view the "));
+ var an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("ASCIIMathML"));
+ an.setAttribute("href","http://www.chapman.edu/~jipsen/asciimath.html");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));
+ an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("MathPlayer"));
+ an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
+ nd.appendChild(AMcreateElementXHTML("p"));
+ return nd;
+}
+
+function AMisMathMLavailable() {
+ if (navigator.appName.slice(0,8)=="Netscape")
+ if (navigator.appVersion.slice(0,1)>="5") return null;
+ else return AMnoMathMLNote();
+ else if (navigator.appName.slice(0,9)=="Microsoft")
+ try {
+ var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
+ return null;
+ } catch (e) {
+ return AMnoMathMLNote();
+ }
+ else return AMnoMathMLNote();
+}
+
+// character lists for Mozilla/Netscape fonts
+var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
+var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
+var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
+
+var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
+ RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
+ LEFTRIGHT = 9, TEXT = 10; // token types
+
+var AMsqrt = {input:"sqrt", tag:"msqrt", output:"sqrt", tex:null, ttype:UNARY},
+ AMroot = {input:"root", tag:"mroot", output:"root", tex:null, ttype:BINARY},
+ AMfrac = {input:"frac", tag:"mfrac", output:"/", tex:null, ttype:BINARY},
+ AMdiv = {input:"/", tag:"mfrac", output:"/", tex:null, ttype:INFIX},
+ AMover = {input:"stackrel", tag:"mover", output:"stackrel", tex:null, ttype:BINARY},
+ AMsub = {input:"_", tag:"msub", output:"_", tex:null, ttype:INFIX},
+ AMsup = {input:"^", tag:"msup", output:"^", tex:null, ttype:INFIX},
+ AMtext = {input:"text", tag:"mtext", output:"text", tex:null, ttype:TEXT},
+ AMmbox = {input:"mbox", tag:"mtext", output:"mbox", tex:null, ttype:TEXT},
+ AMquote = {input:"\"", tag:"mtext", output:"mbox", tex:null, ttype:TEXT};
+
+var AMsymbols = [
+//some greek symbols
+{input:"alpha", tag:"mi", output:"\u03B1", tex:null, ttype:CONST},
+{input:"beta", tag:"mi", output:"\u03B2", tex:null, ttype:CONST},
+{input:"chi", tag:"mi", output:"\u03C7", tex:null, ttype:CONST},
+{input:"delta", tag:"mi", output:"\u03B4", tex:null, ttype:CONST},
+{input:"Delta", tag:"mo", output:"\u0394", tex:null, ttype:CONST},
+{input:"epsi", tag:"mi", output:"\u03B5", tex:"epsilon", ttype:CONST},
+{input:"varepsilon", tag:"mi", output:"\u025B", tex:null, ttype:CONST},
+{input:"eta", tag:"mi", output:"\u03B7", tex:null, ttype:CONST},
+{input:"gamma", tag:"mi", output:"\u03B3", tex:null, ttype:CONST},
+{input:"Gamma", tag:"mo", output:"\u0393", tex:null, ttype:CONST},
+{input:"iota", tag:"mi", output:"\u03B9", tex:null, ttype:CONST},
+{input:"kappa", tag:"mi", output:"\u03BA", tex:null, ttype:CONST},
+{input:"lambda", tag:"mi", output:"\u03BB", tex:null, ttype:CONST},
+{input:"Lambda", tag:"mo", output:"\u039B", tex:null, ttype:CONST},
+{input:"mu", tag:"mi", output:"\u03BC", tex:null, ttype:CONST},
+{input:"nu", tag:"mi", output:"\u03BD", tex:null, ttype:CONST},
+{input:"omega", tag:"mi", output:"\u03C9", tex:null, ttype:CONST},
+{input:"Omega", tag:"mo", output:"\u03A9", tex:null, ttype:CONST},
+{input:"phi", tag:"mi", output:"\u03C6", tex:null, ttype:CONST},
+{input:"varphi", tag:"mi", output:"\u03D5", tex:null, ttype:CONST},
+{input:"Phi", tag:"mo", output:"\u03A6", tex:null, ttype:CONST},
+{input:"pi", tag:"mi", output:"\u03C0", tex:null, ttype:CONST},
+{input:"Pi", tag:"mo", output:"\u03A0", tex:null, ttype:CONST},
+{input:"psi", tag:"mi", output:"\u03C8", tex:null, ttype:CONST},
+{input:"Psi", tag:"mi", output:"\u03A8", tex:null, ttype:CONST},
+{input:"rho", tag:"mi", output:"\u03C1", tex:null, ttype:CONST},
+{input:"sigma", tag:"mi", output:"\u03C3", tex:null, ttype:CONST},
+{input:"Sigma", tag:"mo", output:"\u03A3", tex:null, ttype:CONST},
+{input:"tau", tag:"mi", output:"\u03C4", tex:null, ttype:CONST},
+{input:"theta", tag:"mi", output:"\u03B8", tex:null, ttype:CONST},
+{input:"vartheta", tag:"mi", output:"\u03D1", tex:null, ttype:CONST},
+{input:"Theta", tag:"mo", output:"\u0398", tex:null, ttype:CONST},
+{input:"upsilon", tag:"mi", output:"\u03C5", tex:null, ttype:CONST},
+{input:"xi", tag:"mi", output:"\u03BE", tex:null, ttype:CONST},
+{input:"Xi", tag:"mo", output:"\u039E", tex:null, ttype:CONST},
+{input:"zeta", tag:"mi", output:"\u03B6", tex:null, ttype:CONST},
+
+//binary operation symbols
+{input:"*", tag:"mo", output:"\u22C5", tex:"cdot", ttype:CONST},
+{input:"**", tag:"mo", output:"\u22C6", tex:"star", ttype:CONST},
+{input:"//", tag:"mo", output:"/", tex:null, ttype:CONST},
+{input:"\\\\", tag:"mo", output:"\\", tex:"backslash", ttype:CONST},
+{input:"setminus", tag:"mo", output:"\\", tex:null, ttype:CONST},
+{input:"xx", tag:"mo", output:"\u00D7", tex:"times", ttype:CONST},
+{input:"-:", tag:"mo", output:"\u00F7", tex:"divide", ttype:CONST},
+{input:"@", tag:"mo", output:"\u2218", tex:"circ", ttype:CONST},
+{input:"o+", tag:"mo", output:"\u2295", tex:"oplus", ttype:CONST},
+{input:"ox", tag:"mo", output:"\u2297", tex:"otimes", ttype:CONST},
+{input:"o.", tag:"mo", output:"\u2299", tex:"odot", ttype:CONST},
+{input:"sum", tag:"mo", output:"\u2211", tex:null, ttype:UNDEROVER},
+{input:"prod", tag:"mo", output:"\u220F", tex:null, ttype:UNDEROVER},
+{input:"^^", tag:"mo", output:"\u2227", tex:"wedge", ttype:CONST},
+{input:"^^^", tag:"mo", output:"\u22C0", tex:"bigwedge", ttype:UNDEROVER},
+{input:"vv", tag:"mo", output:"\u2228", tex:"vee", ttype:CONST},
+{input:"vvv", tag:"mo", output:"\u22C1", tex:"bigvee", ttype:UNDEROVER},
+{input:"nn", tag:"mo", output:"\u2229", tex:"cap", ttype:CONST},
+{input:"nnn", tag:"mo", output:"\u22C2", tex:"bigcap", ttype:UNDEROVER},
+{input:"uu", tag:"mo", output:"\u222A", tex:"cup", ttype:CONST},
+{input:"uuu", tag:"mo", output:"\u22C3", tex:"bigcup", ttype:UNDEROVER},
+
+//binary relation symbols
+{input:"!=", tag:"mo", output:"\u2260", tex:"ne", ttype:CONST},
+{input:":=", tag:"mo", output:":=", tex:null, ttype:CONST},
+{input:"lt", tag:"mo", output:"<", tex:null, ttype:CONST},
+{input:"<=", tag:"mo", output:"\u2264", tex:"le", ttype:CONST},
+{input:"lt=", tag:"mo", output:"\u2264", tex:"leq", ttype:CONST},
+{input:">=", tag:"mo", output:"\u2265", tex:"ge", ttype:CONST},
+{input:"geq", tag:"mo", output:"\u2265", tex:null, ttype:CONST},
+{input:"-<", tag:"mo", output:"\u227A", tex:"prec", ttype:CONST},
+{input:"-lt", tag:"mo", output:"\u227A", tex:null, ttype:CONST},
+{input:">-", tag:"mo", output:"\u227B", tex:"succ", ttype:CONST},
+{input:"-<=", tag:"mo", output:"\u2AAF", tex:"preceq", ttype:CONST},
+{input:">-=", tag:"mo", output:"\u2AB0", tex:"succeq", ttype:CONST},
+{input:"in", tag:"mo", output:"\u2208", tex:null, ttype:CONST},
+{input:"!in", tag:"mo", output:"\u2209", tex:"notin", ttype:CONST},
+{input:"sub", tag:"mo", output:"\u2282", tex:"subset", ttype:CONST},
+{input:"sup", tag:"mo", output:"\u2283", tex:"supset", ttype:CONST},
+{input:"sube", tag:"mo", output:"\u2286", tex:"subseteq", ttype:CONST},
+{input:"supe", tag:"mo", output:"\u2287", tex:"supseteq", ttype:CONST},
+{input:"-=", tag:"mo", output:"\u2261", tex:"equiv", ttype:CONST},
+{input:"~=", tag:"mo", output:"\u2245", tex:"cong", ttype:CONST},
+{input:"~~", tag:"mo", output:"\u2248", tex:"approx", ttype:CONST},
+{input:"prop", tag:"mo", output:"\u221D", tex:"propto", ttype:CONST},
+
+//logical symbols
+{input:"and", tag:"mtext", output:"and", tex:null, ttype:SPACE},
+{input:"or", tag:"mtext", output:"or", tex:null, ttype:SPACE},
+{input:"not", tag:"mo", output:"\u00AC", tex:"neg", ttype:CONST},
+{input:"=>", tag:"mo", output:"\u21D2", tex:"implies", ttype:CONST},
+{input:"if", tag:"mo", output:"if", tex:null, ttype:SPACE},
+{input:"<=>", tag:"mo", output:"\u21D4", tex:"iff", ttype:CONST},
+{input:"AA", tag:"mo", output:"\u2200", tex:"forall", ttype:CONST},
+{input:"EE", tag:"mo", output:"\u2203", tex:"exists", ttype:CONST},
+{input:"_|_", tag:"mo", output:"\u22A5", tex:"bot", ttype:CONST},
+{input:"TT", tag:"mo", output:"\u22A4", tex:"top", ttype:CONST},
+{input:"|--", tag:"mo", output:"\u22A2", tex:"vdash", ttype:CONST},
+{input:"|==", tag:"mo", output:"\u22A8", tex:"models", ttype:CONST},
+
+//grouping brackets
+{input:"(", tag:"mo", output:"(", tex:null, ttype:LEFTBRACKET},
+{input:")", tag:"mo", output:")", tex:null, ttype:RIGHTBRACKET},
+{input:"[", tag:"mo", output:"[", tex:null, ttype:LEFTBRACKET},
+{input:"]", tag:"mo", output:"]", tex:null, ttype:RIGHTBRACKET},
+{input:"{", tag:"mo", output:"{", tex:null, ttype:LEFTBRACKET},
+{input:"}", tag:"mo", output:"}", tex:null, ttype:RIGHTBRACKET},
+{input:"|", tag:"mo", output:"|", tex:null, ttype:LEFTRIGHT},
+//{input:"||", tag:"mo", output:"||", tex:null, ttype:LEFTRIGHT},
+{input:"(:", tag:"mo", output:"\u2329", tex:"langle", ttype:LEFTBRACKET},
+{input:":)", tag:"mo", output:"\u232A", tex:"rangle", ttype:RIGHTBRACKET},
+{input:"<<", tag:"mo", output:"\u2329", tex:null, ttype:LEFTBRACKET},
+{input:">>", tag:"mo", output:"\u232A", tex:null, ttype:RIGHTBRACKET},
+{input:"{:", tag:"mo", output:"{:", tex:null, ttype:LEFTBRACKET, invisible:true},
+{input:":}", tag:"mo", output:":}", tex:null, ttype:RIGHTBRACKET, invisible:true},
+
+//miscellaneous symbols
+{input:"int", tag:"mo", output:"\u222B", tex:null, ttype:CONST},
+{input:"dx", tag:"mi", output:"{:d x:}", tex:null, ttype:DEFINITION},
+{input:"dy", tag:"mi", output:"{:d y:}", tex:null, ttype:DEFINITION},
+{input:"dz", tag:"mi", output:"{:d z:}", tex:null, ttype:DEFINITION},
+{input:"dt", tag:"mi", output:"{:d t:}", tex:null, ttype:DEFINITION},
+{input:"oint", tag:"mo", output:"\u222E", tex:null, ttype:CONST},
+{input:"del", tag:"mo", output:"\u2202", tex:"partial", ttype:CONST},
+{input:"grad", tag:"mo", output:"\u2207", tex:"nabla", ttype:CONST},
+{input:"+-", tag:"mo", output:"\u00B1", tex:"pm", ttype:CONST},
+{input:"O/", tag:"mo", output:"\u2205", tex:"emptyset", ttype:CONST},
+{input:"oo", tag:"mo", output:"\u221E", tex:"infty", ttype:CONST},
+{input:"aleph", tag:"mo", output:"\u2135", tex:null, ttype:CONST},
+{input:"...", tag:"mo", output:"...", tex:"ldots", ttype:CONST},
+{input:":.", tag:"mo", output:"\u2234", tex:"therefore", ttype:CONST},
+{input:"/_", tag:"mo", output:"\u2220", tex:"angle", ttype:CONST},
+{input:"\\ ", tag:"mo", output:"\u00A0", tex:null, ttype:CONST},
+{input:"quad", tag:"mo", output:"\u00A0\u00A0", tex:null, ttype:CONST},
+{input:"qquad", tag:"mo", output:"\u00A0\u00A0\u00A0\u00A0", tex:null, ttype:CONST},
+{input:"cdots", tag:"mo", output:"\u22EF", tex:null, ttype:CONST},
+{input:"vdots", tag:"mo", output:"\u22EE", tex:null, ttype:CONST},
+{input:"ddots", tag:"mo", output:"\u22F1", tex:null, ttype:CONST},
+{input:"diamond", tag:"mo", output:"\u22C4", tex:null, ttype:CONST},
+{input:"square", tag:"mo", output:"\u25A1", tex:null, ttype:CONST},
+{input:"|__", tag:"mo", output:"\u230A", tex:"lfloor", ttype:CONST},
+{input:"__|", tag:"mo", output:"\u230B", tex:"rfloor", ttype:CONST},
+{input:"|~", tag:"mo", output:"\u2308", tex:"lceiling", ttype:CONST},
+{input:"~|", tag:"mo", output:"\u2309", tex:"rceiling", ttype:CONST},
+{input:"CC", tag:"mo", output:"\u2102", tex:null, ttype:CONST},
+{input:"NN", tag:"mo", output:"\u2115", tex:null, ttype:CONST},
+{input:"QQ", tag:"mo", output:"\u211A", tex:null, ttype:CONST},
+{input:"RR", tag:"mo", output:"\u211D", tex:null, ttype:CONST},
+{input:"ZZ", tag:"mo", output:"\u2124", tex:null, ttype:CONST},
+{input:"f", tag:"mi", output:"f", tex:null, ttype:UNARY, func:true},
+{input:"g", tag:"mi", output:"g", tex:null, ttype:UNARY, func:true},
+
+//standard functions
+{input:"lim", tag:"mo", output:"lim", tex:null, ttype:UNDEROVER},
+{input:"Lim", tag:"mo", output:"Lim", tex:null, ttype:UNDEROVER},
+{input:"sin", tag:"mo", output:"sin", tex:null, ttype:UNARY, func:true},
+{input:"cos", tag:"mo", output:"cos", tex:null, ttype:UNARY, func:true},
+{input:"tan", tag:"mo", output:"tan", tex:null, ttype:UNARY, func:true},
+{input:"sinh", tag:"mo", output:"sinh", tex:null, ttype:UNARY, func:true},
+{input:"cosh", tag:"mo", output:"cosh", tex:null, ttype:UNARY, func:true},
+{input:"tanh", tag:"mo", output:"tanh", tex:null, ttype:UNARY, func:true},
+{input:"cot", tag:"mo", output:"cot", tex:null, ttype:UNARY, func:true},
+{input:"sec", tag:"mo", output:"sec", tex:null, ttype:UNARY, func:true},
+{input:"csc", tag:"mo", output:"csc", tex:null, ttype:UNARY, func:true},
+{input:"log", tag:"mo", output:"log", tex:null, ttype:UNARY, func:true},
+{input:"ln", tag:"mo", output:"ln", tex:null, ttype:UNARY, func:true},
+{input:"det", tag:"mo", output:"det", tex:null, ttype:UNARY, func:true},
+{input:"dim", tag:"mo", output:"dim", tex:null, ttype:CONST},
+{input:"mod", tag:"mo", output:"mod", tex:null, ttype:CONST},
+{input:"gcd", tag:"mo", output:"gcd", tex:null, ttype:UNARY, func:true},
+{input:"lcm", tag:"mo", output:"lcm", tex:null, ttype:UNARY, func:true},
+{input:"lub", tag:"mo", output:"lub", tex:null, ttype:CONST},
+{input:"glb", tag:"mo", output:"glb", tex:null, ttype:CONST},
+{input:"min", tag:"mo", output:"min", tex:null, ttype:UNDEROVER},
+{input:"max", tag:"mo", output:"max", tex:null, ttype:UNDEROVER},
+
+//arrows
+{input:"uarr", tag:"mo", output:"\u2191", tex:"uparrow", ttype:CONST},
+{input:"darr", tag:"mo", output:"\u2193", tex:"downarrow", ttype:CONST},
+{input:"rarr", tag:"mo", output:"\u2192", tex:"rightarrow", ttype:CONST},
+{input:"->", tag:"mo", output:"\u2192", tex:"to", ttype:CONST},
+{input:"|->", tag:"mo", output:"\u21A6", tex:"mapsto", ttype:CONST},
+{input:"larr", tag:"mo", output:"\u2190", tex:"leftarrow", ttype:CONST},
+{input:"harr", tag:"mo", output:"\u2194", tex:"leftrightarrow", ttype:CONST},
+{input:"rArr", tag:"mo", output:"\u21D2", tex:"Rightarrow", ttype:CONST},
+{input:"lArr", tag:"mo", output:"\u21D0", tex:"Leftarrow", ttype:CONST},
+{input:"hArr", tag:"mo", output:"\u21D4", tex:"Leftrightarrow", ttype:CONST},
+
+//commands with argument
+AMsqrt, AMroot, AMfrac, AMdiv, AMover, AMsub, AMsup,
+{input:"hat", tag:"mover", output:"\u005E", tex:null, ttype:UNARY, acc:true},
+{input:"bar", tag:"mover", output:"\u00AF", tex:"overline", ttype:UNARY, acc:true},
+{input:"vec", tag:"mover", output:"\u2192", tex:null, ttype:UNARY, acc:true},
+{input:"dot", tag:"mover", output:".", tex:null, ttype:UNARY, acc:true},
+{input:"ddot", tag:"mover", output:"..", tex:null, ttype:UNARY, acc:true},
+{input:"ul", tag:"munder", output:"\u0332", tex:"underline", ttype:UNARY, acc:true},
+AMtext, AMmbox, AMquote,
+{input:"bb", tag:"mstyle", atname:"fontweight", atval:"bold", output:"bb", tex:null, ttype:UNARY},
+{input:"mathbf", tag:"mstyle", atname:"fontweight", atval:"bold", output:"mathbf", tex:null, ttype:UNARY},
+{input:"sf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"sf", tex:null, ttype:UNARY},
+{input:"mathsf", tag:"mstyle", atname:"fontfamily", atval:"sans-serif", output:"mathsf", tex:null, ttype:UNARY},
+{input:"bbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"bbb", tex:null, ttype:UNARY, codes:AMbbb},
+{input:"mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", output:"mathbb", tex:null, ttype:UNARY, codes:AMbbb},
+{input:"cc", tag:"mstyle", atname:"mathvariant", atval:"script", output:"cc", tex:null, ttype:UNARY, codes:AMcal},
+{input:"mathcal", tag:"mstyle", atname:"mathvariant", atval:"script", output:"mathcal", tex:null, ttype:UNARY, codes:AMcal},
+{input:"tt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"tt", tex:null, ttype:UNARY},
+{input:"mathtt", tag:"mstyle", atname:"fontfamily", atval:"monospace", output:"mathtt", tex:null, ttype:UNARY},
+{input:"fr", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"fr", tex:null, ttype:UNARY, codes:AMfrk},
+{input:"mathfrak", tag:"mstyle", atname:"mathvariant", atval:"fraktur", output:"mathfrak", tex:null, ttype:UNARY, codes:AMfrk}
+];
+
+function compareNames(s1,s2) {
+ if (s1.input > s2.input) return 1
+ else return -1;
+}
+
+var AMnames = []; //list of input symbols
+
+function AMinitSymbols() {
+ var texsymbols = [], i;
+ for (i=0; i<AMsymbols.length; i++)
+ if (AMsymbols[i].tex)
+ texsymbols[texsymbols.length] = {input:AMsymbols[i].tex,
+ tag:AMsymbols[i].tag, output:AMsymbols[i].output, ttype:AMsymbols[i].ttype};
+ AMsymbols = AMsymbols.concat(texsymbols);
+ AMsymbols.sort(compareNames);
+ for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
+}
+
+var AMmathml = "http://www.w3.org/1998/Math/MathML";
+
+function AMcreateElementMathML(t) {
+ if (isIE) return document.createElement("m:"+t);
+ else return document.createElementNS(AMmathml,t);
+}
+
+function AMcreateMmlNode(t,frag) {
+// var node = AMcreateElementMathML(name);
+ if (isIE) var node = document.createElement("m:"+t);
+ else var node = document.createElementNS(AMmathml,t);
+ node.appendChild(frag);
+ return node;
+}
+
+function newcommand(oldstr,newstr) {
+ AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
+ tex:null, ttype:DEFINITION}]);
+}
+
+function AMremoveCharsAndBlanks(str,n) {
+//remove n characters and any following blanks
+ var st;
+ if (str.charAt(n)=="\\" && str.charAt(n+1)!="\\" && str.charAt(n+1)!=" ")
+ st = str.slice(n+1);
+ else st = str.slice(n);
+ for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
+ return st.slice(i);
+}
+
+function AMposition(arr, str, n) {
+// return position >=n where str appears or would be inserted
+// assumes arr is sorted
+ if (n==0) {
+ var h,m;
+ n = -1;
+ h = arr.length;
+ while (n+1<h) {
+ m = (n+h) >> 1;
+ if (arr[m]<str) n = m; else h = m;
+ }
+ return h;
+ } else
+ for (var i=n; i<arr.length && arr[i]<str; i++);
+ return i; // i=arr.length || arr[i]>=str
+}
+
+function AMgetSymbol(str) {
+//return maximal initial substring of str that appears in names
+//return null if there is none
+ var k = 0; //new pos
+ var j = 0; //old pos
+ var mk; //match pos
+ var st;
+ var tagst;
+ var match = "";
+ var more = true;
+ for (var i=1; i<=str.length && more; i++) {
+ st = str.slice(0,i); //initial substring of length i
+ j = k;
+ k = AMposition(AMnames, st, j);
+ if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
+ match = AMnames[k];
+ mk = k;
+ i = match.length;
+ }
+ more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
+ }
+ AMpreviousSymbol=AMcurrentSymbol;
+ if (match!=""){
+ AMcurrentSymbol=AMsymbols[mk].ttype;
+ return AMsymbols[mk];
+ }
+// if str[0] is a digit or - return maxsubstring of digits.digits
+ AMcurrentSymbol=CONST;
+ k = 1;
+ st = str.slice(0,1);
+ var integ = true;
+ while ("0"<=st && st<="9" && k<=str.length) {
+ st = str.slice(k,k+1);
+ k++;
+ }
+ if (st == decimalsign) {
+ st = str.slice(k,k+1);
+ if ("0"<=st && st<="9") {
+ integ = false;
+ k++;
+ while ("0"<=st && st<="9" && k<=str.length) {
+ st = str.slice(k,k+1);
+ k++;
+ }
+ }
+ }
+ if ((integ && k>1) || k>2) {
+ st = str.slice(0,k-1);
+ tagst = "mn";
+ } else {
+ k = 2;
+ st = str.slice(0,1); //take 1 character
+ tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
+ }
+ if (st=="-" && AMpreviousSymbol==INFIX) {
+ AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
+ return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
+ }
+ return {input:st, tag:tagst, output:st, ttype:CONST};
+}
+
+function AMremoveBrackets(node) {
+ var st;
+ if (node.nodeName=="mrow") {
+ st = node.firstChild.firstChild.nodeValue;
+ if (st=="(" || st=="[" || st=="{") node.removeChild(node.firstChild);
+ }
+ if (node.nodeName=="mrow") {
+ st = node.lastChild.firstChild.nodeValue;
+ if (st==")" || st=="]" || st=="}") node.removeChild(node.lastChild);
+ }
+}
+
+/*Parsing ASCII math expressions with the following grammar
+v ::= [A-Za-z] | greek letters | numbers | other constant symbols
+u ::= sqrt | text | bb | other unary symbols for font commands
+b ::= frac | root | stackrel binary symbols
+l ::= ( | [ | { | (: | {: left brackets
+r ::= ) | ] | } | :) | :} right brackets
+S ::= v | lEr | uS | bSS Simple expression
+I ::= S_S | S^S | S_S^S | S Intermediate expression
+E ::= IE | I/I Expression
+Each terminal symbol is translated into a corresponding mathml node.*/
+
+var AMnestingDepth,AMpreviousSymbol,AMcurrentSymbol;
+
+function AMparseSexpr(str) { //parses str and returns [node,tailstr]
+ var symbol, node, result, i, st,// rightvert = false,
+ newFrag = document.createDocumentFragment();
+ str = AMremoveCharsAndBlanks(str,0);
+ symbol = AMgetSymbol(str); //either a token or a bracket or empty
+ if (symbol == null || symbol.ttype == RIGHTBRACKET && AMnestingDepth > 0) {
+ return [null,str];
+ }
+ if (symbol.ttype == DEFINITION) {
+ str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
+ symbol = AMgetSymbol(str);
+ }
+ switch (symbol.ttype) {
+ case UNDEROVER:
+ case CONST:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode(symbol.tag, //its a constant
+ document.createTextNode(symbol.output)),str];
+ case LEFTBRACKET: //read (expr+)
+ AMnestingDepth++;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseExpr(str,true);
+ AMnestingDepth--;
+ if (typeof symbol.invisible == "boolean" && symbol.invisible)
+ node = AMcreateMmlNode("mrow",result[0]);
+ else {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(result[0]);
+ }
+ return [node,result[1]];
+ case TEXT:
+ if (symbol!=AMquote) str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (str.charAt(0)=="{") i=str.indexOf("}");
+ else if (str.charAt(0)=="(") i=str.indexOf(")");
+ else if (str.charAt(0)=="[") i=str.indexOf("]");
+ else if (symbol==AMquote) i=str.slice(1).indexOf("\"")+1;
+ else i = 0;
+ if (i==-1) i = str.length;
+ st = str.slice(1,i);
+ if (st.charAt(0) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ }
+ newFrag.appendChild(
+ AMcreateMmlNode(symbol.tag,document.createTextNode(st)));
+ if (st.charAt(st.length-1) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ }
+ str = AMremoveCharsAndBlanks(str,i+1);
+ return [AMcreateMmlNode("mrow",newFrag),str];
+ case UNARY:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str];
+ if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
+ st = str.charAt(0);
+ if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
+ return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str];
+ } else {
+ node = AMcreateMmlNode("mrow",
+ AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
+ node.appendChild(result[0]);
+ return [node,result[1]];
+ }
+ }
+ AMremoveBrackets(result[0]);
+ if (symbol.input == "sqrt") { // sqrt
+ return [AMcreateMmlNode(symbol.tag,result[0]),result[1]];
+ } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ node.appendChild(AMcreateMmlNode("mo",document.createTextNode(symbol.output)));
+ return [node,result[1]];
+ } else { // font change command
+ if (!isIE && typeof symbol.codes != "undefined") {
+ for (i=0; i<result[0].childNodes.length; i++)
+ if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
+ st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
+ result[0].childNodes[i].firstChild.nodeValue);
+ var newst = [];
+ for (var j=0; j<st.length; j++)
+ if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
+ String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
+ else newst = newst + st.charAt(j);
+ if (result[0].nodeName=="mi")
+ result[0]=AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst));
+ else result[0].replaceChild(AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
+ }
+ }
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ node.setAttribute(symbol.atname,symbol.atval);
+ return [node,result[1]];
+ }
+ case BINARY:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str];
+ AMremoveBrackets(result[0]);
+ var result2 = AMparseSexpr(result[1]);
+ if (result2[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str];
+ AMremoveBrackets(result2[0]);
+ if (symbol.input=="root" || symbol.input=="stackrel")
+ newFrag.appendChild(result2[0]);
+ newFrag.appendChild(result[0]);
+ if (symbol.input=="frac") newFrag.appendChild(result2[0]);
+ return [AMcreateMmlNode(symbol.tag,newFrag),result2[1]];
+ case INFIX:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),str];
+ case SPACE:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ newFrag.appendChild(
+ AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","1ex");
+ newFrag.appendChild(node);
+ return [AMcreateMmlNode("mrow",newFrag),str];
+ case LEFTRIGHT:
+// if (rightvert) return [null,str]; else rightvert = true;
+ AMnestingDepth++;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseExpr(str,false);
+ AMnestingDepth--;
+ var st = "";
+ if (result[0].lastChild!=null)
+ st = result[0].lastChild.firstChild.nodeValue;
+ if (st == "|") { // its an absolute value subterm
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(result[0]);
+ return [node,result[1]];
+ } else { // the "|" is a \mid
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ return [node,str];
+ }
+ default:
+//alert("default");
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode(symbol.tag, //its a constant
+ document.createTextNode(symbol.output)),str];
+ }
+}
+
+function AMparseIexpr(str) {
+ var symbol, sym1, sym2, node, result, underover;
+ str = AMremoveCharsAndBlanks(str,0);
+ sym1 = AMgetSymbol(str);
+ result = AMparseSexpr(str);
+ node = result[0];
+ str = result[1];
+ symbol = AMgetSymbol(str);
+ if (symbol.ttype == INFIX && symbol.input != "/") {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+// if (symbol.input == "/") result = AMparseIexpr(str); else ...
+ result = AMparseSexpr(str);
+ if (result[0] == null) // show box in place of missing argument
+ result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
+ else AMremoveBrackets(result[0]);
+ str = result[1];
+// if (symbol.input == "/") AMremoveBrackets(node);
+ if (symbol.input == "_") {
+ sym2 = AMgetSymbol(str);
+ underover = (sym1.ttype == UNDEROVER);
+ if (sym2.input == "^") {
+ str = AMremoveCharsAndBlanks(str,sym2.input.length);
+ var res2 = AMparseSexpr(str);
+ AMremoveBrackets(res2[0]);
+ str = res2[1];
+ node = AMcreateMmlNode((underover?"munderover":"msubsup"),node);
+ node.appendChild(result[0]);
+ node.appendChild(res2[0]);
+ node = AMcreateMmlNode("mrow",node); // so sum does not stretch
+ } else {
+ node = AMcreateMmlNode((underover?"munder":"msub"),node);
+ node.appendChild(result[0]);
+ }
+ } else {
+ node = AMcreateMmlNode(symbol.tag,node);
+ node.appendChild(result[0]);
+ }
+ }
+ return [node,str];
+}
+
+function AMparseExpr(str,rightbracket) {
+ var symbol, node, result, i, nodeList = [],
+ newFrag = document.createDocumentFragment();
+ do {
+ str = AMremoveCharsAndBlanks(str,0);
+ result = AMparseIexpr(str);
+ node = result[0];
+ str = result[1];
+ symbol = AMgetSymbol(str);
+ if (symbol.ttype == INFIX && symbol.input == "/") {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseIexpr(str);
+ if (result[0] == null) // show box in place of missing argument
+ result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
+ else AMremoveBrackets(result[0]);
+ str = result[1];
+ AMremoveBrackets(node);
+ node = AMcreateMmlNode(symbol.tag,node);
+ node.appendChild(result[0]);
+ newFrag.appendChild(node);
+ symbol = AMgetSymbol(str);
+ }
+ else if (node!=undefined) newFrag.appendChild(node);
+ } while ((symbol.ttype != RIGHTBRACKET &&
+ (symbol.ttype != LEFTRIGHT || rightbracket)
+ || AMnestingDepth == 0) && symbol!=null && symbol.output!="");
+ if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {
+// if (AMnestingDepth > 0) AMnestingDepth--;
+ var len = newFrag.childNodes.length;
+ if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
+ newFrag.childNodes[len-2].nodeName == "mo" &&
+ newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix
+ var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;
+ if (right==")" || right=="]") {
+ var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;
+ if (left=="(" && right==")" && symbol.output != "}" ||
+ left=="[" && right=="]") {
+ var pos = []; // positions of commas
+ var matrix = true;
+ var m = newFrag.childNodes.length;
+ for (i=0; matrix && i<m; i=i+2) {
+ pos[i] = [];
+ node = newFrag.childNodes[i];
+ if (matrix) matrix = node.nodeName=="mrow" &&
+ (i==m-1 || node.nextSibling.nodeName=="mo" &&
+ node.nextSibling.firstChild.nodeValue==",")&&
+ node.firstChild.firstChild.nodeValue==left &&
+ node.lastChild.firstChild.nodeValue==right;
+ if (matrix)
+ for (var j=0; j<node.childNodes.length; j++)
+ if (node.childNodes[j].firstChild.nodeValue==",")
+ pos[i][pos[i].length]=j;
+ if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;
+ }
+ if (matrix) {
+ var row, frag, n, k, table = document.createDocumentFragment();
+ for (i=0; i<m; i=i+2) {
+ row = document.createDocumentFragment();
+ frag = document.createDocumentFragment();
+ node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>
+ n = node.childNodes.length;
+ k = 0;
+ node.removeChild(node.firstChild); //remove (
+ for (j=1; j<n-1; j++) {
+ if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
+ node.removeChild(node.firstChild); //remove ,
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ k++;
+ } else frag.appendChild(node.firstChild);
+ }
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ if (newFrag.childNodes.length>2) {
+ newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>
+ newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>
+ }
+ table.appendChild(AMcreateMmlNode("mtr",row));
+ }
+ node = AMcreateMmlNode("mtable",table);
+ if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");
+ newFrag.replaceChild(node,newFrag.firstChild);
+ }
+ }
+ }
+ }
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ newFrag.appendChild(node);
+ }
+ }
+ return [newFrag,str];
+}
+
+function AMparseMath(str) {
+ var result, node = AMcreateElementMathML("mstyle");
+ if (mathcolor != "") node.setAttribute("mathcolor",mathcolor);
+ if (displaystyle) node.setAttribute("displaystyle","true");
+ if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily);
+ AMnestingDepth = 0;
+ node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false)[0]);
+ node = AMcreateMmlNode("math",node);
+ if (showasciiformulaonhover) //fixed by djhsu so newline
+ node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
+ if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) {
+ var fnode = AMcreateElementXHTML("font");
+ fnode.setAttribute("face",mathfontfamily);
+ fnode.appendChild(node);
+ return fnode;
+ }
+ return node;
+}
+
+function AMstrarr2docFrag(arr, linebreaks) {
+ var newFrag=document.createDocumentFragment();
+ var expr = false;
+ for (var i=0; i<arr.length; i++) {
+ if (expr) newFrag.appendChild(AMparseMath(arr[i]));
+ else {
+ var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[0])));
+ for (var j=1; j<arri.length; j++) {
+ newFrag.appendChild(AMcreateElementXHTML("p"));
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[j])));
+ }
+ }
+ expr = !expr;
+ }
+ return newFrag;
+}
+
+function AMprocessNodeR(n, linebreaks) {
+ var mtch, str, arr, frg, i;
+ if (n.childNodes.length == 0) {
+ if ((n.nodeType!=8 || linebreaks) &&
+ n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
+ n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
+ n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
+ str = n.nodeValue;
+ if (!(str == null)) {
+ str = str.replace(/\r\n\r\n/g,"\n\n");
+ if (doubleblankmathdelimiter) {
+ str = str.replace(/\x20\x20\./g," "+AMdelimiter1+".");
+ str = str.replace(/\x20\x20,/g," "+AMdelimiter1+",");
+ str = str.replace(/\x20\x20/g," "+AMdelimiter1+" ");
+ }
+ str = str.replace(/\x20+/g," ");
+ str = str.replace(/\s*\r\n/g," ");
+ mtch = false;
+ str = str.replace(new RegExp(AMescape2, "g"),
+ function(st){mtch=true;return "AMescape2"});
+ str = str.replace(new RegExp(AMescape1, "g"),
+ function(st){mtch=true;return "AMescape1"});
+ str = str.replace(new RegExp(AMdelimiter2regexp, "g"),AMdelimiter1);
+ arr = str.split(AMdelimiter1);
+ for (i=0; i<arr.length; i++)
+ arr[i]=arr[i].replace(/AMescape2/g,AMdelimiter2).
+ replace(/AMescape1/g,AMdelimiter1);
+ if (arr.length>1 || mtch) {
+ if (checkForMathML) {
+ checkForMathML = false;
+ var nd = AMisMathMLavailable();
+ AMnoMathML = nd != null;
+ if (AMnoMathML && notifyIfNoMathML)
+ if (alertIfNoMathML)
+ alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
+ or Firefox/Mozilla/Netscape");
+ else AMbody.insertBefore(nd,AMbody.childNodes[0]);
+ }
+ if (!AMnoMathML) {
+ frg = AMstrarr2docFrag(arr,n.nodeType==8);
+ var len = frg.childNodes.length;
+ n.parentNode.replaceChild(frg,n);
+ return len-1;
+ } else return 0;
+ }
+ }
+ } else return 0;
+ } else if (n.nodeName!="math") {
+ for (i=0; i<n.childNodes.length; i++)
+ i += AMprocessNodeR(n.childNodes[i], linebreaks);
+ }
+ return 0;
+}
+
+function AMprocessNode(n, linebreaks, spanclassAM) {
+ var frag,st;
+ if (spanclassAM!=null) {
+ frag = document.getElementsByTagName("span")
+ for (var i=0;i<frag.length;i++)
+ if (frag[i].className == "AM")
+ AMprocessNodeR(frag[i],linebreaks);
+ } else {
+ try {
+ st = n.innerHTML;
+ } catch(err) {}
+ if (st==null ||
+ st.indexOf(AMdelimiter1)!=-1 || st.indexOf(AMdelimiter2)!=-1)
+ AMprocessNodeR(n,linebreaks);
+ }
+ if (isIE) { //needed to match size and font of formula to surrounding text
+ frag = document.getElementsByTagName('math');
+ for (var i=0;i<frag.length;i++) frag[i].update()
+ }
+}
+
+var AMbody;
+var AMnoMathML = false, AMtranslated = false;
+
+function translate(spanclassAM) {
+ if (!AMtranslated) { // run this only once
+ AMtranslated = true;
+ AMinitSymbols();
+ AMbody = document.getElementsByTagName("body")[0];
+ AMprocessNode(AMbody, false, spanclassAM);
+ }
+}
+
+if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
+ document.write("<object id=\"mathplayer\"\
+ classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
+ document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
+}
+
+// GO1.1 Generic onload by Brothercake
+// http://www.brothercake.com/
+//onload function (replaces the onload="translate()" in the <body> tag)
+function generic()
+{
+ translate();
+};
+//setup onload function
+if(typeof window.addEventListener != 'undefined')
+{
+ //.. gecko, safari, konqueror and standard
+ window.addEventListener('load', generic, false);
+}
+else if(typeof document.addEventListener != 'undefined')
+{
+ //.. opera 7
+ document.addEventListener('load', generic, false);
+}
+else if(typeof window.attachEvent != 'undefined')
+{
+ //.. win/ie
+ window.attachEvent('onload', generic);
+}
+//** remove this condition to degrade older browsers
+else
+{
+ //.. mac/ie5 and anything else that gets this far
+ //if there's an existing onload function
+ if(typeof window.onload == 'function')
+ {
+ //store it
+ var existing = onload;
+ //add new onload handler
+ window.onload = function()
+ {
+ //call existing onload function
+ existing();
+ //call generic onload function
+ generic();
+ };
+ }
+ else
+ {
+ //setup onload function
+ window.onload = generic;
+ }
+}
diff --git a/javascripts/LaTeXMathML.js b/javascripts/LaTeXMathML.js
new file mode 100644
index 0000000..51dba70
--- /dev/null
+++ b/javascripts/LaTeXMathML.js
@@ -0,0 +1,1223 @@
+/*
+LaTeXMathML.js
+==============
+
+This file, in this form, is due to Douglas Woodall, June 2006.
+It contains JavaScript functions to convert (most simple) LaTeX
+math notation to Presentation MathML. It was obtained by
+downloading the file ASCIIMathML.js from
+ http://www1.chapman.edu/~jipsen/mathml/asciimathdownload/
+and modifying it so that it carries out ONLY those conversions
+that would be carried out in LaTeX. A description of the original
+file, with examples, can be found at
+ www1.chapman.edu/~jipsen/mathml/asciimath.html
+ ASCIIMathML: Math on the web for everyone
+
+Here is the header notice from the original file:
+
+ASCIIMathML.js
+==============
+This file contains JavaScript functions to convert ASCII math notation
+to Presentation MathML. The conversion is done while the (X)HTML page
+loads, and should work with Firefox/Mozilla/Netscape 7+ and Internet
+Explorer 6+MathPlayer (http://www.dessci.com/en/products/mathplayer/).
+Just add the next line to your (X)HTML page with this file in the same folder:
+This is a convenient and inexpensive solution for authoring MathML.
+
+Version 1.4.7 Dec 15, 2005, (c) Peter Jipsen http://www.chapman.edu/~jipsen
+Latest version at http://www.chapman.edu/~jipsen/mathml/ASCIIMathML.js
+For changes see http://www.chapman.edu/~jipsen/mathml/asciimathchanges.txt
+If you use it on a webpage, please send the URL to jipsen@chapman.edu
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License (at http://www.gnu.org/copyleft/gpl.html)
+for more details.
+
+LaTeXMathML.js (ctd)
+==============
+
+The instructions for use are the same as for the original
+ASCIIMathML.js, except that of course the line you add to your
+file should be
+Or use absolute path names if the file is not in the same folder
+as your (X)HTML page.
+*/
+
+var checkForMathML = true; // check if browser can display MathML
+var notifyIfNoMathML = true; // display note if no MathML capability
+var alertIfNoMathML = false; // show alert box if no MathML capability
+// was "red":
+var mathcolor = ""; // change it to "" (to inherit) or any other color
+// was "serif":
+var mathfontfamily = ""; // change to "" to inherit (works in IE)
+ // or another family (e.g. "arial")
+var showasciiformulaonhover = true; // helps students learn ASCIIMath
+/*
+// Commented out by DRW -- not now used -- see DELIMITERS (twice) near the end
+var displaystyle = false; // puts limits above and below large operators
+var decimalsign = "."; // change to "," if you like, beware of `(1,2)`!
+var AMdelimiter1 = "`", AMescape1 = "\\\\`"; // can use other characters
+var AMdelimiter2 = "$", AMescape2 = "\\\\\\$", AMdelimiter2regexp = "\\$";
+var doubleblankmathdelimiter = false; // if true, x+1 is equal to `x+1`
+ // for IE this works only in <!-- -->
+//var separatetokens;// has been removed (email me if this is a problem)
+*/
+var isIE = document.createElementNS==null;
+
+if (document.getElementById==null)
+ alert("This webpage requires a recent browser such as\
+\nMozilla/Netscape 7+ or Internet Explorer 6+MathPlayer")
+
+// all further global variables start with "AM"
+
+function AMcreateElementXHTML(t) {
+ if (isIE) return document.createElement(t);
+ else return document.createElementNS("http://www.w3.org/1999/xhtml",t);
+}
+
+function AMnoMathMLNote() {
+ var nd = AMcreateElementXHTML("h3");
+ nd.setAttribute("align","center")
+ nd.appendChild(AMcreateElementXHTML("p"));
+ nd.appendChild(document.createTextNode("To view the "));
+ var an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("LaTeXMathML"));
+ an.setAttribute("href","http://www.maths.nott.ac.uk/personal/drw/lm.html");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" notation use Internet Explorer 6+"));
+ an = AMcreateElementXHTML("a");
+ an.appendChild(document.createTextNode("MathPlayer"));
+ an.setAttribute("href","http://www.dessci.com/en/products/mathplayer/download.htm");
+ nd.appendChild(an);
+ nd.appendChild(document.createTextNode(" or Netscape/Mozilla/Firefox"));
+ nd.appendChild(AMcreateElementXHTML("p"));
+ return nd;
+}
+
+function AMisMathMLavailable() {
+ if (navigator.appName.slice(0,8)=="Netscape")
+ if (navigator.appVersion.slice(0,1)>="5") return null;
+ else return AMnoMathMLNote();
+ else if (navigator.appName.slice(0,9)=="Microsoft")
+ try {
+ var ActiveX = new ActiveXObject("MathPlayer.Factory.1");
+ return null;
+ } catch (e) {
+ return AMnoMathMLNote();
+ }
+ else return AMnoMathMLNote();
+}
+
+// character lists for Mozilla/Netscape fonts
+var AMcal = [0xEF35,0x212C,0xEF36,0xEF37,0x2130,0x2131,0xEF38,0x210B,0x2110,0xEF39,0xEF3A,0x2112,0x2133,0xEF3B,0xEF3C,0xEF3D,0xEF3E,0x211B,0xEF3F,0xEF40,0xEF41,0xEF42,0xEF43,0xEF44,0xEF45,0xEF46];
+var AMfrk = [0xEF5D,0xEF5E,0x212D,0xEF5F,0xEF60,0xEF61,0xEF62,0x210C,0x2111,0xEF63,0xEF64,0xEF65,0xEF66,0xEF67,0xEF68,0xEF69,0xEF6A,0x211C,0xEF6B,0xEF6C,0xEF6D,0xEF6E,0xEF6F,0xEF70,0xEF71,0x2128];
+var AMbbb = [0xEF8C,0xEF8D,0x2102,0xEF8E,0xEF8F,0xEF90,0xEF91,0x210D,0xEF92,0xEF93,0xEF94,0xEF95,0xEF96,0x2115,0xEF97,0x2119,0x211A,0x211D,0xEF98,0xEF99,0xEF9A,0xEF9B,0xEF9C,0xEF9D,0xEF9E,0x2124];
+
+var CONST = 0, UNARY = 1, BINARY = 2, INFIX = 3, LEFTBRACKET = 4,
+ RIGHTBRACKET = 5, SPACE = 6, UNDEROVER = 7, DEFINITION = 8,
+ TEXT = 9, BIG = 10, LONG = 11, STRETCHY = 12, MATRIX = 13; // token types
+
+var AMsqrt = {input:"\\sqrt", tag:"msqrt", output:"sqrt", ttype:UNARY},
+ AMroot = {input:"\\root", tag:"mroot", output:"root", ttype:BINARY},
+ AMfrac = {input:"\\frac", tag:"mfrac", output:"/", ttype:BINARY},
+ AMover = {input:"\\stackrel", tag:"mover", output:"stackrel", ttype:BINARY},
+ AMatop = {input:"\\atop", tag:"mfrac", output:"", ttype:INFIX},
+ AMchoose = {input:"\\choose", tag:"mfrac", output:"", ttype:INFIX},
+ AMsub = {input:"_", tag:"msub", output:"_", ttype:INFIX},
+ AMsup = {input:"^", tag:"msup", output:"^", ttype:INFIX},
+ AMtext = {input:"\\mathrm", tag:"mtext", output:"text", ttype:TEXT},
+ AMmbox = {input:"\\mbox", tag:"mtext", output:"mbox", ttype:TEXT};
+
+// Commented out by DRW to prevent 1/2 turning into a 2-line fraction
+// AMdiv = {input:"/", tag:"mfrac", output:"/", ttype:INFIX},
+// Commented out by DRW so that " prints literally in equations
+// AMquote = {input:"\"", tag:"mtext", output:"mbox", ttype:TEXT};
+
+var AMsymbols = [
+//Greek letters
+{input:"\\alpha", tag:"mi", output:"\u03B1", ttype:CONST},
+{input:"\\beta", tag:"mi", output:"\u03B2", ttype:CONST},
+{input:"\\gamma", tag:"mi", output:"\u03B3", ttype:CONST},
+{input:"\\delta", tag:"mi", output:"\u03B4", ttype:CONST},
+{input:"\\epsilon", tag:"mi", output:"\u03B5", ttype:CONST},
+{input:"\\varepsilon", tag:"mi", output:"\u025B", ttype:CONST},
+{input:"\\zeta", tag:"mi", output:"\u03B6", ttype:CONST},
+{input:"\\eta", tag:"mi", output:"\u03B7", ttype:CONST},
+{input:"\\theta", tag:"mi", output:"\u03B8", ttype:CONST},
+{input:"\\vartheta", tag:"mi", output:"\u03D1", ttype:CONST},
+{input:"\\iota", tag:"mi", output:"\u03B9", ttype:CONST},
+{input:"\\kappa", tag:"mi", output:"\u03BA", ttype:CONST},
+{input:"\\lambda", tag:"mi", output:"\u03BB", ttype:CONST},
+{input:"\\mu", tag:"mi", output:"\u03BC", ttype:CONST},
+{input:"\\nu", tag:"mi", output:"\u03BD", ttype:CONST},
+{input:"\\xi", tag:"mi", output:"\u03BE", ttype:CONST},
+{input:"\\pi", tag:"mi", output:"\u03C0", ttype:CONST},
+{input:"\\varpi", tag:"mi", output:"\u03D6", ttype:CONST},
+{input:"\\rho", tag:"mi", output:"\u03C1", ttype:CONST},
+{input:"\\varrho", tag:"mi", output:"\u03F1", ttype:CONST},
+{input:"\\varsigma", tag:"mi", output:"\u03C2", ttype:CONST},
+{input:"\\sigma", tag:"mi", output:"\u03C3", ttype:CONST},
+{input:"\\tau", tag:"mi", output:"\u03C4", ttype:CONST},
+{input:"\\upsilon", tag:"mi", output:"\u03C5", ttype:CONST},
+{input:"\\phi", tag:"mi", output:"\u03C6", ttype:CONST},
+{input:"\\varphi", tag:"mi", output:"\u03D5", ttype:CONST},
+{input:"\\chi", tag:"mi", output:"\u03C7", ttype:CONST},
+{input:"\\psi", tag:"mi", output:"\u03C8", ttype:CONST},
+{input:"\\omega", tag:"mi", output:"\u03C9", ttype:CONST},
+{input:"\\Gamma", tag:"mo", output:"\u0393", ttype:CONST},
+{input:"\\Delta", tag:"mo", output:"\u0394", ttype:CONST},
+{input:"\\Theta", tag:"mo", output:"\u0398", ttype:CONST},
+{input:"\\Lambda", tag:"mo", output:"\u039B", ttype:CONST},
+{input:"\\Xi", tag:"mo", output:"\u039E", ttype:CONST},
+{input:"\\Pi", tag:"mo", output:"\u03A0", ttype:CONST},
+{input:"\\Sigma", tag:"mo", output:"\u03A3", ttype:CONST},
+{input:"\\Upsilon", tag:"mo", output:"\u03A5", ttype:CONST},
+{input:"\\Phi", tag:"mo", output:"\u03A6", ttype:CONST},
+{input:"\\Psi", tag:"mo", output:"\u03A8", ttype:CONST},
+{input:"\\Omega", tag:"mo", output:"\u03A9", ttype:CONST},
+
+//fractions
+{input:"\\frac12", tag:"mo", output:"\u00BD", ttype:CONST},
+{input:"\\frac14", tag:"mo", output:"\u00BC", ttype:CONST},
+{input:"\\frac34", tag:"mo", output:"\u00BE", ttype:CONST},
+{input:"\\frac13", tag:"mo", output:"\u2153", ttype:CONST},
+{input:"\\frac23", tag:"mo", output:"\u2154", ttype:CONST},
+{input:"\\frac15", tag:"mo", output:"\u2155", ttype:CONST},
+{input:"\\frac25", tag:"mo", output:"\u2156", ttype:CONST},
+{input:"\\frac35", tag:"mo", output:"\u2157", ttype:CONST},
+{input:"\\frac45", tag:"mo", output:"\u2158", ttype:CONST},
+{input:"\\frac16", tag:"mo", output:"\u2159", ttype:CONST},
+{input:"\\frac56", tag:"mo", output:"\u215A", ttype:CONST},
+{input:"\\frac18", tag:"mo", output:"\u215B", ttype:CONST},
+{input:"\\frac38", tag:"mo", output:"\u215C", ttype:CONST},
+{input:"\\frac58", tag:"mo", output:"\u215D", ttype:CONST},
+{input:"\\frac78", tag:"mo", output:"\u215E", ttype:CONST},
+
+//binary operation symbols
+{input:"\\pm", tag:"mo", output:"\u00B1", ttype:CONST},
+{input:"\\mp", tag:"mo", output:"\u2213", ttype:CONST},
+{input:"\\triangleleft",tag:"mo", output:"\u22B2", ttype:CONST},
+{input:"\\triangleright",tag:"mo",output:"\u22B3", ttype:CONST},
+{input:"\\cdot", tag:"mo", output:"\u22C5", ttype:CONST},
+{input:"\\star", tag:"mo", output:"\u22C6", ttype:CONST},
+{input:"\\ast", tag:"mo", output:"\u002A", ttype:CONST},
+{input:"\\times", tag:"mo", output:"\u00D7", ttype:CONST},
+{input:"\\div", tag:"mo", output:"\u00F7", ttype:CONST},
+{input:"\\circ", tag:"mo", output:"\u2218", ttype:CONST},
+//{input:"\\bullet", tag:"mo", output:"\u2219", ttype:CONST},
+{input:"\\bullet", tag:"mo", output:"\u2022", ttype:CONST},
+{input:"\\oplus", tag:"mo", output:"\u2295", ttype:CONST},
+{input:"\\ominus", tag:"mo", output:"\u2296", ttype:CONST},
+{input:"\\otimes", tag:"mo", output:"\u2297", ttype:CONST},
+{input:"\\bigcirc", tag:"mo", output:"\u25CB", ttype:CONST},
+{input:"\\oslash", tag:"mo", output:"\u2298", ttype:CONST},
+{input:"\\odot", tag:"mo", output:"\u2299", ttype:CONST},
+{input:"\\land", tag:"mo", output:"\u2227", ttype:CONST},
+{input:"\\wedge", tag:"mo", output:"\u2227", ttype:CONST},
+{input:"\\lor", tag:"mo", output:"\u2228", ttype:CONST},
+{input:"\\vee", tag:"mo", output:"\u2228", ttype:CONST},
+{input:"\\cap", tag:"mo", output:"\u2229", ttype:CONST},
+{input:"\\cup", tag:"mo", output:"\u222A", ttype:CONST},
+{input:"\\sqcap", tag:"mo", output:"\u2293", ttype:CONST},
+{input:"\\sqcup", tag:"mo", output:"\u2294", ttype:CONST},
+{input:"\\uplus", tag:"mo", output:"\u228E", ttype:CONST},
+{input:"\\amalg", tag:"mo", output:"\u2210", ttype:CONST},
+{input:"\\bigtriangleup",tag:"mo",output:"\u25B3", ttype:CONST},
+{input:"\\bigtriangledown",tag:"mo",output:"\u25BD", ttype:CONST},
+{input:"\\dag", tag:"mo", output:"\u2020", ttype:CONST},
+{input:"\\dagger", tag:"mo", output:"\u2020", ttype:CONST},
+{input:"\\ddag", tag:"mo", output:"\u2021", ttype:CONST},
+{input:"\\ddagger", tag:"mo", output:"\u2021", ttype:CONST},
+{input:"\\lhd", tag:"mo", output:"\u22B2", ttype:CONST},
+{input:"\\rhd", tag:"mo", output:"\u22B3", ttype:CONST},
+{input:"\\unlhd", tag:"mo", output:"\u22B4", ttype:CONST},
+{input:"\\unrhd", tag:"mo", output:"\u22B5", ttype:CONST},
+
+
+//BIG Operators
+{input:"\\sum", tag:"mo", output:"\u2211", ttype:UNDEROVER},
+{input:"\\prod", tag:"mo", output:"\u220F", ttype:UNDEROVER},
+{input:"\\bigcap", tag:"mo", output:"\u22C2", ttype:UNDEROVER},
+{input:"\\bigcup", tag:"mo", output:"\u22C3", ttype:UNDEROVER},
+{input:"\\bigwedge", tag:"mo", output:"\u22C0", ttype:UNDEROVER},
+{input:"\\bigvee", tag:"mo", output:"\u22C1", ttype:UNDEROVER},
+{input:"\\bigsqcap", tag:"mo", output:"\u2A05", ttype:UNDEROVER},
+{input:"\\bigsqcup", tag:"mo", output:"\u2A06", ttype:UNDEROVER},
+{input:"\\coprod", tag:"mo", output:"\u2210", ttype:UNDEROVER},
+{input:"\\bigoplus", tag:"mo", output:"\u2A01", ttype:UNDEROVER},
+{input:"\\bigotimes", tag:"mo", output:"\u2A02", ttype:UNDEROVER},
+{input:"\\bigodot", tag:"mo", output:"\u2A00", ttype:UNDEROVER},
+{input:"\\biguplus", tag:"mo", output:"\u2A04", ttype:UNDEROVER},
+{input:"\\int", tag:"mo", output:"\u222B", ttype:CONST},
+{input:"\\oint", tag:"mo", output:"\u222E", ttype:CONST},
+
+//binary relation symbols
+{input:":=", tag:"mo", output:":=", ttype:CONST},
+{input:"\\lt", tag:"mo", output:"<", ttype:CONST},
+{input:"\\gt", tag:"mo", output:">", ttype:CONST},
+{input:"\\ne", tag:"mo", output:"\u2260", ttype:CONST},
+{input:"\\neq", tag:"mo", output:"\u2260", ttype:CONST},
+{input:"\\le", tag:"mo", output:"\u2264", ttype:CONST},
+{input:"\\leq", tag:"mo", output:"\u2264", ttype:CONST},
+{input:"\\leqslant", tag:"mo", output:"\u2264", ttype:CONST},
+{input:"\\ge", tag:"mo", output:"\u2265", ttype:CONST},
+{input:"\\geq", tag:"mo", output:"\u2265", ttype:CONST},
+{input:"\\geqslant", tag:"mo", output:"\u2265", ttype:CONST},
+{input:"\\equiv", tag:"mo", output:"\u2261", ttype:CONST},
+{input:"\\ll", tag:"mo", output:"\u226A", ttype:CONST},
+{input:"\\gg", tag:"mo", output:"\u226B", ttype:CONST},
+{input:"\\doteq", tag:"mo", output:"\u2250", ttype:CONST},
+{input:"\\prec", tag:"mo", output:"\u227A", ttype:CONST},
+{input:"\\succ", tag:"mo", output:"\u227B", ttype:CONST},
+{input:"\\preceq", tag:"mo", output:"\u227C", ttype:CONST},
+{input:"\\succeq", tag:"mo", output:"\u227D", ttype:CONST},
+{input:"\\subset", tag:"mo", output:"\u2282", ttype:CONST},
+{input:"\\supset", tag:"mo", output:"\u2283", ttype:CONST},
+{input:"\\subseteq", tag:"mo", output:"\u2286", ttype:CONST},
+{input:"\\supseteq", tag:"mo", output:"\u2287", ttype:CONST},
+{input:"\\sqsubset", tag:"mo", output:"\u228F", ttype:CONST},
+{input:"\\sqsupset", tag:"mo", output:"\u2290", ttype:CONST},
+{input:"\\sqsubseteq", tag:"mo", output:"\u2291", ttype:CONST},
+{input:"\\sqsupseteq", tag:"mo", output:"\u2292", ttype:CONST},
+{input:"\\sim", tag:"mo", output:"\u223C", ttype:CONST},
+{input:"\\simeq", tag:"mo", output:"\u2243", ttype:CONST},
+{input:"\\approx", tag:"mo", output:"\u2248", ttype:CONST},
+{input:"\\cong", tag:"mo", output:"\u2245", ttype:CONST},
+{input:"\\Join", tag:"mo", output:"\u22C8", ttype:CONST},
+{input:"\\bowtie", tag:"mo", output:"\u22C8", ttype:CONST},
+{input:"\\in", tag:"mo", output:"\u2208", ttype:CONST},
+{input:"\\ni", tag:"mo", output:"\u220B", ttype:CONST},
+{input:"\\owns", tag:"mo", output:"\u220B", ttype:CONST},
+{input:"\\propto", tag:"mo", output:"\u221D", ttype:CONST},
+{input:"\\vdash", tag:"mo", output:"\u22A2", ttype:CONST},
+{input:"\\dashv", tag:"mo", output:"\u22A3", ttype:CONST},
+{input:"\\models", tag:"mo", output:"\u22A8", ttype:CONST},
+{input:"\\perp", tag:"mo", output:"\u22A5", ttype:CONST},
+{input:"\\smile", tag:"mo", output:"\u2323", ttype:CONST},
+{input:"\\frown", tag:"mo", output:"\u2322", ttype:CONST},
+{input:"\\asymp", tag:"mo", output:"\u224D", ttype:CONST},
+{input:"\\notin", tag:"mo", output:"\u2209", ttype:CONST},
+
+//matrices
+{input:"\\begin{eqnarray}", output:"X", ttype:MATRIX, invisible:true},
+{input:"\\begin{array}", output:"X", ttype:MATRIX, invisible:true},
+{input:"\\\\", output:"}&{", ttype:DEFINITION},
+{input:"\\end{eqnarray}", output:"}}", ttype:DEFINITION},
+{input:"\\end{array}", output:"}}", ttype:DEFINITION},
+
+//grouping and literal brackets -- ieval is for IE
+{input:"\\big", tag:"mo", output:"X", atval:"1.2", ieval:"2.2", ttype:BIG},
+{input:"\\Big", tag:"mo", output:"X", atval:"1.6", ieval:"2.6", ttype:BIG},
+{input:"\\bigg", tag:"mo", output:"X", atval:"2.2", ieval:"3.2", ttype:BIG},
+{input:"\\Bigg", tag:"mo", output:"X", atval:"2.9", ieval:"3.9", ttype:BIG},
+{input:"\\left", tag:"mo", output:"X", ttype:LEFTBRACKET},
+{input:"\\right", tag:"mo", output:"X", ttype:RIGHTBRACKET},
+{input:"{", output:"{", ttype:LEFTBRACKET, invisible:true},
+{input:"}", output:"}", ttype:RIGHTBRACKET, invisible:true},
+
+{input:"(", tag:"mo", output:"(", atval:"1", ttype:STRETCHY},
+{input:"[", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
+{input:"\\lbrack", tag:"mo", output:"[", atval:"1", ttype:STRETCHY},
+{input:"\\{", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
+{input:"\\lbrace", tag:"mo", output:"{", atval:"1", ttype:STRETCHY},
+{input:"\\langle", tag:"mo", output:"\u2329", atval:"1", ttype:STRETCHY},
+{input:"\\lfloor", tag:"mo", output:"\u230A", atval:"1", ttype:STRETCHY},
+{input:"\\lceil", tag:"mo", output:"\u2308", atval:"1", ttype:STRETCHY},
+
+// rtag:"mi" causes space to be inserted before a following sin, cos, etc.
+// (see function AMparseExpr() )
+{input:")", tag:"mo",output:")", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"]", tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\rbrack",tag:"mo",output:"]", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\}", tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\rbrace",tag:"mo",output:"}", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\rangle",tag:"mo",output:"\u232A", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\rfloor",tag:"mo",output:"\u230B", rtag:"mi",atval:"1",ttype:STRETCHY},
+{input:"\\rceil", tag:"mo",output:"\u2309", rtag:"mi",atval:"1",ttype:STRETCHY},
+
+// "|", "\\|", "\\vert" and "\\Vert" modified later: lspace = rspace = 0em
+{input:"|", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
+{input:"\\|", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
+{input:"\\vert", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
+{input:"\\Vert", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
+{input:"\\mid", tag:"mo", output:"\u2223", atval:"1", ttype:STRETCHY},
+{input:"\\parallel", tag:"mo", output:"\u2225", atval:"1", ttype:STRETCHY},
+{input:"/", tag:"mo", output:"/", atval:"1.01", ttype:STRETCHY},
+{input:"\\backslash", tag:"mo", output:"\u2216", atval:"1", ttype:STRETCHY},
+{input:"\\setminus", tag:"mo", output:"\\", ttype:CONST},
+
+//miscellaneous symbols
+{input:"\\!", tag:"mspace", atname:"width", atval:"-0.167em", ttype:SPACE},
+{input:"\\,", tag:"mspace", atname:"width", atval:"0.167em", ttype:SPACE},
+{input:"\\>", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
+{input:"\\:", tag:"mspace", atname:"width", atval:"0.222em", ttype:SPACE},
+{input:"\\;", tag:"mspace", atname:"width", atval:"0.278em", ttype:SPACE},
+{input:"~", tag:"mspace", atname:"width", atval:"0.333em", ttype:SPACE},
+{input:"\\quad", tag:"mspace", atname:"width", atval:"1em", ttype:SPACE},
+{input:"\\qquad", tag:"mspace", atname:"width", atval:"2em", ttype:SPACE},
+//{input:"{}", tag:"mo", output:"\u200B", ttype:CONST}, // zero-width
+{input:"\\prime", tag:"mo", output:"\u2032", ttype:CONST},
+{input:"'", tag:"mo", output:"\u02B9", ttype:CONST},
+{input:"''", tag:"mo", output:"\u02BA", ttype:CONST},
+{input:"'''", tag:"mo", output:"\u2034", ttype:CONST},
+{input:"''''", tag:"mo", output:"\u2057", ttype:CONST},
+{input:"\\ldots", tag:"mo", output:"\u2026", ttype:CONST},
+{input:"\\cdots", tag:"mo", output:"\u22EF", ttype:CONST},
+{input:"\\vdots", tag:"mo", output:"\u22EE", ttype:CONST},
+{input:"\\ddots", tag:"mo", output:"\u22F1", ttype:CONST},
+{input:"\\forall", tag:"mo", output:"\u2200", ttype:CONST},
+{input:"\\exists", tag:"mo", output:"\u2203", ttype:CONST},
+{input:"\\Re", tag:"mo", output:"\u211C", ttype:CONST},
+{input:"\\Im", tag:"mo", output:"\u2111", ttype:CONST},
+{input:"\\aleph", tag:"mo", output:"\u2135", ttype:CONST},
+{input:"\\hbar", tag:"mo", output:"\u210F", ttype:CONST},
+{input:"\\ell", tag:"mo", output:"\u2113", ttype:CONST},
+{input:"\\wp", tag:"mo", output:"\u2118", ttype:CONST},
+{input:"\\emptyset", tag:"mo", output:"\u2205", ttype:CONST},
+{input:"\\infty", tag:"mo", output:"\u221E", ttype:CONST},
+{input:"\\surd", tag:"mo", output:"\\sqrt{}", ttype:DEFINITION},
+{input:"\\partial", tag:"mo", output:"\u2202", ttype:CONST},
+{input:"\\nabla", tag:"mo", output:"\u2207", ttype:CONST},
+{input:"\\triangle", tag:"mo", output:"\u25B3", ttype:CONST},
+{input:"\\therefore", tag:"mo", output:"\u2234", ttype:CONST},
+{input:"\\angle", tag:"mo", output:"\u2220", ttype:CONST},
+//{input:"\\\\ ", tag:"mo", output:"\u00A0", ttype:CONST},
+{input:"\\diamond", tag:"mo", output:"\u22C4", ttype:CONST},
+//{input:"\\Diamond", tag:"mo", output:"\u25CA", ttype:CONST},
+{input:"\\Diamond", tag:"mo", output:"\u25C7", ttype:CONST},
+{input:"\\neg", tag:"mo", output:"\u00AC", ttype:CONST},
+{input:"\\lnot", tag:"mo", output:"\u00AC", ttype:CONST},
+{input:"\\bot", tag:"mo", output:"\u22A5", ttype:CONST},
+{input:"\\top", tag:"mo", output:"\u22A4", ttype:CONST},
+{input:"\\square", tag:"mo", output:"\u25AB", ttype:CONST},
+{input:"\\Box", tag:"mo", output:"\u25A1", ttype:CONST},
+{input:"\\wr", tag:"mo", output:"\u2240", ttype:CONST},
+
+//standard functions
+//Note UNDEROVER *must* have tag:"mo" to work properly
+{input:"\\arccos", tag:"mi", output:"arccos", ttype:UNARY, func:true},
+{input:"\\arcsin", tag:"mi", output:"arcsin", ttype:UNARY, func:true},
+{input:"\\arctan", tag:"mi", output:"arctan", ttype:UNARY, func:true},
+{input:"\\arg", tag:"mi", output:"arg", ttype:UNARY, func:true},
+{input:"\\cos", tag:"mi", output:"cos", ttype:UNARY, func:true},
+{input:"\\cosh", tag:"mi", output:"cosh", ttype:UNARY, func:true},
+{input:"\\cot", tag:"mi", output:"cot", ttype:UNARY, func:true},
+{input:"\\coth", tag:"mi", output:"coth", ttype:UNARY, func:true},
+{input:"\\csc", tag:"mi", output:"csc", ttype:UNARY, func:true},
+{input:"\\deg", tag:"mi", output:"deg", ttype:UNARY, func:true},
+{input:"\\det", tag:"mi", output:"det", ttype:UNARY, func:true},
+{input:"\\dim", tag:"mi", output:"dim", ttype:UNARY, func:true}, //CONST?
+{input:"\\exp", tag:"mi", output:"exp", ttype:UNARY, func:true},
+{input:"\\gcd", tag:"mi", output:"gcd", ttype:UNARY, func:true}, //CONST?
+{input:"\\hom", tag:"mi", output:"hom", ttype:UNARY, func:true},
+{input:"\\inf", tag:"mo", output:"inf", ttype:UNDEROVER},
+{input:"\\ker", tag:"mi", output:"ker", ttype:UNARY, func:true},
+{input:"\\lg", tag:"mi", output:"lg", ttype:UNARY, func:true},
+{input:"\\lim", tag:"mo", output:"lim", ttype:UNDEROVER},
+{input:"\\liminf", tag:"mo", output:"liminf", ttype:UNDEROVER},
+{input:"\\limsup", tag:"mo", output:"limsup", ttype:UNDEROVER},
+{input:"\\ln", tag:"mi", output:"ln", ttype:UNARY, func:true},
+{input:"\\log", tag:"mi", output:"log", ttype:UNARY, func:true},
+{input:"\\max", tag:"mo", output:"max", ttype:UNDEROVER},
+{input:"\\min", tag:"mo", output:"min", ttype:UNDEROVER},
+{input:"\\Pr", tag:"mi", output:"Pr", ttype:UNARY, func:true},
+{input:"\\sec", tag:"mi", output:"sec", ttype:UNARY, func:true},
+{input:"\\sin", tag:"mi", output:"sin", ttype:UNARY, func:true},
+{input:"\\sinh", tag:"mi", output:"sinh", ttype:UNARY, func:true},
+{input:"\\sup", tag:"mo", output:"sup", ttype:UNDEROVER},
+{input:"\\tan", tag:"mi", output:"tan", ttype:UNARY, func:true},
+{input:"\\tanh", tag:"mi", output:"tanh", ttype:UNARY, func:true},
+
+//arrows
+{input:"\\gets", tag:"mo", output:"\u2190", ttype:CONST},
+{input:"\\leftarrow", tag:"mo", output:"\u2190", ttype:CONST},
+{input:"\\to", tag:"mo", output:"\u2192", ttype:CONST},
+{input:"\\rightarrow", tag:"mo", output:"\u2192", ttype:CONST},
+{input:"\\leftrightarrow", tag:"mo", output:"\u2194", ttype:CONST},
+{input:"\\uparrow", tag:"mo", output:"\u2191", ttype:CONST},
+{input:"\\downarrow", tag:"mo", output:"\u2193", ttype:CONST},
+{input:"\\updownarrow", tag:"mo", output:"\u2195", ttype:CONST},
+{input:"\\Leftarrow", tag:"mo", output:"\u21D0", ttype:CONST},
+{input:"\\Rightarrow", tag:"mo", output:"\u21D2", ttype:CONST},
+{input:"\\Leftrightarrow", tag:"mo", output:"\u21D4", ttype:CONST},
+{input:"\\iff", tag:"mo", output:"~\\Longleftrightarrow~", ttype:DEFINITION},
+{input:"\\Uparrow", tag:"mo", output:"\u21D1", ttype:CONST},
+{input:"\\Downarrow", tag:"mo", output:"\u21D3", ttype:CONST},
+{input:"\\Updownarrow", tag:"mo", output:"\u21D5", ttype:CONST},
+{input:"\\mapsto", tag:"mo", output:"\u21A6", ttype:CONST},
+{input:"\\longleftarrow", tag:"mo", output:"\u2190", ttype:LONG},
+{input:"\\longrightarrow", tag:"mo", output:"\u2192", ttype:LONG},
+{input:"\\longleftrightarrow", tag:"mo", output:"\u2194", ttype:LONG},
+{input:"\\Longleftarrow", tag:"mo", output:"\u21D0", ttype:LONG},
+{input:"\\Longrightarrow", tag:"mo", output:"\u21D2", ttype:LONG},
+{input:"\\Longleftrightarrow", tag:"mo", output:"\u21D4", ttype:LONG},
+{input:"\\longmapsto", tag:"mo", output:"\u21A6", ttype:CONST},
+ // disaster if LONG
+
+//commands with argument
+AMsqrt, AMroot, AMfrac, AMover, AMsub, AMsup, AMtext, AMmbox, AMatop, AMchoose,
+//AMdiv, AMquote,
+
+//diacritical marks
+{input:"\\acute", tag:"mover", output:"\u00B4", ttype:UNARY, acc:true},
+//{input:"\\acute", tag:"mover", output:"\u0317", ttype:UNARY, acc:true},
+//{input:"\\acute", tag:"mover", output:"\u0301", ttype:UNARY, acc:true},
+//{input:"\\grave", tag:"mover", output:"\u0300", ttype:UNARY, acc:true},
+//{input:"\\grave", tag:"mover", output:"\u0316", ttype:UNARY, acc:true},
+{input:"\\grave", tag:"mover", output:"\u0060", ttype:UNARY, acc:true},
+{input:"\\breve", tag:"mover", output:"\u02D8", ttype:UNARY, acc:true},
+{input:"\\check", tag:"mover", output:"\u02C7", ttype:UNARY, acc:true},
+{input:"\\dot", tag:"mover", output:".", ttype:UNARY, acc:true},
+{input:"\\ddot", tag:"mover", output:"..", ttype:UNARY, acc:true},
+//{input:"\\ddot", tag:"mover", output:"\u00A8", ttype:UNARY, acc:true},
+{input:"\\mathring", tag:"mover", output:"\u00B0", ttype:UNARY, acc:true},
+{input:"\\vec", tag:"mover", output:"\u20D7", ttype:UNARY, acc:true},
+{input:"\\overrightarrow",tag:"mover",output:"\u20D7", ttype:UNARY, acc:true},
+{input:"\\overleftarrow",tag:"mover", output:"\u20D6", ttype:UNARY, acc:true},
+{input:"\\hat", tag:"mover", output:"\u005E", ttype:UNARY, acc:true},
+{input:"\\widehat", tag:"mover", output:"\u0302", ttype:UNARY, acc:true},
+{input:"\\tilde", tag:"mover", output:"~", ttype:UNARY, acc:true},
+//{input:"\\tilde", tag:"mover", output:"\u0303", ttype:UNARY, acc:true},
+{input:"\\widetilde", tag:"mover", output:"\u02DC", ttype:UNARY, acc:true},
+{input:"\\bar", tag:"mover", output:"\u203E", ttype:UNARY, acc:true},
+{input:"\\overbrace", tag:"mover", output:"\u23B4", ttype:UNARY, acc:true},
+{input:"\\overline", tag:"mover", output:"\u00AF", ttype:UNARY, acc:true},
+{input:"\\underbrace", tag:"munder", output:"\u23B5", ttype:UNARY, acc:true},
+{input:"\\underline", tag:"munder", output:"\u00AF", ttype:UNARY, acc:true},
+//{input:"underline", tag:"munder", output:"\u0332", ttype:UNARY, acc:true},
+
+//typestyles and fonts
+{input:"\\displaystyle",tag:"mstyle",atname:"displaystyle",atval:"true", ttype:UNARY},
+{input:"\\textstyle",tag:"mstyle",atname:"displaystyle",atval:"false", ttype:UNARY},
+{input:"\\scriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"1", ttype:UNARY},
+{input:"\\scriptscriptstyle",tag:"mstyle",atname:"scriptlevel",atval:"2", ttype:UNARY},
+{input:"\\textrm", tag:"mstyle", output:"\\mathrm", ttype: DEFINITION},
+{input:"\\mathbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
+{input:"\\textbf", tag:"mstyle", atname:"mathvariant", atval:"bold", ttype:UNARY},
+{input:"\\mathit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
+{input:"\\textit", tag:"mstyle", atname:"mathvariant", atval:"italic", ttype:UNARY},
+{input:"\\mathtt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
+{input:"\\texttt", tag:"mstyle", atname:"mathvariant", atval:"monospace", ttype:UNARY},
+{input:"\\mathsf", tag:"mstyle", atname:"mathvariant", atval:"sans-serif", ttype:UNARY},
+{input:"\\mathbb", tag:"mstyle", atname:"mathvariant", atval:"double-struck", ttype:UNARY, codes:AMbbb},
+{input:"\\mathcal",tag:"mstyle", atname:"mathvariant", atval:"script", ttype:UNARY, codes:AMcal},
+{input:"\\mathfrak",tag:"mstyle",atname:"mathvariant", atval:"fraktur",ttype:UNARY, codes:AMfrk}
+];
+
+function compareNames(s1,s2) {
+ if (s1.input > s2.input) return 1
+ else return -1;
+}
+
+var AMnames = []; //list of input symbols
+
+function AMinitSymbols() {
+ AMsymbols.sort(compareNames);
+ for (i=0; i<AMsymbols.length; i++) AMnames[i] = AMsymbols[i].input;
+}
+
+var AMmathml = "http://www.w3.org/1998/Math/MathML";
+
+function AMcreateElementMathML(t) {
+ if (isIE) return document.createElement("m:"+t);
+ else return document.createElementNS(AMmathml,t);
+}
+
+function AMcreateMmlNode(t,frag) {
+// var node = AMcreateElementMathML(name);
+ if (isIE) var node = document.createElement("m:"+t);
+ else var node = document.createElementNS(AMmathml,t);
+ node.appendChild(frag);
+ return node;
+}
+
+function newcommand(oldstr,newstr) {
+ AMsymbols = AMsymbols.concat([{input:oldstr, tag:"mo", output:newstr,
+ ttype:DEFINITION}]);
+}
+
+function AMremoveCharsAndBlanks(str,n) {
+//remove n characters and any following blanks
+ var st;
+ st = str.slice(n);
+ for (var i=0; i<st.length && st.charCodeAt(i)<=32; i=i+1);
+ return st.slice(i);
+}
+
+function AMposition(arr, str, n) {
+// return position >=n where str appears or would be inserted
+// assumes arr is sorted
+ if (n==0) {
+ var h,m;
+ n = -1;
+ h = arr.length;
+ while (n+1<h) {
+ m = (n+h) >> 1;
+ if (arr[m]<str) n = m; else h = m;
+ }
+ return h;
+ } else
+ for (var i=n; i<arr.length && arr[i]<str; i++);
+ return i; // i=arr.length || arr[i]>=str
+}
+
+function AMgetSymbol(str) {
+//return maximal initial substring of str that appears in names
+//return null if there is none
+ var k = 0; //new pos
+ var j = 0; //old pos
+ var mk; //match pos
+ var st;
+ var tagst;
+ var match = "";
+ var more = true;
+ for (var i=1; i<=str.length && more; i++) {
+ st = str.slice(0,i); //initial substring of length i
+ j = k;
+ k = AMposition(AMnames, st, j);
+ if (k<AMnames.length && str.slice(0,AMnames[k].length)==AMnames[k]){
+ match = AMnames[k];
+ mk = k;
+ i = match.length;
+ }
+ more = k<AMnames.length && str.slice(0,AMnames[k].length)>=AMnames[k];
+ }
+ AMpreviousSymbol=AMcurrentSymbol;
+ if (match!=""){
+ AMcurrentSymbol=AMsymbols[mk].ttype;
+ return AMsymbols[mk];
+ }
+ AMcurrentSymbol=CONST;
+ k = 1;
+ st = str.slice(0,1); //take 1 character
+ if ("0"<=st && st<="9") tagst = "mn";
+ else tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");
+/*
+// Commented out by DRW (not fully understood, but probably to do with
+// use of "/" as an INFIX version of "\\frac", which we don't want):
+//}
+//if (st=="-" && AMpreviousSymbol==INFIX) {
+// AMcurrentSymbol = INFIX; //trick "/" into recognizing "-" on second parse
+// return {input:st, tag:tagst, output:st, ttype:UNARY, func:true};
+//}
+*/
+ return {input:st, tag:tagst, output:st, ttype:CONST};
+}
+
+
+/*Parsing ASCII math expressions with the following grammar
+v ::= [A-Za-z] | greek letters | numbers | other constant symbols
+u ::= sqrt | text | bb | other unary symbols for font commands
+b ::= frac | root | stackrel binary symbols
+l ::= { | \left left brackets
+r ::= } | \right right brackets
+S ::= v | lEr | uS | bSS Simple expression
+I ::= S_S | S^S | S_S^S | S Intermediate expression
+E ::= IE | I/I Expression
+Each terminal symbol is translated into a corresponding mathml node.*/
+
+var AMpreviousSymbol,AMcurrentSymbol;
+
+function AMparseSexpr(str) { //parses str and returns [node,tailstr,(node)tag]
+ var symbol, node, result, result2, i, st,// rightvert = false,
+ newFrag = document.createDocumentFragment();
+ str = AMremoveCharsAndBlanks(str,0);
+ symbol = AMgetSymbol(str); //either a token or a bracket or empty
+ if (symbol == null || symbol.ttype == RIGHTBRACKET)
+ return [null,str,null];
+ if (symbol.ttype == DEFINITION) {
+ str = symbol.output+AMremoveCharsAndBlanks(str,symbol.input.length);
+ symbol = AMgetSymbol(str);
+ if (symbol == null || symbol.ttype == RIGHTBRACKET)
+ return [null,str,null];
+ }
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ switch (symbol.ttype) {
+ case SPACE:
+ node = AMcreateElementMathML(symbol.tag);
+ node.setAttribute(symbol.atname,symbol.atval);
+ return [node,str,symbol.tag];
+ case UNDEROVER:
+ if (isIE) {
+ if (symbol.input.substr(0,4) == "\\big") { // botch for missing symbols
+ str = "\\"+symbol.input.substr(4)+str; // make \bigcup = \cup etc.
+ symbol = AMgetSymbol(str);
+ symbol.ttype = UNDEROVER;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ }
+ }
+ return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str,symbol.tag];
+ case CONST:
+ var output = symbol.output;
+ if (isIE) {
+ if (symbol.input == "'")
+ output = "\u2032";
+ else if (symbol.input == "''")
+ output = "\u2033";
+ else if (symbol.input == "'''")
+ output = "\u2033\u2032";
+ else if (symbol.input == "''''")
+ output = "\u2033\u2033";
+ else if (symbol.input == "\\square")
+ output = "\u25A1"; // same as \Box
+ else if (symbol.input.substr(0,5) == "\\frac") {
+ // botch for missing fractions
+ var denom = symbol.input.substr(6,1);
+ if (denom == "5" || denom == "6") {
+ str = symbol.input.replace(/\\frac/,"\\frac ")+str;
+ return [node,str,symbol.tag];
+ }
+ }
+ }
+ node = AMcreateMmlNode(symbol.tag,document.createTextNode(output));
+ return [node,str,symbol.tag];
+ case LONG: // added by DRW
+ node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
+ node.setAttribute("minsize","1.5");
+ node.setAttribute("maxsize","1.5");
+ node = AMcreateMmlNode("mover",node);
+ node.appendChild(AMcreateElementMathML("mspace"));
+ return [node,str,symbol.tag];
+ case STRETCHY: // added by DRW
+ if (isIE && symbol.input == "\\backslash")
+ symbol.output = "\\"; // doesn't expand, but then nor does "\u2216"
+ node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
+ if (symbol.input == "|" || symbol.input == "\\vert" ||
+ symbol.input == "\\|" || symbol.input == "\\Vert") {
+ node.setAttribute("lspace","0em");
+ node.setAttribute("rspace","0em");
+ }
+ node.setAttribute("maxsize",symbol.atval); // don't allow to stretch here
+ if (symbol.rtag != null)
+ return [node,str,symbol.rtag];
+ else
+ return [node,str,symbol.tag];
+ case BIG: // added by DRW
+ var atval = symbol.atval;
+ if (isIE)
+ atval = symbol.ieval;
+ symbol = AMgetSymbol(str);
+ if (symbol == null)
+ return [null,str,null];
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ node = AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output));
+ if (isIE) { // to get brackets to expand
+ var space = AMcreateElementMathML("mspace");
+ space.setAttribute("height",atval+"ex");
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(space);
+ } else { // ignored in IE
+ node.setAttribute("minsize",atval);
+ node.setAttribute("maxsize",atval);
+ }
+ return [node,str,symbol.tag];
+ case LEFTBRACKET: //read (expr+)
+ if (symbol.input == "\\left") { // left what?
+ symbol = AMgetSymbol(str);
+ if (symbol != null) {
+ if (symbol.input == ".")
+ symbol.invisible = true;
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ }
+ }
+ result = AMparseExpr(str,true,false);
+ if (symbol==null ||
+ (typeof symbol.invisible == "boolean" && symbol.invisible))
+ node = AMcreateMmlNode("mrow",result[0]);
+ else {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(result[0]);
+ }
+ return [node,result[1],result[2]];
+ case MATRIX: //read (expr+)
+ if (symbol.input == "\\begin{array}") {
+ var mask = "";
+ symbol = AMgetSymbol(str);
+ str = AMremoveCharsAndBlanks(str,0);
+ if (symbol == null)
+ mask = "l";
+ else {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (symbol.input != "{")
+ mask = "l";
+ else do {
+ symbol = AMgetSymbol(str);
+ if (symbol != null) {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ if (symbol.input != "}")
+ mask = mask+symbol.input;
+ }
+ } while (symbol != null && symbol.input != "" && symbol.input != "}");
+ }
+ result = AMparseExpr("{"+str,true,true);
+// if (result[0]==null) return [AMcreateMmlNode("mo",
+// document.createTextNode(symbol.input)),str];
+ node = AMcreateMmlNode("mtable",result[0]);
+ mask = mask.replace(/l/g,"left ");
+ mask = mask.replace(/r/g,"right ");
+ mask = mask.replace(/c/g,"center ");
+ node.setAttribute("columnalign",mask);
+ node.setAttribute("displaystyle","false");
+ if (isIE)
+ return [node,result[1],null];
+// trying to get a *little* bit of space around the array
+// (IE already includes it)
+ var lspace = AMcreateElementMathML("mspace");
+ lspace.setAttribute("width","0.167em");
+ var rspace = AMcreateElementMathML("mspace");
+ rspace.setAttribute("width","0.167em");
+ var node1 = AMcreateMmlNode("mrow",lspace);
+ node1.appendChild(node);
+ node1.appendChild(rspace);
+ return [node1,result[1],null];
+ } else { // eqnarray
+ result = AMparseExpr("{"+str,true,true);
+ node = AMcreateMmlNode("mtable",result[0]);
+ if (isIE)
+ node.setAttribute("columnspacing","0.25em"); // best in practice?
+ else
+ node.setAttribute("columnspacing","0.167em"); // correct (but ignored?)
+ node.setAttribute("columnalign","right center left");
+ node.setAttribute("displaystyle","true");
+ node = AMcreateMmlNode("mrow",node);
+ return [node,result[1],null];
+ }
+ case TEXT:
+ if (str.charAt(0)=="{") i=str.indexOf("}");
+ else i = 0;
+ if (i==-1)
+ i = str.length;
+ st = str.slice(1,i);
+ if (st.charAt(0) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","0.33em"); // was 1ex
+ newFrag.appendChild(node);
+ }
+ newFrag.appendChild(
+ AMcreateMmlNode(symbol.tag,document.createTextNode(st)));
+ if (st.charAt(st.length-1) == " ") {
+ node = AMcreateElementMathML("mspace");
+ node.setAttribute("width","0.33em"); // was 1ex
+ newFrag.appendChild(node);
+ }
+ str = AMremoveCharsAndBlanks(str,i+1);
+ return [AMcreateMmlNode("mrow",newFrag),str,null];
+ case UNARY:
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str];
+ if (typeof symbol.func == "boolean" && symbol.func) { // functions hack
+ st = str.charAt(0);
+// if (st=="^" || st=="_" || st=="/" || st=="|" || st==",") {
+ if (st=="^" || st=="_" || st==",") {
+ return [AMcreateMmlNode(symbol.tag,
+ document.createTextNode(symbol.output)),str,symbol.tag];
+ } else {
+ node = AMcreateMmlNode("mrow",
+ AMcreateMmlNode(symbol.tag,document.createTextNode(symbol.output)));
+ if (isIE) {
+ var space = AMcreateElementMathML("mspace");
+ space.setAttribute("width","0.167em");
+ node.appendChild(space);
+ }
+ node.appendChild(result[0]);
+ return [node,result[1],symbol.tag];
+ }
+ }
+ if (symbol.input == "\\sqrt") { // sqrt
+ if (isIE) { // set minsize, for \surd
+ var space = AMcreateElementMathML("mspace");
+ space.setAttribute("height","1.2ex");
+ space.setAttribute("width","0em"); // probably no effect
+ node = AMcreateMmlNode(symbol.tag,result[0])
+// node.setAttribute("minsize","1"); // ignored
+// node = AMcreateMmlNode("mrow",node); // hopefully unnecessary
+ node.appendChild(space);
+ return [node,result[1],symbol.tag];
+ } else
+ return [AMcreateMmlNode(symbol.tag,result[0]),result[1],symbol.tag];
+ } else if (typeof symbol.acc == "boolean" && symbol.acc) { // accent
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ var output = symbol.output;
+ if (isIE) {
+ if (symbol.input == "\\hat")
+ output = "\u0302";
+ else if (symbol.input == "\\widehat")
+ output = "\u005E";
+ else if (symbol.input == "\\bar")
+ output = "\u00AF";
+ else if (symbol.input == "\\grave")
+ output = "\u0300";
+ else if (symbol.input == "\\tilde")
+ output = "\u0303";
+ }
+ var node1 = AMcreateMmlNode("mo",document.createTextNode(output));
+ if (symbol.input == "\\vec" || symbol.input == "\\check")
+ // don't allow to stretch
+ node1.setAttribute("maxsize","1.2");
+ // why doesn't "1" work? \vec nearly disappears in firefox
+ if (isIE && symbol.input == "\\bar")
+ node1.setAttribute("maxsize","0.5");
+ if (symbol.input == "\\underbrace" || symbol.input == "\\underline")
+ node1.setAttribute("accentunder","true");
+ else
+ node1.setAttribute("accent","true");
+ node.appendChild(node1);
+ if (symbol.input == "\\overbrace" || symbol.input == "\\underbrace")
+ node.ttype = UNDEROVER;
+ return [node,result[1],symbol.tag];
+ } else { // font change or displaystyle command
+ if (!isIE && typeof symbol.codes != "undefined") {
+ for (i=0; i<result[0].childNodes.length; i++)
+ if (result[0].childNodes[i].nodeName=="mi" || result[0].nodeName=="mi") {
+ st = (result[0].nodeName=="mi"?result[0].firstChild.nodeValue:
+ result[0].childNodes[i].firstChild.nodeValue);
+ var newst = [];
+ for (var j=0; j<st.length; j++)
+ if (st.charCodeAt(j)>64 && st.charCodeAt(j)<91) newst = newst +
+ String.fromCharCode(symbol.codes[st.charCodeAt(j)-65]);
+ else newst = newst + st.charAt(j);
+ if (result[0].nodeName=="mi")
+ result[0]=AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst));
+ else result[0].replaceChild(AMcreateElementMathML("mo").
+ appendChild(document.createTextNode(newst)),result[0].childNodes[i]);
+ }
+ }
+ node = AMcreateMmlNode(symbol.tag,result[0]);
+ node.setAttribute(symbol.atname,symbol.atval);
+ if (symbol.input == "\\scriptstyle" ||
+ symbol.input == "\\scriptscriptstyle")
+ node.setAttribute("displaystyle","false");
+ return [node,result[1],symbol.tag];
+ }
+ case BINARY:
+ result = AMparseSexpr(str);
+ if (result[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str,null];
+ result2 = AMparseSexpr(result[1]);
+ if (result2[0]==null) return [AMcreateMmlNode("mo",
+ document.createTextNode(symbol.input)),str,null];
+ if (symbol.input=="\\root" || symbol.input=="\\stackrel")
+ newFrag.appendChild(result2[0]);
+ newFrag.appendChild(result[0]);
+ if (symbol.input=="\\frac") newFrag.appendChild(result2[0]);
+ return [AMcreateMmlNode(symbol.tag,newFrag),result2[1],symbol.tag];
+ case INFIX:
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ return [AMcreateMmlNode("mo",document.createTextNode(symbol.output)),
+ str,symbol.tag];
+ default:
+ return [AMcreateMmlNode(symbol.tag, //its a constant
+ document.createTextNode(symbol.output)),str,symbol.tag];
+ }
+}
+
+function AMparseIexpr(str) {
+ var symbol, sym1, sym2, node, result, tag, underover;
+ str = AMremoveCharsAndBlanks(str,0);
+ sym1 = AMgetSymbol(str);
+ result = AMparseSexpr(str);
+ node = result[0];
+ str = result[1];
+ tag = result[2];
+ symbol = AMgetSymbol(str);
+ if (symbol.ttype == INFIX) {
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ result = AMparseSexpr(str);
+ if (result[0] == null) // show box in place of missing argument
+ result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));
+ str = result[1];
+ tag = result[2];
+ if (symbol.input == "_" || symbol.input == "^") {
+ sym2 = AMgetSymbol(str);
+ tag = null; // no space between x^2 and a following sin, cos, etc.
+// This is for \underbrace and \overbrace
+ underover = ((sym1.ttype == UNDEROVER) || (node.ttype == UNDEROVER));
+// underover = (sym1.ttype == UNDEROVER);
+ if (symbol.input == "_" && sym2.input == "^") {
+ str = AMremoveCharsAndBlanks(str,sym2.input.length);
+ var res2 = AMparseSexpr(str);
+ str = res2[1];
+ tag = res2[2]; // leave space between x_1^2 and a following sin etc.
+ node = AMcreateMmlNode((underover?"munderover":"msubsup"),node);
+ node.appendChild(result[0]);
+ node.appendChild(res2[0]);
+ } else if (symbol.input == "_") {
+ node = AMcreateMmlNode((underover?"munder":"msub"),node);
+ node.appendChild(result[0]);
+ } else {
+ node = AMcreateMmlNode((underover?"mover":"msup"),node);
+ node.appendChild(result[0]);
+ }
+ node = AMcreateMmlNode("mrow",node); // so sum does not stretch
+ } else {
+ node = AMcreateMmlNode(symbol.tag,node);
+ if (symbol.input == "\\atop" || symbol.input == "\\choose")
+ node.setAttribute("linethickness","0ex");
+ node.appendChild(result[0]);
+ if (symbol.input == "\\choose")
+ node = AMcreateMmlNode("mfenced",node);
+ }
+ }
+ return [node,str,tag];
+}
+
+function AMparseExpr(str,rightbracket,matrix) {
+ var symbol, node, result, i, tag,
+ newFrag = document.createDocumentFragment();
+ do {
+ str = AMremoveCharsAndBlanks(str,0);
+ result = AMparseIexpr(str);
+ node = result[0];
+ str = result[1];
+ tag = result[2];
+ symbol = AMgetSymbol(str);
+ if (node!=undefined) {
+ if ((tag == "mn" || tag == "mi") && symbol!=null &&
+ typeof symbol.func == "boolean" && symbol.func) {
+ // Add space before \sin in 2\sin x or x\sin x
+ var space = AMcreateElementMathML("mspace");
+ space.setAttribute("width","0.167em");
+ node = AMcreateMmlNode("mrow",node);
+ node.appendChild(space);
+ }
+ newFrag.appendChild(node);
+ }
+ } while ((symbol.ttype != RIGHTBRACKET)
+ && symbol!=null && symbol.output!="");
+ tag = null;
+ if (symbol.ttype == RIGHTBRACKET) {
+ if (symbol.input == "\\right") { // right what?
+ str = AMremoveCharsAndBlanks(str,symbol.input.length);
+ symbol = AMgetSymbol(str);
+ if (symbol != null && symbol.input == ".")
+ symbol.invisible = true;
+ if (symbol != null)
+ tag = symbol.rtag;
+ }
+ if (symbol!=null)
+ str = AMremoveCharsAndBlanks(str,symbol.input.length); // ready to return
+ var len = newFrag.childNodes.length;
+ if (matrix &&
+ len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&
+ newFrag.childNodes[len-2].nodeName == "mo" &&
+ newFrag.childNodes[len-2].firstChild.nodeValue == "&") { //matrix
+ var pos = []; // positions of ampersands
+ var m = newFrag.childNodes.length;
+ for (i=0; matrix && i<m; i=i+2) {
+ pos[i] = [];
+ node = newFrag.childNodes[i];
+ for (var j=0; j<node.childNodes.length; j++)
+ if (node.childNodes[j].firstChild.nodeValue=="&")
+ pos[i][pos[i].length]=j;
+ }
+ var row, frag, n, k, table = document.createDocumentFragment();
+ for (i=0; i<m; i=i+2) {
+ row = document.createDocumentFragment();
+ frag = document.createDocumentFragment();
+ node = newFrag.firstChild; // <mrow> -&-&...&-&- </mrow>
+ n = node.childNodes.length;
+ k = 0;
+ for (j=0; j<n; j++) {
+ if (typeof pos[i][k] != "undefined" && j==pos[i][k]){
+ node.removeChild(node.firstChild); //remove &
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ k++;
+ } else frag.appendChild(node.firstChild);
+ }
+ row.appendChild(AMcreateMmlNode("mtd",frag));
+ if (newFrag.childNodes.length>2) {
+ newFrag.removeChild(newFrag.firstChild); //remove <mrow> </mrow>
+ newFrag.removeChild(newFrag.firstChild); //remove <mo>&</mo>
+ }
+ table.appendChild(AMcreateMmlNode("mtr",row));
+ }
+ return [table,str];
+ }
+ if (typeof symbol.invisible != "boolean" || !symbol.invisible) {
+ node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));
+ newFrag.appendChild(node);
+ }
+ }
+ return [newFrag,str,tag];
+}
+
+function AMparseMath(str) {
+ var result, node = AMcreateElementMathML("mstyle");
+ if (mathcolor != "") node.setAttribute("mathcolor",mathcolor);
+ if (mathfontfamily != "") node.setAttribute("fontfamily",mathfontfamily);
+ node.appendChild(AMparseExpr(str.replace(/^\s+/g,""),false,false)[0]);
+ node = AMcreateMmlNode("math",node);
+ if (showasciiformulaonhover) //fixed by djhsu so newline
+ node.setAttribute("title",str.replace(/\s+/g," "));//does not show in Gecko
+ if (mathfontfamily != "" && (isIE || mathfontfamily != "serif")) {
+ var fnode = AMcreateElementXHTML("font");
+ fnode.setAttribute("face",mathfontfamily);
+ fnode.appendChild(node);
+ return fnode;
+ }
+ return node;
+}
+
+function AMstrarr2docFrag(arr, linebreaks) {
+ var newFrag=document.createDocumentFragment();
+ var expr = false;
+ for (var i=0; i<arr.length; i++) {
+ if (expr) newFrag.appendChild(AMparseMath(arr[i]));
+ else {
+ var arri = (linebreaks ? arr[i].split("\n\n") : [arr[i]]);
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[0])));
+ for (var j=1; j<arri.length; j++) {
+ newFrag.appendChild(AMcreateElementXHTML("p"));
+ newFrag.appendChild(AMcreateElementXHTML("span").
+ appendChild(document.createTextNode(arri[j])));
+ }
+ }
+ expr = !expr;
+ }
+ return newFrag;
+}
+
+function AMprocessNodeR(n, linebreaks) {
+ var mtch, str, arr, frg, i;
+ if (n.childNodes.length == 0) {
+ if ((n.nodeType!=8 || linebreaks) &&
+ n.parentNode.nodeName!="form" && n.parentNode.nodeName!="FORM" &&
+ n.parentNode.nodeName!="textarea" && n.parentNode.nodeName!="TEXTAREA" &&
+ n.parentNode.nodeName!="pre" && n.parentNode.nodeName!="PRE") {
+ str = n.nodeValue;
+ if (!(str == null)) {
+ str = str.replace(/\r\n\r\n/g,"\n\n");
+ str = str.replace(/\x20+/g," ");
+ str = str.replace(/\s*\r\n/g," ");
+// DELIMITERS:
+ mtch = (str.indexOf("\$")==-1 ? false : true);
+ str = str.replace(/([^\\])\$/g,"$1 \$");
+ str = str.replace(/^\$/," \$"); // in case \$ at start of string
+ arr = str.split(" \$");
+ for (i=0; i<arr.length; i++)
+ arr[i]=arr[i].replace(/\\\$/g,"\$");
+ if (arr.length>1 || mtch) {
+ if (checkForMathML) {
+ checkForMathML = false;
+ var nd = AMisMathMLavailable();
+ AMnoMathML = nd != null;
+ if (AMnoMathML && notifyIfNoMathML)
+ if (alertIfNoMathML)
+ alert("To view the ASCIIMathML notation use Internet Explorer 6 +\nMathPlayer (free from www.dessci.com)\n\
+ or Firefox/Mozilla/Netscape");
+ else AMbody.insertBefore(nd,AMbody.childNodes[0]);
+ }
+ if (!AMnoMathML) {
+ frg = AMstrarr2docFrag(arr,n.nodeType==8);
+ var len = frg.childNodes.length;
+ n.parentNode.replaceChild(frg,n);
+ return len-1;
+ } else return 0;
+ }
+ }
+ } else return 0;
+ } else if (n.nodeName!="math") {
+ for (i=0; i<n.childNodes.length; i++)
+ i += AMprocessNodeR(n.childNodes[i], linebreaks);
+ }
+ return 0;
+}
+
+function AMprocessNode(n, linebreaks, spanclassAM) {
+ var frag,st;
+ if (spanclassAM!=null) {
+ frag = document.getElementsByTagName("span")
+ for (var i=0;i<frag.length;i++)
+ if (frag[i].className == "AM")
+ AMprocessNodeR(frag[i],linebreaks);
+ } else {
+ try {
+ st = n.innerHTML;
+ } catch(err) {}
+// DELIMITERS:
+ if (st==null || st.indexOf("\$")!=-1)
+ AMprocessNodeR(n,linebreaks);
+ }
+ if (isIE) { //needed to match size and font of formula to surrounding text
+ frag = document.getElementsByTagName('math');
+ for (var i=0;i<frag.length;i++) frag[i].update()
+ }
+}
+
+var AMbody;
+var AMnoMathML = false, AMtranslated = false;
+
+function translate(spanclassAM) {
+ if (!AMtranslated) { // run this only once
+ AMtranslated = true;
+ AMinitSymbols();
+ AMbody = document.getElementsByTagName("body")[0];
+ AMprocessNode(AMbody, false, spanclassAM);
+ }
+}
+
+if (isIE) { // avoid adding MathPlayer info explicitly to each webpage
+ document.write("<object id=\"mathplayer\"\
+ classid=\"clsid:32F66A20-7614-11D4-BD11-00104BD3F987\"></object>");
+ document.write("<?import namespace=\"m\" implementation=\"#mathplayer\"?>");
+}
+
+// GO1.1 Generic onload by Brothercake
+// http://www.brothercake.com/
+//onload function (replaces the onload="translate()" in the <body> tag)
+function generic()
+{
+ translate();
+};
+//setup onload function
+if(typeof window.addEventListener != 'undefined')
+{
+ //.. gecko, safari, konqueror and standard
+ window.addEventListener('load', generic, false);
+}
+else if(typeof document.addEventListener != 'undefined')
+{
+ //.. opera 7
+ document.addEventListener('load', generic, false);
+}
+else if(typeof window.attachEvent != 'undefined')
+{
+ //.. win/ie
+ window.attachEvent('onload', generic);
+}
+//** remove this condition to degrade older browsers
+else
+{
+ //.. mac/ie5 and anything else that gets this far
+ //if there's an existing onload function
+ if(typeof window.onload == 'function')
+ {
+ //store it
+ var existing = onload;
+ //add new onload handler
+ window.onload = function()
+ {
+ //call existing onload function
+ existing();
+ //call generic onload function
+ generic();
+ };
+ }
+ else
+ {
+ //setup onload function
+ window.onload = generic;
+ }
+}
diff --git a/javascripts/toc.js b/javascripts/toc.js
new file mode 100644
index 0000000..a8437ba
--- /dev/null
+++ b/javascripts/toc.js
@@ -0,0 +1,67 @@
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, October 2006. License: GPL */
+
+function getText(el) {
+ var text = "";
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+ text += i.data;
+ else if (i.firstChild != null)
+ text += getText(i);
+ }
+ return text;
+}
+
+function TocEntry(el, text, toclevel) {
+ this.element = el;
+ this.text = text;
+ this.toclevel = toclevel;
+}
+
+function tocEntries(el, toclevels) {
+ var result = new Array;
+ var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+ // Function that scans the DOM tree for header elements (the DOM2
+ // nodeIterator API would be a better technique but not supported by all
+ // browsers).
+ var iterate = function (el) {
+ for (var i = el.firstChild; i != null; i = i.nextSibling) {
+ if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+ var mo = re.exec(i.tagName)
+ if (mo)
+ result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+ iterate(i);
+ }
+ }
+ }
+ iterate(el);
+ return result;
+}
+
+// This function does the work. toclevels = 1..4.
+function generateToc(toclevels) {
+ var toc = document.getElementById("toc");
+ var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels);
+ for (var i = 0; i < entries.length; ++i) {
+ var entry = entries[i];
+ if (entry.element.id == "")
+ entry.element.id = "toc" + i;
+ var a = document.createElement("a");
+ a.href = "#" + entry.element.id;
+ a.appendChild(document.createTextNode(entry.text));
+ var div = document.createElement("div");
+ div.appendChild(a);
+ div.className = "toclevel" + entry.toclevel;
+ toc.appendChild(div);
+ }
+}
diff --git a/latex.conf b/latex.conf
new file mode 100644
index 0000000..894798e
--- /dev/null
+++ b/latex.conf
@@ -0,0 +1,663 @@
+#
+# latex.conf
+#
+# Asciidoc configuration file.
+# latex backend, generates LaTeX conformant markup.
+#
+
+[titles]
+subs=quotes,replacements,attributes,macros,specialcharacters,replacements2
+
+
+# The listing block uses a LaTeX verbatim environment where special characters don't need to be escaped.
+# Hence only "callouts" substitution should be applied.
+[blockdef-listing]
+subs=callouts
+
+
+[attributes]
+basebackend=latex
+basebackend-latex=
+
+latex-table-rowlimit=20
+latex-use-bibliography-environment!
+latex-indent-paragraphs!
+latex-recognize-escaped-unicode!
+latex-use-custom-list-items!
+latex-use-colored-tables!
+latex-use-running-title-headings!
+latex-use-colored-sidebar-blocks!
+
+[miscellaneous]
+subsnormal=quotes,specialwords,replacements,attributes,macros,passthroughs,specialcharacters,replacements2
+subsverbatim=callouts,specialcharacters
+outfilesuffix=.tex
+# Screen width in pixels.
+pagewidth=418
+pageunits=pt
+
+
+[specialcharacters]
+{=\{{}
+}=\}{}
+\\=\textbackslash{}
+$=\${}
+<=\textless{}
+>=\textgreater{}
+&=\&{}
+_=\_{}
+%=\%{}
+\#=\#{}
+^=\textasciicircum{}
+~=\textasciitilde{}
+|=\textbar{}
+"=\textquotedbl{}
+
+
+[macros]
+# I needed to rewrite some regular expressions because '<' and '>' have not been escaped to '&lt;' and '&gt;'
+
+# Callout
+[\\]?<(?P<index>\d+)>=callout
+
+# Link: <<id,text>>
+(?su)[\\]?<<(?P<attrlist>[\w"].*?)>>=xref2
+
+[replacements]
+
+# Line break.
+(?m)^(.*)\s\+$=\1 !..backslash..!newline!..braceleft..!!..braceright..!
+
+# -- Spaced em dashes (entity reference &mdash;)
+(^|[^-\\])--($|[^-])=\1--\2
+
+
+# (C) Copyright (entity reference &copy;)
+(?<!\\)\(C\)=!..backslash..!textcopyright!..braceleft..!!..braceright..!
+\\\(C\)=(C)
+
+# (R) registered trade mark (entity reference &reg;
+(?<!\\)\(R\)=!..backslash..!textregistered!..braceleft..!!..braceright..!
+\\\(R\)=(R)
+
+# (TM) Trademark (entity reference &trade;)
+(?<!\\)\(TM\)=!..backslash..!texttrademark!..braceleft..!!..braceright..!
+\\\(TM\)=(TM)
+
+# ... Ellipsis (entity reference &hellip;)
+(?<!\\)\.\.\.=!..backslash..!dots!..braceleft..!!..braceright..!
+\\\.\.\.=...
+
+# Recognize escaped unicode characters
+ifdef::latex-recognize-escaped-unicode[]
+\{amp\}#([0-9]*);=!..backslash..!unichar!..braceleft..!\1!..braceright..!
+\{amp\}#x([0123456789abcdefABCDEF]*);=!..backslash..!unichar!..braceleft..!{eval:0x\1}!..braceright..!
+endif::latex-recognize-escaped-unicode[]
+
+# -> right arrow
+->=!..backslash..!textrightarrow!..braceleft..!!..braceright..!
+# => right double arrow (have to enter math mode)
+=>=!..dollar..!!..backslash..!Rightarrow!..braceleft..!!..braceright..!!..dollar..!
+# <- left arrow
+<-=!..backslash..!textleftarrow!..braceleft..!!..braceright..!
+# <= left double arrow (have to enter math mode)
+<\==!..dollar..!!..backslash..!Leftarrow!..braceleft..!!..braceright..!!..dollar..!
+# --> long right arrow (have to enter math mode)
+-->=!..backslash..!textrightarrow!..braceleft..!!..braceright..!
+# ==> long right double arrow (have to enter math mode)
+=\=>=!..dollar..!!..backslash..!Rightarrow!..braceleft..!!..braceright..!!..dollar..!
+# <-- long left arrow (have to enter math mode)
+<--=!..backslash..!textleftarrow!..braceleft..!!..braceright..!
+# <== long left double arrow (have to enter math mode)
+<\=\==!..dollar..!!..backslash..!Leftarrow!..braceleft..!!..braceright..!!..dollar..!
+
+
+
+[replacements2]
+!..braceleft..!={
+!..braceright..!=}
+!..backslash..!=\\
+!..dollar..!=$
+!..lessthan..!=<
+!..greaterthan..!=>
+!..amp..!=&
+!..underline..!=_
+!..percent..!=%
+!..sharp..!=#
+!..circum..!=^
+!..tilde..!=~
+!..bar..!=|
+!..doublequote..!="
+
+
+
+# Ruler is interpreted as a page break.
+[ruler-blockmacro]
+\clearpage
+
+[image-inlinemacro]
+!..backslash..!href!..braceleft..!{link}!..braceright..!!..braceleft..!!..percent..!
+!..backslash..!includegraphics[{scale?scale={scale},}{width?width={width}pt,}{height? height={height}pt}]!..braceleft..!{target}!..braceright..!
+{link#}!..braceright..!
+
+
+[image-blockmacro]
+\begin\{figure\}
+\hypertarget\{{id}\}\{\}
+\caption\{{title}\}
+\href\{{link}\}\{%
+\includegraphics[{scale?scale={scale},}{width?width={width}pt,}{height? height={height}pt}]\{{target}\}%
+\label\{{id}\}
+{link#}\}
+\end\{figure\}
+
+[indexterm-inlinemacro]
+# Inline index term.
+!..backslash..!index!..braceleft..!{1}{2?!{2}}{3?!{3}}!..braceright..!
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+!..backslash..!index!..braceleft..!{1}!..braceright..!{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+!..backslash..!footnote!..braceleft..!{0}!..braceright..!
+
+[callout-inlinemacro]
+# Inline callout.
+<{index}>
+
+[listdef-numbered2]
+listtag=olist2
+itemtag=olist2item
+texttag=olist2text
+
+[listdef-bulleted2]
+listtag=ilist2
+itemtag=ilist2item
+texttag=ilist2text
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ifdef::latex-use-custom-list-items[]
+ilistitem=\item[\textendash] |
+ilist2item=\item[\textbullet] |
+olist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}[1)]|\end\{enumerate\}
+olist2={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}[a)]|\end\{enumerate\}
+endif::latex-use-custom-list-items[]
+
+ifndef::latex-use-custom-list-items[]
+ilistitem=\item%|
+ilist2item=\item%|
+olist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}|\end\{enumerate\}
+olist2={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}|\end\{enumerate\}
+endif::latex-use-custom-list-items[]
+
+ilist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{itemize\}|\end\{itemize\}
+ilisttext=|
+ilist2={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{itemize\}|\end\{itemize\}
+ilist2text=|
+olistitem=\item%|
+olisttext=|
+olist2item=\item%|
+olist2text=|
+vlist={title?\minisec\{{title}\}} \par{id?\label\{{id}\}\hypertarget\{{id}\}\{\}} |
+vlistentry=|
+vlistterm=\noindent\textbf\{%|\}
+vlistitem=\begin\{quote\}|\end\{quote\}
+vlisttext=|
+# Horizontal labeled list.
+hlist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{description\}|\end\{description\}
+hlistentry=|
+hlistterm=\item[%|]
+hlistitem=|
+hlisttext=|
+# Question and Answer list.
+qlist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}|\end\{enumerate\}
+qlistentry=\item%|
+qlistterm=|
+qlistitem=\begin\{quotation\}|\end\{quotation\}
+qlisttext=|
+# Callout list.
+colist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{enumerate\}|\end\{enumerate\}
+colistitem=\item%|
+colisttext=|
+
+# Bibliography list.
+ifdef::latex-use-bibliography-environment[]
+biblist=|
+endif::latex-use-bibliography-environment[]
+
+ifndef::latex-use-bibliography-environment[]
+biblist={title?\minisec\{{title}\}} {id?\label\{{id}\}\hypertarget\{{id}\}\{\}} \begin\{description\} | \end\{description\}
+endif::latex-use-bibliography-environment[]
+
+biblistitem=|
+biblisttext=|
+
+superscript=!..backslash..!textsuperscript!..braceleft..!|!..braceright..!
+subscript=!..backslash..!textsubscript!..braceleft..!|!..braceright..!
+
+
+
+# Quoted text.
+emphasis=!..backslash..!emph!..braceleft..!|!..braceright..!
+strong=!..backslash..!textbf!..braceleft..!|!..braceright..!
+monospaced=!..backslash..!texttt!..braceleft..!|!..braceright..!
+quoted=!..backslash..!{language!textquotedblleft}{language?{language@.german:glqq}}{language?{language@english:textquotedblleft}}!..braceleft..!!..braceright..!|!..backslash..!{language?{language@.german:grqq}}{language?{language@english:textquotedblright}}{language!textquotedblright}!..braceleft..!!..braceright..!
+unquoted=|
+
+# $$ inline passthrough.
+$$passthrough=|
+
+# Inline macros
+[http-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={name}:{target}}!..braceright..!
+[https-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={name}:{target}}!..braceright..!
+[ftp-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={name}:{target}}!..braceright..!
+[file-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={name}:{target}}!..braceright..!
+[mailto-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={target}}!..braceright..!
+[callto-inlinemacro]
+!..backslash..!href!..braceleft..!{name}:{target}!..braceright..!!..braceleft..!{0={target}}!..braceright..!
+[link-inlinemacro]
+!..backslash..!href!..braceleft..!{target}!..braceright..!!..braceleft..!{0={target}}!..braceright..!
+# anchor:id[text]
+[anchor-inlinemacro]
+!..backslash..!label!..braceleft..!{target}!..braceright..!!..backslash..!hypertarget!..braceleft..!{target}!..braceright..!!..braceleft..!{0={target}}!..braceright..!
+# [[id,text]]
+[anchor2-inlinemacro]
+!..backslash..!label!..braceleft..!{1}!..braceright..!!..backslash..!hypertarget!..braceleft..!{1}!..braceright..!!..braceleft..!{2={1}}!..braceright..!
+# [[[id]]]
+[anchor3-inlinemacro]
+{latex-use-bibliography-environment?!..backslash..!bibitem!..braceleft..!{1}!..braceright..!} {latex-use-bibliography-environment!!..backslash..!item[{1}]} !..backslash..!label!..braceleft..!{1}!..braceright..!!..backslash..!hypertarget!..braceleft..!{1}!..braceright..!!..braceleft..!!..braceright..!
+# xref:id[text]
+[xref-inlinemacro]
+{style#}{style$page:!..backslash..!pageref!..braceleft..!{target}!..braceright..!}
+{style#}{style$autoref:!..backslash..!autoref!..braceleft..!{target}!..braceright..!}
+{style#}{style$ref:!..backslash..!ref!..braceleft..!{target}!..braceright..!}
+{style#}{latex-use-bibliography-environment#}{style$cite:!..backslash..!cite!..braceleft..!{target}!..braceright..!}
+{style#}{latex-use-bibliography-environment%}{style$cite:!..backslash..!hyperlink!..braceleft..!{target}!..braceright..!!..braceleft..!{0=[{target}]}!..braceright..!}
+{style%}!..backslash..!hyperlink!..braceleft..!{target}!..braceright..!!..braceleft..!{0=[{target}]}!..braceright..!
+
+# <<id,text>>
+[xref2-inlinemacro]
+{3#}{3$page:!..backslash..!pageref!..braceleft..!{1}!..braceright..!}
+{3#}{3$autoref:!..backslash..!autoref!..braceleft..!{1}!..braceright..!}
+{3#}{3$ref:!..backslash..!ref!..braceleft..!{1}!..braceright..!}
+{3#}{latex-use-bibliography-environment#}{3$cite:!..backslash..!cite!..braceleft..!{1}!..braceright..!}
+{3#}{latex-use-bibliography-environment%}{3$cite:!..backslash..!hyperlink!..braceleft..!{1}!..braceright..!!..braceleft..!{2=[{1}]}!..braceright..!}
+{3%}!..backslash..!hyperlink!..braceleft..!{1}!..braceright..!!..braceleft..!{2=[{1}]}!..braceright..!
+
+
+# Special word substitution.
+[emphasizedwords]
+!..backslash..!emph!..braceleft..!{words}!..braceright..!
+[monospacedwords]
+!..backslash..!texttt!..braceleft..!{words}!..braceright..!
+[strongwords]
+!..backslash..!textbf!..braceleft..!{words}!..braceright..!
+
+
+
+# Paragraph substitution.
+[paragraph]
+{title%} \par{latex-indent-paragraphs!\noindent}
+{title#} \paragraph\{{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+
+|
+
+[literalparagraph]
+# The literal block employs the same markup.
+template::[literalblock]
+
+[verseparagraph]
+# The verse block employs the same markup.
+template::[verseblock]
+
+[admonitionparagraph]
+# The admonition block employs the same markup.
+template::[admonitionblock]
+
+# Delimited blocks.
+[passthroughblock]
+|
+
+[listingblock]
+\minisec\{{caption=Listing: }{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{lstlisting\}[{title?name={title}}]
+
+|
+
+\end\{lstlisting\}
+
+[literalblock]
+\minisec\{{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{alltt\}
+
+|
+
+\end\{alltt\}
+
+[verseblock]
+\minisec\{{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{alltt\}
+\normalfont\{\}
+
+|
+
+\end\{alltt\}
+
+[sidebarblock]
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\par\noindent
+ifndef::latex-use-colored-sidebar-blocks[]
+\setlength\{\tabcolsep\}\{0pt\}
+\rowcolors\{1\}\{\}\{\}
+\begin\{tabular\}\{l>\{\columncolor[gray]\{.75\}\}rcl\}
+\hspace*\{0pt\} &
+\hspace*\{8pt\} &
+\hspace*\{16pt\} &
+\begin\{minipage\}\{4in\}
+endif::latex-use-colored-sidebar-blocks[]
+ifdef::latex-use-colored-sidebar-blocks[]
+\fcolorbox\{SidebarBorderColor\}\{SidebarBackgroundColor\}\{\parbox\{\textwidth\}\{
+endif::latex-use-colored-sidebar-blocks[]
+\minisec\{{title}\}
+
+|
+
+ifdef::latex-use-colored-sidebar-blocks[]
+\}
+\}
+endif::latex-use-colored-sidebar-blocks[]
+ifndef::latex-use-colored-sidebar-blocks[]
+\end\{minipage\}
+\end\{tabular\}
+endif::latex-use-colored-sidebar-blocks[]
+\bigskip
+
+[quoteblock]
+\minisec\{{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{quote\}
+
+|
+
+\end\{quote\}
+
+\begin\{flushright\}
+{citetitle} \\
+-- {attribution}
+\end\{flushright\}
+
+[exampleblock]
+\minisec\{{caption=Example: }{title}\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{quotation\}
+
+|
+
+\end\{quotation\}
+
+[admonitionblock]
+\begin\{addmargin*\}[0em]\{0em\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{minipage\}\{\linewidth\}
+{icons#} \includegraphics\{{icon={iconsdir}/{name}.png}\}
+{icons%} \minisec\{{caption}\}
+\\
+\rule\{\linewidth\}\{2pt\}
+\par\{\}\noindent\{\}|\par\{\}\noindent\{\}%
+\rule[.25\baselineskip]\{\linewidth\}\{2pt\}
+\end\{minipage\}
+\end\{addmargin*\}
+
+# Bibliography list.
+# Same as numbered list.
+[listdef-bibliography]
+listtag=biblist
+itemtag=biblistitem
+texttag=biblisttext
+
+# Glossary list.
+# Same as labeled list.
+[listdef-glossary]
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+# Tables.
+[tabledef-default]
+template=table
+colspec=>\{{colalign@left:\\raggedright}{colalign@center:\\centering}{colalign@right:\\raggedleft}\}p\{ {colwidth}pt \}
+bodyrow=%| \tabularnewline
+headdata=\{\bfseries\{\}%|\} {colnumber@{cols}::&}
+footdata=\{\bfseries\{\}%|\} {colnumber@{cols}::&}
+bodydata=%| {colnumber@{cols}:%:&}
+
+[table]
+ifdef::latex-use-colored-tables[]
+\rowcolors\{1\}\{TableEvenColor\}\{TableOddColor\}
+\setlength\arrayrulewidth\{1.5pt\}
+\arrayrulecolor\{TableBorderColor\}
+endif::latex-use-colored-tables[]
+{eval:{rows}{gt}{latex-table-rowlimit}} \begin\{longtable\}\{
+{eval:{rows}{gt}{latex-table-rowlimit}} {frame$all|sides:|}
+{eval:{rows}{gt}{latex-table-rowlimit}} {colspecs}
+{eval:{rows}{gt}{latex-table-rowlimit}} {frame$all|sides:|}
+{eval:{rows}{gt}{latex-table-rowlimit}} \}
+{eval:{rows}{gt}{latex-table-rowlimit}} \hypertarget\{{id}\}\{\}
+{eval:{rows}{gt}{latex-table-rowlimit}} \caption\{{title}\}
+{eval:{rows}{gt}{latex-table-rowlimit}} {frame$all|topbot:\hline}
+{eval:{rows}{gt}{latex-table-rowlimit}} {headrows}
+{eval:{rows}{gt}{latex-table-rowlimit}} {headrows#} \endhead
+{eval:{rows}{gt}{latex-table-rowlimit}} {footrows}
+{eval:{rows}{gt}{latex-table-rowlimit}} {footrows#} \endlastfoot
+{eval:{rows}{gt}{latex-table-rowlimit}}
+{eval:{rows}{gt}{latex-table-rowlimit}} {bodyrows}
+{eval:{rows}{gt}{latex-table-rowlimit}} {frame$all|topbot:\hline}
+{eval:{rows}{gt}{latex-table-rowlimit}} \label\{{id}\}
+{eval:{rows}{gt}{latex-table-rowlimit}} \end\{longtable\}
+{eval:{rows}{lt}={latex-table-rowlimit}} {title%} \par{latex-indent-paragraphs!\noindent}
+{eval:{rows}{lt}={latex-table-rowlimit}} {title#} \begin\{table\}
+{eval:{rows}{lt}={latex-table-rowlimit}} {title#} \begin\{center\}
+{eval:{rows}{lt}={latex-table-rowlimit}} \hypertarget\{{id}\}\{\}
+{eval:{rows}{lt}={latex-table-rowlimit}} \caption\{{title}\}
+{eval:{rows}{lt}={latex-table-rowlimit}} \begin\{tabular\}\{
+{eval:{rows}{lt}={latex-table-rowlimit}} {frame$all|sides:|}
+{eval:{rows}{lt}={latex-table-rowlimit}} {colspecs}
+{eval:{rows}{lt}={latex-table-rowlimit}} {frame$all|sides:|}
+{eval:{rows}{lt}={latex-table-rowlimit}} \}
+{eval:{rows}{lt}={latex-table-rowlimit}} {frame$all|topbot:\hline}
+{eval:{rows}{lt}={latex-table-rowlimit}} {headrows}
+{eval:{rows}{lt}={latex-table-rowlimit}} {bodyrows}
+{eval:{rows}{lt}={latex-table-rowlimit}} {footrows}
+{eval:{rows}{lt}={latex-table-rowlimit}} {frame$all|topbot:\hline}
+{eval:{rows}{lt}={latex-table-rowlimit}} \end\{tabular\}
+{eval:{rows}{lt}={latex-table-rowlimit}} {title#} \end\{center\}
+{eval:{rows}{lt}={latex-table-rowlimit}} \label\{{id}\}
+{eval:{rows}{lt}={latex-table-rowlimit}} {title#} \end\{table\}
+
+[specialsections]
+ifdef::doctype-article[]
+^Abstract$=sect-abstract
+endif::doctype-article[]
+
+ifdef::doctype-book[]
+^Dedication$=sect-dedication
+endif::doctype-book[]
+
+^Index$=sect-index
+
+ifdef::latex-use-bibliography-environment[]
+^(Bibliography|References)$=sect-bibliography
+endif::latex-use-bibliography-environment[]
+
+^Appendix.*$=sect-appendix
+^(TOC|Contents)$=sect-toc
+
+^Figures$=sect-list-of-figures
+
+# Special sections.
+
+
+[sect-list-of-figures]
+\listoffigures
+
+
+[sect-toc]
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\tableofcontents
+
+[sect-index]
+\setindexpreamble\{
+|
+\}
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\printindex
+
+ifdef::latex-use-bibliography-environment[]
+[sect-bibliography]
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{thebibliography\}\{99\}
+|
+\end\{thebibliography\}
+endif::latex-use-bibliography-environment[]
+
+[sect-appendix]
+\appendix
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+|
+
+[sect-abstract]
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\begin\{abstract\}
+|
+
+\end\{abstract\}
+
+[sect-dedication]
+\label\{{id}\}\hypertarget\{{id}\}\{\}
+\dedication\{
+|
+\}
+
+[preamble]
+# Untitled elements between header and first section title.
+ifdef::doctype-book[]
+\frontmatter
+\chapter*\{Preface\}
+\label\{preamble\}\hypertarget\{preamble\}\{\}
+endif::doctype-book[]
+
+
+|
+
+ifdef::doctype-book[]
+\mainmatter
+endif::doctype-book[]
+
+# Document sections.
+[sect0]
+\hypertarget\{{id}\}\{\}
+\chapter\{{title}\}
+\label\{{id}\}
+|
+
+[sect1]
+\hypertarget\{{id}\}\{\}
+\section\{{title}\}
+\label\{{id}\}
+
+[sect2]
+\hypertarget\{{id}\}\{\}
+\subsection\{{title}\}
+\label\{{id}\}
+|
+
+[sect3]
+\hypertarget\{{id}\}\{\}
+\subsubsection\{{title}\}
+\label\{{id}\}
+|
+
+[sect4]
+\hypertarget\{{id}\}\{\}
+\minisec\{{title}\}
+\label\{{id}\}
+|
+
+[header]
+{encoding$UTF-8:}% coding: utf-8
+\documentclass [a4paper,abstracton,titlepage]\{{doctype@article:scrartcl:scrbook}\}
+\pagestyle\{{latex-use-running-title-headings?headings}{latex-use-running-title-headings!plain}\}
+\usepackage\{makeidx\}
+\usepackage[table]\{xcolor\}
+\definecolor\{LinkColor\}\{RGB\}\{85,107,47\}
+\definecolor\{TableEvenColor\}\{RGB\}\{238,255,204\}
+\definecolor\{TableOddColor\}\{RGB\}\{238,255,255\}
+\definecolor\{TableBorderColor\}\{RGB\}\{140,172,187\}
+\definecolor\{ListingBorderColor\}\{gray\}\{0.55\}
+\definecolor\{ListingBackgroundColor\}\{gray\}\{0.95\}
+\definecolor\{SidebarBorderColor\}\{gray\}\{0.95\}
+\definecolor\{SidebarBackgroundColor\}\{RGB\}\{255,255,238\}
+\usepackage\{type1ec\}
+\usepackage[{language=english}]\{babel\}
+\usepackage[
+ pdftex,
+ pdftitle=\{{doctitle}\},
+ pdfauthor=\{{author}\},
+ backref,
+ pagebackref,
+ breaklinks=true,
+ unicode
+ ]
+ \{hyperref\}
+\usepackage\{enumerate\}
+\usepackage\{graphicx\}
+\usepackage\{longtable\}
+\usepackage[T1]\{fontenc\}
+\usepackage\{ucs\}
+\usepackage[{encoding@ISO-8859-1:latin1}{encoding@UTF-8:utf8x}{encoding!utf8x}]\{inputenc\}
+\usepackage\{textcomp\}
+\usepackage\{alltt\}
+\usepackage\{listings\}
+
+
+\lstset\{basicstyle=\footnotesize\ttfamily,showstringspaces=false,breaklines,frame=single, rulecolor=\color\{ListingBorderColor\}, backgroundcolor=\color\{ListingBackgroundColor\}, xleftmargin=0cm, linewidth=0.95\textwidth\}
+
+{latex-indent-paragraphs%} \setlength\{\parskip\}\{1ex plus 0.5ex minus 0.2ex\}
+
+\makeatletter
+\DeclareRobustCommand*\textsubscript[1]\{%
+ \@textsubscript\{\selectfont#1\}\}
+\def\@textsubscript#1\{%
+ \{\m@th\ensuremath\{_\{\mbox\{\fontsize\sf@size\z@#1\}\}\}\}\}
+\makeatother
+
+\subject\{{subject}\}
+\title\{{doctitle}\}
+\author\{{author}{email?, \href\{mailto:{email}\}\{{email}\}}\}
+\date\{{date}\}
+\publishers\{\begin\{tabular\}\{ll\} {revision?\textbf\{Revision:\} & {revision} \\ } {keywords?\textbf\{Keywords:\} & {keywords} \\ } \end\{tabular\}\}
+
+\makeindex
+
+\begin\{document\}
+\label\{header\}\hypertarget\{header\}\{\}
+{doctitle#\maketitle}
+
+[footer]
+\label\{footer\}\hypertarget\{footer\}\{\}
+\end\{document\} \ No newline at end of file
diff --git a/linuxdoc.conf b/linuxdoc.conf
new file mode 100644
index 0000000..abba29c
--- /dev/null
+++ b/linuxdoc.conf
@@ -0,0 +1,285 @@
+# linuxdoc.conf
+#
+# Asciidoc configuration file.
+# linuxdoc backend, article document type.
+#
+# NOTE:
+# - The Linuxdoc format only supports article documents.
+# - Linuxdoc does not support a number of AsciiDoc elements, for
+# example table.
+# - The AsciiDoc linuxdoc backend is no longer being actively
+# developed or tested with new AsciiDoc releases.
+#
+
+[attributes]
+basebackend=linuxdoc
+basebackend-linuxdoc=
+
+[miscellaneous]
+outfilesuffix=.sgml
+
+[replacements]
+(?m)^(.*)\s\+$=\1<newline>
+
+# To allow the AsciiDoc User Guide to be processed.
+{amp}\#960;=pi
+
+# Small 'NEW' image.
+(?<!\\)#NEW#=New!
+\\#NEW#=#NEW#
+
+# (C) Copyright (entity reference &copy;)
+(?<!\\)\(C\)=&#169;
+\\\(C\)=(C)
+
+# (R) registered trade mark (entity reference &reg;
+(?<!\\)\(R\)=&reg;
+\\\(R\)=(R)
+
+# (TM) Trademark (entity reference &trade;)
+(?<!\\)\(TM\)=&trade;
+\\\(TM\)=(TM)
+
+# -- Spaced and unspaced em dashes (entity reference &mdash;)
+(^|[^-\\])--($|[^-])=\1&mdash;\2
+\\--(?!-)=--
+
+# ... Ellipsis (entity reference &hellip;)
+(?<!\\)\.\.\.=&hellip;
+\\\.\.\.=...
+
+[header]
+<!doctype linuxdoc system>
+<article>
+<title>{doctitle}</title>
+<author>
+ by {author}
+ <tt>&lt;<url url="mailto:{email}" name="{email}">&gt;</tt>
+</author>
+{date#}<date>
+{date#} v{revision}{date?,}
+{date#} {date}
+{date#}</date>
+
+[footer]
+</article>
+
+[indexterm-inlinemacro]
+# Inline index term.
+{2%}<nidx>{1}</nidx>
+{2#}{3%}<nidx>{2}</nidx>
+<nidx>{3}</nidx>
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+<nidx>{1}</nidx>
+{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+<newline>[{0}]<newline>
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ilist={title?<p><bf>{title}</bf>}<itemize>|</itemize>
+ilistitem=<item>|</item>
+ilisttext=|
+olist={title?<p><bf>{title}</bf>}<enum>|</enum>
+olist2=<enum>|</enum>
+olistitem=<item>|</item>
+olisttext=|
+vlist={title?<p><bf>{title}</bf>}<descrip>|</descrip>
+vlistitem=|
+vlisttext=|
+vlistentry=|
+vlistterm=<tag>|</tag>
+# Same as vertical labeled list.
+hlist={title?<p><bf>{title}</bf>}<descrip>|</descrip>
+hlistitem=|
+hlisttext=|
+hlistentry=|
+hlistterm=<tag>|</tag>
+# Question and Answer list.
+qlist=<enum>|</enum>
+qlistentry=<item>|</item>
+qlistterm=|
+qlistitem=|
+qlisttext=<p>|
+# Callout list (same as numbered list).
+colist={title?<p><bf>{title}</bf>}<enum>|</enum>
+colistitem=<item>|</item>
+colisttext=|
+
+# Quoted text
+emphasis=<em>|</em>
+strong=<bf>|</bf>
+monospaced=<tt>|</tt>
+quoted=``|''
+
+[specialsections]
+^Abstract$=sect-abstract
+
+[sect-abstract]
+<abstract>
+|
+</abstract>
+<toc>
+
+[preamble]
+<abstract>
+|
+</abstract>
+<toc>
+
+[sect1]
+<sect>{title}
+<p>
+|
+
+[sect2]
+<sect1>{title}
+<p>
+|
+
+[sect3]
+<sect2>{title}
+<p>
+|
+
+[sect4]
+<p><bf>{title}</bf>
+<p>
+|
+
+# Inline macros
+[http-inlinemacro]
+<url url="{name}:{target}" name="{0={name}:{target}}">
+[https-inlinemacro]
+<url url="{name}:{target}" name="{0={name}:{target}}">
+[ftp-inlinemacro]
+<url url="{name}:{target}" name="{0={name}:{target}}">
+[file-inlinemacro]
+<url url="{name}:{target}" name="{0={name}:{target}}">
+[mailto-inlinemacro]
+<url url="{name}:{target}" name="{0={target}}">
+[link-inlinemacro]
+<url url="{target}" name="{0={target}}">
+# LinuxDoc does not have anchors or anchor reference elements but we include
+# the macros so the anchor is hidden and the reference text displayed.
+# Anchor: [[id,xreflabel]]
+[anchor-inlinemacro]
+#&lsqb;{target}&rsqb;
+[anchor2-inlinemacro]
+# [[id,text]]
+#&lsqb;{1}&rsqb;
+[xref-inlinemacro]
+#{1} &lsqb;{target}&rsqb;
+{1={target}}
+[xref2-inlinemacro]
+# <<id,text>>
+#{2} &lsqb;{1}&rsqb;
+{2=1}
+
+# Special word macros
+[emphasizedwords]
+<em>{words}</em>
+[monospacedwords]
+<tt>{words}</tt>
+[strongwords]
+<bf>{words}</bf>
+
+# Paragraph substitution.
+[paragraph]
+<p><bf>{title}</bf><newline>
+|
+{empty}
+{empty}
+
+[literalparagraph]
+<p><bf>Example:</bf> {title}
+<verb>|</verb>
+{empty}
+
+[admonitionparagraph]
+<p><bf>{style}:</bf> |
+{empty}
+{empty}
+
+[verseparagraph]
+template::[paragraph]
+
+[image-inlinemacro]
+{1={target}}
+
+[ruler-blockmacro]
+# Only applies to HTML so don't output anything.
+
+[image-blockmacro]
+<p><bf>Figure:</bf> {title}
+<p>{1}
+{1%}<p>Image file: {target}
+
+[literalblock]
+<p><bf>Example:</bf> {title}
+<verb>
+|
+</verb>
+{empty}
+
+[listingblock]
+<p><bf>Example:</bf> {title}
+<tscreen><verb>
+|
+</verb></tscreen>
+{empty}
+
+[sidebarblock]
+<p><bf>{title}</bf>
+|
+{empty}
+{empty}
+
+[exampleblock]
+<p><bf>{title}</bf>
+|
+{empty}
+{empty}
+
+[admonitionblock]
+<p><bf>{style}</bf>
+|
+{empty}
+{empty}
+
+[passthroughblock]
+|
+
+[quoteblock]
+<p><bf>{title}</bf>
+|
+<p>
+&mdash; {1={attribution}}
+<em>{2={citetitle}}</em>
+{empty}
+
+[verseblock]
+|
+{empty}
+{empty}
+
+# Bibliography list.
+# Same as numbered list.
+[listdef-bibliography]
+listtag=olist
+itemtag=olistitem
+texttag=olisttext
+
+# Glossary list.
+# Same as variable list.
+[listdef-glossary]
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
diff --git a/stylesheets/docbook-xsl.css b/stylesheets/docbook-xsl.css
new file mode 100644
index 0000000..22606ed
--- /dev/null
+++ b/stylesheets/docbook-xsl.css
@@ -0,0 +1,271 @@
+/*
+ CSS stylesheet for XHTML produced by DocBook XSL stylesheets.
+ Tested with XSL stylesheets 1.61.2, 1.67.2
+*/
+
+span.strong {
+ font-weight: bold;
+}
+
+body blockquote {
+ margin-top: .75em;
+ line-height: 1.5;
+ margin-bottom: .75em;
+}
+
+html body {
+ margin: 1em 5% 1em 5%;
+ line-height: 1.2;
+}
+
+body div {
+ margin: 0;
+}
+
+h1, h2, h3, h4, h5, h6,
+div.toc p b,
+div.list-of-figures p b,
+div.list-of-tables p b,
+div.abstract p.title
+{
+ color: #527bbd;
+ font-family: tahoma, verdana, sans-serif;
+}
+
+div.toc p:first-child,
+div.list-of-figures p:first-child,
+div.list-of-tables p:first-child,
+div.example p.title
+{
+ margin-bottom: 0.2em;
+}
+
+body h1 {
+ margin: .0em 0 0 -4%;
+ line-height: 1.3;
+ border-bottom: 2px solid silver;
+}
+
+body h2 {
+ margin: 0.5em 0 0 -4%;
+ line-height: 1.3;
+ border-bottom: 2px solid silver;
+}
+
+body h3 {
+ margin: .8em 0 0 -3%;
+ line-height: 1.3;
+}
+
+body h4 {
+ margin: .8em 0 0 -3%;
+ line-height: 1.3;
+}
+
+body h5 {
+ margin: .8em 0 0 -2%;
+ line-height: 1.3;
+}
+
+body h6 {
+ margin: .8em 0 0 -1%;
+ line-height: 1.3;
+}
+
+body hr {
+ border: none; /* Broken on IE6 */
+}
+div.footnotes hr {
+ border: 1px solid silver;
+}
+
+div.navheader th, div.navheader td, div.navfooter td {
+ font-family: sans-serif;
+ font-size: 0.9em;
+ font-weight: bold;
+ color: #527bbd;
+}
+div.navheader img, div.navfooter img {
+ border-style: none;
+}
+div.navheader a, div.navfooter a {
+ font-weight: normal;
+}
+div.navfooter hr {
+ border: 1px solid silver;
+}
+
+body td {
+ line-height: 1.2
+}
+
+body th {
+ line-height: 1.2;
+}
+
+ol {
+ line-height: 1.2;
+}
+
+ul, body dir, body menu {
+ line-height: 1.2;
+}
+
+html {
+ margin: 0;
+ padding: 0;
+}
+
+body h1, body h2, body h3, body h4, body h5, body h6 {
+ margin-left: 0
+}
+
+body pre {
+ margin: 0.5em 10% 0.5em 1em;
+ line-height: 1.0;
+ color: navy;
+}
+
+tt.literal, code.literal {
+ color: navy;
+}
+
+.programlisting, .screen {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ margin: 0.5em 10% 0.5em 0;
+ padding: 0.5em 1em;
+}
+
+div.sidebar {
+ background: #ffffee;
+ margin: 1.0em 10% 0.5em 0;
+ padding: 0.5em 1em;
+ border: 1px solid silver;
+}
+div.sidebar * { padding: 0; }
+div.sidebar div { margin: 0; }
+div.sidebar p.title {
+ font-family: sans-serif;
+ margin-top: 0.5em;
+ margin-bottom: 0.2em;
+}
+
+div.bibliomixed {
+ margin: 0.5em 5% 0.5em 1em;
+}
+
+div.glossary dt {
+ font-weight: bold;
+}
+div.glossary dd p {
+ margin-top: 0.2em;
+}
+
+dl {
+ margin: .8em 0;
+ line-height: 1.2;
+}
+
+dt {
+ margin-top: 0.5em;
+}
+
+dt span.term {
+ font-style: italic;
+}
+
+div.variablelist dd p {
+ margin-top: 0;
+}
+
+div.itemizedlist li, div.orderedlist li {
+ margin-left: -0.8em;
+ margin-top: 0.5em;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+
+div.sidebar ul, div.sidebar ol {
+ margin-left: 2.8em;
+}
+
+div.itemizedlist p.title,
+div.orderedlist p.title,
+div.variablelist p.title
+{
+ margin-bottom: -0.8em;
+}
+
+div.revhistory table {
+ border-collapse: collapse;
+ border: none;
+}
+div.revhistory th {
+ border: none;
+ color: #527bbd;
+ font-family: tahoma, verdana, sans-serif;
+}
+div.revhistory td {
+ border: 1px solid silver;
+}
+
+/* Keep TOC and index lines close together. */
+div.toc dl, div.toc dt,
+div.list-of-figures dl, div.list-of-figures dt,
+div.list-of-tables dl, div.list-of-tables dt,
+div.indexdiv dl, div.indexdiv dt
+{
+ line-height: normal;
+ margin-top: 0;
+ margin-bottom: 0;
+}
+
+/*
+ Table styling does not work because of overriding attributes in
+ generated HTML.
+*/
+div.table table,
+div.informaltable table
+{
+ margin-left: 0;
+ margin-right: 5%;
+ margin-bottom: 0.8em;
+}
+div.informaltable table
+{
+ margin-top: 0.4em
+}
+div.table thead,
+div.table tfoot,
+div.table tbody,
+div.informaltable thead,
+div.informaltable tfoot,
+div.informaltable tbody
+{
+ /* No effect in IE6. */
+ border-top: 2px solid #527bbd;
+ border-bottom: 2px solid #527bbd;
+}
+div.table thead, div.table tfoot,
+div.informaltable thead, div.informaltable tfoot
+{
+ font-weight: bold;
+}
+
+div.mediaobject img {
+ border: 1px solid silver;
+ margin-bottom: 0.8em;
+}
+div.figure p.title,
+div.table p.title
+{
+ margin-top: 1em;
+ margin-bottom: 0.4em;
+}
+
+@media print {
+ div.navheader, div.navfooter { display: none; }
+}
diff --git a/stylesheets/xhtml-deprecated-manpage.css b/stylesheets/xhtml-deprecated-manpage.css
new file mode 100644
index 0000000..3cb4e21
--- /dev/null
+++ b/stylesheets/xhtml-deprecated-manpage.css
@@ -0,0 +1,21 @@
+/* Man page text is indented from headings. */
+p,ul,ol,dl,h4,h5 {
+ padding: 0 10%;
+}
+
+h2 { text-decoration: none;}
+
+/* Man page emphasis is always bold. */
+em, dt {
+ font-style: normal;
+ font-weight: bold;
+}
+
+div#synopsis p { }
+
+div.literalparagraph { margin: 0 10%; }
+div.literalblock { margin: 0 10%; }
+
+div.listingblock {
+ margin: 0 10%;
+}
diff --git a/stylesheets/xhtml-deprecated.css b/stylesheets/xhtml-deprecated.css
new file mode 100644
index 0000000..b318d3f
--- /dev/null
+++ b/stylesheets/xhtml-deprecated.css
@@ -0,0 +1,247 @@
+body {
+ background: #dedede;
+ margin: 0;
+ min-height: 480px;
+}
+
+h1,h2,h3,h4,h5 {
+ padding: 0.5em 0 0 5%;
+ text-align: left;
+ background: transparent;
+ font-family: Tahoma, Verdana, sans-serif;
+ font-weight: bold;
+ margin-top: 1.5em;
+}
+
+h1 { font-size: 200%; }
+h2 { font-size: 125%; }
+h3 { font-size: 110%; font-family: sans-serif;}
+h4 { font-size: 100%; font-style: italic; font-family: sans-serif;}
+
+h1 {
+ padding: 0.5em 0 0.5em 5%;
+ color: white;
+ background: #1f764c; /* Olive green */
+ margin: 0;
+ border-bottom: solid 1px black;
+}
+
+h2 { text-decoration: underline;}
+
+/* This is only used by level 0 sections in book document types. */
+h2.sect0 { font-size: 175%; text-decoration: underline;}
+
+span#author {
+ font-family: sans-serif;
+ font-size: larger;
+ font-weight: bold;
+}
+
+div#informalpreface p { }
+
+div.literalparagraph { margin: 0 5%; }
+div.literalblock { margin: 0 5%; }
+div.listingblock { padding: 0 5%; }
+pre.verseblock { padding: 0 5%; }
+
+p.verseblock {
+ white-space: pre;
+}
+
+a {
+ font-weight: bold;
+ background: #ffd; /* Light yellow */
+ color: #093; /* Green */
+ text-decoration: none;
+}
+a:hover { text-decoration: underline; }
+
+p { padding: 0 5%; }
+
+ul,ol {
+ padding: 0 5%;
+ margin-left: 1.75em;
+ list-style-position: outside;
+}
+ol ol, ol ul, ul ol, ul ul, dd ol, dd ul {
+ margin-left: 0;
+}
+/* Keep lists close to preceeding titles. Broken in IE6. */
+p.listtitle + ul, p.listtitle + ol, p.listtitle + dl {
+ margin-top: 0;
+}
+
+dl { padding: 0 5%; }
+dt { font-style: italic; }
+dd, li { padding-bottom: 0.5em; }
+dd p, li p { margin: 0 0 0.4em; padding: 0; }
+li div.literalparagraph { margin-left: 0; }
+div.literalparagraph pre, li div.literalparagraph pre { margin-left: 2%; }
+div.listingblock, li div.listingblock { margin-left: 0; }
+li div.literalblock { margin-left: 0; }
+dd div.literalblock { margin-left: 0; }
+div.literalblock pre, li div.literalblock pre { margin-left: 2%; }
+dd div.literalparagraph { margin-left: 0; }
+dd div.literalparagraph pre { margin-left: 2%; }
+
+.listingblock, .literalparagraph, .literalblock, tt {
+ color: #461b7e;
+}
+
+div.listingblock pre {
+ background: #f0f0f0;
+ border: 1px dashed gray;
+ padding: 0.5em 1em;
+}
+
+table {
+ margin-left: 5%;
+ margin-right: 5%;
+}
+thead,tfoot,tbody {
+ /* No effect in IE6. */
+ border-top: 2px solid green;
+ border-bottom: 2px solid green;
+}
+thead,tfoot {
+ font-weight: bold;
+}
+
+table.hlist td:first-child { font-style: italic; }
+
+p.listtitle {
+ margin-top: 1.5em;
+ margin-bottom: 0.2em;
+}
+p.tabletitle {
+ margin-top: 1.5em;
+ margin-bottom: 0.5em;
+}
+p.blocktitle {
+ margin-top: 1.5em;
+ margin-bottom: 0.2em;
+}
+p.imagetitle {
+ margin-top: 0.2em;
+ margin-bottom: 1.5em;
+}
+div.image img {
+ border: 1px solid #ece9d8;
+}
+a.imagelink > img:hover { border: 1px solid #093; } /* IE6 broken */
+a.imagelink > img { border: 1px solid transparent; }
+a.imagelink {
+ /* Don't use text link colors. */
+ background: transparent;
+ color: white;
+}
+
+div#content {
+ margin: 50px 3em 3em 140px;
+ border-top: 1px solid black;
+ border-left: 1px solid black;
+ border-right: 2px solid black;
+ border-bottom: 2px solid black;
+ background: white;
+}
+
+div#footer {
+ background: #f0f0f0;
+ font: 8pt sans-serif;
+ margin-top: 2em;
+ margin-bottom: 0;
+ padding: 0.8em 0 0.8em 0;
+ position: relative;
+ bottom: 0;
+ border-top: 1px solid silver;
+}
+
+div#footer table {
+ margin-left: 2%;
+}
+
+div#footer p {
+ margin: .5em 0 0 0;
+ padding: 0 5%;
+}
+
+div#footer a {
+ color: black;
+ background: transparent;
+ text-decoration: underline;
+}
+
+div#badges {
+ padding: 0 15px;
+}
+
+div#badges td {
+ vertical-align: middle;
+}
+
+div#badges img {
+ border-style: none;
+}
+
+/*
+ * Style sheet rules that are applied using element class attributes.
+ */
+
+div.image {
+ width: 100%;
+ border-style: none;
+ margin-bottom: 1.5em;
+ margin-left: 1em; /* for IE5,6 misbehavior */
+ padding: 0;
+ text-align: left;
+}
+div.admonition {
+ margin: 1.0em 20% 1.0em 5%;
+}
+div.admonition div.text * { padding: 0; }
+div.admonition div.icon {
+ float: left;
+ width: 56px;
+}
+div.admonition div.text {
+ margin-left: 56px;
+ padding-top: 1px;
+}
+div.admonition div.text * { padding: 0; }
+div.clear {
+ clear: both;
+}
+
+/* Print nicely. */
+@media print {
+ @page { margin: 10% } /* This _is_ valid CSS2. */
+ h1,h2,h3,h4 { page-break-after: avoid; page-break-inside: avoid }
+ blockquote,pre { page-break-inside: avoid }
+ ul,ol,dl { page-break-before: avoid }
+ /* Override existing property settings. */
+ h1,a { color: black; background: white; }
+ div#content { margin: 0; border: 0; }
+ div#footer { display: none; }
+ /* IE5,6 only has the problem displaying, so restore margin for printing */
+ div.image { margin-left: 0; }
+ p.imagetitle { page-break-before: avoid; }
+ p.blocktitle, tabletitle { page-break-after: avoid; }
+}
+
+div.sidebarblock, exampleblock {
+ margin: 0.5em 20% 0.5em 5%;
+ padding: 0.5em 1em;
+ border: 1px solid silver;
+}
+div.sidebarblock *, exampleblock * { padding: 0; }
+div.sidebarblock div, exampleblock div { margin: 0; }
+div.sidebarblock {
+ background: #ffffee;
+}
+p.sidebartitle {
+ font-family: sans-serif;
+ font-weight: bold;
+ margin-top: 0.5em;
+ margin-bottom: 0.2em;
+}
+
diff --git a/stylesheets/xhtml11-manpage.css b/stylesheets/xhtml11-manpage.css
new file mode 100644
index 0000000..be16440
--- /dev/null
+++ b/stylesheets/xhtml11-manpage.css
@@ -0,0 +1,13 @@
+/* Overrides for manpage documents */
+h1 {
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+ border-top: 2px solid silver;
+ border-bottom: 2px solid silver;
+}
+h2 {
+ border-style: none;
+}
+div.sectionbody {
+ margin-left: 5%;
+}
diff --git a/stylesheets/xhtml11-quirks.css b/stylesheets/xhtml11-quirks.css
new file mode 100644
index 0000000..7478972
--- /dev/null
+++ b/stylesheets/xhtml11-quirks.css
@@ -0,0 +1,31 @@
+/* Workarounds for IE6's broken and incomplete CSS2. */
+
+div.sidebar-content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+div.sidebar-title, div.image-title {
+ font-family: sans-serif;
+ font-weight: bold;
+ margin-top: 0.0em;
+ margin-bottom: 0.5em;
+}
+
+div.listingblock div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock-content {
+ padding-left: 2.0em;
+}
+
+div.exampleblock-content {
+ border-left: 2px solid silver;
+ padding-left: 0.5em;
+}
+
+/* IE6 sets dynamically generated links as visited. */
+div#toc a:visited { color: blue; }
diff --git a/stylesheets/xhtml11.css b/stylesheets/xhtml11.css
new file mode 100644
index 0000000..1e2a373
--- /dev/null
+++ b/stylesheets/xhtml11.css
@@ -0,0 +1,266 @@
+/* Debug borders */
+p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
+/*
+ border: 1px solid red;
+*/
+}
+
+body {
+ margin: 1em 5% 1em 5%;
+}
+
+a {
+ color: blue;
+ text-decoration: underline;
+}
+a:visited {
+ color: fuchsia;
+}
+
+em {
+ font-style: italic;
+}
+
+strong {
+ font-weight: bold;
+}
+
+tt {
+ color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #527bbd;
+ font-family: sans-serif;
+ margin-top: 1.2em;
+ margin-bottom: 0.5em;
+ line-height: 1.3;
+}
+
+h1, h2, h3 {
+ border-bottom: 2px solid silver;
+}
+h2 {
+ padding-top: 0.5em;
+}
+h3 {
+ float: left;
+}
+h3 + * {
+ clear: left;
+}
+
+div.sectionbody {
+ font-family: serif;
+ margin-left: 0;
+}
+
+hr {
+ border: 1px solid silver;
+}
+
+p {
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+}
+
+pre {
+ padding: 0;
+ margin: 0;
+}
+
+span#author {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-weight: bold;
+ font-size: 1.1em;
+}
+span#email {
+}
+span#revision {
+ font-family: sans-serif;
+}
+
+div#footer {
+ font-family: sans-serif;
+ font-size: small;
+ border-top: 2px solid silver;
+ padding-top: 0.5em;
+ margin-top: 4.0em;
+}
+div#footer-text {
+ float: left;
+ padding-bottom: 0.5em;
+}
+div#footer-badges {
+ float: right;
+ padding-bottom: 0.5em;
+}
+
+div#preamble,
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+ margin-right: 10%;
+ margin-top: 1.5em;
+ margin-bottom: 1.5em;
+}
+div.admonitionblock {
+ margin-top: 2.5em;
+ margin-bottom: 2.5em;
+}
+
+div.content { /* Block element content. */
+ padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+ font-family: sans-serif;
+ font-weight: bold;
+ text-align: left;
+ margin-top: 1.0em;
+ margin-bottom: 0.5em;
+}
+div.title + * {
+ margin-top: 0;
+}
+
+td div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content div.title:first-child {
+ margin-top: 0.0em;
+}
+div.content + div.title {
+ margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+ background: #ffffee;
+ border: 1px solid silver;
+ padding: 0.5em;
+}
+
+div.listingblock {
+ margin-right: 0%;
+}
+div.listingblock > div.content {
+ border: 1px solid silver;
+ background: #f4f4f4;
+ padding: 0.5em;
+}
+
+div.quoteblock > div.content {
+ padding-left: 2.0em;
+}
+
+div.attribution {
+ text-align: right;
+}
+div.verseblock + div.attribution {
+ text-align: left;
+}
+
+div.admonitionblock .icon {
+ vertical-align: top;
+ font-size: 1.1em;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #527bbd;
+ padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+ padding-left: 0.5em;
+ border-left: 2px solid silver;
+}
+
+div.exampleblock > div.content {
+ border-left: 2px solid silver;
+ padding: 0.5em;
+}
+
+div.verseblock div.content {
+ white-space: pre;
+}
+
+div.imageblock div.content { padding-left: 0; }
+div.imageblock img { border: 1px solid silver; }
+span.image img { border-style: none; }
+
+dl {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+dt {
+ margin-top: 0.5em;
+ margin-bottom: 0;
+ font-style: italic;
+}
+dd > *:first-child {
+ margin-top: 0;
+}
+
+ul, ol {
+ list-style-position: outside;
+}
+div.olist2 ol {
+ list-style-type: lower-alpha;
+}
+
+div.tableblock > table {
+ border: 3px solid #527bbd;
+}
+thead {
+ font-family: sans-serif;
+ font-weight: bold;
+}
+tfoot {
+ font-weight: bold;
+}
+
+div.hlist {
+ margin-top: 0.8em;
+ margin-bottom: 0.8em;
+}
+div.hlist td {
+ padding-bottom: 5px;
+}
+td.hlist1 {
+ vertical-align: top;
+ font-style: italic;
+ padding-right: 0.8em;
+}
+td.hlist2 {
+ vertical-align: top;
+}
+
+@media print {
+ div#footer-badges { display: none; }
+}
+
+div#toctitle {
+ color: #527bbd;
+ font-family: sans-serif;
+ font-size: 1.1em;
+ font-weight: bold;
+ margin-top: 1.0em;
+ margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+ margin-top: 0;
+ margin-bottom: 0;
+}
+div.toclevel2 {
+ margin-left: 2em;
+ font-size: 0.9em;
+}
+div.toclevel3 {
+ margin-left: 4em;
+ font-size: 0.9em;
+}
+div.toclevel4 {
+ margin-left: 6em;
+ font-size: 0.9em;
+}
diff --git a/text.conf b/text.conf
new file mode 100644
index 0000000..60a183e
--- /dev/null
+++ b/text.conf
@@ -0,0 +1,16 @@
+# text.conf
+# Used by the AsciiDoc a2x(1) toolchain wrapper utility.
+# Filters to add leading blank line and margin indent to verbatim
+# block elements so lynx(1) generated text output looks nicer.
+
+[paradef-default]
+verse-style=template="verseparagraph",filter="echo; echo; sed 's/^/ /'"
+
+[paradef-literal]
+filter=echo; echo; sed 's/^/ /'
+
+[blockdef-listing]
+filter=echo; sed 's/^/ /'
+
+[blockdef-literal]
+filter=echo; sed 's/^/ /'
diff --git a/uninstall.sh b/uninstall.sh
new file mode 120000
index 0000000..61e71e2
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1 @@
+install.sh \ No newline at end of file
diff --git a/vim/ftdetect/asciidoc_filetype.vim b/vim/ftdetect/asciidoc_filetype.vim
new file mode 100644
index 0000000..4311125
--- /dev/null
+++ b/vim/ftdetect/asciidoc_filetype.vim
@@ -0,0 +1,53 @@
+" Vim filetype detection file
+" Language: AsciiDoc
+" Author: Stuart Rackham <srackham@methods.co.nz>
+" Last Change: AsciiDoc 8.2.0
+" URL: http://www.methods.co.nz/asciidoc/
+" Licence: GPL (http://www.gnu.org)
+" Remarks: Vim 6 or greater
+
+" COMMENT OUT ONE OF THE TWO FOLLOWING COMMANDS
+" The first sets asciidoc syntax highlighting on all .txt files, the second
+" only existing files *.txt that appear to be AsciiDoc files.
+
+au BufNewFile,BufRead *.txt setfiletype asciidoc
+"au BufRead *.txt call s:FTasciidoc()
+
+" This function checks for a valid AsciiDoc document title after first
+" skipping any leading comments.
+function! s:FTasciidoc()
+ let in_comment_block = 0
+ let n = 1
+ while n < 50
+ let line = getline(n)
+ let n = n + 1
+ if line =~ '^/\{4,}$'
+ if ! in_comment_block
+ let in_comment_block = 1
+ else
+ let in_comment_block = 0
+ endif
+ continue
+ endif
+ if in_comment_block
+ continue
+ endif
+ if line !~ '\(^//\)\|\(^\s*$\)'
+ break
+ endif
+ endwhile
+ if line !~ '.\{3,}'
+ return
+ endif
+ let len = len(line)
+ let line = getline(n)
+ if line !~ '[-=]\{3,}'
+ return
+ endif
+ if len < len(line) - 3 || len > len(line) + 3
+ return
+ endif
+ setfiletype asciidoc
+endfunction
+
+" vim: et sw=2 ts=2 sts=2:
diff --git a/vim/syntax/asciidoc.vim b/vim/syntax/asciidoc.vim
new file mode 100644
index 0000000..46405b9
--- /dev/null
+++ b/vim/syntax/asciidoc.vim
@@ -0,0 +1,128 @@
+" Vim syntax file
+" Language: AsciiDoc
+" Author: Stuart Rackham <srackham@methods.co.nz> (inspired by Felix
+" Obenhuber's original asciidoc.vim script).
+" Last Change: AsciiDoc 8.2.0
+" URL: http://www.methods.co.nz/asciidoc/
+" Licence: GPL (http://www.gnu.org)
+" Remarks: Vim 6 or greater
+" Limitations: See 'Appendix J: Vim Syntax Highlighter' in the AsciiDoc 'User
+" Guide'.
+
+if exists("b:current_syntax")
+ finish
+endif
+
+syn clear
+syn sync fromstart
+syn sync linebreaks=1
+
+" Run :help syn-priority to review syntax matching priority.
+syn keyword asciidocToDo TODO FIXME XXX ZZZ
+syn match asciidocBackslash /\\/
+syn region asciidocIdMarker start=/^\$Id:\s/ end=/\s\$$/
+syn match asciidocCallout /\\\@<!<\d\{1,2}>/
+syn match asciidocListBlockDelimiter /^--$/
+syn match asciidocLineBreak /[ \t]+$/
+syn match asciidocRuler /^'\{4,}$/
+" The tricky part is not triggering on indented list items that are also
+" preceeded by blank line, handles only bulleted items (see 'Limitations' above
+" for workarounds).
+syn region asciidocLiteralParagraph start=/^\n[ \t]\+\(\([^-*. \t] \)\|\(\S\S\)\)/ end=/\(^+\?\s*$\)\@=/
+syn match asciidocListBullet /^\s*[-*+]\s/
+syn match asciidocListNumber /^\s*\(\d*\.\{1,2}\|\l\?)\)\s\+/
+syn match asciidocEmail /\S\+@\S\+\(.\S+\)*/
+syn match asciidocAttributeRef /{\(\w\|-\)\+}/
+syn match asciidocBlockTitle /^\.[^. \t].*[^-~_]$/
+syn match asciidocAdmonition /^\u\{3,15}:\(\s\+.*\)\@=/
+syn region asciidocSubscript start=/\~\S/ end=/\(\~\|^$\)/
+syn region asciidocSuperscript start=/\^\S/ end=/\(\^\|^$\)/
+syn region asciidocAttributeEntry start=/^:\a/ end=/:\(\s\|$\)/ oneline
+syn region asciidocVLabel start=/^\s*/ end=/\S\(::\|;;\|:-\|??\)$/ oneline
+syn region asciidocHLabel start=/^\s*/ end=/\S\(::\|;;\)\(\s\+\|\\$\)/ oneline
+syn region asciidocMacroAttributes matchgroup=asciidocRefMacro start=/<<\w\(\w\|-\)*,\?/ end=/>>/
+syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\[\{2}\(\w\|-\)\+,\?/ end=/\]\{2}/
+syn region asciidocMacroAttributes matchgroup=asciidocAnchorMacro start=/\[\{3}\(\w\|-\)\+/ end=/\]\{3}/
+syn region asciidocMacroAttributes matchgroup=asciidocMacro start=/\w\(\w\|-\)*:\S\{-}\[/ skip=/\\\]/ end=/\]/
+syn region asciidocMacroAttributes matchgroup=asciidocIndexTerm start=/(\{2,3}/ end=/)\{2,3}/
+syn match asciidocCommentLine "^//\([^/].*\|\)$" contains=asciidocToDo
+" As a damage control measure quoted patterns always terminate at a blank
+" line (see 'Limitations' above).
+syn region asciidocMonospaced start=/\(^\|[ \t(\[.,]\)\@<=+\([ )]\)\@!/ end=/\(+\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocMonospaced2 start=/\(^\|[ \t(\[.,]\)\@<=`\([ )]\)\@!/ end=/\(`\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocUnconstrainedMonospaced start=/++\S/ end=/\(++\|^$\)/
+syn region asciidocEmphasized start=/\(^\|[ \t(\[.,]\)\@<=_\([ )]\)\@!/ end=/\(_\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocEmphasized2 start=/\(^\|[ \t(\[.,]\)\@<='\([ )]\)\@!/ end=/\('\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocUnconstrainedEmphasized start=/__\S/ end=/\(__\|^$\)/
+syn region asciidocBold start=/\(^\|[ \t(\[.,]\)\@<=\*\([ )]\)\@!/ end=/\(\*\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocUnconstrainedBold start=/\*\*\S/ end=/\(\*\*\|^$\)/
+syn region asciidocQuoted start=/\(^\|[ \t(\[.,]\)\@<=``\([ )]\)\@!/ end=/\(''\([ \t)\],.?!;:]\|$\)\@=\|^$\)/
+syn region asciidocDoubleDollarPassthrough start=/\(^\|\W\)\@<=\$\{2,3}\S/ end=/\(\$\{2,3}\(\W\|$\)\@=\|^$\)/
+syn region asciidocTriplePlusPassthrough start=/\(^\|\W\)\@<=+++\S/ end=/\(+++\(\W\|$\)\@=\|^$\)/
+syn region asciidocTable start=/^\([`.']\d*[-~_]*\)\+[-~_]\+\d*$/ end=/^$/
+syn match asciidocOneLineTitle /^=\{1,5}\s\+\S.*$/
+syn match asciidocTwoLineTitle /^[^. +/].*[^.:]\n[-=~^+]\{2,}$/
+syn match asciidocAttributeList /^\[[^[ \t].*\]$/
+syn match asciidocQuoteBlockDelimiter /^_\{4,}$/
+syn match asciidocExampleBlockDelimiter /^=\{4,}$/
+syn match asciidocSidebarDelimiter /^*\{4,}$/
+syn match asciidocListContinuation /^+$/
+syn region asciidocLiteralBlock start=/^\.\{4,}$/ end=/^\.\{4,}$/ contains=asciidocCallout
+syn region asciidocListingBlock start=/^-\{4,}$/ end=/^-\{4,}$/ contains=asciidocCallout
+syn region asciidocCommentBlock start="^/\{4,}$" end="^/\{4,}$"
+syn region asciidocPassthroughBlock start="^+\{4,}$" end="^+\{4,}$"
+syn region asciidocFilterBlock start=/^\w\+\~\{4,}$/ end=/^\w\+\~\{4,}$/
+
+highlight link asciidocMacroAttributes Label
+highlight link asciidocIdMarker Special
+highlight link asciidocDoubleDollarPassthrough Special
+highlight link asciidocTriplePlusPassthrough Special
+highlight link asciidocSubscript Type
+highlight link asciidocSuperscript Type
+highlight link asciidocOneLineTitle Title
+highlight link asciidocTwoLineTitle Title
+highlight link asciidocBlockTitle Title
+highlight link asciidocRefMacro Macro
+highlight link asciidocIndexTerm Macro
+highlight link asciidocMacro Macro
+highlight link asciidocAnchorMacro Macro
+highlight link asciidocEmail Macro
+highlight link asciidocListBullet Label
+highlight link asciidocListNumber Label
+highlight link asciidocVLabel Label
+highlight link asciidocHLabel Label
+highlight link asciidocTable Type
+highlight link asciidocListBlockDelimiter Label
+highlight link asciidocListContinuation Label
+highlight link asciidocLiteralParagraph Identifier
+highlight link asciidocQuoteBlockDelimiter Type
+highlight link asciidocExampleBlockDelimiter Type
+highlight link asciidocSidebarDelimiter Type
+highlight link asciidocLiteralBlock Identifier
+highlight link asciidocListingBlock Identifier
+highlight link asciidocPassthroughBlock Identifier
+highlight link asciidocCommentBlock Comment
+highlight link asciidocFilterBlock Type
+highlight link asciidocBold Special
+highlight link asciidocUnconstrainedBold Special
+highlight link asciidocEmphasized Type
+highlight link asciidocEmphasized2 Type
+highlight link asciidocUnconstrainedEmphasized Type
+highlight link asciidocMonospaced Identifier
+highlight link asciidocMonospaced2 Identifier
+highlight link asciidocUnconstrainedMonospaced Identifier
+highlight link asciidocQuoted Label
+highlight link asciidocToDo Todo
+highlight link asciidocCommentLine Comment
+highlight link asciidocAdmonition Special
+highlight link asciidocAttributeRef Special
+highlight link asciidocAttributeList Special
+highlight link asciidocAttributeEntry Special
+highlight link asciidocBackslash Special
+highlight link asciidocCallout Label
+highlight link asciidocLineBreak Special
+highlight link asciidocRuler Type
+
+let b:current_syntax = "asciidoc"
+
+" vim: wrap et sw=2 sts=2:
diff --git a/xhtml-deprecated-css.conf b/xhtml-deprecated-css.conf
new file mode 100644
index 0000000..c6be98a
--- /dev/null
+++ b/xhtml-deprecated-css.conf
@@ -0,0 +1,235 @@
+#
+# xhtml-deprecated-css.conf
+#
+# Legacy AsciiDoc 6 xhtml backend.
+# Included in xhtml-deprecated.conf
+#
+
+[tags]
+# Add title class.
+ilist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<ul>|</ul>
+olist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<ol>|</ol>
+vlist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<dl>|</dl>
+hlist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<table class="hlist">|</table>
+qlist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<ol>|</ol>
+colist={id?<a name="{id}"></a>}{title?<p class="listtitle"><b>{title}</b></p>}<ol>|</ol>
+
+[image-inlinemacro]
+<a class="imagelink" href="{link}">
+# border="0" so broken IE6 does not put border round linked image.
+ <img src="{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"} border="0"/>
+{link#}</a>
+
+[image-blockmacro]
+<div class="image">
+ <a name="{id}"></a>
+ <p>{link?<a class="imagelink" href="{link}">}
+# border="0" so broken IE6 does not put border round linked image.
+ <img src="{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"} border="0"/>
+ {link?</a>}</p>
+ <p class="imagetitle"><b>Figure:</b> {title}</p>
+</div>
+
+# Paragraph substitution.
+[literalparagraph]
+<a name="{id}"></a>
+<p class="blocktitle"><b>Example:</b> {title}</p>
+<div class="literalparagraph"><pre>|</pre></div>
+
+# Admonition paragraphs.
+[admonitionparagraph]
+<div class="admonition">
+<a name="{id}"></a>
+# For backward compatibility still accept deprecated imagesdir attribute.
+{icons#}<div class="icon"><img src="{imagesdir={iconsdir}}/{name}.png" alt="{caption}" /></div>
+<div class="text"><p><b>{style}:</b> |</p></div>
+<div class="clear"></div>
+</div>
+
+# Delimited block substitution.
+[literalblock]
+<a name="{id}"></a>
+<p class="blocktitle"><b>Example:</b> {title}</p>
+<div class="literalblock"><pre>
+|
+</pre></div>
+
+[listingblock]
+<a name="{id}"></a>
+<p class="blocktitle"><b>Example:</b> {title}</p>
+<div class="listingblock"><pre>
+|
+</pre></div>
+
+[sidebarblock]
+<div class="sidebarblock">
+<a name="{id}"></a>
+<p class="sidebartitle">{title}</p>
+|
+</div>
+
+[passthroughblock]
+|
+
+[exampleblock]
+<a name="{id}"></a>
+<p class="blocktitle"><b>Example:</b> {title}</p>
+<div class="exampleblock">
+|
+</div>
+
+# Admonition blocks.
+[admonitionblock]
+<div class="admonition">
+<a name="{id}"></a>
+# For backward compatibility still accept deprecated imagesdir attribute.
+{icons#}<div class="icon"><img src="{imagesdir={iconsdir}}/{name}.png" alt="{caption}" /></div>
+<div class="text">
+<p><b>{title={style}}</b></p>
+|</div>
+<div class="clear"></div>
+</div>
+
+[verseblock]
+<p class="verseblock">{id?<a name="{id}"></a>}{title?<b>{title}</b><br />}
+|
+</p>
+
+[table]
+# Table captions not used because IE6 is broken.
+<p class="tabletitle"><b>Table:</b> {title}</p>
+# If you want styled table borders in IE use the following table tag:
+# 1. Border style specified here rather than in CSS because IE6 is broken.
+# 2. bordercolor attribute is IE specific and not valid XHTML 1.0.
+#<table rules="groups" border="2" bordercolor="green" frame="hsides"
+# cellspacing="0" cellpadding="4">
+#
+# Use this in preference to be strictly XHTML 1.0 conformant.
+<a name="{id}"></a>
+<table class="tableblock" rules="{grid=none}"
+frame="{frame%hsides}"
+frame="{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}"
+cellspacing="0" cellpadding="4">
+{headrows#}<thead{noborders? style="border-width: 0;"}>
+{headrows}
+{headrows#}</thead>
+{footrows#}<tfoot{noborders? style="border-width: 0;"}>
+{footrows}
+{footrows#}</tfoot>
+<tbody{noborders? style="border-width: 0;"}>
+{bodyrows}
+</tbody>
+</table>
+
+[preamble]
+# Untitled elements between header and first section title.
+<div id="preamble">
+<a name="{id}"></a>
+|
+</div>
+
+[sect0]
+<h2 class="sect0">{id?<a name="{id}"></a>}{title}</h2>
+|
+
+[sect1]
+<h2>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h2>
+|
+
+[sect2]
+<h3>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h3>
+|
+
+[sect3]
+<h4>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h4>
+|
+
+[sect4]
+<h5>{id?<a name="{id}"></a>}{title}</h5>
+|
+
+[footer]
+<div id="footer">
+<p>
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</p>
+</div>
+</div>
+</body>
+</html>
+
+#-------------------------
+# article and book document types
+# Both use the article.css stylesheet
+#-------------------------
+ifndef::doctype-manpage[]
+
+[header]
+<!DOCTYPE html {dtddecl}>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}" />
+<meta name="generator" content="AsciiDoc {asciidoc-version}" />
+ifdef::linkcss[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}.css" type="text/css" />
+endif::linkcss[]
+ifndef::linkcss[]
+<style type="text/css">
+include1::./stylesheets/{theme={backend}}.css[]
+</style>
+endif::linkcss[]
+<title>{doctitle}</title>
+</head>
+<body>
+<div id="content">
+<h1>{doctitle}</h1>
+<p>
+<span id="author">by {author}</span><br />
+<tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt><br />
+v{revision}{date?,}
+{date}
+</p>
+
+endif::doctype-manpage[]
+
+#-------------------------
+# manpage document type
+#-------------------------
+ifdef::doctype-manpage[]
+
+[header]
+<!DOCTYPE html {dtddecl}>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}" />
+<meta name="generator" content="AsciiDoc {asciidoc-version}" />
+ifdef::linkcss[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}.css" type="text/css" />
+<link rel="stylesheet" href="{stylesdir=.}/{backend}-manpage.css" type="text/css" />
+endif::linkcss[]
+ifndef::linkcss[]
+<style type="text/css">
+include1::./stylesheets/{theme={backend}}.css[]
+include1::./stylesheets/{theme={backend}}-manpage.css[]
+</style>
+endif::linkcss[]
+<title>{mantitle}</title>
+</head>
+<body>
+<div id="content">
+<h1>{doctitle} Manual Page</h1>
+<h2>NAME</h2>
+<p>{manname} -
+ {manpurpose}
+</p>
+
+# Section macros
+[sect-synopsis]
+<div id="synopsis">
+<a name="{id}"></a>
+<h2>SYNOPSIS</h2>
+|
+</div>
+
+endif::doctype-manpage[]
diff --git a/xhtml-deprecated.conf b/xhtml-deprecated.conf
new file mode 100644
index 0000000..716b363
--- /dev/null
+++ b/xhtml-deprecated.conf
@@ -0,0 +1,352 @@
+#
+# xhtml-deprecated.conf
+#
+# Asciidoc configuration file.
+# Legacy AsciiDoc 6 xhtml backend.
+#
+[miscellaneous]
+outfilesuffix=.html
+# Screen width in pixels.
+pagewidth=800
+pageunits=
+
+[attributes]
+basebackend=html
+basebackend-html=
+dtddecl=PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+[replacements]
+# Line break.
+(?m)^(.*)\s\+$=\1<br />
+# Superscripts.
+\^(.+?)\^=<sup>\1</sup>
+# Subscripts.
+~(.+?)~=<sub>\1</sub>
+
+[ruler-blockmacro]
+<hr />
+
+[image-inlinemacro]
+<a href="{link}">
+ <img src="{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"}/>
+{link#}</a>
+
+[image-blockmacro]
+<a name="{id}"></a>
+<a href="{link}">
+ <img src="{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"}/>
+{link#}</a>
+<p><b>Figure:</b> {title}</p>
+
+[indexterm-inlinemacro]
+# Inline index term.
+{empty}
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+<br />[{0}]<br />
+
+[callout-inlinemacro]
+# Inline callout.
+<b>({index})</b>
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ilist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ul>|</ul>
+ilistitem=<li>|</li>
+ilisttext=<p>|</p>
+olist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+olist2={id?<a name="{id}"></a>}<ol type="a">|</ol>
+olistitem=<li>|</li>
+olisttext=<p>|</p>
+vlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<dl>|</dl>
+vlistentry=|
+vlistterm=<dt>|</dt>
+vlistitem=<dd>|</dd>
+vlisttext=<p>|</p>
+# Horizontal labeled list.
+hlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<table cellpadding="4">|</table>
+hlistentry=<tr valign="top">|</tr>
+hlisttext=|
+hlistterm=<td{1? width="{1}%"}>|</td>
+hlistitem=<td{2? width="{2}%"}>|</td>
+# Question and Answer list.
+qlist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+qlistentry=<li>|</li>
+qlistterm=<p><em>|</em></p>
+qlistitem=|
+qlisttext=<p>|</p>
+# Callout list.
+colist={id?<a name="{id}"></a>}{title?<p><b>{title}</b></p>}<ol>|</ol>
+colistitem=<li>|</li>
+colisttext=<p>|</p>
+
+# Quoted text.
+emphasis=<em>|</em>
+strong=<strong>|</strong>
+monospaced=<tt>|</tt>
+quoted={amp}#8220;|{amp}#8221;
+
+# Inline macros
+[http-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[https-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[ftp-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[file-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[mailto-inlinemacro]
+<a href="{name}:{target}">{0={target}}</a>
+[link-inlinemacro]
+<a href="{target}">{0={target}}</a>
+# anchor:id[text]
+[anchor-inlinemacro]
+<a name="{target}"></a>
+# [[id,text]]
+[anchor2-inlinemacro]
+<a name="{1}"></a>
+# [[[id]]]
+[anchor3-inlinemacro]
+<a name="{1}">[{1}]</a>
+# xref:id[text]
+[xref-inlinemacro]
+<a href="#{target}">{0=[{target}]}</a>
+# <<id,text>>
+[xref2-inlinemacro]
+<a href="#{1}">{2=[{1}]}</a>
+
+# Special word substitution.
+[emphasizedwords]
+<em>{words}</em>
+[monospacedwords]
+<tt>{words}</tt>
+[strongwords]
+<strong>{words}</strong>
+
+# Paragraph substitution.
+[paragraph]
+<p>{id?<a name="{id}"></a>}{title?<b>{title}</b><br />}
+|
+</p>
+
+[literalparagraph]
+# The literal block employs the same markup.
+template::[literalblock]
+
+[verseparagraph]
+# The verse block employs the same markup.
+template::[verseblock]
+
+[admonitionparagraph]
+<a name="{id}"></a>
+<p><b>{style}:</b> |</p>
+
+# Delimited blocks.
+[passthroughblock]
+|
+
+[listingblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td>
+<pre>
+|
+</pre>
+</td></tr></table>
+
+[literalblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+<pre>
+|
+</pre>
+
+[verseblock]
+<a name="{id}"></a>
+<p><b>{title}</b></p>
+# Font inheritance broken in IE6.
+<pre style="font-family: inherit;">
+|
+</pre>
+
+[sidebarblock]
+<a name="{id}"></a>
+<table frame="border" bgcolor="#ffffee" width="80%" cellpadding="15">
+<tr><td>
+<p><em>{title}</em></p>
+|
+</td></tr></table>
+
+[quoteblock]
+<a name="{id}"></a>
+<blockquote>
+<p><b>{title}</b></p>
+|
+<p align="right">
+<em>{citetitle}</em><br />
+&#8212; {attribution}
+</p>
+</blockquote>
+
+[exampleblock]
+<a name="{id}"></a>
+<p><b>Example:</b> {title}</p>
+<table frame="border" bgcolor="white" width="80%" cellpadding="15">
+<tr><td>
+|
+</td></tr></table>
+
+[admonitionblock]
+<a name="{id}"></a>
+<table frame="void" bgcolor="white" width="80%" cellpadding="8">
+<tr valign="top"><td><p><b>{style}</b></p></td><td>
+<p><b>{title}</b></p>
+|
+</td></tr></table>
+
+# Bibliography list.
+# Same as numbered list.
+[listdef-bibliography]
+listtag=olist
+itemtag=olistitem
+texttag=olisttext
+
+# Glossary list.
+# Same as labeled list.
+[listdef-glossary]
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+# Tables.
+[tabledef-default]
+template=table
+bodyrow=<tr>|</tr>
+headdata=<th align="{colalign}" width="{colwidth}{pageunits}">|</th>
+footdata=<td align="{colalign}" width="{colwidth}{pageunits}"><strong>|</strong></td>
+bodydata=<td align="{colalign}" width="{colwidth}{pageunits}" valign="top">|</td>
+
+[table]
+<p><b>Table:</b> {title}</p>
+<a name="{id}"></a>
+<table rules="{grid=none}"
+frame="{frame%hsides}"
+frame="{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}"
+cellspacing="0" cellpadding="4">
+{headrows#}<thead>
+{headrows}
+{headrows#}</thead>
+{footrows#}<tfoot>
+{footrows}
+{footrows#}</tfoot>
+<tbody>
+{bodyrows}
+</tbody>
+</table>
+
+[footer]
+<p></p>
+<p></p>
+<hr /><p><small>
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</small></p>
+</body>
+</html>
+
+[preamble]
+# Untitled elements between header and first section title.
+<a name="{id}"></a>
+|
+
+[sect0]
+{doctype-manpage%}<hr />
+<h1>{id?<a name="{id}"></a>}{title}</h1>
+|
+
+[sect1]
+{doctype-manpage%}<hr />
+<h2>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h2>
+|
+
+[sect2]
+<h3>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h3>
+|
+
+[sect3]
+<h4>{id?<a name="{id}"></a>}{numbered?{sectnum} }{title}</h4>
+|
+
+[sect4]
+<h5>{id?<a name="{id}"></a>}{title}</h5>
+|
+
+#-------------------------
+# article and book document types
+#-------------------------
+ifndef::doctype-manpage[]
+
+[header]
+<!DOCTYPE html {dtddecl}>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}"/>
+<meta name="generator" content="AsciiDoc {asciidoc-version}"/>
+<title>{doctitle}</title>
+</head>
+<body>
+<h1>{doctitle}</h1>
+<p>
+<strong>by {author}</strong><br />
+<tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt><br />
+v{revision}{date?,}
+{date}
+</p>
+
+endif::doctype-manpage[]
+
+#-------------------------
+# manpage document type
+#-------------------------
+ifdef::doctype-manpage[]
+
+[tags]
+# This is more inline with man page convention.
+emphasis=<b>|</b>
+vlistterm=<dt><b>|</b></dt>
+
+[header]
+<!DOCTYPE html {dtddecl}>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset={encoding=ISO-8859-1}"/>
+<meta name="generator" content="AsciiDoc {asciidoc-version}"/>
+<title>{mantitle}</title>
+</head>
+<body>
+<hr />
+<h1>
+ {doctitle} Manual Page
+</h1>
+<hr />
+<h2>NAME</h2>
+<p>{manname} -
+ {manpurpose}
+</p>
+
+[sect-synopsis]
+template::[sect1]
+
+endif::doctype-manpage[]
+
+ifdef::css[]
+include::xhtml-deprecated-css.conf[]
+endif::css[]
diff --git a/xhtml11-quirks.conf b/xhtml11-quirks.conf
new file mode 100644
index 0000000..b903a39
--- /dev/null
+++ b/xhtml11-quirks.conf
@@ -0,0 +1,45 @@
+#
+# xhtml11-quirks.conf
+#
+# Workarounds for IE6's broken # and incomplete CSS2.
+#
+
+[image-blockmacro]
+<div class="imageblock"{id? id="{id}"}>
+<div class="content">
+<a class="image" href="{link}">
+<img src="{imagesdir=}{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"}/>
+{link#}</a>
+</div>
+<div class="image-title">{caption=Figure: }{title}</div>
+</div>
+
+[sidebarblock]
+<div class="sidebarblock"{id? id="{id}"}>
+<div class="sidebar-content">
+<div class="sidebar-title">{title}</div>
+|
+</div></div>
+
+[quoteblock]
+<div class="quoteblock"{id? id="{id}"}>
+<div class="title">{title}</div>
+<div class="quoteblock-content">
+|
+<div class="attribution">
+<span class="emphasis">{citetitle}</span><br />
+&#8212; {attribution}
+</div></div></div>
+
+[exampleblock]
+<div class="exampleblock"{id? id="{id}"}>
+<div class="title">{caption=Example: }{title}</div>
+<div class="exampleblock-content">
+|
+</div></div>
+
+[sect2]
+# The <div> is because the IE6 adjacent-sibling CSS selector is broken.
+<h3{id? id="{id}"}>{numbered?{sectnum} }{title}</h3><div style="clear:left"></div>
+|
+
diff --git a/xhtml11.conf b/xhtml11.conf
new file mode 100644
index 0000000..aca26ce
--- /dev/null
+++ b/xhtml11.conf
@@ -0,0 +1,466 @@
+#
+# xhtml11.conf
+#
+# Asciidoc configuration file.
+# xhtml11 backend, generates XHTML 1.1 conformant markup.
+#
+[miscellaneous]
+outfilesuffix=.html
+# Screen width in pixels.
+pagewidth=800
+pageunits=
+
+[attributes]
+basebackend=html
+basebackend-html=
+
+[replacements]
+# Line break.
+(?m)^(.*)\s\+$=\1<br />
+# Escape ASCIIMathML delimiters.
+ifdef::asciimath[]
+\$=\$
+`=\`
+endif::asciimath[]
+ifdef::asciidoc7compatible[]
+# Superscripts.
+\^(.+?)\^=<sup>\1</sup>
+# Subscripts.
+~(.+?)~=<sub>\1</sub>
+endif::asciidoc7compatible[]
+
+[ruler-blockmacro]
+<hr />
+
+[image-inlinemacro]
+<span class="image">
+<a class="image" href="{link}">
+<img src="{imagesdir=}{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"} />
+{link#}</a>
+</span>
+
+[image-blockmacro]
+<div class="imageblock"{id? id="{id}"}>
+<div class="content">
+<a class="image" href="{link}">
+<img src="{imagesdir=}{target}" alt="{1={target}}"{1? title="{1}"}{width? width="{width}"}{height? height="{height}"} />
+{link#}</a>
+</div>
+<div class="title">{caption=Figure: }{title}</div>
+</div>
+
+[indexterm-inlinemacro]
+# Inline index term.
+{empty}
+
+[indexterm2-inlinemacro]
+# Inline index term.
+# Single entry index term that is visible in the primary text flow.
+{1}
+
+[footnote-inlinemacro]
+# Inline footnote.
+<br />[{0}]<br />
+
+[callout-inlinemacro]
+# Inline callout.
+<b>({index})</b>
+
+[tags]
+# Bulleted, numbered and labeled list tags.
+ilist=<div class="ilist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ul>|</ul></div>
+ilistitem=<li>|</li>
+ilisttext=<p>|</p>
+olist=<div class="olist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol>|</ol></div>
+olist2=<div class="olist2"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol>|</ol></div>
+olistitem=<li>|</li>
+olisttext=<p>|</p>
+vlist=<div class="vlist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<dl>|</dl></div>
+vlistentry=|
+vlistterm=<dt>|</dt>
+vlistitem=<dd>|</dd>
+vlisttext=<p>|</p>
+# Horizontal labeled list.
+hlist=<div class="hlist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<table>{1?<col width="{1}%" />}{2?<col width="{2}%" />}|</table></div>
+hlistentry=<tr>|</tr>
+hlistterm=<td class="hlist1">|</td>
+hlistitem=<td class="hlist2">|</td>
+hlisttext=|
+# Question and Answer list.
+qlist=<div class="qlist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol>|</ol></div>
+qlistentry=<li>|</li>
+qlistterm=<p><em>|</em></p>
+qlistitem=|
+qlisttext=<p>|</p>
+# Callout list.
+colist=<div class="colist"{id? id="{id}"}>{title?<div class="title">{title}</div>}<ol>|</ol></div>
+colistitem=<li>|</li>
+colisttext=<p>|</p>
+
+# Quoted text.
+emphasis=<em{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</em>
+strong=<strong{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</strong>
+monospaced=<tt{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</tt>
+quoted={0?<span style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?">}{amp}#8220;|{amp}#8221;{0?</span>}
+unquoted={0?<span style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?">}|{0?</span>}
+superscript=<sup{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</sup>
+subscript=<sub{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</sub>
+
+# $$ inline passthrough.
+$$passthrough=<span{0? style="}{1?color: {1};}{2?background-color: {2};}{3?font-size: {3}em;}{0?"}>|</span>
+
+# Inline macros
+[http-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[https-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[ftp-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[file-inlinemacro]
+<a href="{name}:{target}">{0={name}:{target}}</a>
+[mailto-inlinemacro]
+<a href="{name}:{target}">{0={target}}</a>
+[link-inlinemacro]
+<a href="{target}">{0={target}}</a>
+[callto-inlinemacro]
+<a href="{name}:{target}">{0={target}}</a>
+# anchor:id[text]
+[anchor-inlinemacro]
+<a id="{target}"></a>
+# [[id,text]]
+[anchor2-inlinemacro]
+<a id="{1}"></a>
+# [[[id]]]
+[anchor3-inlinemacro]
+<a id="{1}"></a>[{1}]
+# xref:id[text]
+[xref-inlinemacro]
+<a href="#{target}">{0=[{target}]}</a>
+# <<id,text>>
+[xref2-inlinemacro]
+<a href="#{1}">{2=[{1}]}</a>
+
+# Special word substitution.
+[emphasizedwords]
+<em>{words}</em>
+[monospacedwords]
+<tt>{words}</tt>
+[strongwords]
+<strong>{words}</strong>
+
+# Paragraph substitution.
+[paragraph]
+<div class="para"{id? id="{id}"}>{title?<div class="title">{title}</div>}<p>
+|
+</p></div>
+
+[literalparagraph]
+# The literal block employs the same markup.
+template::[literalblock]
+
+[verseparagraph]
+# The verse block employs the same markup.
+template::[verseblock]
+
+[admonitionparagraph]
+# The admonition block employs the same markup.
+template::[admonitionblock]
+
+# Delimited blocks.
+[passthroughblock]
+|
+
+[listingblock]
+<div class="listingblock"{id? id="{id}"}>
+<div class="title">{caption=Example: }{title}</div>
+<div class="content">
+<pre><tt>
+|
+</tt></pre>
+</div></div>
+
+[literalblock]
+<div class="literalblock"{id? id="{id}"}>
+<div class="title">{title}</div>
+<div class="content">
+{style#}<pre class="{style}"><span>
+{style%}<pre><tt>
+|
+</tt></pre>
+</div></div>
+
+[verseblock]
+<div class="verseblock"{id? id="{id}"}>
+<div class="title">{title}</div>
+<div class="content">
+|
+</div></div>
+
+[sidebarblock]
+<div class="sidebarblock"{id? id="{id}"}>
+<div class="content">
+<div class="title">{title}</div>
+|
+</div></div>
+
+[quoteblock]
+<div class="quoteblock"{id? id="{id}"}>
+<div class="title">{title}</div>
+<div class="content">
+|
+<div class="attribution">
+<em>{citetitle}</em><br />
+&#8212; {attribution}
+</div></div></div>
+
+[exampleblock]
+<div class="exampleblock"{id? id="{id}"}>
+<div class="title">{caption=Example: }{title}</div>
+<div class="content">
+|
+</div></div>
+
+[admonitionblock]
+<div class="admonitionblock"{id? id="{id}"}>
+<table><tr>
+<td class="icon">
+{icons#}<img src="{icon={iconsdir}/{name}.png}" alt="{caption}" />
+{icons%}<div class="title">{caption}</div>
+</td>
+<td class="content">
+<div class="title">{title}</div>
+|
+</td>
+</tr></table>
+</div>
+
+# Bibliography list.
+# Same as numbered list.
+[listdef-bibliography]
+listtag=olist
+itemtag=olistitem
+texttag=olisttext
+
+# Glossary list.
+# Same as labeled list.
+[listdef-glossary]
+listtag=vlist
+itemtag=vlistitem
+texttag=vlisttext
+entrytag=vlistentry
+labeltag=vlistterm
+
+# Tables.
+[tabledef-default]
+template=table
+colspec=<col width="{colwidth}{pageunits}" />
+bodyrow=<tr>|</tr>
+headdata=<th align="{colalign}">|</th>
+footdata=<td align="{colalign}">|</td>
+bodydata=<td align="{colalign}">|</td>
+
+[table]
+<div class="tableblock"{id? id="{id}"}>
+<table rules="{grid=none}"
+frame="{frame%hsides}"
+frame="{frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}"
+cellspacing="0" cellpadding="4">
+<caption class="title">{caption=Table: }{title}</caption>
+{colspecs}
+{headrows#}<thead>
+{headrows}
+{headrows#}</thead>
+{footrows#}<tfoot>
+{footrows}
+{footrows#}</tfoot>
+<tbody valign="top">
+{bodyrows}
+</tbody>
+</table>
+</div>
+
+[preamble]
+# Untitled elements between header and first section title.
+<div id="preamble"{id? id="{id}"}>
+<div class="sectionbody">
+|
+</div>
+</div>
+
+# Document sections.
+[sect0]
+<h1{id? id="{id}"}>{title}</h1>
+|
+
+[sect1]
+<h2{id? id="{id}"}>{numbered?{sectnum} }{title}</h2>
+<div class="sectionbody">
+|
+</div>
+
+[sect2]
+<h3{id? id="{id}"}>{numbered?{sectnum} }{title}</h3>
+|
+
+[sect3]
+<h4{id? id="{id}"}>{numbered?{sectnum} }{title}</h4>
+|
+
+[sect4]
+<h5{id? id="{id}"}>{title}</h5>
+|
+
+[header]
+# IE6 enters quirks mode if the following XML directive is present.
+#<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="{quirks=application/xhtml+xml}{quirks?text/html}; charset={encoding}" />
+<meta name="generator" content="AsciiDoc {asciidoc-version}" />
+ifdef::linkcss[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}.css" type="text/css" />
+{doctype-manpage}<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-manpage.css" type="text/css" />
+ifdef::quirks[]
+<link rel="stylesheet" href="{stylesdir=.}/{theme={backend}}-quirks.css" type="text/css" />
+endif::quirks[]
+endif::linkcss[]
+ifndef::linkcss[]
+<style type="text/css">
+include1::{stylesdir=./stylesheets}/{theme={backend}}.css[]
+{doctype-manpage}include1::{stylesdir=./stylesheets}/{theme={backend}}-manpage.css[]
+ifdef::quirks[]
+include1::{stylesdir=./stylesheets}/{theme={backend}}-quirks.css[]
+endif::quirks[]
+</style>
+endif::linkcss[]
+ifdef::toc[]
+ifdef::linkcss[]
+<script type="text/javascript">
+# Escape as CDATA to pass validators.
+/*<![CDATA[*/
+window.onload = function()\{generateToc({toclevels=2})\}
+/*]]>*/
+</script>
+<script type="text/javascript" src="{scriptsdir=.}/toc.js"></script>
+endif::linkcss[]
+ifndef::linkcss[]
+<script type="text/javascript">
+# Escape as CDATA to pass validators.
+/*<![CDATA[*/
+window.onload = function()\{generateToc({toclevels=2})\}
+include1::{scriptsdir=./javascripts}/toc.js[]
+/*]]>*/
+</script>
+endif::linkcss[]
+endif::toc[]
+ifdef::asciimath[]
+ifdef::linkcss[]
+<script type="text/javascript" src="{scriptsdir=.}/ASCIIMathML.js"></script>
+endif::linkcss[]
+ifndef::linkcss[]
+<script type="text/javascript">
+# Escape as CDATA to pass validators.
+/*<![CDATA[*/
+include1::{scriptsdir=./javascripts}/ASCIIMathML.js[]
+/*]]>*/
+</script>
+endif::linkcss[]
+endif::asciimath[]
+ifdef::latexmath[]
+ifdef::linkcss[]
+<script type="text/javascript" src="{scriptsdir=.}/LaTeXMathML.js"></script>
+endif::linkcss[]
+ifndef::linkcss[]
+<script type="text/javascript">
+# Escape as CDATA to pass validators.
+/*<![CDATA[*/
+include1::{scriptsdir=./javascripts}/LaTeXMathML.js[]
+/*]]>*/
+</script>
+endif::linkcss[]
+endif::latexmath[]
+<title>{doctitle=}</title>
+</head>
+<body>
+# Article, book header.
+ifndef::doctype-manpage[]
+<div id="header">
+<h1>{doctitle}</h1>
+<span id="author">{author}</span><br />
+<span id="email"><tt>&lt;<a href="mailto:{email}">{email}</a>&gt;</tt></span><br />
+<span id="revision">version {revision}{date?,}</span>
+{date}
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+</div>
+endif::doctype-manpage[]
+# Man page header.
+ifdef::doctype-manpage[]
+<div id="header">
+<h1>
+{doctitle} Manual Page
+</h1>
+ifdef::toc[]
+<div id="toc">
+ <div id="toctitle">Table of Contents</div>
+ <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+</div>
+endif::toc[]
+<h2>NAME</h2>
+<div class="sectionbody">
+<p>{manname} -
+ {manpurpose}
+</p>
+</div>
+</div>
+endif::doctype-manpage[]
+
+[footer]
+<div id="footer">
+<div id="footer-text">
+Version {revision}<br />
+Last updated {localdate} {localtime}
+</div>
+ifdef::badges[]
+<div id="footer-badges">
+ifndef::icons[]
+Valid <a href="http://validator.w3.org/check?uri=referer">XHTML</a>
+and <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
+endif::icons[]
+ifdef::icons[]
+<a href="http://validator.w3.org/check?uri=referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://www.w3.org/Icons/valid-xhtml11"
+ alt="Valid XHTML 1.1!" />
+</a>
+<a href="http://jigsaw.w3.org/css-validator/check/referer">
+ <img style="border:none; width:88px; height:31px;"
+ src="http://jigsaw.w3.org/css-validator/images/vcss"
+ alt="Valid CSS!" />
+</a>
+<a href="http://www.mozilla.org/products/firefox/">
+ <img style="border:none; width:110px; height:32px;"
+ src="http://www.spreadfirefox.com/community/images/affiliates/Buttons/110x32/safer.gif"
+ alt="Get Firefox!" />
+</a>
+endif::icons[]
+</div>
+endif::badges[]
+</div>
+</body>
+</html>
+
+ifdef::doctype-manpage[]
+[sect-synopsis]
+template::[sect1]
+endif::doctype-manpage[]
+
+ifdef::quirks[]
+include::{backend}-quirks.conf[]
+endif::quirks[]