Name

cx:asciidoctor — Convert Asciidoctor documents.

Synopsis

The cx:asciidoctor step converts Asciidoctor documents to DocBook, HTML5, or PDF.

Input portPrimarySequenceContent types
source✔  text/asciidoc text 
Output portPrimarySequenceContent types
result✔  xml html application/pdf 
Option nameTypeValuesDefault value
attributesmap(xs:QName, item()*)? ()
backendxs:string?('docbook', 'html5', 'pdf') ()
parametersmap(xs:QName, item()*)? ()
This is an extension step; to use it, your pipeline must include its declaration. For example, by including the extension library with an import at the top of your pipeline:
<p:import href="https://xmlcalabash.com/ext/library/asciidoctor.xpl"/>
Declaration
1 |<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions"
  |                xmlns:p="http://www.w3.org/ns/xproc"
  |                type="cx:asciidoctor">
  |   <p:input port="source" content-types="text/asciidoc text"/>
5 |   <p:output port="result" content-types="xml html application/pdf"/>
  |   <p:option name="backend" as="xs:string?" values="('docbook', 'html5', 'pdf')"/>
  |   <p:option name="parameters" as="map(xs:QName, item()*)?"/>
  |   <p:option name="attributes" as="map(xs:QName, item()*)?"/>
  |</p:declare-step>

Description

Asciidoctor is the modern toolchain for processing Asciidoc markup. Asciidoc is a sophisticated lightweight markup language that can be used to represent complex structures. One of its original goals was to capture DocBook in a markdown-like style. Asciidoc predates Markdown.

The Java API that XML Calabash uses, AsciidoctorJ, offers both options and attributes. In fact, the attributes are part of the options API. It all seems a bit confused to me.

For the step, I’ve implemented options in the parameters option and attributes in the attributes option.

Parameters

The parameters listed below are supported. These are passed directly to the Asciidoctor API; please consult the API for more details.

ParameterTypeNotes
base_dirxs:stringMust be the name of a directory.
backendxs:stringMust be the same as the backend option, if both are specified.
catalog_assetsxs:boolean
doctypexs:string
standalonexs:boolean
template_dirsxs:string*Must be directory names
template_enginexs:string
template_cachexs:boolean
safexs:stringunsafe”, “safe”, “server”, or “secure
sourcemapxs:boolean
erubyxs:string
compactxs:boolean
parse_header_onlyxs:boolean

Attributes

The attributes listed below are supported. These are passed directly to the Asciidoctor API; please consult the API for more details.

Note

There were errors in this table as initial published. The names of many attributes were corrected in the documentation for XML Calabash 3.0.49. Most of the errors were related to the presence of underscores or hyphens, but note that the “math” attribute is actually named “stem”.

ParameterTypeNotes
allow-uri-readxs:boolean
appendix-captionxs:string
attribute-missingxs:string
attribute-undefinedxs:string
backendxs:string
compat-modexs:stringdefault” or “legacy
data-urixs:boolean
docdatexs:dateTime
doctimexs:dateTime
doctypexs:string
experimentalxs:boolean
hardbreaksxs:boolean
hide-uri-schemexs:boolean
iconfont-cdnxs:anyURI
iconfont-namexs:string
iconfont-remotexs:boolean
iconsxs:string
iconsdirxs:string
ignore-undefinedxs:boolean
imagesdirxs:string
linkattrsxs:boolean
linkcssxs:boolean
localdatexs:dateTime
localtimexs:dateTime
max-include-depthxs:int
nofooterxs:boolean
sectnumsxs:boolean
sectnumlevelsxs:int
sectanchorsxs:boolean
showtitlexs:boolean
skip-front-matterxs:boolean
source-highlighterxs:string
source-languagexs:string
stemxs:string
stylesheetxs:string
stylesdirxs:string
titlexs:string
tocxs:stringtrue”, “false”, “top”, “bottom”, “left”, “right”, “preamble”, or “macro
untitled-labelxs:string

Dependencies

This step is included in the XML Calabash application. If you are getting XML Calabash from Maven, you will also need to include the extension dependencies:

  • org.asciidoctor:asciidoctorj:3.0.1
  • org.asciidoctor:asciidoctorj-pdf:2.3.23

Additional examples

The XML Calabash test suite contains examples of the cx:asciidoctor step.