dita-topic
is a custom converter for Asciidoctor that converts a single AsciiDoc file to a corresponding DITA topic. To convert the produced DITA topic to a specialized DITA concept, reference, or task, use the dita_convert Python package.
To use the custom converter on the command line, load it with the -r dita-topic
option and then select dita-topic
as the backend output format with -b dita-topic
:
$ asciidoctor -r dita-topic -b dita-topic your_file.adoc
This creates a new file, your_file.dita
, in the same directory as your_file.adoc
. You can also convert multiple files at the same time:
$ asciidoctor -r dita-topic -b dita-topic *.adoc
Important
|
$ dita -i converted_file.dita -f xhtml To produce slightly more readable errors, you can also use $ xmlstarlet val -e -s path_to_dita-ot_directory/plugins/org.oasis-open.dita.v1_3/schema-url/technicalContent/xsd/topic.xsd converted_file.dita |
If your AsciiDoc files use attributes that are defined outside of these files, you can supply the attribute definitions on the command line with the -a attribute=value
option:
$ asciidoctor -r dita-topic -b dita-topic -a attribute=value your_file.adoc
You can provide multiple -a attribute=value
options at the same time. Providing relevant attribute definitions is especially important if your document contains conditional content.
ifeval
conditionsYour AsciiDoc files include a number of ifeval
statements that provide different content for different versions of the product you are documenting:
ifeval::["{ProductNumber}" == "1"]
...
endif::[]
ifeval::["{ProductNumber}" == "2"]
...
endif::[]
To ensure that the converted DITA files include all content for version 2 of your product, run:
$ asciidoctor -r dita-topic -b dita-topic -a ProductNumber=2 *.adoc
Unlike AsciiDoc, DITA does not support floating titles and only allows titles to be assigned to a limited number of elements. To avoid losing content during the conversion, as a workaround, the dita-topic
converter uses the following markup by default:
<p outputclass="title"><b>Floating title</b></p>
To disable this behavior, set the value of the dita-topic-titles
to off
:
$ asciidoctor -r dita-topic -b dita-topic -a dita-topic-titles=off your_file.adoc
Unlike AsciiDoc, DITA does not support callouts as a method to add annotations to specific lines in verbatim blocks. To avoid losing content during the conversion, as a workaround, the dita-topic
converter uses XML entities for circled numbers.
To disable this behavior, set the value of the dita-topic-callouts
to off
:
$ asciidoctor -r dita-topic -b dita-topic -a dita-topic-callouts=off your_file.adoc
Despite aspiring to avoid losing content during conversion and produce a valid DITA output, there are limitations to what is possible because of the differences between the two markup languages. When the dita-topic
converter encounters a possible problem, it prints a warning to standard error output in the following format:
asciidoctor: WARNING: dita-topic: The warning message
This possible warning messages are as follows:
Admonition titles not supported in DITA |
AsciiDoc allows you to add a custom title to any admonition by including |
Audio macro not supported |
AsciiDoc allows you to embed audio content in your documents by using the |
Block titles not supported in DITA |
AsciiDoc allows you to include |
Callouts not supported in DITA |
AsciiDoc allows you to use |
Floating titles not supported in DITA |
AsciiDoc allows you to use floating titles anywhere in the document. Unlike AsciiDoc, DITA does not support floating titles. |
Inline breaks not supported in DITA |
AsciiDoc provides multiple ways to insert line breaks in paragraphs, such as inserting |
Inline index terms not implemented |
AsciiDoc allows you to define index terms within the text by using the |
Nesting of sections not supported in DITA |
AsciiDoc allows you to nest sections up to 5 levels deep. Unlike AsciiDoc, DITA does not allow the |
Page breaks not supported in DITA |
AsciiDoc allows you to use |
Possible invalid reference: reference |
AsciiDoc allows you to cross reference by using an ID no matter if this ID is defined within or outside of the converted document. Unlike AsciiDoc, DITA requires both the target ID and the ID of the target topic to be included in the cross reference if the reference leads outside of the current file. As |
STEM support not implemented |
AsciiDoc provides multiple ways to insert Science, Technology, Engineering and Math (STEM) expressions in the document, including the |
Table footers not supported in DITA |
AsciiDoc allows you to set the |
Thematic breaks not supported in DITA |
Asciidoc allows you to use |
Video macro not supported |
AsciiDoc allows you to embed video content in your documents by using the |
Copyright © 2024 Jaromir Hradilek
This program is free software, released under the terms of the MIT license. It 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.