table of contents
A2X(1) | A2X(1) |
NAME¶
a2x - A toolchain manager for AsciiDoc (converts Asciidoc text files to other file formats)
SYNOPSIS¶
a2x [OPTIONS] SOURCE_FILE
DESCRIPTION¶
A DocBook toolchain manager that translates an AsciiDoc text file SOURCE_FILE to PDF, EPUB, DVI, PS, LaTeX, XHTML (single page or chunked), man page, HTML Help or plain text formats using asciidoc(1) and other applications (see REQUISITES section). SOURCE_FILE can also be a DocBook file with an .xml extension.
OPTIONS¶
-a, --attribute=ATTRIBUTE
--asciidoc-opts=ASCIIDOC_OPTS
--conf-file=CONF_FILE
-D, --destination-dir=DESTINATION_DIR
-d, --doctype=DOCTYPE
-b, --backend=BACKEND
-f, --format=FORMAT
-h, --help
--icons
--icons-dir=PATH
-k, --keep-artifacts
--lynx
-L, --no-xmllint
---epubcheck
-n, --dry-run
-r, --resource=RESOURCE_SPEC
-m, --resource-manifest=FILE
--stylesheet=STYLESHEET
-v, --verbose
--version
--xsltproc-opts=XSLTPROC_OPTS
--xsl-file=XSL_FILE
--fop
--fop-opts=FOP_OPTS
--dblatex-opts=DBLATEX_OPTS
--backend-opts=BACKEND_OPTS
Options can also be set in the AsciiDoc source file. If SOURCE_FILE contains a comment line beginning with // a2x: then the remainder of the line will be treated as a2x command-line options. For example:
// a2x default options. // a2x: -dbook --epubcheck // Suppress revision history in dblatex outputs. // a2x: --dblatex-opts "-P latex.output.revhistory=0"
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; .epub for epub; .hhp for htmlhelp; .pdf for pdf; .text for text, .xml for docbook. 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.
In addition to generating HTML files the xhtml, epub, chunked and htmlhelp formats ensure resource files are copied to their correct destination directory locations.
RESOURCES¶
Resources are files (typically CSS and images) that are required by HTML based outputs (xhtml, epub, chunked, htmlhelp formats). a2x scans the generated HTML files and builds a list of required CSS and image files. Additional resource files can be specified explicitly using the --resource option.
a2x searches for resource files in the following locations in the following order:
When a resource file is found it is copied to the correct relative destination directory. Missing destination sub-directories are created automatically.
There are two distinct mechanisms for specifying additional resources:
Resources are specified with --resource option values which can be one of the following formats:
<resource_dir> <resource_file>[=<destination_file>] .<ext>=<mimetype>
Where:
<resource_dir>
<resource_file>
<destination_file>
chunked, htmlhelp
epub
xhtml
.<ext>=<mimetype>
Resource option examples:
--resource ../images/ --resource doc/README.txt=README.txt --resource ~/images/tiger.png=images/tiger.png --resource .ttf=application/x-font-ttf
EXAMPLES¶
a2x -f pdf doc/source-highlight-filter.txt
a2x -f xhtml -D ../doc --icons -r ../images/ team.txt
a2x -f manpage doc/asciidoc.1.txt
REQUISITES¶
a2x uses the following programs:
See also the latest README file.
CONF FILES¶
A configuration file contains executable Python code that overrides the global configuration parameters in a2x.py. Optional configuration files are loaded in the following order:
Here are the default configuration file option values:
# Optional environment variable dictionary passed to # executing programs. If set to None the existing # environment is used. ENV = None # External executables. ASCIIDOC = 'asciidoc' XSLTPROC = 'xsltproc' DBLATEX = 'dblatex' # pdf generation. FOP = 'fop' # pdf generation (--fop option). W3M = 'w3m' # primary text file generator. LYNX = 'lynx' # alternate text file generator. XMLLINT = 'xmllint' # Set to '' to disable. EPUBCHECK = 'epubcheck' # Set to '' to disable. # External executable default options. ASCIIDOC_OPTS = '' BACKEND_OPTS = '' DBLATEX_OPTS = '' FOP_OPTS = '' LYNX_OPTS = '-dump' W3M_OPTS = '-dump -cols 70 -T text/html -no-graph' XSLTPROC_OPTS = ''
Note, that it is possible to redefine W3M and LYNX to use different text-based browsers, e.g. links: http://links.twibright.com/ or elinks: http://elinks.or.cz/. LYNX_OPTS and W3M_OPTS can be used to pass options to the selected browser. If these are defined they override the respective defaults listed above (so don’t forget to include the -dump option in your definition: this is mandatory at least with w3m, lynx, links, and elinks in order to send the formatted text to stdout).
BUGS¶
See the AsciiDoc distribution BUGS file.
AUTHOR¶
a2x was originally written by Stuart Rackham. Many people have contributed to it.
RESOURCES¶
GitHub: https://github.com/asciidoc/asciidoc-py3/
Main web site: https://asciidoc.org/
SEE ALSO¶
COPYING¶
Copyright (C) 2002-2013 Stuart Rackham.
Copyright (C) 2013-2020 AsciiDoc Contributors.
Free use of this software is granted under the terms of the MIT license.
08/09/2021 |