metanorma-generic 1.10.3 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/generic/basicdoc.rng +21 -4
- data/lib/asciidoctor/generic/converter.rb +24 -20
- data/lib/asciidoctor/generic/isodoc.rng +497 -88
- data/lib/asciidoctor/generic/reqt.rng +23 -2
- data/lib/isodoc/generic/base_convert.rb +4 -3
- data/lib/isodoc/generic/html/generic.scss +0 -1
- data/lib/isodoc/generic/html/htmlstyle.scss +12 -1
- data/lib/isodoc/generic/html/scripts.html +0 -1
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma/generic.rb +27 -35
- data/metanorma-generic.gemspec +2 -3
- metadata +10 -24
@@ -58,6 +58,14 @@
|
|
58
58
|
<optional>
|
59
59
|
<attribute name="type"/>
|
60
60
|
</optional>
|
61
|
+
<optional>
|
62
|
+
<attribute name="tag"/>
|
63
|
+
</optional>
|
64
|
+
<optional>
|
65
|
+
<attribute name="multilingual-rendering">
|
66
|
+
<ref name="MultilingualRenderingType"/>
|
67
|
+
</attribute>
|
68
|
+
</optional>
|
61
69
|
<optional>
|
62
70
|
<ref name="reqtitle"/>
|
63
71
|
</optional>
|
@@ -101,7 +109,9 @@
|
|
101
109
|
</define>
|
102
110
|
<define name="label">
|
103
111
|
<element name="label">
|
104
|
-
<
|
112
|
+
<oneOrMore>
|
113
|
+
<ref name="TextElement"/>
|
114
|
+
</oneOrMore>
|
105
115
|
</element>
|
106
116
|
</define>
|
107
117
|
<define name="subject">
|
@@ -175,8 +185,19 @@
|
|
175
185
|
<data type="boolean"/>
|
176
186
|
</attribute>
|
177
187
|
</optional>
|
188
|
+
<optional>
|
189
|
+
<attribute name="tag"/>
|
190
|
+
</optional>
|
191
|
+
<optional>
|
192
|
+
<attribute name="multilingual-rendering">
|
193
|
+
<ref name="MultilingualRenderingType"/>
|
194
|
+
</attribute>
|
195
|
+
</optional>
|
178
196
|
<oneOrMore>
|
179
|
-
<
|
197
|
+
<choice>
|
198
|
+
<ref name="BasicBlock"/>
|
199
|
+
<ref name="component"/>
|
200
|
+
</choice>
|
180
201
|
</oneOrMore>
|
181
202
|
</define>
|
182
203
|
<define name="ObligationType">
|
@@ -12,14 +12,15 @@ module IsoDoc
|
|
12
12
|
def term_cleanup(docxml)
|
13
13
|
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
14
14
|
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
15
|
-
h2
|
16
|
-
|
15
|
+
d["id"] = h2["id"]
|
16
|
+
d.children.first.previous =
|
17
|
+
"<strong>#{h2.remove.children.to_xml}</strong> "
|
17
18
|
end
|
18
19
|
docxml
|
19
20
|
end
|
20
21
|
|
21
22
|
def make_body(xml, docxml)
|
22
|
-
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
23
|
+
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72",
|
23
24
|
"xml:lang": "EN-US", class: "container" }
|
24
25
|
xml.body **body_attr do |body|
|
25
26
|
make_body1(body, docxml)
|
@@ -296,7 +296,6 @@ p.Terms, li.Terms, div.Terms
|
|
296
296
|
mso-fareast-font-family:$headerfont;
|
297
297
|
mso-bidi-font-family:$headerfont;
|
298
298
|
mso-ansi-language:EN-GB;
|
299
|
-
font-weight:bold;
|
300
299
|
mso-bidi-font-weight:normal;}
|
301
300
|
p.AltTerms, li.AltTerms, div.AltTerms
|
302
301
|
{mso-style-name:"AltTerm\(s\)";
|
@@ -216,9 +216,12 @@ h3 {
|
|
216
216
|
font-weight: 100;
|
217
217
|
}
|
218
218
|
|
219
|
+
.TermNum {
|
220
|
+
font-weight: 100;
|
221
|
+
}
|
222
|
+
|
219
223
|
.TermNum, .Terms, .AltTerms {
|
220
224
|
color: #1661AD;
|
221
|
-
font-weight: 100;
|
222
225
|
}
|
223
226
|
|
224
227
|
h2.TermNum {
|
@@ -275,6 +278,14 @@ ul > li:first-child {
|
|
275
278
|
margin-top: 1em;
|
276
279
|
}
|
277
280
|
|
281
|
+
ul ul > li:first-child {
|
282
|
+
margin-top: 0;
|
283
|
+
}
|
284
|
+
ol ul > li:first-child {
|
285
|
+
margin-top: 0;
|
286
|
+
}
|
287
|
+
|
288
|
+
|
278
289
|
#toc-list ul {
|
279
290
|
margin-bottom: 0.25em;
|
280
291
|
}
|
data/lib/metanorma/generic.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "metanorma/generic/processor"
|
2
2
|
require "metanorma/generic/version"
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "forwardable"
|
4
|
+
require "yaml"
|
5
5
|
|
6
6
|
module Metanorma
|
7
|
-
module Generic
|
7
|
+
module Generic # rubocop:disable Style/MutableConstant
|
8
8
|
ORGANIZATION_NAME_SHORT = "Acme"
|
9
9
|
ORGANIZATION_NAME_LONG = "Acme Corp."
|
10
10
|
DOCUMENT_NAMESPACE = "https://www.metanorma.org/ns/generic"
|
11
|
-
YAML_CONFIG_FILE =
|
11
|
+
YAML_CONFIG_FILE = "metanorma.yml"
|
12
12
|
|
13
13
|
class Configuration
|
14
14
|
CONFIG_ATTRS = %i[
|
@@ -63,23 +63,10 @@ module Metanorma
|
|
63
63
|
].freeze
|
64
64
|
|
65
65
|
def filepath_attrs
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
logo_paths
|
71
|
-
header
|
72
|
-
htmlcoverpage
|
73
|
-
htmlintropage
|
74
|
-
htmlstylesheet
|
75
|
-
scripts
|
76
|
-
scripts_pdf
|
77
|
-
standardstylesheet
|
78
|
-
validate_rng_file
|
79
|
-
wordcoverpage
|
80
|
-
wordintropage
|
81
|
-
wordstylesheet
|
82
|
-
]
|
66
|
+
%i[i18nyaml boilerplate logo_path logo_paths header
|
67
|
+
htmlcoverpage htmlintropage htmlstylesheet scripts scripts_pdf
|
68
|
+
standardstylesheet validate_rng_file wordcoverpage wordintropage
|
69
|
+
wordstylesheet]
|
83
70
|
end
|
84
71
|
|
85
72
|
attr_accessor(*CONFIG_ATTRS)
|
@@ -88,24 +75,26 @@ module Metanorma
|
|
88
75
|
attr_accessor :_file
|
89
76
|
end
|
90
77
|
|
91
|
-
def self.inherited(
|
92
|
-
|
78
|
+
def self.inherited(klass) # rubocop:disable Lint/MissingSuper
|
79
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
93
80
|
end
|
94
81
|
|
95
82
|
def initialize(*args)
|
96
83
|
super
|
97
84
|
# Try to set config values from yaml file in current directory
|
98
|
-
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
85
|
+
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
86
|
+
"..", YAML_CONFIG_FILE)
|
99
87
|
set_default_values_from_yaml_file(@yaml) if File.file?(@yaml)
|
100
88
|
self.organization_name_short ||= ORGANIZATION_NAME_SHORT
|
101
89
|
self.organization_name_long ||= ORGANIZATION_NAME_LONG
|
102
90
|
self.document_namespace ||= DOCUMENT_NAMESPACE
|
103
|
-
self.termsdefs_titles ||=
|
91
|
+
self.termsdefs_titles ||=
|
104
92
|
["Terms and definitions", "Terms, definitions, symbols and abbreviated terms",
|
105
93
|
"Terms, definitions, symbols and abbreviations", "Terms, definitions and symbols",
|
106
94
|
"Terms, definitions and abbreviations", "Terms, definitions and abbreviated terms"]
|
107
95
|
self.symbols_titles ||=
|
108
|
-
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
96
|
+
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
97
|
+
"Abbreviations"]
|
109
98
|
self.normref_titles ||=
|
110
99
|
["Normative references"]
|
111
100
|
self.bibliography_titles ||= ["Bibliography"]
|
@@ -113,10 +102,13 @@ module Metanorma
|
|
113
102
|
|
114
103
|
def set_default_values_from_yaml_file(config_file)
|
115
104
|
root_path = File.dirname(self.class::_file || __FILE__)
|
116
|
-
default_config_options =
|
117
|
-
|
118
|
-
|
119
|
-
|
105
|
+
default_config_options =
|
106
|
+
YAML.safe_load(File.read(config_file, encoding: "UTF-8"))
|
107
|
+
if default_config_options["doctypes"].is_a? Array
|
108
|
+
default_config_options["doctypes"] =
|
109
|
+
default_config_options["doctypes"].each_with_object({}) do |k, m|
|
110
|
+
m[k] = nil
|
111
|
+
end
|
120
112
|
end
|
121
113
|
CONFIG_ATTRS.each do |attr_name|
|
122
114
|
value = default_config_options[attr_name.to_s]
|
@@ -128,8 +120,8 @@ module Metanorma
|
|
128
120
|
end
|
129
121
|
end
|
130
122
|
|
131
|
-
def blank?(
|
132
|
-
|
123
|
+
def blank?(val)
|
124
|
+
val.nil? || (val.respond_to?(:empty?) && val.empty?)
|
133
125
|
end
|
134
126
|
|
135
127
|
def absolute_path(value, root_path)
|
@@ -145,14 +137,14 @@ module Metanorma
|
|
145
137
|
end
|
146
138
|
end
|
147
139
|
|
148
|
-
def absolute_path1(
|
149
|
-
|
140
|
+
def absolute_path1(hash, pref)
|
141
|
+
hash.reject { |_k, v| blank?(v) }
|
142
|
+
.each_with_object({}) do |(k, v), g|
|
150
143
|
g[k] = absolute_path(v, pref)
|
151
144
|
end
|
152
145
|
end
|
153
146
|
end
|
154
147
|
|
155
|
-
|
156
148
|
class << self
|
157
149
|
extend Forwardable
|
158
150
|
|
data/metanorma-generic.gemspec
CHANGED
@@ -27,11 +27,10 @@ Gem::Specification.new do |spec|
|
|
27
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 "
|
31
|
-
spec.add_dependency "metanorma-standoc", "~> 1.10.0"
|
30
|
+
spec.add_dependency "metanorma-standoc", "~> 1.11.0"
|
32
31
|
spec.add_dependency "ruby-jing"
|
33
32
|
|
34
|
-
spec.add_development_dependency "
|
33
|
+
spec.add_development_dependency "debug"
|
35
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
36
35
|
spec.add_development_dependency "guard", "~> 2.14"
|
37
36
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
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.11.2
|
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-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -24,34 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 4.3.4
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: isodoc
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.7.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.7.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: metanorma-standoc
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
33
|
+
version: 1.11.0
|
48
34
|
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
40
|
+
version: 1.11.0
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: ruby-jing
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,19 +53,19 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: debug
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: equivalent-xml
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -281,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
281
267
|
- !ruby/object:Gem::Version
|
282
268
|
version: '0'
|
283
269
|
requirements: []
|
284
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.2.32
|
285
271
|
signing_key:
|
286
272
|
specification_version: 4
|
287
273
|
summary: Metanorma template gem for customisation.
|