27. Intrinsic Attributes

Intrinsic attributes are simple attributes that are created automatically from: AsciiDoc document header parameters; asciidoc(1) command-line arguments; attributes defined in the default configuration files; the execution context. Here’s the list of predefined intrinsic attributes:

{amp}                 ampersand (&) character entity
{asciidoc-dir}        the asciidoc(1) application directory
{asciidoc-file}       the full path name of the asciidoc(1) script
{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
{backslash}           backslash character
{basebackend-<base>}  empty string ''
{basebackend}         html or docbook
{brvbar}              broken vertical bar (|) character
{revdate}             document revision date (from document header)
{docdate}             document last modified date
{doctime}             document last modified time
{docname}             document file name without extension
{docfile}             document file name  (note 5)
{docdir}              document input directory name  (note 5)
{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 ''
{encoding}            specifies input and output encoding
{filetype-<fileext>}  empty string ''
{filetype}            output file name file extension
{firstname}           author first name (from document header)
{gt}                  greater than (>) character entity
{id}                  running block id generated by BlockId elements
{indir}               input file directory name (note 2,5)
{infile}              input file name (note 2,5)
{lastname}            author last name (from document header)
{level}               title level 1..4 (in section titles)
{listindex}           the list index (1..) of the most recent list item
{localdate}           the current date
{localtime}           the current time
{lt}                  less than (<) character entity
{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)
{nbsp}                non-breaking space character entity
{notitle}             do not display the document title
{outdir}              document output directory name (note 2)
{outfile}             output file name (note 2)
{reftext}             running block xreflabel generated by BlockId elements
{revnumber}           document revision number (from document header)
{sectnum}             formatted section number (in section titles)
{showcomments}        send comment lines to the output
{title}               section title (in titled elements)
{two-colons}          Two colon characters
{two-semicolons}      Two semicolon characters
{user-dir}            the ~/.asciidoc directory (if it exists)
{verbose}             defined as '' if --verbose command option specified
{zwsp}                Zero-width space character entity

NOTES

  1. Intrinsic attributes are global so avoid defining custom attributes with the same names.
  2. {outfile}, {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 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. [4]
  5. {docfile} and {docdir} refer to root document specified on the asciidoc(1) command-line; {infile} and {indir} refer to the current input file which may be the root document or an included file. When the input is being read from the standard input (stdin) these attributes are undefined.


[4] 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.