This extension automatically generates a Terminology section for Asciidoctor-PDF documents using Asciidoctor’s built-in Index feature.
This extension achieves three main goals:
-
To ensure abbreviations are used consistently throughout documentation using the indexterm markup.
This encourages authors to fully spell out a term on the first instance, and then use an abbreviated term in subsequent instances. -
Eliminate manual work.
-
[Optional] Provide additional externally-curated, and centrally-maintained, definitions via a table with the
.terminologyrole in the document AST.
Asciidoctor-PDF Standalone Usage Instructions
Complete these steps to use this extension:
-
Clone this repository, or acquire the
autogen-terminology.rbandadd-table-roles.rbfiles along with thepdf-themes/table-roles-theme.ymlfile. -
Create an Asciidoctor document using the index terms.
-
Include a table with the
.terminologyrole containing definitions.
See terminology-definitions.html for an example of the markup.
The table should be included in your document using theincludedirective with tags:link:terminology-definitions.adoc[role=include]To control whether custom definitions are used, set the document attribute:
:terminology-use-definitions: trueNote-
When custom terminology definitions are disabled (
:terminology-use-definitions: falseor not set), only index terms with abbreviations in parentheses (e.g.,Application Programming Interface (API)) are included in the terminology section. -
When enabled (
:terminology-use-definitions: true), the table with.terminologyrole will be parsed from the AST and hidden from the rendered output using the table role extension and theme. -
The
:terminology-use-definitions:attribute defaults tofalseif not specified.
-
-
[Asciidoctor-PDF Users] Create two sections at the end of the document, assigning one the
[type=terminology]block attribute:link:antora-asciidoctor-autoterm.adoc[role=include]NoteThe title of the sections is not fixed. -
Copy the
pdf-themes/table-roles-theme.ymlfile or create a theme that hides tables with the.terminologyrole. -
Render the document with this command:
asciidoctor-pdf -r ./add-table-roles.rb -r ./autogen-terminology.rb \ -a pdf-theme=table-roles -a pdf-themesdir=pdf-themes \ antora-asciidoctor-autoterm.adoc
Antora Assembler w/Asciidoctor-PDF Usage Instructions
Antora Assembler users require an additional extension to add the Terminology and the Index, complete these steps:
-
Complete the steps in Asciidoctor-PDF Standalone Usage Instructions until Add Two Sections.
Skip that step and instead add the file antora-assembler-add-terminology-and-index.rb to execution directory.-
To remove section numbering, uncomment out the specified lines.
-
-
Add
-r add-table-roles.rb,-r antora-assembler-add-terminology-and-index.rb, and-r autogen-terminology.rbto theantora-assembler.yml’s `build/commandsection, or userequire_relativefor each file. -
Add the PDF theme attributes:
-a pdf-theme=table-roles -a pdf-themesdir=pdf-themes(adjust paths as needed) -
Add two document attributes to either the
antora.ymlorantora-assembler.ymlfile:-
include-terminology: true -
include-index: trueNoteEnable/disable those attributes as desired.
-
-
Render the Antora project.
Antora Assembler Background
More information on using the Index with Antora Assembler is available at these links: