asciidoctor-dita-topic 1.1.8 → 1.2.0
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 +53 -16
- data/lib/dita-topic.rb +66 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a2caa5d7a9ffe86c7953d7ac7b7be5b75e805e2cc26f1d5b41cfcbc82c876d
|
4
|
+
data.tar.gz: 37951e25ad0227c52b0d1aeb1c37c8195bcc316a7f2073e1fc3c22d7b4bb5592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a3d3efe86dc34fcf92014fa9e2f3c08c8a9ac76150f22e0dea7951239170cbbcd18d0477797c0acad7464dc401ae849010c4409271d1df4d4b38deb5a04c63
|
7
|
+
data.tar.gz: 2bf8a48fcd886f3674f21ce2676c1de1e9e7b3564a87803500d6d4994dec573b24608e50e5caadaccc9b98e1d6baefec3c26a0690590fd384b4814faa4513fe8
|
data/README.adoc
CHANGED
@@ -144,18 +144,6 @@ To disable this behavior, set the value of the `dita-topic-callouts` to `off`:
|
|
144
144
|
$ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-callouts=off _your_file_.adoc**
|
145
145
|
....
|
146
146
|
|
147
|
-
[#abstracts]
|
148
|
-
=== Disable abstracts
|
149
|
-
|
150
|
-
By default, the `dita-topic` converter recognizes a paragraph preceded by the `[role="_abstract"]` attribute list and preserves this information by adding the `outputclass="abstract"` attribute to it in DITA. The link:https://github.com/jhradilek/dita-custom-xslt#installation[dita-convert Python package] uses this attribute to populate the `<shortdesc>` element during conversion to a specialized DITA concept, reference, or task.
|
151
|
-
|
152
|
-
To disable this behavior, set the value of the `dita-topic-abstracts` to `off`:
|
153
|
-
|
154
|
-
[literal,subs="+quotes"]
|
155
|
-
....
|
156
|
-
$ **asciidoctor -r dita-topic -b dita-topic -a dita-topic-abstracts=off _your_file_.adoc**
|
157
|
-
....
|
158
|
-
|
159
147
|
[#includes]
|
160
148
|
=== Disabling include directives
|
161
149
|
|
@@ -166,6 +154,59 @@ By default, Asciidoctor resolves all `include` directives before converting the
|
|
166
154
|
$ **asciidoctor -r dita-topic -b dita-topic -S secure _your_file_.adoc**
|
167
155
|
....
|
168
156
|
|
157
|
+
[#abstracts]
|
158
|
+
=== Adding short descriptions
|
159
|
+
|
160
|
+
DITA provides the `<shortdesc>` element which allows the user to describe the purpose of the topic and is often used as preview text in search results. To replicate this behavior, the `dita-topic` converter recognizes a paragraph preceded by the `[role="_abstract"]` attribute list and adds the `outputclass="abstract"` attribute to it. The link:https://github.com/jhradilek/dita-custom-xslt#installation[dita-convert Python package] transforms such a paragraph to `<shortdesc>` during conversion to a specialized DITA concept, reference, or task.
|
161
|
+
|
162
|
+
For example, to designate a paragraph as a short description, use the following AsciiDoc markup:
|
163
|
+
|
164
|
+
[source,asciidoc]
|
165
|
+
----
|
166
|
+
[id="topic-id"]
|
167
|
+
= Procedure title
|
168
|
+
|
169
|
+
[role="_abstract"]
|
170
|
+
A short description of the procedure module and what it helps the
|
171
|
+
user accomplish.
|
172
|
+
|
173
|
+
An introductory paragraph.
|
174
|
+
----
|
175
|
+
|
176
|
+
[#semantics]
|
177
|
+
=== Adding semantic markup
|
178
|
+
|
179
|
+
Unlike AsciiDoc, DITA provides a number of semantic elements for software components such as file names, commands, or command-line options. To replicate this behavior, the `dita-topic` converter recognizes the following link:https://docs.asciidoctor.org/asciidoc/latest/attributes/role/#assign-roles-to-formatted-inline-elements[roles] assigned to monospace (```) inline text:
|
180
|
+
|
181
|
+
[cols="1,1"]
|
182
|
+
|===
|
183
|
+
| AsciiDoc Role
|
184
|
+
| DITA Element
|
185
|
+
|
186
|
+
| command
|
187
|
+
| `<cmdname>`
|
188
|
+
|
189
|
+
| directory
|
190
|
+
| `<filepath>`
|
191
|
+
|
192
|
+
| filename
|
193
|
+
| `<filepath>`
|
194
|
+
|
195
|
+
| option
|
196
|
+
| `<option>`
|
197
|
+
|
198
|
+
| variable
|
199
|
+
| `<varname>`
|
200
|
+
|===
|
201
|
+
|
202
|
+
For example, to describe a file name, use the following AsciiDoc markup:
|
203
|
+
|
204
|
+
[source,asciidoc]
|
205
|
+
----
|
206
|
+
Read the [filename]`/etc/passwd` file to see the complete list of
|
207
|
+
available user accounts.
|
208
|
+
----
|
209
|
+
|
169
210
|
[#warnings]
|
170
211
|
== Warnings
|
171
212
|
|
@@ -181,8 +222,6 @@ This possible warning messages are as follows:
|
|
181
222
|
[horizontal]
|
182
223
|
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.
|
183
224
|
|
184
|
-
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.
|
185
|
-
|
186
225
|
Author lines not enabled for topics:: AsciiDoc interprets the first line that directly follows the document title as an author line. Because topics are not expected to have author lines, `dita-topic` issues this warning when an author line is present in the converted AsciiDoc file.
|
187
226
|
|
188
227
|
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.
|
@@ -209,8 +248,6 @@ Table footers not supported in DITA:: AsciiDoc allows you to set the `footer` op
|
|
209
248
|
|
210
249
|
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.
|
211
250
|
|
212
|
-
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.
|
213
|
-
|
214
251
|
[#copyright]
|
215
252
|
== Copyright
|
216
253
|
|
data/lib/dita-topic.rb
CHANGED
@@ -38,9 +38,6 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
38
38
|
# Disable the author line by default:
|
39
39
|
@authors_allowed = false
|
40
40
|
|
41
|
-
# Enable abstract paragraphs by default:
|
42
|
-
@abstracts_allowed = true
|
43
|
-
|
44
41
|
# Enable callouts by default:
|
45
42
|
@callouts_allowed = true
|
46
43
|
|
@@ -55,9 +52,6 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
55
52
|
# Check if the author line is enabled:
|
56
53
|
@authors_allowed = true if (node.attr 'dita-topic-authors') == 'on'
|
57
54
|
|
58
|
-
# Check if abstract paragraphs are enabled:
|
59
|
-
@abstracts_allowed = false if (node.attr 'dita-topic-abstracts') == 'off'
|
60
|
-
|
61
55
|
# Check if callouts are enabled:
|
62
56
|
@callouts_allowed = false if (node.attr 'dita-topic-callouts') == 'off'
|
63
57
|
|
@@ -135,9 +129,16 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
135
129
|
end
|
136
130
|
|
137
131
|
def convert_audio node
|
138
|
-
#
|
139
|
-
|
140
|
-
|
132
|
+
# Check if the audio macro has a title specified:
|
133
|
+
if node.title?
|
134
|
+
<<~EOF.chomp
|
135
|
+
<object data="#{node.media_uri(node.attr 'target')}">
|
136
|
+
<desc>#{node.title}</desc>
|
137
|
+
</object>
|
138
|
+
EOF
|
139
|
+
else
|
140
|
+
%(<object data="#{node.media_uri(node.attr 'target')}" />)
|
141
|
+
end
|
141
142
|
end
|
142
143
|
|
143
144
|
def convert_colist node
|
@@ -450,7 +451,26 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
450
451
|
when :strong
|
451
452
|
%(<b>#{node.text}</b>)
|
452
453
|
when :monospaced
|
453
|
-
|
454
|
+
# Check whether a role is provided:
|
455
|
+
if node.role
|
456
|
+
# Define supported roles:
|
457
|
+
semantic_markup = {
|
458
|
+
'command' => 'cmdname',
|
459
|
+
'directory' => 'filepath',
|
460
|
+
'filename' => 'filepath',
|
461
|
+
'option' => 'option',
|
462
|
+
'variable' => 'varname'
|
463
|
+
}
|
464
|
+
|
465
|
+
# Select the appropriate semantic element:
|
466
|
+
element = (semantic_markup.key? node.role) ? semantic_markup[node.role] : 'tt'
|
467
|
+
else
|
468
|
+
# Use the teletype element by default:
|
469
|
+
element = 'tt'
|
470
|
+
end
|
471
|
+
|
472
|
+
# Return the result:
|
473
|
+
%(<#{element}>#{node.text}</#{element}>)
|
454
474
|
when :superscript
|
455
475
|
%(<sup>#{node.text}</sup>)
|
456
476
|
when :subscript
|
@@ -557,7 +577,7 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
557
577
|
end
|
558
578
|
|
559
579
|
def convert_paragraph node
|
560
|
-
if
|
580
|
+
if (node.attr 'role') == '_abstract'
|
561
581
|
add_block_title %(<p outputclass="abstract">#{node.content}</p>), node.title
|
562
582
|
else
|
563
583
|
add_block_title %(<p>#{node.content}</p>), node.title
|
@@ -782,9 +802,41 @@ class DitaTopic < Asciidoctor::Converter::Base
|
|
782
802
|
end
|
783
803
|
|
784
804
|
def convert_video node
|
785
|
-
#
|
786
|
-
|
787
|
-
|
805
|
+
# Check if additional attributes are specified:
|
806
|
+
width = (node.attr? 'width') ? %( width="#{node.attr 'width'}") : ''
|
807
|
+
height = (node.attr? 'height') ? %( height="#{node.attr 'height'}") : ''
|
808
|
+
|
809
|
+
# Check if the video is a Vimeo or YouTube video:
|
810
|
+
if (provider = (node.attr 'poster')) == 'youtube'
|
811
|
+
# Separate a playlist from the target:
|
812
|
+
target, list = (node.attr 'target').split '/', 2
|
813
|
+
|
814
|
+
# Check if the playlist is provided as an attribute:
|
815
|
+
if node.attr 'list' and not list
|
816
|
+
list = node.attr 'list'
|
817
|
+
end
|
818
|
+
|
819
|
+
# Compose the playlist URL fragment:
|
820
|
+
list = list ? %(?list=#{list}) : ''
|
821
|
+
|
822
|
+
# Compose the target URL:
|
823
|
+
target_url = %(https://www.youtube.com/embed/#{target}#{list})
|
824
|
+
elsif provider == 'vimeo'
|
825
|
+
target_url = %(https://player.vimeo.com/video/#{node.attr 'target'})
|
826
|
+
else
|
827
|
+
target_url = node.media_uri(node.attr 'target')
|
828
|
+
end
|
829
|
+
|
830
|
+
# Check if the audio macro has a title specified:
|
831
|
+
if node.title?
|
832
|
+
<<~EOF.chomp
|
833
|
+
<object data="#{target_url}"#{width}#{height}>
|
834
|
+
<desc>#{node.title}</desc>
|
835
|
+
</object>
|
836
|
+
EOF
|
837
|
+
else
|
838
|
+
%(<object data="#{target_url}"#{width}#{height} />)
|
839
|
+
end
|
788
840
|
end
|
789
841
|
|
790
842
|
def compose_qanda_dlist node
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-dita-topic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaromir Hradilek
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-06-23 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: asciidoctor
|