asciidoctor-dita-topic 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dita-topic.rb +17 -28
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d8849df85b9b5beff0e0e583464b4e1398ca56fe49b52255dd27a9f072ddf9a
4
- data.tar.gz: dff16a2d22920219d867521ed689df99cde217c750394010e5057c10a7b68730
3
+ metadata.gz: 282b184606c6d438a12c520b52f460e331d001d94c0727109639e971412db055
4
+ data.tar.gz: b22f5085ea51ac0502e177d30a6df600056043d85a0c8b0cbe7a6755bd3a580a
5
5
  SHA512:
6
- metadata.gz: 01752f000d44a620eb19726e23a86b2d67eb9fe5559dd1a7949d75af941ce7dfabdb9e7d49aa7342a8c5742984d078149d029062d6778fed9e3b0d21071e926b
7
- data.tar.gz: fe84a2ebe09d0376897a9d1858b214c8103519236e4456f66d6496d152cb6d9838f3de14cce5db9576b5aa916a53f1ab956f122ac6e9a591675ebf2acd997302
6
+ metadata.gz: b17790a1bb95fd63098fbb73e2661fbefbd687f38167f40e7181c2222c621a52d06a45127e1f463a7bad159860bf0426dc4fc35f4ca93bc1cde42667b8b633b1
7
+ data.tar.gz: e91f8fc1905a115439207edcaf04bfa2e42b36e590630e91774c20fd6f2f579e79b4887eb537e4b04d0061a1f1ba06f3a9985f64c72188fc9090913bfe996b8b
data/lib/dita-topic.rb CHANGED
@@ -47,28 +47,19 @@ class DitaTopic < Asciidoctor::Converter::Base
47
47
  # Check if callouts are enabled:
48
48
  @callouts_allowed = false if (node.attr 'dita-topic-callouts') == 'off'
49
49
 
50
- # Check if a specific topic type is provided:
51
- if (value = node.attr 'dita-topic-type') =~ /^(concept|reference|task)$/
52
- type = value
53
- body = (type == 'task') ? 'taskbody' : %(#{type[0,3]}body)
54
- else
55
- type = 'topic'
56
- body = 'body'
57
- end
58
-
59
50
  # Check if the modular documentation content type is specified:
60
51
  outputclass = (node.attr? '_mod-docs-content-type') ? %( outputclass="#{(node.attr '_mod-docs-content-type').downcase}") : ''
61
52
 
62
53
  # Return the XML output:
63
54
  <<~EOF.chomp
64
55
  <?xml version='1.0' encoding='utf-8' ?>
65
- <!DOCTYPE #{type} PUBLIC "-//OASIS//DTD DITA #{type.capitalize}//EN" "#{type}.dtd">
66
- <#{type}#{compose_id (node.id or node.attributes['docname'])}#{outputclass}>
56
+ <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
57
+ <topic#{compose_id (node.id or node.attributes['docname'])}#{outputclass}>
67
58
  <title>#{node.doctitle}</title>
68
- <#{body}>
59
+ <body>
69
60
  #{node.content}
70
- </#{body}>
71
- </#{type}>
61
+ </body>
62
+ </topic>
72
63
  EOF
73
64
  end
74
65
 
@@ -107,7 +98,7 @@ class DitaTopic < Asciidoctor::Converter::Base
107
98
  number = 0
108
99
 
109
100
  # Open the table:
110
- result = ['<table>']
101
+ result = ['<table outputclass="callout-list">']
111
102
  result << %(<tgroup cols="2">)
112
103
  result << %(<colspec colwidth="#{node.attr 'labelwidth', 15}*" />)
113
104
  result << %(<colspec colwidth="#{node.attr 'itemwidth', 85}*" />)
@@ -186,7 +177,7 @@ class DitaTopic < Asciidoctor::Converter::Base
186
177
  result << '</dl>'
187
178
 
188
179
  # Return the XML output:
189
- add_block_title (result.join LF), node.title, 'dlist'
180
+ add_block_title (result.join LF), node.title
190
181
  end
191
182
 
192
183
  def convert_example node
@@ -400,7 +391,7 @@ class DitaTopic < Asciidoctor::Converter::Base
400
391
  end
401
392
 
402
393
  # Return the XML output:
403
- add_block_title result, node.title, 'listing'
394
+ add_block_title result, node.title
404
395
  end
405
396
 
406
397
  def convert_literal node
@@ -412,7 +403,7 @@ class DitaTopic < Asciidoctor::Converter::Base
412
403
  EOF
413
404
 
414
405
  # Return the XML output:
415
- add_block_title result, node.title, 'literal'
406
+ add_block_title result, node.title
416
407
  end
417
408
 
418
409
  def convert_olist node
@@ -436,7 +427,7 @@ class DitaTopic < Asciidoctor::Converter::Base
436
427
  result << '</ol>'
437
428
 
438
429
  # Return the XML output:
439
- add_block_title (result.join LF), node.title, 'olist'
430
+ add_block_title (result.join LF), node.title
440
431
  end
441
432
 
442
433
  # FIXME: This is not the top priority.
@@ -455,7 +446,7 @@ class DitaTopic < Asciidoctor::Converter::Base
455
446
  end
456
447
 
457
448
  def convert_paragraph node
458
- add_block_title %(<p>#{node.content}</p>), node.title, 'paragraph'
449
+ add_block_title %(<p>#{node.content}</p>), node.title
459
450
  end
460
451
 
461
452
  def convert_preamble node
@@ -652,7 +643,7 @@ class DitaTopic < Asciidoctor::Converter::Base
652
643
  result << '</ul>'
653
644
 
654
645
  # Returned the XML output:
655
- add_block_title (result.join LF), node.title, 'ulist'
646
+ add_block_title (result.join LF), node.title
656
647
  end
657
648
 
658
649
  def convert_verse node
@@ -704,12 +695,12 @@ class DitaTopic < Asciidoctor::Converter::Base
704
695
  result << '</ol>'
705
696
 
706
697
  # Return the XML output:
707
- add_block_title (result.join LF), node.title, 'qanda'
698
+ add_block_title (result.join LF), node.title
708
699
  end
709
700
 
710
701
  def compose_horizontal_dlist node
711
702
  # Open the table:
712
- result = ['<table>']
703
+ result = ['<table outputclass="horizontal-dlist">']
713
704
  result << %(<tgroup cols="2">)
714
705
  result << %(<colspec colwidth="#{node.attr 'labelwidth', 15}*" />)
715
706
  result << %(<colspec colwidth="#{node.attr 'itemwidth', 85}*" />)
@@ -755,7 +746,7 @@ class DitaTopic < Asciidoctor::Converter::Base
755
746
  result << %(</table>)
756
747
 
757
748
  # Return the XML output:
758
- add_block_title (result.join LF), node.title, 'horizontal'
749
+ add_block_title (result.join LF), node.title
759
750
  end
760
751
 
761
752
  # Method aliases
@@ -766,10 +757,10 @@ class DitaTopic < Asciidoctor::Converter::Base
766
757
 
767
758
  # Helper methods
768
759
 
769
- def add_block_title content, title, context='wrapper'
760
+ def add_block_title content, title
770
761
  # NOTE: Unlike AsciiDoc, DITA does not support titles assigned to
771
762
  # certain block elements. As a workaround, I decided to use a paragraph
772
- # with the outputclass attribute and wrap the block in a div element.
763
+ # with the outputclass attribute.
773
764
 
774
765
  # Check if the title is defined:
775
766
  return content unless title
@@ -782,10 +773,8 @@ class DitaTopic < Asciidoctor::Converter::Base
782
773
 
783
774
  # Return the XML output:
784
775
  <<~EOF.chomp
785
- <div outputclass="#{context}">
786
776
  <p outputclass="title"><b>#{title}</b></p>
787
777
  #{content}
788
- </div>
789
778
  EOF
790
779
  end
791
780
 
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.5
4
+ version: 1.0.7
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-08-05 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor