asciidoctor-dita-map 0.9.2 → 0.9.4
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 +25 -10
- data/lib/dita-map/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4dd982c41b3653429b386ada97215adc7c1eaf82bfdd6415d116e974e3f2446c
|
|
4
|
+
data.tar.gz: b547c896716b562ad96393b4802ceeaf87bf8af26270e4e8ad1ab8427d8aec3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 647f898eac5920a8d976136683065acaa8ed6173bf4cf245bbebfaf9e75381f3a222866ffd1532c343900ec2508d80e800750b3ac8ecd8592141f09e5678c773
|
|
7
|
+
data.tar.gz: be60464080a6f54e249dd3432e8313486d3afe9298c02a5448502e5ac9ecd33cf02d943268459698d8a2ed9f12d4962f53d7caf7d05f42026737e4af91a52067
|
data/lib/dita-map/cli.rb
CHANGED
|
@@ -35,13 +35,15 @@ module AsciidoctorDitaMap
|
|
|
35
35
|
@opts = {
|
|
36
36
|
:chunk => true,
|
|
37
37
|
:id => true,
|
|
38
|
+
:locktitle => true,
|
|
38
39
|
:navtitle => true,
|
|
39
40
|
:output => false,
|
|
40
41
|
:title => true,
|
|
41
42
|
:toc => true,
|
|
42
43
|
:type => true,
|
|
43
44
|
:self => false,
|
|
44
|
-
:verbose => false
|
|
45
|
+
:verbose => false,
|
|
46
|
+
:zero_offset => false
|
|
45
47
|
}
|
|
46
48
|
@prep = []
|
|
47
49
|
@name = name
|
|
@@ -88,6 +90,10 @@ module AsciidoctorDitaMap
|
|
|
88
90
|
@opts[:chunk] = false
|
|
89
91
|
end
|
|
90
92
|
|
|
93
|
+
opt.on('-L', '--no-locktitle', 'do not generate the locktitle attribute') do
|
|
94
|
+
@opts[:locktitle] = false
|
|
95
|
+
end
|
|
96
|
+
|
|
91
97
|
opt.on('-N', '--no-navtitle', 'do not generate the navtitle attribute') do
|
|
92
98
|
@opts[:navtitle] = false
|
|
93
99
|
end
|
|
@@ -106,6 +112,10 @@ module AsciidoctorDitaMap
|
|
|
106
112
|
@opts[:verbose] = true
|
|
107
113
|
end
|
|
108
114
|
|
|
115
|
+
opt.on('-z', '--zero-offset', 'allow include directives with zero leveloffset') do
|
|
116
|
+
@opts[:zero_offset] = true
|
|
117
|
+
end
|
|
118
|
+
|
|
109
119
|
opt.separator ''
|
|
110
120
|
|
|
111
121
|
opt.on('-h', '--help', 'display this help and exit') do
|
|
@@ -144,12 +154,13 @@ module AsciidoctorDitaMap
|
|
|
144
154
|
end
|
|
145
155
|
|
|
146
156
|
def compose_topicref_attributes file_info, title, type
|
|
147
|
-
target_file
|
|
148
|
-
attributes
|
|
149
|
-
attributes['navtitle']
|
|
150
|
-
attributes['
|
|
151
|
-
attributes['
|
|
152
|
-
attributes['
|
|
157
|
+
target_file = file_info[:target].sub(/\.adoc$/, '.dita')
|
|
158
|
+
attributes = { 'href' => target_file }
|
|
159
|
+
attributes['navtitle'] = title if @opts[:navtitle] and title
|
|
160
|
+
attributes['locktitle'] = 'yes' if @opts[:locktitle] and attributes['navtitle']
|
|
161
|
+
attributes['type'] = type if @opts[:type] and type and ['concept', 'reference', 'task'].include? type
|
|
162
|
+
attributes['chunk'] = file_info[:chunk] if @opts[:chunk] and file_info[:chunk]
|
|
163
|
+
attributes['toc'] = file_info[:toc] if @opts[:toc] and file_info[:toc]
|
|
153
164
|
|
|
154
165
|
return attributes
|
|
155
166
|
end
|
|
@@ -249,14 +260,18 @@ module AsciidoctorDitaMap
|
|
|
249
260
|
end
|
|
250
261
|
|
|
251
262
|
if offset == 0
|
|
252
|
-
|
|
253
|
-
|
|
263
|
+
if @opts[:zero_offset]
|
|
264
|
+
offset = 0
|
|
265
|
+
else
|
|
266
|
+
warn "#{@name}: warning: invalid leveloffset - expected 1, got 0: #{target}"
|
|
267
|
+
offset = 1
|
|
268
|
+
end
|
|
254
269
|
elsif offset > last_offset and offset - last_offset > 1
|
|
255
270
|
expected_offset = last_offset + 1
|
|
256
271
|
warn "#{@name}: warning: invalid leveloffset - expected #{expected_offset}, got #{offset}: #{target}"
|
|
257
272
|
end
|
|
258
273
|
|
|
259
|
-
while stack.last[:offset] >= offset
|
|
274
|
+
while stack.length > 1 and stack.last[:offset] >= offset
|
|
260
275
|
stack.pop
|
|
261
276
|
end
|
|
262
277
|
|
data/lib/dita-map/version.rb
CHANGED