asciidoctor-dita-topic 1.1.9 → 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +0 -4
  3. data/lib/dita-topic.rb +45 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38849b62e13e55fe22459cab2c4a7aab8d47286e94cb5d573eeed98c175381ce
4
- data.tar.gz: 440406834354a1a70c87be6026b763f95c920de0d924d5f9a2cdb2aee5842a1f
3
+ metadata.gz: 51a2caa5d7a9ffe86c7953d7ac7b7be5b75e805e2cc26f1d5b41cfcbc82c876d
4
+ data.tar.gz: 37951e25ad0227c52b0d1aeb1c37c8195bcc316a7f2073e1fc3c22d7b4bb5592
5
5
  SHA512:
6
- metadata.gz: cb1ee4720a5c4580557cf96bba10e93aa70e3ea1d3c976e0a2968f329a4e9eab7c04f3a60b8c791fa524089f0096c07e6624d170ffe8acc987f56add7992cab3
7
- data.tar.gz: 26fe19f12366806c508b6c11218c6a78aa3d522032260d135e5b344bad150c91cdbe159d75b81b6ff1adcf0f58a3e52e440bee41c0563f785f4be70e0a92671a
6
+ metadata.gz: 23a3d3efe86dc34fcf92014fa9e2f3c08c8a9ac76150f22e0dea7951239170cbbcd18d0477797c0acad7464dc401ae849010c4409271d1df4d4b38deb5a04c63
7
+ data.tar.gz: 2bf8a48fcd886f3674f21ce2676c1de1e9e7b3564a87803500d6d4994dec573b24608e50e5caadaccc9b98e1d6baefec3c26a0690590fd384b4814faa4513fe8
data/README.adoc CHANGED
@@ -222,8 +222,6 @@ This possible warning messages are as follows:
222
222
  [horizontal]
223
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.
224
224
 
225
- 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.
226
-
227
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.
228
226
 
229
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.
@@ -250,8 +248,6 @@ Table footers not supported in DITA:: AsciiDoc allows you to set the `footer` op
250
248
 
251
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.
252
250
 
253
- 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.
254
-
255
251
  [#copyright]
256
252
  == Copyright
257
253
 
data/lib/dita-topic.rb CHANGED
@@ -129,9 +129,16 @@ class DitaTopic < Asciidoctor::Converter::Base
129
129
  end
130
130
 
131
131
  def convert_audio node
132
- # Issue a warning if audio content is present:
133
- logger.warn "#{NAME}: Audio macro not supported"
134
- return ''
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
135
142
  end
136
143
 
137
144
  def convert_colist node
@@ -795,9 +802,41 @@ class DitaTopic < Asciidoctor::Converter::Base
795
802
  end
796
803
 
797
804
  def convert_video node
798
- # Issue a warning if video content is present:
799
- logger.warn "#{NAME}: Video macro not supported"
800
- return ''
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
801
840
  end
802
841
 
803
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.1.9
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-06-07 00:00:00.000000000 Z
10
+ date: 2025-06-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: asciidoctor