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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3ca734004441a43e80c5537935c0bbbf2ff555b9ff00810a6f80f5f461003ad
4
- data.tar.gz: f1f533b51dac4e4ebbcbf8632562c3caddb1a70bf5d1c7bbc1da73739ae97d07
3
+ metadata.gz: 4dd982c41b3653429b386ada97215adc7c1eaf82bfdd6415d116e974e3f2446c
4
+ data.tar.gz: b547c896716b562ad96393b4802ceeaf87bf8af26270e4e8ad1ab8427d8aec3e
5
5
  SHA512:
6
- metadata.gz: 0bfff3d85f8c89f127af916d7d0c8c3c577e1cb2d53be274bc8c2d252af73f9dd157d231acc2385948bead240f19fb296fafe03eb6fadf2c670f18cfe9ba156f
7
- data.tar.gz: 9058a374b8c72b5edf4397208ee3167a63154fc956b4206ef00b86739c91d52151e6223de1791e3e901289be59ac856eac12306dd8fe478018d3c36011127546
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 = file_info[:target].sub(/\.adoc$/, '.dita')
148
- attributes = { 'href' => target_file }
149
- attributes['navtitle'] = title if @opts[:navtitle] and title
150
- attributes['type'] = type if @opts[:type] and type and ['concept', 'reference', 'task'].include? type
151
- attributes['chunk'] = file_info[:chunk] if @opts[:chunk] and file_info[:chunk]
152
- attributes['toc'] = file_info[:toc] if @opts[:toc] and file_info[:toc]
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
- warn "#{@name}: warning: invalid leveloffset - expected 1, got 0: #{target}"
253
- offset = 1
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
 
@@ -24,5 +24,5 @@
24
24
  # frozen_string_literal: true
25
25
 
26
26
  module AsciidoctorDitaMap
27
- VERSION = '0.9.2'
27
+ VERSION = '0.9.4'
28
28
  end
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.2
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek