asciidoctor-dita-map 0.9.10 → 0.9.12
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/lib/dita-map/cli.rb +10 -3
- data/lib/dita-map/convert.rb +7 -5
- data/lib/dita-map/map.rb +3 -1
- 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: 5c6a12e6aed6332bab0729841ef59f95889de1a2b29835b61e4262a41160a193
|
|
4
|
+
data.tar.gz: 595b111f04f4ce44b4d49ecd1e7f02facb44c2c9446501af403f48679335bf94
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c27e7c8d5350b9231cbfbe0ee68a133de45f5287b6a5a61772ff8ecbcd5c05a3cbc2d1d6851913900be0c2b04cb9b029d7b2a2671c0ee5e89dc0de24aa317c4
|
|
7
|
+
data.tar.gz: 38450ab30ec18a34a0019134b2e1585fc8d28390596ef9d922caadc7f2cb1c14a1ba5f3a9699a9cf62b186eaec64a7f82de30c6216d2990e9cef42c073cf8bf5
|
data/lib/dita-map/cli.rb
CHANGED
|
@@ -29,9 +29,10 @@ require_relative 'version'
|
|
|
29
29
|
module AsciidoctorDitaMap
|
|
30
30
|
class Cli
|
|
31
31
|
def initialize argv
|
|
32
|
-
@output
|
|
33
|
-
@
|
|
34
|
-
@
|
|
32
|
+
@output = nil
|
|
33
|
+
@conditionals = false
|
|
34
|
+
@converter = Convert.new
|
|
35
|
+
@args = self.parse_args argv
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
def parse_args argv
|
|
@@ -61,6 +62,10 @@ module AsciidoctorDitaMap
|
|
|
61
62
|
@converter.opts[:self] = true
|
|
62
63
|
end
|
|
63
64
|
|
|
65
|
+
opt.on('-c', '--conditionals', 'do not ignore conditional directives when processing the file') do
|
|
66
|
+
@conditionals = true
|
|
67
|
+
end
|
|
68
|
+
|
|
64
69
|
opt.separator ''
|
|
65
70
|
|
|
66
71
|
opt.on('-A', '--no-assembly', 'do not treat assemblies as maps') do
|
|
@@ -144,6 +149,8 @@ module AsciidoctorDitaMap
|
|
|
144
149
|
output = @output ? @output : Pathname.new(file).sub_ext('.ditamap').to_s
|
|
145
150
|
end
|
|
146
151
|
|
|
152
|
+
input.gsub!(/^(?:ifn?def|ifeval|endif)::\S*\[(.*)\]\s*$/, '\1') if not @conditionals
|
|
153
|
+
|
|
147
154
|
if @converter.opts[:self] and file != $stdin
|
|
148
155
|
result = @converter.run input, base_dir, file
|
|
149
156
|
else
|
data/lib/dita-map/convert.rb
CHANGED
|
@@ -97,16 +97,18 @@ module AsciidoctorDitaMap
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
if map.title and @opts[:title]
|
|
100
|
-
xml_title
|
|
100
|
+
xml_title = xml_root.add_element('title')
|
|
101
101
|
xml_title.add REXML::Text.new(map.title, false, nil, true)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
if @opts[:self] and file
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
file_info = map.chunk ? { :target => file, :chunk => 'to-content' } : { :target => file }
|
|
106
|
+
xml_self = xml_root.add_element('topicref')
|
|
107
|
+
compose_topicref_attributes(xml_self, file_info, map.title, map.type)
|
|
108
|
+
|
|
109
|
+
stack = [{ :offset => 0, :element => xml_self }]
|
|
108
110
|
else
|
|
109
|
-
stack
|
|
111
|
+
stack = [{ :offset => 0, :element => xml_root }]
|
|
110
112
|
end
|
|
111
113
|
|
|
112
114
|
map.includes.each do |file_info|
|
data/lib/dita-map/map.rb
CHANGED
|
@@ -27,7 +27,7 @@ require_relative 'topic'
|
|
|
27
27
|
|
|
28
28
|
module AsciidoctorDitaMap
|
|
29
29
|
class Map < Topic
|
|
30
|
-
attr_accessor :id, :includes
|
|
30
|
+
attr_accessor :chunk, :id, :includes
|
|
31
31
|
|
|
32
32
|
def initialize input, base_dir, attributes = []
|
|
33
33
|
if input.empty?
|
|
@@ -35,6 +35,7 @@ module AsciidoctorDitaMap
|
|
|
35
35
|
@title = nil
|
|
36
36
|
@type = nil
|
|
37
37
|
@includes = []
|
|
38
|
+
@chunk = false
|
|
38
39
|
else
|
|
39
40
|
Asciidoctor::Extensions.register do
|
|
40
41
|
include_processor CatalogIncludeDirectives
|
|
@@ -46,6 +47,7 @@ module AsciidoctorDitaMap
|
|
|
46
47
|
@id = doc.id ? doc.id.gsub(/["']/, '') : nil
|
|
47
48
|
@title = doc.title ? doc.title.gsub(/<[^>]*>/, '') : nil
|
|
48
49
|
@type = get_content_type doc.attributes
|
|
50
|
+
@chunk = doc.attributes.key? 'chunk-to-content'
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
end
|
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.12
|
|
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.18
|
|
148
148
|
specification_version: 4
|
|
149
149
|
summary: Convert an AsciiDoc file to a DITA map
|
|
150
150
|
test_files: []
|