asciidoctor-dita-map 0.9.1 → 0.9.2

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: 4eb319b4d8423d61539d7ec4816ccfac5499656cc15b739542ddb68023d210a0
4
- data.tar.gz: 768371877af9214c0d80db4e19f29db88ab85c00821a5965480bd7f5304c3f2a
3
+ metadata.gz: b3ca734004441a43e80c5537935c0bbbf2ff555b9ff00810a6f80f5f461003ad
4
+ data.tar.gz: f1f533b51dac4e4ebbcbf8632562c3caddb1a70bf5d1c7bbc1da73739ae97d07
5
5
  SHA512:
6
- metadata.gz: d251c66f265772f85a48aee4e8da5c4f9902870e991074dfe10c12977fcbb5921c3a6b695108bfa0025becb1d97bd8cb19bd92fbbeee958b3a5958ed8cfead5f
7
- data.tar.gz: 0ed486763aa0b355ef4ec931ce87181ab2a6ca9c024e55d9ec03b2782c9ceed05f321ef396378e9421ad10a1ef13200fb05c954e30081af25397ab6905fe0846
6
+ metadata.gz: 0bfff3d85f8c89f127af916d7d0c8c3c577e1cb2d53be274bc8c2d252af73f9dd157d231acc2385948bead240f19fb296fafe03eb6fadf2c670f18cfe9ba156f
7
+ data.tar.gz: 9058a374b8c72b5edf4397208ee3167a63154fc956b4206ef00b86739c91d52151e6223de1791e3e901289be59ac856eac12306dd8fe478018d3c36011127546
@@ -30,11 +30,15 @@ class CatalogIncludeDirectives < Asciidoctor::Extensions::IncludeProcessor
30
30
 
31
31
  def process doc, reader, target, attributes
32
32
  offset = attributes['leveloffset'].to_i
33
+ chunk = attributes['chunk'] or nil
34
+ toc = attributes['toc'] or nil
33
35
 
34
36
  doc.catalog[:include_files] = [] unless doc.catalog[:include_files]
35
37
  doc.catalog[:include_files].append({
36
38
  :target => target,
37
- :offset => offset
39
+ :offset => offset,
40
+ :chunk => chunk,
41
+ :toc => toc
38
42
  })
39
43
 
40
44
  reader
data/lib/dita-map/cli.rb CHANGED
@@ -33,10 +33,12 @@ module AsciidoctorDitaMap
33
33
  def initialize name, argv
34
34
  @attr = []
35
35
  @opts = {
36
+ :chunk => true,
36
37
  :id => true,
37
38
  :navtitle => true,
38
39
  :output => false,
39
40
  :title => true,
41
+ :toc => true,
40
42
  :type => true,
41
43
  :self => false,
42
44
  :verbose => false
@@ -82,10 +84,18 @@ module AsciidoctorDitaMap
82
84
  @opts[:title] = false
83
85
  end
84
86
 
87
+ opt.on('-C', '--no-chunk', 'do not generate the chunk attribute') do
88
+ @opts[:chunk] = false
89
+ end
90
+
85
91
  opt.on('-N', '--no-navtitle', 'do not generate the navtitle attribute') do
86
92
  @opts[:navtitle] = false
87
93
  end
88
94
 
95
+ opt.on('-O', '--no-toc', 'do not generate the toc attribute') do
96
+ @opts[:toc] = false
97
+ end
98
+
89
99
  opt.on('-T', '--no-type', 'do not generate the type attribute') do
90
100
  @opts[:type] = false
91
101
  end
@@ -123,20 +133,23 @@ module AsciidoctorDitaMap
123
133
  return args
124
134
  end
125
135
 
126
- def compose_mapref_attributes file_name, type
127
- target_file = file_name.sub(/\.adoc$/, '.ditamap')
128
- attributes = { 'href' => target_file, 'format' => 'ditamap' }
129
- attributes['type'] = type if @opts[:type]
136
+ def compose_mapref_attributes file_info, type
137
+ target_file = file_info[:target].sub(/\.adoc$/, '.ditamap')
138
+ attributes = { 'href' => target_file, 'format' => 'ditamap' }
139
+ attributes['type'] = type if @opts[:type]
140
+ attributes['chunk'] = file_info[:chunk] if @opts[:chunk] and file_info[:chunk]
141
+ attributes['toc'] = file_info[:toc] if @opts[:toc] and file_info[:toc]
130
142
 
131
143
  return attributes
132
144
  end
133
145
 
134
- def compose_topicref_attributes file_name, title, type
135
- target_file = file_name.sub(/\.adoc$/, '.dita')
136
-
146
+ def compose_topicref_attributes file_info, title, type
147
+ target_file = file_info[:target].sub(/\.adoc$/, '.dita')
137
148
  attributes = { 'href' => target_file }
138
149
  attributes['navtitle'] = title if @opts[:navtitle] and title
139
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]
140
153
 
141
154
  return attributes
142
155
  end
@@ -210,16 +223,16 @@ module AsciidoctorDitaMap
210
223
  end
211
224
 
212
225
  if @opts[:self] and file
213
- attributes = compose_topicref_attributes file, map[:title], map[:type]
226
+ attributes = compose_topicref_attributes({ :target => file }, map[:title], map[:type])
214
227
  xml_self = xml_root.add_element('topicref', attributes)
215
228
  stack = [{ :offset => 0, :element => xml_self }]
216
229
  else
217
230
  stack = [{ :offset => 0, :element => xml_root }]
218
231
  end
219
232
 
220
- include_files.each do |file|
221
- target = file[:target]
222
- offset = file[:offset]
233
+ include_files.each do |file_info|
234
+ target = file_info[:target]
235
+ offset = file_info[:offset]
223
236
  last_offset = stack.last[:offset]
224
237
  full_path = base_dir + target
225
238
 
@@ -250,10 +263,10 @@ module AsciidoctorDitaMap
250
263
  xml_parent = stack.last[:element]
251
264
 
252
265
  if include_type == 'map'
253
- attributes = compose_mapref_attributes target, include_type
266
+ attributes = compose_mapref_attributes file_info, include_type
254
267
  xml_element = xml_parent.add_element('mapref', attributes)
255
268
  else
256
- attributes = compose_topicref_attributes target, include_title, include_type
269
+ attributes = compose_topicref_attributes file_info, include_title, include_type
257
270
  xml_element = xml_parent.add_element('topicref', attributes)
258
271
  end
259
272
 
@@ -24,5 +24,5 @@
24
24
  # frozen_string_literal: true
25
25
 
26
26
  module AsciidoctorDitaMap
27
- VERSION = '0.9.1'
27
+ VERSION = '0.9.2'
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.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek