asciidoctor-dita-topic 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dita-topic.rb +15 -26
- 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: 282b184606c6d438a12c520b52f460e331d001d94c0727109639e971412db055
|
4
|
+
data.tar.gz: b22f5085ea51ac0502e177d30a6df600056043d85a0c8b0cbe7a6755bd3a580a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
66
|
-
|
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
|
-
|
59
|
+
<body>
|
69
60
|
#{node.content}
|
70
|
-
|
71
|
-
|
61
|
+
</body>
|
62
|
+
</topic>
|
72
63
|
EOF
|
73
64
|
end
|
74
65
|
|
@@ -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
|
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
|
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
|
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
|
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
|
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
|
646
|
+
add_block_title (result.join LF), node.title
|
656
647
|
end
|
657
648
|
|
658
649
|
def convert_verse node
|
@@ -704,7 +695,7 @@ 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
|
698
|
+
add_block_title (result.join LF), node.title
|
708
699
|
end
|
709
700
|
|
710
701
|
def compose_horizontal_dlist node
|
@@ -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
|
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
|
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
|
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.
|
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-
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|