asciidoctor-dita-topic 1.2.0 → 1.2.1

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 +5 -0
  3. data/lib/dita-topic.rb +34 -21
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51a2caa5d7a9ffe86c7953d7ac7b7be5b75e805e2cc26f1d5b41cfcbc82c876d
4
- data.tar.gz: 37951e25ad0227c52b0d1aeb1c37c8195bcc316a7f2073e1fc3c22d7b4bb5592
3
+ metadata.gz: 648f69ba5e5ada330dd2f74e5b6421d37e74a5a87e74d8fcce2a06361cf4f356
4
+ data.tar.gz: 3ba982932cab3253139ec969449584214db56e638f0bce7b1893685eeded2aed
5
5
  SHA512:
6
- metadata.gz: 23a3d3efe86dc34fcf92014fa9e2f3c08c8a9ac76150f22e0dea7951239170cbbcd18d0477797c0acad7464dc401ae849010c4409271d1df4d4b38deb5a04c63
7
- data.tar.gz: 2bf8a48fcd886f3674f21ce2676c1de1e9e7b3564a87803500d6d4994dec573b24608e50e5caadaccc9b98e1d6baefec3c26a0690590fd384b4814faa4513fe8
6
+ metadata.gz: 6aed474f0fdda4e30e85ae64cd8d2c532b6646d93713584bdffef7b00e875c2b9f12c94eae7c5c00ca00a364415fcb7d6a9da581eed88b036072f010a5de6b39
7
+ data.tar.gz: 214b99142e2ca90f6e0ad5e5baf42de415127977cf585ca04017db57213c47cccbc2261a9a61a66e9f315d922210020d1c3f165233f4c904d6d1542452f270bd
data/README.adoc CHANGED
@@ -35,6 +35,11 @@ Install the `asciidoctor-dita-topic` Ruby gem:
35
35
  $ *gem install asciidoctor-dita-topic*
36
36
  ....
37
37
 
38
+ [IMPORTANT]
39
+ ====
40
+ On macOS, `asciidoctor` installed with Homebrew expects Ruby gems in a different directory than where `gem install` places them. To work around this issue, you can either link:https://docs.asciidoctor.org/asciidoctor/latest/install/ruby-packaging/#gem-install[install `asciidoctor` as a Ruby gem], or run `asciidoctor` with the `-r` option followed by the relative path to the `dita-topic.rb` file.
41
+ ====
42
+
38
43
  [#use]
39
44
  == Usage
40
45
 
data/lib/dita-topic.rb CHANGED
@@ -61,6 +61,13 @@ class DitaTopic < Asciidoctor::Converter::Base
61
61
  # Check if sidebars are enabled:
62
62
  @sidebars_allowed = false if (node.attr 'dita-topic-sidebars') == 'off'
63
63
 
64
+ # Check if the file name is available (it is not for standard input):
65
+ if node.attr? 'docname'
66
+ file_name = node.attr 'docname'
67
+ file_suffix = (node.attr? 'docfilesuffix') ? (node.attr 'docfilesuffix') : ''
68
+ @file_name = "#{file_name}#{file_suffix}"
69
+ end
70
+
64
71
  # Check if the modular documentation content type is specified; both
65
72
  # _module-type and _content-type are deprecated, but still present in
66
73
  # some modules:
@@ -95,7 +102,7 @@ class DitaTopic < Asciidoctor::Converter::Base
95
102
  # Check if the author line defined while disabled:
96
103
  if !@authors_allowed && !node.authors.empty?
97
104
  # Issue a warning as inline content is not going to be processed:
98
- logger.warn "#{NAME}: Author lines not enabled for topics"
105
+ logger.warn format_message "Author lines not enabled for topics"
99
106
 
100
107
  # Process the author line as a plain paragraph:
101
108
  result << %(<p>#{node.authors.map {|author| compose_author author, node}.join('; ')}</p>)
@@ -117,7 +124,7 @@ class DitaTopic < Asciidoctor::Converter::Base
117
124
 
118
125
  # Issue a warning if the admonition has a title:
119
126
  if node.title?
120
- logger.warn "#{NAME}: Admonition titles not supported in DITA"
127
+ logger.warn format_message "Admonition titles not supported in DITA"
121
128
  end
122
129
 
123
130
  # Return the XML output:
@@ -144,7 +151,7 @@ class DitaTopic < Asciidoctor::Converter::Base
144
151
  def convert_colist node
145
152
  # Issue a warning if callouts are disabled:
146
153
  unless @callouts_allowed
147
- logger.warn "#{NAME}: Callouts not supported in DITA"
154
+ logger.warn format_message "Callouts not supported in DITA"
148
155
  return ''
149
156
  end
150
157
 
@@ -231,7 +238,7 @@ class DitaTopic < Asciidoctor::Converter::Base
231
238
  def convert_example node
232
239
  # Issue a warning if the example is nested:
233
240
  if (parent = node.parent.context) != :document && parent != :preamble
234
- logger.warn "#{NAME}: Examples not supported within #{parent} in DITA"
241
+ logger.warn format_message "Examples not supported within #{parent} in DITA"
235
242
  end
236
243
 
237
244
  # Return the XML output:
@@ -249,7 +256,7 @@ class DitaTopic < Asciidoctor::Converter::Base
249
256
 
250
257
  # Issue a warning if floating titles are disabled:
251
258
  unless @titles_allowed
252
- logger.warn "#{NAME}: Floating titles not supported in DITA"
259
+ logger.warn format_message "Floating titles not supported in DITA"
253
260
  return ''
254
261
  end
255
262
 
@@ -303,7 +310,7 @@ class DitaTopic < Asciidoctor::Converter::Base
303
310
  # Determine whether the cross reference links to a file path:
304
311
  if (path = node.attributes['path'])
305
312
  # Issue a warning if the cross reference includes an ID:
306
- logger.warn "#{NAME}: Possible invalid reference: #{node.target}" if node.target.include? '#'
313
+ logger.warn format_message "Possible invalid reference: #{node.target}" if node.target.include? '#'
307
314
 
308
315
  # Compose a cross reference:
309
316
  return %(<xref href="#{node.target}">#{node.text || path}</xref>)
@@ -322,7 +329,7 @@ class DitaTopic < Asciidoctor::Converter::Base
322
329
  end
323
330
 
324
331
  # Issue a warning as the cross reference is unlikely to work:
325
- logger.warn "#{NAME}: Possible invalid reference: #{node.target}"
332
+ logger.warn format_message "Possible invalid reference: #{node.target}"
326
333
 
327
334
  # Compose the cross reference:
328
335
  node.text ? %(<xref href="#{node.target}">#{node.text}</xref>) : %(<xref href="#{node.target}" />)
@@ -344,7 +351,7 @@ class DitaTopic < Asciidoctor::Converter::Base
344
351
  %(<i id="#{node.id}" />[#{node.reftext || node.id}])
345
352
  else
346
353
  # Issue a warning if an unknown anchor type is present:
347
- logger.warn "#{NAME}: Unknown anchor type: #{node.type}"
354
+ logger.warn format_message "Unknown anchor type: #{node.type}"
348
355
  ''
349
356
  end
350
357
  end
@@ -353,7 +360,7 @@ class DitaTopic < Asciidoctor::Converter::Base
353
360
  # NOTE: Unlike AsciiDoc, DITA does not support inline line breaks.
354
361
 
355
362
  # Issue a warning if an inline line break is present:
356
- logger.warn "#{NAME}: Inline breaks not supported in DITA"
363
+ logger.warn format_message "Inline breaks not supported in DITA"
357
364
 
358
365
  # Return the XML output:
359
366
  %(#{node.text}<!-- break -->)
@@ -366,7 +373,7 @@ class DitaTopic < Asciidoctor::Converter::Base
366
373
  def convert_inline_callout node
367
374
  # Issue a warning if callouts are disabled:
368
375
  unless @callouts_allowed
369
- logger.warn "#{NAME}: Callouts not supported in DITA"
376
+ logger.warn format_message "Callouts not supported in DITA"
370
377
  return ''
371
378
  end
372
379
 
@@ -481,13 +488,13 @@ class DitaTopic < Asciidoctor::Converter::Base
481
488
  %(&#8216;#{node.text}&#8217;)
482
489
  when :asciimath
483
490
  # Issue a warning if a STEM content is present:
484
- logger.warn "#{NAME}: STEM support not implemented"
491
+ logger.warn format_message "STEM support not implemented"
485
492
 
486
493
  # Add comments around the STEM content:
487
494
  %(<!-- asciimath start -->#{node.text}<!-- asciimath end -->)
488
495
  when :latexmath
489
496
  # Issue a warning if a STEM content is present:
490
- logger.warn "#{NAME}: STEM support not implemented"
497
+ logger.warn format_message "STEM support not implemented"
491
498
 
492
499
  # Add comments around the STEM content:
493
500
  %(<!-- latexmath start -->#{node.text}<!-- latexmath end -->)
@@ -570,7 +577,7 @@ class DitaTopic < Asciidoctor::Converter::Base
570
577
  # NOTE: Unlike AsciiDoc, DITA does not support page breaks.
571
578
 
572
579
  # Issue a warning if a page break is present:
573
- logger.warn "#{NAME}: Page breaks not supported in DITA"
580
+ logger.warn format_message "Page breaks not supported in DITA"
574
581
 
575
582
  # Return the XML output:
576
583
  %(<p outputclass="page-break"></p>)
@@ -623,7 +630,7 @@ class DitaTopic < Asciidoctor::Converter::Base
623
630
  # markup.
624
631
 
625
632
  # Issue a warning if there are nested sections:
626
- logger.warn "#{NAME}: Nesting of sections not supported in DITA" if node.level > 1
633
+ logger.warn format_message "Nesting of sections not supported in DITA" if node.level > 1
627
634
 
628
635
  # Return the XML output:
629
636
  <<~EOF.chomp
@@ -640,7 +647,7 @@ class DitaTopic < Asciidoctor::Converter::Base
640
647
 
641
648
  # Issue a warning if sidebars are disabled:
642
649
  unless @sidebars_allowed
643
- logger.warn "#{NAME}: Sidebars not supported in DITA"
650
+ logger.warn format_message "Sidebars not supported in DITA"
644
651
  return ''
645
652
  end
646
653
 
@@ -662,7 +669,7 @@ class DitaTopic < Asciidoctor::Converter::Base
662
669
 
663
670
  def convert_stem node
664
671
  # Issue a warning if a STEM content is present:
665
- logger.warn "#{NAME}: STEM support not implemented"
672
+ logger.warn format_message "STEM support not implemented"
666
673
  return ''
667
674
  end
668
675
 
@@ -688,7 +695,7 @@ class DitaTopic < Asciidoctor::Converter::Base
688
695
 
689
696
  # Issue a warning if a table footer is present:
690
697
  if type == :foot
691
- logger.warn "#{NAME}: Table footers not supported in DITA"
698
+ logger.warn format_message "Table footers not supported in DITA"
692
699
  next
693
700
  end
694
701
 
@@ -750,7 +757,7 @@ class DitaTopic < Asciidoctor::Converter::Base
750
757
  # NOTE: Unlike AsciiDoc, DITA does not support thematic breaks.
751
758
 
752
759
  # Issue a warning if a thematic break is present:
753
- logger.warn "#{NAME}: Thematic breaks not supported in DITA"
760
+ logger.warn format_message "Thematic breaks not supported in DITA"
754
761
 
755
762
  # Return the XML output:
756
763
  %(<p outputclass="thematic-break"></p>)
@@ -944,7 +951,7 @@ class DitaTopic < Asciidoctor::Converter::Base
944
951
 
945
952
  # Issue a warning if block titles are disabled:
946
953
  unless @titles_allowed
947
- logger.warn "#{NAME}: Block titles not supported in DITA"
954
+ logger.warn format_message "Block titles not supported in DITA"
948
955
  return content
949
956
  end
950
957
 
@@ -971,7 +978,7 @@ class DitaTopic < Asciidoctor::Converter::Base
971
978
 
972
979
  # Issue a warning if floating titles are disabled:
973
980
  unless @titles_allowed
974
- logger.warn "#{NAME}: Floating titles not supported in DITA"
981
+ logger.warn format_message "Floating titles not supported in DITA"
975
982
  return ''
976
983
  end
977
984
 
@@ -986,7 +993,7 @@ class DitaTopic < Asciidoctor::Converter::Base
986
993
  def compose_circled_number number
987
994
  # Verify the number is in a supported range:
988
995
  if number < 1 || number > 50
989
- logger.warn "#{NAME}: Callout number not in range between 1 and 50"
996
+ logger.warn format_message "Callout number not in range between 1 and 50"
990
997
  return number
991
998
  end
992
999
 
@@ -999,5 +1006,11 @@ class DitaTopic < Asciidoctor::Converter::Base
999
1006
  %(&##{12941 + number};)
1000
1007
  end
1001
1008
  end
1009
+
1010
+ def format_message message
1011
+ # Compose the warning or error message:
1012
+ file_name = (defined? @file_name) ? %( #{@file_name}:) : ''
1013
+ %(#{NAME}:#{file_name} #{message})
1014
+ end
1002
1015
  end
1003
1016
  end
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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-23 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: asciidoctor
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.6.2
106
+ rubygems_version: 3.6.7
107
107
  specification_version: 4
108
108
  summary: A custom AsciiDoc converter that generates individual DITA topics
109
109
  test_files: []