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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65632c6df171bc8a0d2f518aa1e5d2a00928582cf7468edfe38ab2cfa69418d9
4
- data.tar.gz: 48e2e26502c6e3979d4aeaa77064176eeabfb315221e88b7d3330411d2265f4d
3
+ metadata.gz: 5c6a12e6aed6332bab0729841ef59f95889de1a2b29835b61e4262a41160a193
4
+ data.tar.gz: 595b111f04f4ce44b4d49ecd1e7f02facb44c2c9446501af403f48679335bf94
5
5
  SHA512:
6
- metadata.gz: d64f8d5d83fe46b8387dc5e65245bd5fbf2f0b968c7519ff40499113953d920fe3d0977a96eabbda21d95e4724f1f8386afdae69337bf47eb17825bda8814937
7
- data.tar.gz: 2a37fc303b7b5657aa0b6c9aa5d9104082a93ad5b984f8815c67b1b6370ce2a9cc53058a039575f6882bd10d7b5804a79a0f815d8dc0d8269145a8a3b6fcbd2a
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 = nil
33
- @converter = Convert.new
34
- @args = self.parse_args argv
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
@@ -97,16 +97,18 @@ module AsciidoctorDitaMap
97
97
  end
98
98
 
99
99
  if map.title and @opts[:title]
100
- xml_title = xml_root.add_element('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
- xml_self = xml_root.add_element('topicref')
106
- compose_topicref_attributes(xml_self, { :target => file }, map.title, map.type)
107
- stack = [{ :offset => 0, :element => xml_self }]
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 = [{ :offset => 0, :element => xml_root }]
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
@@ -25,5 +25,5 @@
25
25
 
26
26
  module AsciidoctorDitaMap
27
27
  NAME = 'dita-map'
28
- VERSION = '0.9.10'
28
+ VERSION = '0.9.12'
29
29
  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.10
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.15
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: []