asciidoctor-dita-map 0.9.14 → 0.9.16

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: e88ed0e53a52ea190b7e6c9a019f6beec53e56b4c2cbe697e8ccbdb30ec8a054
4
- data.tar.gz: 6472d8d180c56526fbc53baef936e0f67c38b918a1bf01b7eec6eb272a0eba9a
3
+ metadata.gz: c016c694244dff2b14010224ad4a7d73b392e888fbd88544fa861a39ab1703c5
4
+ data.tar.gz: 037cc6b077f7d60371ad24a20812f5ca7cfca65fda12c63b3dd4f462dec088f7
5
5
  SHA512:
6
- metadata.gz: 55e181b3063be81b310dfa4d3cf80eb65ee4ca257c660244f184fed9db58c69cc37b45b4fef38e3b18db29afbbd6d17687a1654397ab66962c38d717954665be
7
- data.tar.gz: 2e8578bc05678448fa76ca9feaaa514d0c7bf54bcaa69659c61c31c799b1385e62e707c5a821bd03f1d49d884e586ba2a461510775eb7aef34cbecb2eaf9bc87
6
+ metadata.gz: 43c40ec17e31e85c82cff49da650a8fa0ea72b059d82c7365439a6abba502dde0655ffa92c18d4875cfa2571b884f6c7cabc0d159a75f2d23c8115c6b86b16cb
7
+ data.tar.gz: 5aeafa68457cda489f360be7b76c9ca1af07c69e940a4f6cc5ebc9098f414459ade7a20e1ca11353f3a244532fe370d027cd3634be5970b6a69b1a624b69d147
data/lib/dita-map/cli.rb CHANGED
@@ -72,22 +72,26 @@ module AsciidoctorDitaMap
72
72
  @converter.opts[:assembly] = false
73
73
  end
74
74
 
75
- opt.on('-I', '--no-id', 'do not generate the map id attribute') do
76
- @converter.opts[:id] = false
75
+ opt.on('-C', '--no-chunk', 'do not generate the chunk attribute') do
76
+ @converter.opts[:chunk] = false
77
77
  end
78
78
 
79
- opt.on('-M', '--no-maptitle', 'do not generate the map title') do
80
- @converter.opts[:title] = false
79
+ opt.on('-H', '--no-topichead', 'do not generate the topichead element') do
80
+ @converter.opts[:topichead] = false
81
81
  end
82
82
 
83
- opt.on('-C', '--no-chunk', 'do not generate the chunk attribute') do
84
- @converter.opts[:chunk] = false
83
+ opt.on('-I', '--no-id', 'do not generate the map id attribute') do
84
+ @converter.opts[:id] = false
85
85
  end
86
86
 
87
87
  opt.on('-L', '--no-locktitle', 'do not generate the locktitle attribute') do
88
88
  @converter.opts[:locktitle] = false
89
89
  end
90
90
 
91
+ opt.on('-M', '--no-maptitle', 'do not generate the map title') do
92
+ @converter.opts[:title] = false
93
+ end
94
+
91
95
  opt.on('-N', '--no-navtitle', 'do not generate the navtitle attribute') do
92
96
  @converter.opts[:navtitle] = false
93
97
  end
@@ -39,6 +39,7 @@ module AsciidoctorDitaMap
39
39
  :navtitle => true,
40
40
  :title => true,
41
41
  :toc => true,
42
+ :topichead => true,
42
43
  :type => true,
43
44
  :self => false,
44
45
  :verbose => false,
@@ -70,8 +71,6 @@ module AsciidoctorDitaMap
70
71
 
71
72
  if file_info[:navtitle]
72
73
  element.add_attribute REXML::Attribute.new('navtitle', file_info[:navtitle]) if @opts[:navtitle]
73
- else
74
- element.add_attribute REXML::Attribute.new('navtitle', title) if @opts[:navtitle] and title
75
74
  end
76
75
 
77
76
  element.add_attribute 'locktitle', 'yes' if @opts[:locktitle] and element['navtitle']
@@ -101,6 +100,10 @@ module AsciidoctorDitaMap
101
100
  xml_title.add REXML::Text.new(map.title, false, nil, true)
102
101
  end
103
102
 
103
+ if map.topichead and @opts[:topichead]
104
+ xml_root = xml_root.add_element('topichead', { 'navtitle' => map.topichead })
105
+ end
106
+
104
107
  if @opts[:self] and file
105
108
  xml_self = xml_root.add_element('topicref')
106
109
  file_info = { :target => file }
data/lib/dita-map/map.rb CHANGED
@@ -27,16 +27,17 @@ require_relative 'topic'
27
27
 
28
28
  module AsciidoctorDitaMap
29
29
  class Map < Topic
30
- attr_accessor :chunk, :id, :includes, :navtitle
30
+ attr_accessor :chunk, :id, :includes, :navtitle, :topichead
31
31
 
32
32
  def initialize input, base_dir, attributes = []
33
33
  if input.empty?
34
- @id = nil
35
- @title = nil
36
- @navtitle = nil
37
- @type = nil
38
- @includes = []
39
- @chunk = false
34
+ @id = nil
35
+ @title = nil
36
+ @navtitle = nil
37
+ @type = nil
38
+ @topichead = nil
39
+ @includes = []
40
+ @chunk = false
40
41
  else
41
42
  Asciidoctor::Extensions.register do
42
43
  include_processor CatalogIncludeDirectives
@@ -44,12 +45,13 @@ module AsciidoctorDitaMap
44
45
 
45
46
  doc = Asciidoctor.load input, safe: :safe, logger: false, catalog_assets: true, attributes: attributes, base_dir: base_dir
46
47
 
47
- @includes = doc.catalog[:include_files] ? doc.catalog[:include_files] : []
48
- @id = doc.id ? doc.id.gsub(/["']/, '') : nil
49
- @title = doc.title ? doc.title.gsub(/<[^>]*>/, '') : nil
50
- @navtitle = (doc.attributes.key? 'navtitle') ? doc.attributes['navtitle'] : nil
51
- @type = get_content_type doc.attributes
52
- @chunk = doc.attributes.key? 'chunk-to-content'
48
+ @includes = doc.catalog[:include_files] ? doc.catalog[:include_files] : []
49
+ @id = doc.id ? doc.id.gsub(/["']/, '') : nil
50
+ @title = doc.title ? doc.title.gsub(/<[^>]*>/, '') : nil
51
+ @navtitle = (doc.attributes.key? 'navtitle') ? doc.attributes['navtitle'] : nil
52
+ @type = get_content_type doc.attributes
53
+ @topichead = (doc.attributes.key? 'topichead') ? doc.attributes['topichead'] : nil
54
+ @chunk = doc.attributes.key? 'chunk-to-content'
53
55
  end
54
56
  end
55
57
  end
@@ -25,5 +25,5 @@
25
25
 
26
26
  module AsciidoctorDitaMap
27
27
  NAME = 'dita-map'
28
- VERSION = '0.9.14'
28
+ VERSION = '0.9.16'
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.14
4
+ version: 0.9.16
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.19
147
+ rubygems_version: 4.0.20
148
148
  specification_version: 4
149
149
  summary: Convert an AsciiDoc file to a DITA map
150
150
  test_files: []