Chapter 31. 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-args}       used to pass inherited arguments to asciidoc filters
{asciidoc-confdir}    the asciidoc(1) global configuration directory
{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
{backend-confdir}     the directory containing the <backend>.conf file
{backslash}           backslash character
{basebackend-<base>}  empty string ''
{basebackend}         html or docbook
{blockname}           current block name (note 8).
{brvbar}              broken vertical bar (|) character
{docdate}             document last modified date (note 9)
{docdir}              document input directory name  (note 5)
{docfile}             document file name  (note 5)
{docname}             document file name without extension (note 6)
{doctime}             document last modified time (note 9)
{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)
{ldquo}               Left double quote character (note 7)
{level}               title level 1..4 (in section titles)
{listindex}           the list index (1..) of the most recent list item
{localdate}           the current date (note 9)
{localtime}           the current time (note 9)
{lsquo}               Left single quote character (note 7)
{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)
{plus}                plus character
{python}              the full path name of the Python interpreter executable
{rdquo}               right double quote character (note 7)
{reftext}             running block xreflabel generated by BlockId elements
{revdate}             document revision date (from document header)
{revnumber}           document revision number (from document header)
{rsquo}               right single quote character (note 7)
{sectnum}             formatted section number (in section titles)
{sp}                  space character
{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
{wj}                  word-joiner
{zwsp}                zero-width space character entity
[Note]
  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 Backend Attributes section 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.
  6. If the input file is the standard input and the output file is not the standard output then {docname} is the output file name sans file extension.
  7. See non-English usage of quotation marks.
  8. The {blockname} attribute identifies the style of the current block. It applies to delimited blocks, lists and tables. Here is a list of {blockname} values (does not include filters or custom block and style names):

    delimited blocks
    comment, sidebar, open, pass, literal, verse, listing, quote, example, note, tip, important, caution, warning, abstract, partintro
    lists
    arabic, loweralpha, upperalpha, lowerroman, upperroman, labeled, labeled3, labeled4, qanda, horizontal, bibliography, glossary
    tables
    table
  9. If the SOURCE_DATE_EPOCH environment variable is set to a UNIX timestamp, then the {docdate}, {doctime}, {localdate}, and {localtime} attributes are computed in the UTC time zone, with any timestamps newer than SOURCE_DATE_EPOCH replaced by SOURCE_DATE_EPOCH. (This helps software using AsciiDoc to build reproducibly.)


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