asciidoctor-dita-map 0.9.13 → 0.9.15

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: 98bea8d9cbc76880ed050644d87dba51910d7e7ac722fdf04449d4b53743e7fd
4
- data.tar.gz: e96e393535d5212e2f786b77baa6a182eb81874bc64e11d3e9c8d63ac823fdfe
3
+ metadata.gz: e10278e445c7ebb802fd7b59b0f2d59833ef3cf15daac9f5401a21ffa5004cf5
4
+ data.tar.gz: db2bfadc8deb15cddac4f2edc10c2e84edaae52532eb85539046376f310f6736
5
5
  SHA512:
6
- metadata.gz: 217aa01cb9a704bc51e7bef39f6e36b263d9f0a7e7d7678f084feabebb2e2c8db84af43b1e0d97009fe4c9944da9d939fc9b35f6aa49a4a3c777b0bbb6f63cb7
7
- data.tar.gz: 9646161ae41f05054b8ff31474128464299d5c948150927a5b550223593302bf8163571dc8323c46e51424de37c61fa5010be54f3ef97437a94b2e51038523b2
6
+ metadata.gz: 8e6b6ab31781f9cba233fbc62194a738e3db56746c8dcb134d4ce4288119ead15cf13af4f985812688caa7195dcbd76204290e0c03a39b880c0ccb4f22626267
7
+ data.tar.gz: 7274e2d7e1f79bbefae1500e1530ad7ed167e6a814d58ed6aa977914ebb12ebd455668bd72cabb7fb07bb807dfc778ad474ebb5e457e6b15d644cd1b15625bae
data/bin/dita-type CHANGED
@@ -73,11 +73,6 @@ class Cli
73
73
  topic = AsciidoctorDitaMap::Topic.new File.read(@file)
74
74
  end
75
75
 
76
- if not topic.type
77
- puts 'undef'
78
- abort
79
- end
80
-
81
76
  puts topic.type
82
77
  end
83
78
  end
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,
@@ -101,6 +102,10 @@ module AsciidoctorDitaMap
101
102
  xml_title.add REXML::Text.new(map.title, false, nil, true)
102
103
  end
103
104
 
105
+ if map.topichead and @opts[:topichead]
106
+ xml_root = xml_root.add_element('topichead', { 'navtitle' => map.topichead })
107
+ end
108
+
104
109
  if @opts[:self] and file
105
110
  xml_self = xml_root.add_element('topicref')
106
111
  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
@@ -30,7 +30,7 @@ module AsciidoctorDitaMap
30
30
  def initialize input, attributes = []
31
31
  if input.empty?
32
32
  @title = nil
33
- @type = nil
33
+ @type = 'undef'
34
34
  else
35
35
  doc = Asciidoctor.load input, safe: :secure, logger: false, attributes: attributes
36
36
 
@@ -46,12 +46,14 @@ module AsciidoctorDitaMap
46
46
  type = attributes['_content-type'] ? attributes['_content-type'].downcase : nil unless type
47
47
  type = attributes['_module-type'] ? attributes['_module-type'].downcase : nil unless type
48
48
 
49
- if type
50
- type.sub!(/^procedure$/, 'task')
49
+ if not type
50
+ return 'undef'
51
51
  end
52
52
 
53
+ type.sub!(/^procedure$/, 'task')
54
+
53
55
  unless ['assembly', 'concept', 'reference', 'task', 'map', 'attributes', 'snippet', 'ignore'].include? type
54
- return nil
56
+ return 'invalid'
55
57
  end
56
58
 
57
59
  return type
@@ -25,5 +25,5 @@
25
25
 
26
26
  module AsciidoctorDitaMap
27
27
  NAME = 'dita-map'
28
- VERSION = '0.9.13'
28
+ VERSION = '0.9.15'
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.13
4
+ version: 0.9.15
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.18
147
+ rubygems_version: 4.0.19
148
148
  specification_version: 4
149
149
  summary: Convert an AsciiDoc file to a DITA map
150
150
  test_files: []