asciidoctor-dita-map 0.9.13 → 0.9.15
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/bin/dita-type +0 -5
- data/lib/dita-map/cli.rb +10 -6
- data/lib/dita-map/convert.rb +5 -0
- data/lib/dita-map/map.rb +15 -13
- data/lib/dita-map/topic.rb +6 -4
- data/lib/dita-map/version.rb +1 -1
- 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: e10278e445c7ebb802fd7b59b0f2d59833ef3cf15daac9f5401a21ffa5004cf5
|
|
4
|
+
data.tar.gz: db2bfadc8deb15cddac4f2edc10c2e84edaae52532eb85539046376f310f6736
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e6b6ab31781f9cba233fbc62194a738e3db56746c8dcb134d4ce4288119ead15cf13af4f985812688caa7195dcbd76204290e0c03a39b880c0ccb4f22626267
|
|
7
|
+
data.tar.gz: 7274e2d7e1f79bbefae1500e1530ad7ed167e6a814d58ed6aa977914ebb12ebd455668bd72cabb7fb07bb807dfc778ad474ebb5e457e6b15d644cd1b15625bae
|
data/bin/dita-type
CHANGED
data/lib/dita-map/cli.rb
CHANGED
|
@@ -72,22 +72,26 @@ module AsciidoctorDitaMap
|
|
|
72
72
|
@converter.opts[:assembly] = false
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
opt.on('-
|
|
76
|
-
@converter.opts[:
|
|
75
|
+
opt.on('-C', '--no-chunk', 'do not generate the chunk attribute') do
|
|
76
|
+
@converter.opts[:chunk] = false
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
opt.on('-
|
|
80
|
-
@converter.opts[:
|
|
79
|
+
opt.on('-H', '--no-topichead', 'do not generate the topichead element') do
|
|
80
|
+
@converter.opts[:topichead] = false
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
opt.on('-
|
|
84
|
-
@converter.opts[:
|
|
83
|
+
opt.on('-I', '--no-id', 'do not generate the map id attribute') do
|
|
84
|
+
@converter.opts[:id] = false
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
opt.on('-L', '--no-locktitle', 'do not generate the locktitle attribute') do
|
|
88
88
|
@converter.opts[:locktitle] = false
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
opt.on('-M', '--no-maptitle', 'do not generate the map title') do
|
|
92
|
+
@converter.opts[:title] = false
|
|
93
|
+
end
|
|
94
|
+
|
|
91
95
|
opt.on('-N', '--no-navtitle', 'do not generate the navtitle attribute') do
|
|
92
96
|
@converter.opts[:navtitle] = false
|
|
93
97
|
end
|
data/lib/dita-map/convert.rb
CHANGED
|
@@ -39,6 +39,7 @@ module AsciidoctorDitaMap
|
|
|
39
39
|
:navtitle => true,
|
|
40
40
|
:title => true,
|
|
41
41
|
:toc => true,
|
|
42
|
+
:topichead => true,
|
|
42
43
|
:type => true,
|
|
43
44
|
:self => false,
|
|
44
45
|
:verbose => false,
|
|
@@ -101,6 +102,10 @@ module AsciidoctorDitaMap
|
|
|
101
102
|
xml_title.add REXML::Text.new(map.title, false, nil, true)
|
|
102
103
|
end
|
|
103
104
|
|
|
105
|
+
if map.topichead and @opts[:topichead]
|
|
106
|
+
xml_root = xml_root.add_element('topichead', { 'navtitle' => map.topichead })
|
|
107
|
+
end
|
|
108
|
+
|
|
104
109
|
if @opts[:self] and file
|
|
105
110
|
xml_self = xml_root.add_element('topicref')
|
|
106
111
|
file_info = { :target => file }
|
data/lib/dita-map/map.rb
CHANGED
|
@@ -27,16 +27,17 @@ require_relative 'topic'
|
|
|
27
27
|
|
|
28
28
|
module AsciidoctorDitaMap
|
|
29
29
|
class Map < Topic
|
|
30
|
-
attr_accessor :chunk, :id, :includes, :navtitle
|
|
30
|
+
attr_accessor :chunk, :id, :includes, :navtitle, :topichead
|
|
31
31
|
|
|
32
32
|
def initialize input, base_dir, attributes = []
|
|
33
33
|
if input.empty?
|
|
34
|
-
@id
|
|
35
|
-
@title
|
|
36
|
-
@navtitle
|
|
37
|
-
@type
|
|
38
|
-
@
|
|
39
|
-
@
|
|
34
|
+
@id = nil
|
|
35
|
+
@title = nil
|
|
36
|
+
@navtitle = nil
|
|
37
|
+
@type = nil
|
|
38
|
+
@topichead = nil
|
|
39
|
+
@includes = []
|
|
40
|
+
@chunk = false
|
|
40
41
|
else
|
|
41
42
|
Asciidoctor::Extensions.register do
|
|
42
43
|
include_processor CatalogIncludeDirectives
|
|
@@ -44,12 +45,13 @@ module AsciidoctorDitaMap
|
|
|
44
45
|
|
|
45
46
|
doc = Asciidoctor.load input, safe: :safe, logger: false, catalog_assets: true, attributes: attributes, base_dir: base_dir
|
|
46
47
|
|
|
47
|
-
@includes
|
|
48
|
-
@id
|
|
49
|
-
@title
|
|
50
|
-
@navtitle
|
|
51
|
-
@type
|
|
52
|
-
@
|
|
48
|
+
@includes = doc.catalog[:include_files] ? doc.catalog[:include_files] : []
|
|
49
|
+
@id = doc.id ? doc.id.gsub(/["']/, '') : nil
|
|
50
|
+
@title = doc.title ? doc.title.gsub(/<[^>]*>/, '') : nil
|
|
51
|
+
@navtitle = (doc.attributes.key? 'navtitle') ? doc.attributes['navtitle'] : nil
|
|
52
|
+
@type = get_content_type doc.attributes
|
|
53
|
+
@topichead = (doc.attributes.key? 'topichead') ? doc.attributes['topichead'] : nil
|
|
54
|
+
@chunk = doc.attributes.key? 'chunk-to-content'
|
|
53
55
|
end
|
|
54
56
|
end
|
|
55
57
|
end
|
data/lib/dita-map/topic.rb
CHANGED
|
@@ -30,7 +30,7 @@ module AsciidoctorDitaMap
|
|
|
30
30
|
def initialize input, attributes = []
|
|
31
31
|
if input.empty?
|
|
32
32
|
@title = nil
|
|
33
|
-
@type =
|
|
33
|
+
@type = 'undef'
|
|
34
34
|
else
|
|
35
35
|
doc = Asciidoctor.load input, safe: :secure, logger: false, attributes: attributes
|
|
36
36
|
|
|
@@ -46,12 +46,14 @@ module AsciidoctorDitaMap
|
|
|
46
46
|
type = attributes['_content-type'] ? attributes['_content-type'].downcase : nil unless type
|
|
47
47
|
type = attributes['_module-type'] ? attributes['_module-type'].downcase : nil unless type
|
|
48
48
|
|
|
49
|
-
if type
|
|
50
|
-
|
|
49
|
+
if not type
|
|
50
|
+
return 'undef'
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
+
type.sub!(/^procedure$/, 'task')
|
|
54
|
+
|
|
53
55
|
unless ['assembly', 'concept', 'reference', 'task', 'map', 'attributes', 'snippet', 'ignore'].include? type
|
|
54
|
-
return
|
|
56
|
+
return 'invalid'
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
return type
|
data/lib/dita-map/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: asciidoctor-dita-map
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jaromir Hradilek
|
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
145
|
version: '0'
|
|
146
146
|
requirements: []
|
|
147
|
-
rubygems_version: 4.0.
|
|
147
|
+
rubygems_version: 4.0.19
|
|
148
148
|
specification_version: 4
|
|
149
149
|
summary: Convert an AsciiDoc file to a DITA map
|
|
150
150
|
test_files: []
|