metanorma-generic 1.9.0 → 1.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +11 -33
- data/.gitignore +2 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +7 -7
- data/lib/asciidoctor/generic/biblio.rng +5 -6
- data/lib/asciidoctor/generic/generic.rng +9 -0
- data/lib/asciidoctor/generic/isodoc.rng +499 -13
- data/lib/asciidoctor/generic/reqt.rng +15 -4
- data/lib/isodoc/generic.rb +0 -1
- data/lib/isodoc/generic/html_convert.rb +1 -2
- data/lib/isodoc/generic/metadata.rb +26 -21
- data/lib/metanorma/generic/processor.rb +9 -28
- data/lib/metanorma/generic/version.rb +1 -1
- data/metanorma-generic.gemspec +10 -10
- metadata +36 -41
- data/.rubocop.ribose.yml +0 -66
- data/.rubocop.tb.yml +0 -650
- data/lib/isodoc/generic/pdf_convert.rb +0 -66
@@ -64,9 +64,9 @@
|
|
64
64
|
<optional>
|
65
65
|
<ref name="label"/>
|
66
66
|
</optional>
|
67
|
-
<
|
67
|
+
<zeroOrMore>
|
68
68
|
<ref name="subject"/>
|
69
|
-
</
|
69
|
+
</zeroOrMore>
|
70
70
|
<zeroOrMore>
|
71
71
|
<ref name="reqinherit"/>
|
72
72
|
</zeroOrMore>
|
@@ -80,6 +80,7 @@
|
|
80
80
|
<ref name="verification"/>
|
81
81
|
<ref name="import"/>
|
82
82
|
<ref name="description"/>
|
83
|
+
<ref name="component"/>
|
83
84
|
</choice>
|
84
85
|
</zeroOrMore>
|
85
86
|
<optional>
|
@@ -105,12 +106,16 @@
|
|
105
106
|
</define>
|
106
107
|
<define name="subject">
|
107
108
|
<element name="subject">
|
108
|
-
<
|
109
|
+
<oneOrMore>
|
110
|
+
<ref name="TextElement"/>
|
111
|
+
</oneOrMore>
|
109
112
|
</element>
|
110
113
|
</define>
|
111
114
|
<define name="reqinherit">
|
112
115
|
<element name="inherit">
|
113
|
-
<
|
116
|
+
<oneOrMore>
|
117
|
+
<ref name="TextElement"/>
|
118
|
+
</oneOrMore>
|
114
119
|
</element>
|
115
120
|
</define>
|
116
121
|
<define name="measurementtarget">
|
@@ -138,6 +143,12 @@
|
|
138
143
|
<ref name="RequirementSubpart"/>
|
139
144
|
</element>
|
140
145
|
</define>
|
146
|
+
<define name="component">
|
147
|
+
<element name="component">
|
148
|
+
<attribute name="class"/>
|
149
|
+
<ref name="RequirementSubpart"/>
|
150
|
+
</element>
|
151
|
+
</define>
|
141
152
|
<define name="reqt_references">
|
142
153
|
<element name="references">
|
143
154
|
<oneOrMore>
|
data/lib/isodoc/generic.rb
CHANGED
@@ -48,8 +48,7 @@ module IsoDoc
|
|
48
48
|
html_doc_path("html_generic_titlepage.html"),
|
49
49
|
htmlintropage: baselocation(configuration.htmlintropage) ||
|
50
50
|
html_doc_path("html_generic_intro.html"),
|
51
|
-
scripts: baselocation(configuration.scripts)
|
52
|
-
html_doc_path("scripts.html"),
|
51
|
+
scripts: baselocation(configuration.scripts),
|
53
52
|
i18nyaml: (configuration.i18nyaml.is_a?(String) ?
|
54
53
|
baselocation(configuration.i18nyaml) : nil)
|
55
54
|
}.transform_values { |v| v&.empty? ? nil : v }
|
@@ -4,20 +4,20 @@ require_relative "init"
|
|
4
4
|
require_relative "utils"
|
5
5
|
|
6
6
|
class Nokogiri::XML::Node
|
7
|
-
TYPENAMES = {1=>
|
7
|
+
TYPENAMES = { 1 => "element", 2 => "attribute", 3 => "text",
|
8
|
+
4 => "cdata", 8 => "comment" }.freeze
|
8
9
|
def to_hash
|
9
|
-
|
10
|
-
h
|
10
|
+
{ kind: TYPENAMES[node_type], name: name }.tap do |h|
|
11
|
+
h[:text] = text&.strip
|
11
12
|
a = attribute_nodes.map(&:to_hash)
|
12
13
|
if element? && !a.empty?
|
13
|
-
h
|
14
|
+
h[:attr] = a.inject({}) { |m, v| m[v[:name]] = v[:text]; m }
|
14
15
|
end
|
15
16
|
c = children.map(&:to_hash)
|
16
17
|
if element? && !(c&.size == 1 && c[0][:kind] == "text")
|
17
18
|
h.merge! kids: c.delete_if { |n| n[:kind] == "text" && n[:text].empty? }
|
18
19
|
end
|
19
20
|
end
|
20
|
-
ret
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -27,15 +27,16 @@ end
|
|
27
27
|
|
28
28
|
module IsoDoc
|
29
29
|
module Generic
|
30
|
-
|
31
30
|
class Metadata < IsoDoc::Metadata
|
32
31
|
def initialize(lang, script, labels)
|
33
32
|
super
|
34
33
|
here = File.dirname(__FILE__)
|
35
|
-
default_logo_path =
|
34
|
+
default_logo_path =
|
35
|
+
File.expand_path(File.join(here, "html", "logo.jpg"))
|
36
36
|
set(:logo, baselocation(configuration.logo_path) || default_logo_path)
|
37
37
|
unless configuration.logo_paths.nil?
|
38
|
-
set(:logo_paths,
|
38
|
+
set(:logo_paths,
|
39
|
+
Array(configuration.logo_paths).map { |p| baselocation(p) })
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
@@ -43,8 +44,8 @@ module IsoDoc
|
|
43
44
|
attr_accessor :_file
|
44
45
|
end
|
45
46
|
|
46
|
-
def self.inherited(
|
47
|
-
|
47
|
+
def self.inherited(klass) # rubocop:disable Lint/MissingSuper
|
48
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
48
49
|
end
|
49
50
|
|
50
51
|
def author(isoxml, _out)
|
@@ -55,6 +56,7 @@ module IsoDoc
|
|
55
56
|
|
56
57
|
def stage_abbr(status)
|
57
58
|
return super unless configuration.stage_abbreviations
|
59
|
+
|
58
60
|
Hash(configuration.stage_abbreviations).dig(status)
|
59
61
|
end
|
60
62
|
|
@@ -65,32 +67,35 @@ module IsoDoc
|
|
65
67
|
|
66
68
|
def doctype(isoxml, _out)
|
67
69
|
super
|
68
|
-
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
70
|
+
b = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}")) ||
|
69
71
|
isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return
|
70
72
|
a = b["abbreviation"] and set(:doctype_abbr, a)
|
71
73
|
end
|
72
74
|
|
73
|
-
def xmlhash2hash(
|
75
|
+
def xmlhash2hash(hash)
|
74
76
|
ret = {}
|
75
|
-
return ret if
|
76
|
-
|
77
|
-
|
77
|
+
return ret if hash.nil? || hash[:kind] != "element"
|
78
|
+
|
79
|
+
hash[:attr].nil? or
|
80
|
+
hash[:attr].each { |k, v| ret["#{hash[:name]}_#{k}"] = v }
|
81
|
+
ret[hash[:name]] = hash[:kids] ? xmlhash2hash_kids(hash) : hash[:text]
|
78
82
|
ret
|
79
83
|
end
|
80
84
|
|
81
|
-
def xmlhash2hash_kids(
|
85
|
+
def xmlhash2hash_kids(hash)
|
82
86
|
c = {}
|
83
|
-
|
87
|
+
hash[:kids].each do |n|
|
84
88
|
xmlhash2hash(n).each do |k1, v1|
|
85
|
-
c[k1] = c[k1].nil?
|
86
|
-
|
87
|
-
|
89
|
+
c[k1] = if c[k1].nil? then v1
|
90
|
+
elsif c[k1].is_a?(Array) then c[k1] << v1
|
91
|
+
else [c[k1], v1]
|
92
|
+
end
|
88
93
|
end
|
89
94
|
end
|
90
95
|
c
|
91
96
|
end
|
92
97
|
|
93
|
-
def ext(isoxml,
|
98
|
+
def ext(isoxml, _out)
|
94
99
|
b = isoxml&.at(ns("//bibdata/ext")) or return
|
95
100
|
set(:metadata_extensions, xmlhash2hash(b.to_hash)["ext"])
|
96
101
|
end
|
@@ -17,7 +17,6 @@ module Metanorma
|
|
17
17
|
super.merge(
|
18
18
|
html: "html",
|
19
19
|
doc: "doc",
|
20
|
-
pdf: "pdf"
|
21
20
|
)
|
22
21
|
end
|
23
22
|
|
@@ -27,31 +26,15 @@ module Metanorma
|
|
27
26
|
|
28
27
|
def extract_options(file)
|
29
28
|
head = file.sub(/\n\n.*$/m, "\n")
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
/\n:ulstyle: (?<ulstyle>[^\n]+)\n/ =~ head
|
40
|
-
/\n:olstyle: (?<olstyle>[^\n]+)\n/ =~ head
|
41
|
-
new_options = {
|
42
|
-
htmlstylesheet: defined?(htmlstylesheet) ? htmlstylesheet : nil,
|
43
|
-
htmlcoverpage: defined?(htmlcoverpage) ? htmlcoverpage : nil,
|
44
|
-
htmlintropage: defined?(htmlintropage) ? htmlintropage : nil,
|
45
|
-
scripts: defined?(scripts) ? scripts : nil,
|
46
|
-
wordstylesheet: defined?(wordstylesheet) ? wordstylesheet : nil,
|
47
|
-
standardstylesheet: defined?(standardstylesheet) ? standardstylesheet : nil,
|
48
|
-
header: defined?(header) ? header : nil,
|
49
|
-
wordcoverpage: defined?(wordcoverpage) ? wordcoverpage : nil,
|
50
|
-
wordintropage: defined?(wordintropage) ? wordintropage : nil,
|
51
|
-
ulstyle: defined?(ulstyle) ? ulstyle : nil,
|
52
|
-
olstyle: defined?(olstyle) ? olstyle : nil,
|
53
|
-
}.reject { |_, val| val.nil? }
|
54
|
-
super.merge(new_options)
|
29
|
+
ret = %w(htmlstylesheet htmlcoverpage htmlintropage scripts scripts-pdf
|
30
|
+
wordstylesheet standardstylesheet header wordcoverpage
|
31
|
+
wordintropage datauriimage htmltoclevels doctoclevels
|
32
|
+
ulstyle olstyle htmlstylesheet-override sectionsplit
|
33
|
+
wordstylesheet-override).each_with_object({}) do |w, acc|
|
34
|
+
m = /\n:#{w}: ([^\n]+)\n/.match(head) or next
|
35
|
+
acc[w.sub(/-/, "_").to_sym] = m[1]
|
36
|
+
end
|
37
|
+
super.merge(ret)
|
55
38
|
end
|
56
39
|
|
57
40
|
def output(isodoc_node, inname, outname, format, options={})
|
@@ -60,8 +43,6 @@ module Metanorma
|
|
60
43
|
IsoDoc::Generic::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
61
44
|
when :doc
|
62
45
|
IsoDoc::Generic::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
63
|
-
when :pdf
|
64
|
-
IsoDoc::Generic::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
65
46
|
when :presentation
|
66
47
|
IsoDoc::Generic::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
67
48
|
else
|
data/metanorma-generic.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path("
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require "metanorma/generic/version"
|
4
4
|
|
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Metanorma template gem for customisation."
|
12
12
|
spec.description = <<~DESCRIPTION
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Metanorma template gem for customisation. This gem is meant to be customised for any downstream use.
|
14
|
+
#{' '}
|
15
|
+
Formerly known as metanorma-acme
|
16
16
|
DESCRIPTION
|
17
17
|
|
18
18
|
spec.homepage = "https://github.com/metanorma/metanorma-generic"
|
@@ -24,21 +24,21 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.bindir = "exe"
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ["lib"]
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
29
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
30
|
+
spec.add_dependency "isodoc", "~> 1.7.0"
|
31
|
+
spec.add_dependency "metanorma-standoc", "~> 1.10.0"
|
30
32
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.8.0"
|
32
|
-
spec.add_dependency "isodoc", "~> 1.5.0"
|
33
33
|
|
34
34
|
spec.add_development_dependency "byebug", "~> 9.1"
|
35
|
-
spec.add_development_dependency "sassc", "2.4.0"
|
36
35
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
37
36
|
spec.add_development_dependency "guard", "~> 2.14"
|
38
37
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
39
|
-
spec.add_development_dependency "rake", "~>
|
38
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
39
|
spec.add_development_dependency "rspec", "~> 3.6"
|
41
|
-
spec.add_development_dependency "rubocop", "
|
40
|
+
spec.add_development_dependency "rubocop", "~> 1.5.2"
|
41
|
+
spec.add_development_dependency "sassc", "2.4.0"
|
42
42
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
43
43
|
spec.add_development_dependency "timecop", "~> 0.9"
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-generic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -25,47 +25,47 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.3.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: isodoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.7.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.7.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-standoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.10.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.10.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: ruby-jing
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '9.1'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: sassc
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - '='
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 2.4.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - '='
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 2.4.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: equivalent-xml
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +128,14 @@ dependencies:
|
|
142
128
|
requirements:
|
143
129
|
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
131
|
+
version: '13.0'
|
146
132
|
type: :development
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
136
|
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
138
|
+
version: '13.0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: rspec
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,18 +152,32 @@ dependencies:
|
|
166
152
|
version: '3.6'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: rubocop
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.5.2
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.5.2
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: sassc
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - '='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 2.4.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - '='
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 2.4.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: simplecov
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,10 +206,8 @@ dependencies:
|
|
206
206
|
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0.9'
|
209
|
-
description:
|
210
|
-
|
211
|
-
|
212
|
-
Formerly known as metanorma-acme
|
209
|
+
description: " Metanorma template gem for customisation. This gem is meant to be
|
210
|
+
customised for any downstream use.\n \n Formerly known as metanorma-acme\n"
|
213
211
|
email:
|
214
212
|
- open.source@ribose.com
|
215
213
|
executables: []
|
@@ -219,8 +217,6 @@ files:
|
|
219
217
|
- ".github/workflows/rake.yml"
|
220
218
|
- ".gitignore"
|
221
219
|
- ".hound.yml"
|
222
|
-
- ".rubocop.ribose.yml"
|
223
|
-
- ".rubocop.tb.yml"
|
224
220
|
- ".rubocop.yml"
|
225
221
|
- CODE_OF_CONDUCT.md
|
226
222
|
- Gemfile
|
@@ -255,7 +251,6 @@ files:
|
|
255
251
|
- lib/isodoc/generic/i18n.rb
|
256
252
|
- lib/isodoc/generic/init.rb
|
257
253
|
- lib/isodoc/generic/metadata.rb
|
258
|
-
- lib/isodoc/generic/pdf_convert.rb
|
259
254
|
- lib/isodoc/generic/presentation_xml_convert.rb
|
260
255
|
- lib/isodoc/generic/utils.rb
|
261
256
|
- lib/isodoc/generic/word_convert.rb
|
@@ -279,14 +274,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
279
274
|
requirements:
|
280
275
|
- - ">="
|
281
276
|
- !ruby/object:Gem::Version
|
282
|
-
version: 2.
|
277
|
+
version: 2.5.0
|
283
278
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
279
|
requirements:
|
285
280
|
- - ">="
|
286
281
|
- !ruby/object:Gem::Version
|
287
282
|
version: '0'
|
288
283
|
requirements: []
|
289
|
-
rubygems_version: 3.
|
284
|
+
rubygems_version: 3.1.4
|
290
285
|
signing_key:
|
291
286
|
specification_version: 4
|
292
287
|
summary: Metanorma template gem for customisation.
|