A2X(1)
πΈ NAME πΈ
a2x β A toolchain manager for AsciiDoc (converts Asciidoc text files to other file formats). And yes bestie, this is the a2x(1) manual, so buckle up. π
β¨ SYNOPSIS β¨
a2x [OPTIONS] SOURCE_FILE
π DESCRIPTION π
okay so a2x is 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 the REQUISITES section). Also SOURCE_FILE can be a DocBook file with an .xml extension. No cap, it's giving build-system main character energy. π₯
π OPTIONS π
-a,--attribute=ATTRIBUTEβ Setasciidoc(1)attribute value (shortcut for--asciidoc-opts="-a ATTRIBUTE"option). This option may be specified more than once.--asciidoc-opts=ASCIIDOC_OPTSβ Additionalasciidoc(1)options. This option may be specified more than once.--conf-file=CONF_FILEβ Load configuration file. See the CONF FILES section.-D,--destination-dir=DESTINATION_DIRβ Output directory. Defaults to SOURCE_FILE directory. This option is only applicable to HTML and manpage based output formats (chunked,epub,htmlhelp,xhtml,manpage).-d,--doctype=DOCTYPEβ DocBook document type:article,manpageorbook. Default document type isarticleunless the format ismanpage(in which case it defaults tomanpage).-b,--backend=BACKENDβ BACKEND is the name of an installed backend plugin. When this option is specifieda2xattempts to load a file namea2x-backend.pyfrom the BACKEND plugin directory. It then converts the SOURCE_FILE to a BACKEND formatted output file using a global function defined ina2x-backend.pycalledto_BACKEND.-f,--format=FORMATβ Output formats:chunked,docbook,dvi,epub,htmlhelp,manpage,pdf(default),ps,tex,text,xhtml. The AsciiDoca2x-formatattribute value is set to FORMAT.-h,--helpβ Print command-line syntax and program options tostdout.--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 output files) containing admonition and navigation icons. Defaults toimages/icons. The--iconsoption is implicit if this option is used.-k,--keep-artifactsβ Do not delete temporary build files.--lynxβ Uselynx(1)(actually: the text-based browser defined by theLYNXconfig variable) when generating text formatted output. The default behavior is to usew3m(1)(actually: the text-based browser defined by theW3Mconfig variable).-L,--no-xmllintβ Do not check asciidoc output withxmllint(1).---epubcheckβ Check EPUB output withepubcheck(1).-n,--dry-runβ Do not do anything just print what would have been done.-r,--resource=RESOURCE_SPECβ Specify a resource. This option may be specified more than once. See the RESOURCES section for more details.-m,--resource-manifest=FILEβ FILE contains a list resources (one per line). Manifest FILE entries are formatted just like--resourceoption arguments. Environment variables and tilde home directories are allowed.--stylesheet=STYLESHEETβ A space delimited list of one or more CSS stylesheet file names that are used to style HTML output generated by DocBook XSL Stylesheets. Defaults todocbook-xsl.css. The stylesheets are processed in list order. The stylesheets must reside in a valid resource file location. Applies to HTML formats:xhtml,epub,chunked,htmlhelpformats.-v,--verboseβ Print operational details tostderr. A second-voption applies the verbose option to toolchain commands.--versionβ Print program version tostdout.--xsltproc-opts=XSLTPROC_OPTSβ Additionalxsltproc(1)options. This option may be specified more than once.--xsl-file=XSL_FILEβ Override the built-in XSL stylesheet with the custom XSL stylesheet XSL_FILE.--fopβ Use FOP to generate PDFs. The default behavior is to usedblatex(1). The--fopoption is implicit if the--fop-optsoption is used.--fop-opts=FOP_OPTSβ Additionalfop(1)options. If this option is specified FOP is used to generate PDFs. This option may be specified more than once.--dblatex-opts=DBLATEX_OPTSβ Additionaldblatex(1)options. This option may be specified more than once.--backend-opts=BACKEND_OPTSβ Options for the backend plugin specified by the--backendoption. This option may be specified more than once.
π«Ά options in your source file π«Ά
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"
- Options spanning multiple such comment lines will be concatenated.
- Zero or more white space characters can appear between the leading
//anda2x:. - Command-line options take precedence over options set in the source file.
π OUTPUT FILES π
okay so 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. periodt. π
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. they get overwritten, bestie β that's the whole sentence. π
In addition to generating HTML files the xhtml, epub, chunked and htmlhelp formats ensure resource files are copied to their correct destination directory locations. That's the little behind-the-scenes slay. β¨
π¦ 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. iykyk. π
a2x searches for resource files in the following locations in the following order:
- The SOURCE_FILE directory.
- Resource directories specified by the
--resourceoption (searched recursively). - Resource directories specified by the
--resource-manifestoption (searched recursively in the order they appear in the manifest file). - The stock images and stylesheets directories in the
asciidoc(1)configuration files directories (searched recursively). - The destination directory.
When a resource file is found it is copied to the correct relative destination directory. Missing destination sub-directories are created automatically. no cap, it makes the folders for you. π«Ά
There are two distinct mechanisms for specifying additional resources:
- A resource directory which will be searched recursively for missing resource files.
- A resource file which will be copied to the output destination directory.
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>β Specifies a directory (absolute or relative to the SOURCE_FILE) which is searched recursively for missing resource files. To eliminate ambiguity the<resource_dir>name should end with a directory separator character.<resource_file>β Specifies a resource file (absolute or relative to the SOURCE_FILE) which will be copied to<destination_file>. If<destination_file>is not specified then it is the same as the<resource_file>.<destination_file>β Specifies the destination of the copied source file. The<destination_file>path is relative to the destination directory (absolute paths are not allowed). The location of the destination directory depends on the output FORMAT (see the OUTPUT FILES section for details):chunked,htmlhelpβ The chunked output directory.epubβ The archived OEBPS directory.xhtmlβ The output DESTINATION_DIR.
.<ext>=<mimetype>β When adding resources to EPUB files the mimetype is inferred from the<destination file>extension, if the mimetype cannot be guessed an error occurs. The.<ext>=<mimetype>resource syntax can be used to explicitly set mimetypes.<ext>is the file name extension,<mimetype>is the corresponding MIME type.
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β Generatesdoc/source-highlight-filter.pdffile. pdf bestie, classic. β¨a2x -f xhtml -D ../doc --icons -r ../images/ team.txtβ Creates HTML file../doc/team.html, uses admonition icons and recursively searches the../images/directory for any missing resources. the way this one multitasks. πa2x -f manpage doc/asciidoc.1.txtβ Generatedoc/asciidoc.1manpage. manpage era. π
π REQUISITES π
a2x uses the following programs:
- Asciidoc:
https://asciidoc.org/ - xsltproc: (all formats except text):
http://xmlsoft.org/XSLT/ - DocBook XSL Stylesheets (all formats except text):
https://github.com/docbook/xslt10-stylesheets - dblatex (
pdf,dvi,ps,texformats):http://dblatex.sourceforge.net/ - FOP (
pdfformat β alternative PDF file generator):https://xmlgraphics.apache.org/fop/ - w3m (
textformat):http://w3m.sourceforge.net/index.en.html - Lynx (
textformat β alternative text file generator):https://invisible-island.net/lynx/ - epubcheck (
epubformat β EPUB file validator):https://github.com/w3c/epubcheck
See also the latest README file. π«Ά
π CONF FILES π
okay so bestie, a configuration file is literally executable Python code that overrides the global configuration parameters in a2x.py. Optional configuration files get loaded in this exact order, no cap:
a2x.conffrom the directory containing thea2x.pyexecutable.a2x.conffrom the AsciiDoc global configuration directory. Skip this step if we are executing a locally installed (non system wide) copy.a2x.conffrom the AsciiDoc$HOME/.asciidocconfiguration directory.- The
CONF_FILEspecified in the--conf-fileoption.
Here are the default configuration file option values, and yes bestie you can copy-paste these bad boys exactly:
# 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/. <code>LYNX_OPTS</code> and <code>W3M_OPTS</code> 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 <code>-dump</code> option in your definition: this is mandatory at least with <code>w3m</code>, <code>lynx</code>, <code>links</code>, and <code>elinks</code> in order to send the formatted text to <code>stdout</code>.
π¨ fr fr, do not skip the-dumpthing β the formatted text needs to go tostdout, and thatβs the vibe. β¨
π BUGS π
See the AsciiDoc distribution BUGS file. short and iconic. π«Ά
π AUTHOR π
a2x was originally written by Stuart Rackham. Many people have contributed to it. slay, collaborative queen behavior π
π RESOURCES π
- GitHub:
https://github.com/asciidoc/asciidoc-py3/ - Main web site:
https://asciidoc.org/
yes bestie, resources said βrun it backβ β we donβt make the rules π
π¦ SEE ALSO π¦
asciidoc(1) β go read it, iykyk. π¦
π COPYING π
Copyright (C) 2002-2013 Stuart Rackham.
Copyright (C) 2013-2022 AsciiDoc Contributors.
Free use of this software is granted 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.
π okay bye bestie β this page is <code>A2X(1)</code>, dated <code>07/17/2024</code>. go off and make something iconic. π
π¦ where this page comes from
- alpine 3.22: asciidoc-doc 10.2.1-r0 Β· GPL-2.0-or-later AND MIT
- alpine 3.23: asciidoc-doc 10.2.1-r0 Β· GPL-2.0-or-later AND MIT
- alpine 3.24: asciidoc-doc 10.2.1-r1 Β· GPL-2.0-or-later AND MIT
- arch rolling: asciidoc 10.2.1-3 Β· GPL-2.0-or-later
- opensuse-leap 16.0: asciidoc 10.2.1-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms