asciidoctor-dita-topic 1.1.4 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +29 -2
- data/lib/dita-topic.rb +31 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4800181685253324c6e93aa8be4011212e700a94ef82e6489b2980f3b6361cf2
|
4
|
+
data.tar.gz: e3f39557c7dc47af05889e99546369448c3ef4b4af53a233c0beb3d8b5d48705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 691af18c68f264cc32b5a1a01ad3f220a0bbda0258333be153d36f2de15559da8b1bb7184a9046ef1b53c37a366f3e25fa5aecbfcba4882445c9b4238be0238b
|
7
|
+
data.tar.gz: f366e45753bba7d68146839ba1e55b6d480588aab356fff072cba5093b52554b4f56667e347f3497fa12683927c4c2ea6995f94695f30b9ccf46d73a5a4567ed
|
data/README.adoc
CHANGED
@@ -1,6 +1,29 @@
|
|
1
1
|
= dita-topic
|
2
2
|
|
3
|
-
`dita-topic` is a custom converter for Asciidoctor that converts a single AsciiDoc file to a corresponding DITA
|
3
|
+
`dita-topic` is a custom converter for Asciidoctor that converts a single AsciiDoc file to a corresponding DITA 1.3 topic.
|
4
|
+
|
5
|
+
In combination with link:https://github.com/jhradilek/asciidoctor-dita-vale[asciidoctor-dita-vale] and link:https://github.com/jhradilek/dita-custom-xslt#installation[dita-convert], this project can be used to rapidly convert AsciiDoc content to DITA:
|
6
|
+
|
7
|
+
. Identify incompatible markup in the AsciiDoc source file:
|
8
|
+
+
|
9
|
+
[literal,subs="+quotes"]
|
10
|
+
....
|
11
|
+
$ *vale source_file.adoc*
|
12
|
+
....
|
13
|
+
|
14
|
+
. Convert the AsciiDoc file to a generic DITA topic:
|
15
|
+
+
|
16
|
+
[literal,subs="+quotes"]
|
17
|
+
....
|
18
|
+
$ *asciidoctor -r dita-topic -b dita-topic source_file.adoc*
|
19
|
+
....
|
20
|
+
|
21
|
+
. Convert the generic DITA topic to a specialized DITA concept, reference, or task:
|
22
|
+
+
|
23
|
+
[literal,subs="+quotes"]
|
24
|
+
....
|
25
|
+
$ *dita-convert -gt task source_file.dita*
|
26
|
+
....
|
4
27
|
|
5
28
|
[#install]
|
6
29
|
== Installation
|
@@ -166,6 +189,8 @@ Block titles not supported in DITA:: AsciiDoc allows you to include `._Block tit
|
|
166
189
|
|
167
190
|
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.
|
168
191
|
|
192
|
+
Examples not supported within _object_ in DITA:: AsciiDoc allows you to use an example block anywhere in the document. Unlike AsciiDoc, DITA only allows examples to appear directly in the topic body. `dita-topic` issues a warning whenever an example is nested in another AsciiDoc element.
|
193
|
+
|
169
194
|
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.
|
170
195
|
|
171
196
|
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.
|
@@ -174,7 +199,9 @@ Nesting of sections not supported in DITA:: AsciiDoc allows you to nest sections
|
|
174
199
|
|
175
200
|
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.
|
176
201
|
|
177
|
-
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
|
202
|
+
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 the cross reference target is not present in the converted AsciiDoc file.
|
203
|
+
|
204
|
+
Sidebars not supported in DITA:: AsciiDoc allows you to assign any block the `[sidebar]` block style or enclose it between a pair of `\****` to create a delimited sidebar block. Unlike AsciiDoc, DITA does not support sidebar blocks. `dita-topic` issues this warning when the `-a dita-topic-sidebars=off` option is specified and a sidebar block is present in the converted AsciiDoc file.
|
178
205
|
|
179
206
|
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.
|
180
207
|
|
data/lib/dita-topic.rb
CHANGED
@@ -46,6 +46,9 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
46
46
|
|
47
47
|
# Enable floating and block titles by default:
|
48
48
|
@titles_allowed = true
|
49
|
+
|
50
|
+
# Enable sidebars by default:
|
51
|
+
@sidebars_allowed = true
|
49
52
|
end
|
50
53
|
|
51
54
|
def convert_document node
|
@@ -61,6 +64,9 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
61
64
|
# Check if floating and block titles are enabled:
|
62
65
|
@titles_allowed = false if (node.attr 'dita-topic-titles') == 'off'
|
63
66
|
|
67
|
+
# Check if sidebars are enabled:
|
68
|
+
@sidebars_allowed = false if (node.attr 'dita-topic-sidebars') == 'off'
|
69
|
+
|
64
70
|
# Check if the modular documentation content type is specified; both
|
65
71
|
# _module-type and _content-type are deprecated, but still present in
|
66
72
|
# some modules:
|
@@ -222,6 +228,12 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
222
228
|
end
|
223
229
|
|
224
230
|
def convert_example node
|
231
|
+
# Issue a warning if the example is nested:
|
232
|
+
unless (parent = node.parent.context) == :document
|
233
|
+
logger.warn "#{NAME}: Examples not supported within #{parent} in DITA"
|
234
|
+
end
|
235
|
+
|
236
|
+
# Return the XML output:
|
225
237
|
<<~EOF.chomp
|
226
238
|
<example#{compose_id node.id}>
|
227
239
|
#{node.title ? %(<title>#{node.title}</title>\n) : ''}#{node.content}
|
@@ -352,7 +364,7 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
352
364
|
end
|
353
365
|
|
354
366
|
# Return the XML entity:
|
355
|
-
compose_circled_number node.text.to_i
|
367
|
+
%(<b outputclass="callout">#{compose_circled_number node.text.to_i}</b>)
|
356
368
|
end
|
357
369
|
|
358
370
|
def convert_inline_footnote node
|
@@ -441,6 +453,18 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
441
453
|
%(“#{node.text}”)
|
442
454
|
when :single
|
443
455
|
%(‘#{node.text}’)
|
456
|
+
when :asciimath
|
457
|
+
# Issue a warning if a STEM content is present:
|
458
|
+
logger.warn "#{NAME}: STEM support not implemented"
|
459
|
+
|
460
|
+
# Add comments around the STEM content:
|
461
|
+
%(<!-- asciimath start -->#{node.text}<!-- asciimath end -->)
|
462
|
+
when :latexmath
|
463
|
+
# Issue a warning if a STEM content is present:
|
464
|
+
logger.warn "#{NAME}: STEM support not implemented"
|
465
|
+
|
466
|
+
# Add comments around the STEM content:
|
467
|
+
%(<!-- latexmath start -->#{node.text}<!-- latexmath end -->)
|
444
468
|
else
|
445
469
|
node.text
|
446
470
|
end
|
@@ -588,6 +612,12 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
588
612
|
# NOTE: Unlike AsciiDoc, DITA does not provide markup for a sidebar. As
|
589
613
|
# a workaround, I decided to use a div with the outputclass attribute.
|
590
614
|
|
615
|
+
# Issue a warning if sidebars are disabled:
|
616
|
+
unless @sidebars_allowed
|
617
|
+
logger.warn "#{NAME}: Sidebars not supported in DITA"
|
618
|
+
return ''
|
619
|
+
end
|
620
|
+
|
591
621
|
# Check if the content contains multiple block elements:
|
592
622
|
if node.content_model == :compound
|
593
623
|
<<~EOF.chomp
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-dita-topic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaromir Hradilek
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-
|
10
|
+
date: 2025-05-12 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: asciidoctor
|
@@ -90,7 +89,6 @@ metadata:
|
|
90
89
|
homepage_uri: https://github.com/jhradilek/asciidoctor-dita-topic
|
91
90
|
bug_tracker_uri: https://github.com/jhradilek/asciidoctor-dita-topic/issues
|
92
91
|
documentation_uri: https://github.com/jhradilek/asciidoctor-dita-topic/blob/main/README.adoc
|
93
|
-
post_install_message:
|
94
92
|
rdoc_options: []
|
95
93
|
require_paths:
|
96
94
|
- lib
|
@@ -105,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
103
|
- !ruby/object:Gem::Version
|
106
104
|
version: '0'
|
107
105
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
106
|
+
rubygems_version: 3.6.2
|
110
107
|
specification_version: 4
|
111
108
|
summary: A custom AsciiDoc converter that generates individual DITA topics
|
112
109
|
test_files: []
|