asciidoctor-dita-map 0.9.7 → 0.9.9

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: d7626d126ee7c6b58d30ffdf8cc39779d95abc3c4fe20e746bbaff413588f641
4
- data.tar.gz: 20f9b6210532883e8b833739dd83f63e5959399f70557126c0a26616602ce6d5
3
+ metadata.gz: f33388a8cdd8a79fe816cbf3056c21e1622fe7fe8d96df305437c3cc12243b7d
4
+ data.tar.gz: 33fd57ff00fae99afc529ccb988e226af6924283ee693d20c06a294a764d0739
5
5
  SHA512:
6
- metadata.gz: 2da052d875e9757273443f6cec4275ef43440362663209956b6d498b297b3490f16d0bddef4fae87f94bea3042a272784530e8896982a7e6281648c44c6c8063
7
- data.tar.gz: cbd419c07d5943d484c4428c85e306a8768722d13457fe622fff5099bbf1c7db9a1887aa616d46799f9bb92d2b746185ed139d8a453c3dfe3abc6e7c68f135aa
6
+ metadata.gz: c3da4381f8213d39279c8be54ed51f8bbb54b7056681dcc96f63273b592e081b41b3558805d37681544c2ba6e2404cbe37f4fbdba4d06aa233a84fbcdc81aa63
7
+ data.tar.gz: 2e2d6ab2518d64153896ea177731f50c95528dc27396e9aadf7b34c3061721d1c8ff675cbdcaed7c2d9ff6196928208f53915a806ef0f1bf50b06b55e0648adc
data/bin/dita-type ADDED
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright (C) 2026 Jaromir Hradilek
4
+
5
+ # MIT License
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining
8
+ # a copy of this software and associated documentation files (the "Soft-
9
+ # ware"), to deal in the Software without restriction, including without
10
+ # limitation the rights to use, copy, modify, merge, publish, distribute,
11
+ # sublicense, and/or sell copies of the Software, and to permit persons to
12
+ # whom the Software is furnished to do so, subject to the following condi-
13
+ # tions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included
16
+ # in all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19
+ # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABI-
20
+ # LITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
+ # SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
22
+ # OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24
+ # OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ require 'optparse'
27
+ require (topic = File.absolute_path '../lib/dita-map/topic.rb', __dir__) ? topic : 'dita-map/topic'
28
+
29
+ class Cli
30
+ NAME = 'dita-type'
31
+ VERSION = '0.9.0'
32
+
33
+ def initialize argv
34
+ @file = self.parse_args argv
35
+ end
36
+
37
+ def parse_args argv
38
+ parser = OptionParser.new do |opt|
39
+ opt.banner = "Usage: #{NAME} [FILE]\n"
40
+ opt.banner += " #{NAME} -h|-V\n\n"
41
+
42
+ opt.on('-h', '--help', 'display this help and exit') do
43
+ puts opt
44
+ exit
45
+ end
46
+
47
+ opt.on('-V', '--version', 'display version information and exit') do
48
+ puts "#{NAME} #{VERSION}"
49
+ exit
50
+ end
51
+ end
52
+
53
+ args = parser.parse argv
54
+
55
+ raise OptionParser::InvalidArgument, "invalid number of arguments" if args.length > 1
56
+
57
+ if args.length == 0 or args[0].strip == '-'
58
+ return $stdin
59
+ end
60
+
61
+ file = args[0]
62
+
63
+ raise OptionParser::InvalidArgument, "not a file: #{file}" unless File.exist? file and File.file? file
64
+ raise OptionParser::InvalidArgument, "file not readable: #{file}" unless File.readable? file
65
+
66
+ return file
67
+ end
68
+
69
+ def run
70
+ if @file == $stdin
71
+ topic = AsciidoctorDitaMap::Topic.new $stdin.read
72
+ else
73
+ topic = AsciidoctorDitaMap::Topic.new File.read(@file)
74
+ end
75
+
76
+ if not topic.type
77
+ puts 'undef'
78
+ abort
79
+ end
80
+
81
+ puts topic.type
82
+ end
83
+ end
84
+
85
+ begin
86
+ cli = Cli.new ARGV
87
+ cli.run
88
+ rescue OptionParser::InvalidArgument, OptionParser::InvalidOption,
89
+ OptionParser::AmbiguousOption, OptionParser::MissingArgument => error
90
+ abort "#{Cli::NAME}: #{error.message}"
91
+ rescue Interrupt
92
+ exit 130
93
+ end
data/lib/dita-map/cli.rb CHANGED
@@ -63,6 +63,10 @@ module AsciidoctorDitaMap
63
63
 
64
64
  opt.separator ''
65
65
 
66
+ opt.on('-A', '--no-assembly', 'do not treat assemblies as maps') do
67
+ @converter.opts[:assembly] = false
68
+ end
69
+
66
70
  opt.on('-I', '--no-id', 'do not generate the map id attribute') do
67
71
  @converter.opts[:id] = false
68
72
  end
@@ -71,10 +75,6 @@ module AsciidoctorDitaMap
71
75
  @converter.opts[:title] = false
72
76
  end
73
77
 
74
- opt.on('-A', '--no-assembly', 'do treat assemblies as maps') do
75
- @converter.opts[:assembly] = false
76
- end
77
-
78
78
  opt.on('-C', '--no-chunk', 'do not generate the chunk attribute') do
79
79
  @converter.opts[:chunk] = false
80
80
  end
@@ -25,5 +25,5 @@
25
25
 
26
26
  module AsciidoctorDitaMap
27
27
  NAME = 'dita-map'
28
- VERSION = '0.9.7'
28
+ VERSION = '0.9.9'
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.7
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaromir Hradilek
@@ -108,6 +108,7 @@ description: A command line utility that converts a single AsciiDoc file to a DI
108
108
  email: jhradilek@gmail.com
109
109
  executables:
110
110
  - dita-map
111
+ - dita-type
111
112
  extensions: []
112
113
  extra_rdoc_files: []
113
114
  files:
@@ -115,6 +116,7 @@ files:
115
116
  - LICENSE
116
117
  - README.md
117
118
  - bin/dita-map
119
+ - bin/dita-type
118
120
  - lib/dita-map/catalog.rb
119
121
  - lib/dita-map/cli.rb
120
122
  - lib/dita-map/convert.rb
@@ -142,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
144
  - !ruby/object:Gem::Version
143
145
  version: '0'
144
146
  requirements: []
145
- rubygems_version: 4.0.10
147
+ rubygems_version: 4.0.15
146
148
  specification_version: 4
147
149
  summary: Convert an AsciiDoc file to a DITA map
148
150
  test_files: []