asciidoctor-dita-topic 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHORS +1 -0
- data/LICENSE +21 -0
- data/README.adoc +166 -0
- data/lib/dita-topic.rb +17 -3
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69250bbb61960007901efdae04ea972ce5089345d50c83ee667468c107022c5b
|
4
|
+
data.tar.gz: 587dc9c0bc07b4354f2c459bdd955f2b52e40c28803063d06788fa54cb2d6334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6e37a1231ca1c890ac761598d5ed576bf9114e83157c611ad0ffb9d585a164e9ba3c1de5138d0797ac08dcfca54f73a7c1a9280883c986be593c1665a990744
|
7
|
+
data.tar.gz: 4caaceb8cfed3c43d9991a51f9ec95614d22af38889521505b99527a37ae6e5e410813d268d1a2fe3ff7fef0b1cc87891dbcbaf48c8dd1d715c2367f98d847dd
|
data/AUTHORS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Jaromir Hradilek <jhradilek@gmail.com>
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (C) 2024 Jaromir Hradilek
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
6
|
+
copy of this software and associated documentation files (the "Software"),
|
7
|
+
to deal in the Software without restriction, including without limitation
|
8
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
9
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
20
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
21
|
+
DEALINGS IN THE SOFTWARE.
|
data/README.adoc
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
= dita-topic
|
2
|
+
|
3
|
+
`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 link:https://github.com/jhradilek/dita-custom-xslt[dita_convert Python package].
|
4
|
+
|
5
|
+
[#install]
|
6
|
+
== Installation
|
7
|
+
|
8
|
+
Install the `asciidoctor-dita-topic` Ruby gem:
|
9
|
+
|
10
|
+
[literal,subs="+quotes"]
|
11
|
+
....
|
12
|
+
$ *gem install asciidoctor-dita-topic*
|
13
|
+
....
|
14
|
+
|
15
|
+
[#use]
|
16
|
+
== Usage
|
17
|
+
|
18
|
+
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`:
|
19
|
+
|
20
|
+
[literal,subs="+quotes"]
|
21
|
+
....
|
22
|
+
$ *asciidoctor -r dita-topic -b dita-topic _your_file_.adoc*
|
23
|
+
....
|
24
|
+
|
25
|
+
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:
|
26
|
+
|
27
|
+
[literal,subs="+quotes"]
|
28
|
+
....
|
29
|
+
$ **asciidoctor -r dita-topic -b dita-topic *.adoc**
|
30
|
+
....
|
31
|
+
|
32
|
+
[IMPORTANT]
|
33
|
+
====
|
34
|
+
`dita-topic` does not validate the converted content. If you have link:https://www.dita-ot.org/[DITA Open Toolkit] installed, you can check that the converted file can be built as follows:
|
35
|
+
|
36
|
+
[literal,subs="+quotes"]
|
37
|
+
....
|
38
|
+
$ **dita -i _converted_file_.dita -f xhtml**
|
39
|
+
....
|
40
|
+
|
41
|
+
To produce slightly more readable errors, you can also use `xmlstarlet`:
|
42
|
+
|
43
|
+
[literal,subs="+quotes"]
|
44
|
+
....
|
45
|
+
$ **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**
|
46
|
+
....
|
47
|
+
====
|
48
|
+
|
49
|
+
[#attributes]
|
50
|
+
=== Supplying attribute definitions
|
51
|
+
|
52
|
+
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:
|
53
|
+
|
54
|
+
[literal,subs="+quotes"]
|
55
|
+
....
|
56
|
+
$ **asciidoctor -r dita-topic -b dita-topic -a _attribute_=_value_ _your_file_.adoc**
|
57
|
+
....
|
58
|
+
|
59
|
+
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.
|
60
|
+
|
61
|
+
.Providing a product version to resolve `ifeval` conditions
|
62
|
+
====
|
63
|
+
Your AsciiDoc files include a number of `ifeval` statements that provide different content for different versions of the product you are documenting:
|
64
|
+
|
65
|
+
[source]
|
66
|
+
----
|
67
|
+
\ifeval::["{ProductNumber}" == "1"]
|
68
|
+
...
|
69
|
+
\endif::[]
|
70
|
+
\ifeval::["{ProductNumber}" == "2"]
|
71
|
+
...
|
72
|
+
\endif::[]
|
73
|
+
----
|
74
|
+
|
75
|
+
To ensure that the converted DITA files include all content for version 2 of your product, run:
|
76
|
+
|
77
|
+
[literal,subs="+quotes"]
|
78
|
+
....
|
79
|
+
$ **asciidoctor -r dita-topic -b dita-topic -a ProductNumber=2 *.adoc**
|
80
|
+
....
|
81
|
+
====
|
82
|
+
|
83
|
+
[#titles]
|
84
|
+
=== Disabling floating titles
|
85
|
+
|
86
|
+
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:
|
87
|
+
|
88
|
+
[source,xml]
|
89
|
+
----
|
90
|
+
<p outputclass="title"><b>Floating title</b></p>
|
91
|
+
----
|
92
|
+
|
93
|
+
To disable this behavior, set the value of the `dita-topic-titles` to `off`:
|
94
|
+
|
95
|
+
[literal,subs="+quotes"]
|
96
|
+
....
|
97
|
+
$ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-titles=off _your_file_.adoc**
|
98
|
+
....
|
99
|
+
|
100
|
+
[#callouts]
|
101
|
+
=== Disabling callouts
|
102
|
+
|
103
|
+
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.
|
104
|
+
|
105
|
+
To disable this behavior, set the value of the `dita-topic-callouts` to `off`:
|
106
|
+
|
107
|
+
[literal,subs="+quotes"]
|
108
|
+
....
|
109
|
+
$ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-callouts=off _your_file_.adoc**
|
110
|
+
....
|
111
|
+
|
112
|
+
[#includes]
|
113
|
+
=== Disabling include directives
|
114
|
+
|
115
|
+
By default, Asciidoctor resolves all `include` directives before converting the file. To only convert the contents of the selected file, specify the `-S secure` option:
|
116
|
+
|
117
|
+
[literal,subs="+quotes"]
|
118
|
+
....
|
119
|
+
$ **asciidoctor -r dita-topic -b dita-topic -S secure _your_file_.adoc**
|
120
|
+
....
|
121
|
+
|
122
|
+
[#warnings]
|
123
|
+
== Warnings
|
124
|
+
|
125
|
+
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:
|
126
|
+
|
127
|
+
[literal,subs="+quotes"]
|
128
|
+
....
|
129
|
+
asciidoctor: WARNING: dita-topic: _The warning message_
|
130
|
+
....
|
131
|
+
|
132
|
+
This possible warning messages are as follows:
|
133
|
+
|
134
|
+
[horizontal]
|
135
|
+
Admonition titles not supported in DITA:: AsciiDoc allows you to add a custom title to any admonition by including `._Admonition title_` on the line above it. Unlike AsciiDoc, DITA does not allow titles for admonitions. `dita-topic` issues this warning whenever an admonition has a title defined in the converted AsciiDoc file.
|
136
|
+
|
137
|
+
Audio macro not supported:: AsciiDoc allows you to embed audio content in your documents by using the `audio::__audio_file__[]` macro. `dita-topic` does not implement this feature and issues this warning whenever the `audio` macro is present in the converted AsciiDoc file.
|
138
|
+
|
139
|
+
Block titles not supported in DITA:: AsciiDoc allows you to include `._Block title_` on the line above most of the block elements to assign a custom title to them. Unlike AsciiDoc, DITA only allows titles to be assigned to a limited number of elements. `dita-topic` issues this warning when the `-a dita-topic-titles=off` option is specified and a block title is present in the converted AsciiDoc file.
|
140
|
+
|
141
|
+
Callouts not supported in DITA:: AsciiDoc allows you to use `<1>`, `<2>`, `<3>` and so on in verbatim blocks to add annotations to the specific lines. Unlike AsciiDoc, DITA does not provide a direct equivalent for this functionality. `dita-topic` issues this warning when the `-a dita-topic-callouts=off` option is specified and these annotations are present in the converted AsciiDoc file.
|
142
|
+
|
143
|
+
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. `dita-topic` issues this warning when the `-a dita-topic-titles=off` option is specified and a floating title is present in the converted AsciiDoc file.
|
144
|
+
|
145
|
+
Inline breaks not supported in DITA:: AsciiDoc provides multiple ways to insert line breaks in paragraphs, such as inserting `{nbsp}+` at the end of the line or specifying `[%hardbreaks]` on the line preceding the paragraph. Unlike AsciiDoc, DITA does not provide direct equivalent for this functionality. `dita-topic` issues this warning whenever an inline line break is present in the converted AsciiDoc file and places the `<!-- break -\->` comment in the output file to mark its place.
|
146
|
+
|
147
|
+
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 `<section>` elements to be nested. `dita-topic` issues a warning whenever nested sections are present in the converted AsciiDoc file.
|
148
|
+
|
149
|
+
Page breaks not supported in DITA:: AsciiDoc allows you to use `<<<` on a separate line to enforce a page break in output formats that support it. Unlike AsciiDoc, DITA does not support page breaks. `dita-topic` issues this warning whenever a page break is present in the converted AsciiDoc file and places the `<p outputclass="page-break"></p>` in the output file to mark its place.
|
150
|
+
|
151
|
+
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 `dita-topic` is meant to be run on individual AsciiDoc files, it does not have access to information from referenced files during conversion. `dita-topic` issues this warning whenever a cross reference is present in the converted AsciiDoc file.
|
152
|
+
|
153
|
+
STEM support not implemented:: AsciiDoc provides multiple ways to insert Science, Technology, Engineering and Math (STEM) expressions in the document, including the `\stem:[_formula_]` inline macro and the `[stem]` delimited block. `dita-topic` does not implement this feature and issues this warning whenever such an expression is present in the converted AsciiDoc file.
|
154
|
+
|
155
|
+
Table footers not supported in DITA:: AsciiDoc allows you to set the `footer` option to mark the last table row as a table footer. Unlike AsciiDoc, DITA does not support table footers. `dita-topic` issues this warning whenever a table footer is present in the converted AsciiDoc file.
|
156
|
+
|
157
|
+
Thematic breaks not supported in DITA:: Asciidoc allows you to use `'''`, `---`, or `\***` (the last two with possible optional spaces in between the characters) to insert a thematic break in between two blocks, most commonly represented by a horizontal line. Unlike AsciiDoc, DITA does not support thematic breaks. `dita-topic` issues this warning whenever a thematic break is present in the converted AsciiDoc file.
|
158
|
+
|
159
|
+
Video macro not supported:: AsciiDoc allows you to embed video content in your documents by using the `video::__video_file__[]` macro. `dita-topic` does not implement this feature and issues this warning whenever the `video` macro is present in the converted AsciiDoc file.
|
160
|
+
|
161
|
+
[#copyright]
|
162
|
+
== Copyright
|
163
|
+
|
164
|
+
Copyright (C) 2024 Jaromir Hradilek
|
165
|
+
|
166
|
+
This program is free software, released under the terms of the link:LICENSE[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.
|
data/lib/dita-topic.rb
CHANGED
@@ -319,9 +319,23 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
319
319
|
end
|
320
320
|
|
321
321
|
def convert_inline_indexterm node
|
322
|
-
#
|
323
|
-
|
324
|
-
|
322
|
+
# Check if the index term appears in the flow of the text:
|
323
|
+
if node.type == :visible
|
324
|
+
return %(<indexterm>#{node.text}</indexterm>#{node.text})
|
325
|
+
end
|
326
|
+
|
327
|
+
# Get primary, secondary, and tertiary index terms:
|
328
|
+
terms = node.attr 'terms'
|
329
|
+
|
330
|
+
# Determine the number of terms:
|
331
|
+
case terms.size
|
332
|
+
when 1
|
333
|
+
%(<indexterm>#{terms[0]}</indexterm>)
|
334
|
+
when 2
|
335
|
+
%(<indexterm>#{terms[0]}<indexterm>#{terms[1]}</indexterm></indexterm>)
|
336
|
+
else
|
337
|
+
%(<indexterm>#{terms[0]}<indexterm>#{terms[1]}<indexterm>#{terms[2]}</indexterm></indexterm></indexterm>)
|
338
|
+
end
|
325
339
|
end
|
326
340
|
|
327
341
|
def convert_inline_kbd node
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-dita-topic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaromir Hradilek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -79,6 +79,9 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- AUTHORS
|
83
|
+
- LICENSE
|
84
|
+
- README.adoc
|
82
85
|
- lib/dita-topic.rb
|
83
86
|
homepage: https://github.com/jhradilek/asciidoctor-dita-topic
|
84
87
|
licenses:
|
@@ -102,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
105
|
- !ruby/object:Gem::Version
|
103
106
|
version: '0'
|
104
107
|
requirements: []
|
105
|
-
rubygems_version: 3.5.
|
108
|
+
rubygems_version: 3.5.22
|
106
109
|
signing_key:
|
107
110
|
specification_version: 4
|
108
111
|
summary: A custom AsciiDoc converter that generates individual DITA topics
|