metanorma-cli 1.2.13.1 → 1.2.13.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/05-020r26.rxl +75 -0
- data/05-020r26.xml.zip +0 -0
- data/Gemfile.lock +334 -0
- data/a +3 -0
- data/a.json +33 -0
- data/a.rb +13 -0
- data/a.rxl +45 -0
- data/b +85 -0
- data/csd-tofix 2.zip +0 -0
- data/csd-tofix.zip +0 -0
- data/exe/metanorma.old +178 -0
- data/extract/sourcecode/sourcecode-0000.txt +5 -0
- data/files.zip +0 -0
- data/lib/metanorma/cli/version.rb +1 -1
- data/relaton/cache/version +1 -0
- data/rice.rxl +51 -0
- data/sourcecode/0 +5 -0
- data/test.rxl +52 -0
- data/tmp/my-custom-csd/Gemfile +4 -0
- data/tmp/my-custom-csd/Makefile +144 -0
- data/tmp/my-custom-csd/Makefile.win +116 -0
- data/tmp/my-custom-csd/appveyor.yml +29 -0
- data/tmp/my-custom-csd/metanorma.yml +4 -0
- data/tmp/my-document/Gemfile +4 -0
- data/tmp/my-document/Makefile +144 -0
- data/tmp/my-document/Makefile.win +116 -0
- data/tmp/my-document/appveyor.yml +29 -0
- data/tmp/my-document/metanorma.yml +4 -0
- data/tmp/my-local-document/Gemfile +4 -0
- data/tmp/my-local-document/Makefile +144 -0
- data/tmp/my-local-document/Makefile.win +116 -0
- data/tmp/my-local-document/appveyor.yml +29 -0
- data/tmp/my-local-document/metanorma.yml +4 -0
- metadata +37 -3
data/a.rb
ADDED
data/a.rxl
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
<bibdata type="standard">
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
<contributor>
|
8
|
+
<role type="author"/>
|
9
|
+
<organization>
|
10
|
+
<name>International Organization for Standardization</name>
|
11
|
+
<abbreviation>ISO</abbreviation>
|
12
|
+
</organization>
|
13
|
+
</contributor>
|
14
|
+
<contributor>
|
15
|
+
<role type="publisher"/>
|
16
|
+
<organization>
|
17
|
+
<name>International Organization for Standardization</name>
|
18
|
+
<abbreviation>ISO</abbreviation>
|
19
|
+
</organization>
|
20
|
+
</contributor>
|
21
|
+
|
22
|
+
<language>en</language>
|
23
|
+
<script>Latn</script>
|
24
|
+
<status>
|
25
|
+
<stage>60</stage>
|
26
|
+
<substage>60</substage>
|
27
|
+
</status>
|
28
|
+
<copyright>
|
29
|
+
<from>2020</from>
|
30
|
+
<owner>
|
31
|
+
<organization>
|
32
|
+
<name>International Organization for Standardization</name>
|
33
|
+
<abbreviation>ISO</abbreviation>
|
34
|
+
</organization>
|
35
|
+
</owner>
|
36
|
+
</copyright>
|
37
|
+
<ext>
|
38
|
+
<doctype>article</doctype>
|
39
|
+
<editorialgroup>
|
40
|
+
<technical-committee/>
|
41
|
+
<subcommittee/>
|
42
|
+
<workgroup/>
|
43
|
+
</editorialgroup>
|
44
|
+
</ext>
|
45
|
+
</bibdata>
|
data/b
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<gb-standard xmlns="http://riboseinc.com/gbstandard">
|
3
|
+
<bibdata type="standard">
|
4
|
+
<title>
|
5
|
+
|
6
|
+
</title>
|
7
|
+
<title>
|
8
|
+
|
9
|
+
</title>
|
10
|
+
<docidentifier type="gb">T/AAA 123</docidentifier>
|
11
|
+
<docidentifier type="gb-structured">
|
12
|
+
<project-number>T/AAA 123</project-number>
|
13
|
+
</docidentifier>
|
14
|
+
<docnumber>123</docnumber>
|
15
|
+
<contributor>
|
16
|
+
<role type="author"/>
|
17
|
+
<person>
|
18
|
+
<name>
|
19
|
+
<surname>Author</surname>
|
20
|
+
</name>
|
21
|
+
</person>
|
22
|
+
</contributor>
|
23
|
+
<contributor>
|
24
|
+
<role type="author"/>
|
25
|
+
<organization>
|
26
|
+
<name>GB</name>
|
27
|
+
</organization>
|
28
|
+
</contributor>
|
29
|
+
<contributor>
|
30
|
+
<role type="publisher"/>
|
31
|
+
<organization>
|
32
|
+
<name>GB</name>
|
33
|
+
</organization>
|
34
|
+
</contributor>
|
35
|
+
<contributor>
|
36
|
+
<role type="authority"/>
|
37
|
+
<organization>
|
38
|
+
<name>GB</name>
|
39
|
+
</organization>
|
40
|
+
</contributor>
|
41
|
+
<contributor>
|
42
|
+
<role type="proposer"/>
|
43
|
+
<organization>
|
44
|
+
<name>GB</name>
|
45
|
+
</organization>
|
46
|
+
</contributor>
|
47
|
+
<contributor>
|
48
|
+
<role type="issuer"/>
|
49
|
+
<organization>
|
50
|
+
<name>GB</name>
|
51
|
+
</organization>
|
52
|
+
</contributor>
|
53
|
+
|
54
|
+
<language>en</language>
|
55
|
+
<script>Latn</script>
|
56
|
+
<status>
|
57
|
+
<stage>60</stage>
|
58
|
+
<substage>60</substage>
|
59
|
+
</status>
|
60
|
+
<copyright>
|
61
|
+
<from>2019</from>
|
62
|
+
<owner>
|
63
|
+
<organization>
|
64
|
+
<name>GB</name>
|
65
|
+
</organization>
|
66
|
+
</owner>
|
67
|
+
</copyright>
|
68
|
+
<relation type="nonequivalent">
|
69
|
+
<bibitem>
|
70
|
+
<title> Televisual Frequencies</title>
|
71
|
+
<docidentifier>ISO 1012</docidentifier>
|
72
|
+
</bibitem>
|
73
|
+
</relation>
|
74
|
+
<ext>
|
75
|
+
<doctype>recommendation</doctype>
|
76
|
+
<gbtype>
|
77
|
+
<gbscope>social-group</gbscope>
|
78
|
+
<gbprefix>AAA</gbprefix>
|
79
|
+
<gbmandate>recommendation</gbmandate>
|
80
|
+
<gbtopic>basic</gbtopic>
|
81
|
+
</gbtype>
|
82
|
+
</ext>
|
83
|
+
</bibdata>
|
84
|
+
<sections/>
|
85
|
+
</gb-standard
|
data/csd-tofix 2.zip
ADDED
Binary file
|
data/csd-tofix.zip
ADDED
Binary file
|
data/exe/metanorma.old
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "optparse"
|
4
|
+
require "metanorma"
|
5
|
+
require "fileutils"
|
6
|
+
require "nokogiri"
|
7
|
+
|
8
|
+
registry = Metanorma::Registry.instance
|
9
|
+
|
10
|
+
supported_gem_paths = [
|
11
|
+
"asciidoctor-rfc",
|
12
|
+
"metanorma-iso",
|
13
|
+
"metanorma-gb",
|
14
|
+
"metanorma-csd",
|
15
|
+
"metanorma-csand",
|
16
|
+
"metanorma-m3d",
|
17
|
+
"metanorma-rsd",
|
18
|
+
"metanorma-acme",
|
19
|
+
"metanorma-standoc",
|
20
|
+
]
|
21
|
+
|
22
|
+
puts "[metanorma] detecting backends:"
|
23
|
+
supported_gem_paths.each do |backend|
|
24
|
+
begin
|
25
|
+
puts backend
|
26
|
+
require backend
|
27
|
+
rescue LoadError
|
28
|
+
puts "[metanorma] backend #{backend} not present"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
puts
|
32
|
+
|
33
|
+
options = {
|
34
|
+
format: :asciidoc
|
35
|
+
}
|
36
|
+
opt_parser = OptionParser.new do |opts|
|
37
|
+
opts.banner += " <file>"
|
38
|
+
opts.on(
|
39
|
+
'-t',
|
40
|
+
'--type TYPE',
|
41
|
+
"Type of standard to generate: #{registry.supported_backends.join(", ")}"
|
42
|
+
) { |v| options[:type] = v.to_sym }
|
43
|
+
|
44
|
+
opts.on(
|
45
|
+
'-x',
|
46
|
+
'--extensions EXT1,EXT2,... | all',
|
47
|
+
Array,
|
48
|
+
"Type of extension to generate per type: #{registry.output_formats}\n"
|
49
|
+
) { |v| options[:extension_keys] = v.map(&:to_sym) }
|
50
|
+
|
51
|
+
opts.on(
|
52
|
+
'-f',
|
53
|
+
'--format FORMAT',
|
54
|
+
'Format of source file: asciidoc (current default, only format supported)'
|
55
|
+
) { |v| options[:format] = v.to_sym }
|
56
|
+
|
57
|
+
opts.on(
|
58
|
+
'-r',
|
59
|
+
'--require LIBRARY',
|
60
|
+
'Require LIBRARY prior to execution'
|
61
|
+
) { |v|
|
62
|
+
options[:require] ||= []
|
63
|
+
options[:require] << v
|
64
|
+
}
|
65
|
+
|
66
|
+
opts.on(
|
67
|
+
'-v',
|
68
|
+
'--version',
|
69
|
+
"Print version of code (accompanied with -t)",
|
70
|
+
) { options[:version] = true }
|
71
|
+
|
72
|
+
opts.on(
|
73
|
+
'-w',
|
74
|
+
'--wrapper',
|
75
|
+
'Create wrapper folder for HTML output'
|
76
|
+
) { options[:wrapper] = true }
|
77
|
+
|
78
|
+
opts.on(
|
79
|
+
'-d',
|
80
|
+
'--data-uri-image',
|
81
|
+
'Encode HTML output images as data URIs'
|
82
|
+
) { options[:datauriimage] = true }
|
83
|
+
|
84
|
+
opts.on(
|
85
|
+
'-R',
|
86
|
+
'--relaton FILENAME',
|
87
|
+
'Export Relaton XML for document to nominated filename'
|
88
|
+
) { |v| options[:relaton] = v }
|
89
|
+
|
90
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
91
|
+
puts opts
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
opt_parser.parse!(ARGV)
|
98
|
+
|
99
|
+
if options[:require]
|
100
|
+
options[:require].each do |r|
|
101
|
+
require r
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
if options[:version]
|
106
|
+
case options[:format]
|
107
|
+
when :asciidoc
|
108
|
+
processor = registry.find_processor(options[:type].to_sym)
|
109
|
+
puts processor.version
|
110
|
+
exit
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
options[:filename] = ARGV.pop
|
115
|
+
|
116
|
+
unless options[:type]
|
117
|
+
puts "[metanorma] Error: Please specify a standard type."
|
118
|
+
puts opt_parser.help
|
119
|
+
exit 0
|
120
|
+
end
|
121
|
+
|
122
|
+
unless registry.supported_backends.include? options[:type]
|
123
|
+
puts "[metanorma] Error: #{options[:type]} is not a supported standard type."
|
124
|
+
exit 0
|
125
|
+
end
|
126
|
+
|
127
|
+
unless options[:format] == :asciidoc
|
128
|
+
puts "[metanorma] Error: Only source file format currently supported is 'asciidoc'."
|
129
|
+
exit 0
|
130
|
+
end
|
131
|
+
|
132
|
+
unless options[:filename]
|
133
|
+
puts "[metanorma] Error: Need to specify a file to process."
|
134
|
+
exit 0
|
135
|
+
end
|
136
|
+
|
137
|
+
options[:extension_keys] = nil if options[:extension_keys] == [:all]
|
138
|
+
|
139
|
+
case options[:format]
|
140
|
+
when :asciidoc
|
141
|
+
processor = registry.find_processor(options[:type].to_sym)
|
142
|
+
options[:extension_keys] ||= processor.output_formats.inject([]) do |memo, (k, _)|
|
143
|
+
memo << k; memo
|
144
|
+
end
|
145
|
+
extensions = options[:extension_keys].inject([]) do |memo, e|
|
146
|
+
if processor.output_formats[e]
|
147
|
+
memo << e
|
148
|
+
else
|
149
|
+
warn "[metanorma] Error: #{e} format is not supported for this standard"
|
150
|
+
end
|
151
|
+
memo
|
152
|
+
end
|
153
|
+
exit 0 if extensions.empty?
|
154
|
+
|
155
|
+
file = File.read(options[:filename], encoding: "utf-8")
|
156
|
+
isodoc = processor.input_to_isodoc(file)
|
157
|
+
if options[:relaton]
|
158
|
+
xml = Nokogiri::XML(isodoc)
|
159
|
+
bibdata = xml.at("//xmlns:bibdata")
|
160
|
+
#docid = bibdata&.at("./xmlns:docidentifier")&.text || options[:filename]
|
161
|
+
#outname = docid.sub(/^\s+/, "").sub(/\s+$/, "").gsub(/\s+/, "-") + ".xml"
|
162
|
+
File.open(options[:relaton], "w:UTF-8") { |f| f.write bibdata.to_xml }
|
163
|
+
end
|
164
|
+
isodoc_options = processor.extract_options(file)
|
165
|
+
isodoc_options[:datauriimage] = true if options[:datauriimage]
|
166
|
+
extensions.each do |ext|
|
167
|
+
file_extension = processor.output_formats[ext]
|
168
|
+
outfilename = options[:filename].sub(/\.[^.]+$/, ".#{file_extension}")
|
169
|
+
processor.output(isodoc, outfilename, ext, isodoc_options)
|
170
|
+
if options[:wrapper] and /html$/.match file_extension
|
171
|
+
outfilename = outfilename.sub(/\.html$/, "")
|
172
|
+
FileUtils.mkdir_p outfilename
|
173
|
+
FileUtils.mv "#{outfilename}.html", outfilename
|
174
|
+
FileUtils.mv "#{outfilename}_images", outfilename
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
data/files.zip
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
0.5.0
|
data/rice.rxl
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
<bibdata type="standard">
|
2
|
+
<title language="en" format="text/plain">Rice model</title>
|
3
|
+
<title language="intro-en" format="text/plain">Cereals and pulses</title>
|
4
|
+
<title language="main-en" format="text/plain">Specifications and test methods</title>
|
5
|
+
<title language="part-en" format="text/plain">Rice</title>
|
6
|
+
<title language="intro-fr" format="text/plain">Céréales et légumineuses</title>
|
7
|
+
<title language="main-fr" format="text/plain">Spécification et méthodes d'essai</title>
|
8
|
+
<title language="part-fr" format="text/plain">Riz</title>
|
9
|
+
<docidentifier type="m3d">17301:2016</docidentifier>
|
10
|
+
<docnumber>17301</docnumber>
|
11
|
+
<contributor>
|
12
|
+
<role type="author"/>
|
13
|
+
<organization>
|
14
|
+
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
15
|
+
<abbreviation>M3AAWG</abbreviation>
|
16
|
+
</organization>
|
17
|
+
</contributor>
|
18
|
+
<contributor>
|
19
|
+
<role type="publisher"/>
|
20
|
+
<organization>
|
21
|
+
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
22
|
+
<abbreviation>M3AAWG</abbreviation>
|
23
|
+
</organization>
|
24
|
+
</contributor>
|
25
|
+
<edition>2</edition>
|
26
|
+
<version>
|
27
|
+
<revision-date>2016-05-01</revision-date>
|
28
|
+
|
29
|
+
</version>
|
30
|
+
<language>en</language>
|
31
|
+
<script>Latn</script>
|
32
|
+
<status>
|
33
|
+
<stage>30</stage>
|
34
|
+
<substage>92</substage>
|
35
|
+
</status>
|
36
|
+
<copyright>
|
37
|
+
<from>2016</from>
|
38
|
+
<owner>
|
39
|
+
<organization>
|
40
|
+
<name>Messaging Malware and Mobile Anti-Abuse Working Group</name>
|
41
|
+
<abbreviation>M3AAWG</abbreviation>
|
42
|
+
</organization>
|
43
|
+
</owner>
|
44
|
+
</copyright>
|
45
|
+
<ext>
|
46
|
+
<doctype>report</doctype>
|
47
|
+
<editorialgroup>
|
48
|
+
<committee>Food products</committee>
|
49
|
+
</editorialgroup>
|
50
|
+
</ext>
|
51
|
+
</bibdata>
|
data/sourcecode/0
ADDED
data/test.rxl
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
<bibdata type="standard">
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
<docidentifier type="iso">ISO 123</docidentifier>
|
7
|
+
<docidentifier type="iso-with-lang">ISO 123(E)</docidentifier>
|
8
|
+
<docidentifier type="iso-reference">ISO 123(E)</docidentifier>
|
9
|
+
<docnumber>123</docnumber>
|
10
|
+
<contributor>
|
11
|
+
<role type="author"/>
|
12
|
+
<organization>
|
13
|
+
<name>International Organization for Standardization</name>
|
14
|
+
<abbreviation>ISO</abbreviation>
|
15
|
+
</organization>
|
16
|
+
</contributor>
|
17
|
+
<contributor>
|
18
|
+
<role type="publisher"/>
|
19
|
+
<organization>
|
20
|
+
<name>International Organization for Standardization</name>
|
21
|
+
<abbreviation>ISO</abbreviation>
|
22
|
+
</organization>
|
23
|
+
</contributor>
|
24
|
+
|
25
|
+
<language>en</language>
|
26
|
+
<script>script.html</script>
|
27
|
+
<status>
|
28
|
+
<stage abbreviation="IS">60</stage>
|
29
|
+
<substage>60</substage>
|
30
|
+
</status>
|
31
|
+
<copyright>
|
32
|
+
<from>2020</from>
|
33
|
+
<owner>
|
34
|
+
<organization>
|
35
|
+
<name>International Organization for Standardization</name>
|
36
|
+
<abbreviation>ISO</abbreviation>
|
37
|
+
</organization>
|
38
|
+
</owner>
|
39
|
+
</copyright>
|
40
|
+
<ext>
|
41
|
+
<doctype>article</doctype>
|
42
|
+
<editorialgroup>
|
43
|
+
<technical-committee/>
|
44
|
+
<subcommittee/>
|
45
|
+
<workgroup/>
|
46
|
+
</editorialgroup>
|
47
|
+
<structuredidentifier>
|
48
|
+
<project-number>ISO 123</project-number>
|
49
|
+
</structuredidentifier>
|
50
|
+
<stagename>International standard</stagename>
|
51
|
+
</ext>
|
52
|
+
</bibdata>
|