metanorma-generic 1.10.1 → 1.11.0
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 +4 -4
- data/.github/workflows/rake.yml +1 -1
- data/lib/asciidoctor/generic/basicdoc.rng +21 -4
- data/lib/asciidoctor/generic/converter.rb +24 -20
- data/lib/asciidoctor/generic/isodoc.rng +518 -93
- data/lib/asciidoctor/generic/reqt.rng +38 -6
- data/lib/isodoc/generic/html/htmlstyle.scss +8 -0
- data/lib/isodoc/generic.rb +0 -1
- data/lib/metanorma/generic/processor.rb +0 -3
- data/lib/metanorma/generic/version.rb +1 -1
- data/lib/metanorma/generic.rb +21 -17
- data/metanorma-generic.gemspec +1 -2
- metadata +5 -20
- data/lib/isodoc/generic/pdf_convert.rb +0 -66
@@ -58,15 +58,23 @@
|
|
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>
|
64
72
|
<optional>
|
65
73
|
<ref name="label"/>
|
66
74
|
</optional>
|
67
|
-
<
|
75
|
+
<zeroOrMore>
|
68
76
|
<ref name="subject"/>
|
69
|
-
</
|
77
|
+
</zeroOrMore>
|
70
78
|
<zeroOrMore>
|
71
79
|
<ref name="reqinherit"/>
|
72
80
|
</zeroOrMore>
|
@@ -80,6 +88,7 @@
|
|
80
88
|
<ref name="verification"/>
|
81
89
|
<ref name="import"/>
|
82
90
|
<ref name="description"/>
|
91
|
+
<ref name="component"/>
|
83
92
|
</choice>
|
84
93
|
</zeroOrMore>
|
85
94
|
<optional>
|
@@ -100,17 +109,23 @@
|
|
100
109
|
</define>
|
101
110
|
<define name="label">
|
102
111
|
<element name="label">
|
103
|
-
<
|
112
|
+
<oneOrMore>
|
113
|
+
<ref name="TextElement"/>
|
114
|
+
</oneOrMore>
|
104
115
|
</element>
|
105
116
|
</define>
|
106
117
|
<define name="subject">
|
107
118
|
<element name="subject">
|
108
|
-
<
|
119
|
+
<oneOrMore>
|
120
|
+
<ref name="TextElement"/>
|
121
|
+
</oneOrMore>
|
109
122
|
</element>
|
110
123
|
</define>
|
111
124
|
<define name="reqinherit">
|
112
125
|
<element name="inherit">
|
113
|
-
<
|
126
|
+
<oneOrMore>
|
127
|
+
<ref name="TextElement"/>
|
128
|
+
</oneOrMore>
|
114
129
|
</element>
|
115
130
|
</define>
|
116
131
|
<define name="measurementtarget">
|
@@ -138,6 +153,12 @@
|
|
138
153
|
<ref name="RequirementSubpart"/>
|
139
154
|
</element>
|
140
155
|
</define>
|
156
|
+
<define name="component">
|
157
|
+
<element name="component">
|
158
|
+
<attribute name="class"/>
|
159
|
+
<ref name="RequirementSubpart"/>
|
160
|
+
</element>
|
161
|
+
</define>
|
141
162
|
<define name="reqt_references">
|
142
163
|
<element name="references">
|
143
164
|
<oneOrMore>
|
@@ -164,8 +185,19 @@
|
|
164
185
|
<data type="boolean"/>
|
165
186
|
</attribute>
|
166
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>
|
167
196
|
<oneOrMore>
|
168
|
-
<
|
197
|
+
<choice>
|
198
|
+
<ref name="BasicBlock"/>
|
199
|
+
<ref name="component"/>
|
200
|
+
</choice>
|
169
201
|
</oneOrMore>
|
170
202
|
</define>
|
171
203
|
<define name="ObligationType">
|
data/lib/isodoc/generic.rb
CHANGED
@@ -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
|
|
@@ -44,8 +43,6 @@ module Metanorma
|
|
44
43
|
IsoDoc::Generic::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
45
44
|
when :doc
|
46
45
|
IsoDoc::Generic::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
47
|
-
when :pdf
|
48
|
-
IsoDoc::Generic::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
49
46
|
when :presentation
|
50
47
|
IsoDoc::Generic::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
|
51
48
|
else
|
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
7
|
module Generic
|
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,7 +63,7 @@ module Metanorma
|
|
63
63
|
].freeze
|
64
64
|
|
65
65
|
def filepath_attrs
|
66
|
-
|
66
|
+
%i[
|
67
67
|
i18nyaml
|
68
68
|
boilerplate
|
69
69
|
logo_path
|
@@ -88,24 +88,26 @@ module Metanorma
|
|
88
88
|
attr_accessor :_file
|
89
89
|
end
|
90
90
|
|
91
|
-
def self.inherited(
|
92
|
-
|
91
|
+
def self.inherited(klass)
|
92
|
+
klass._file = caller_locations(1..1).first.absolute_path
|
93
93
|
end
|
94
94
|
|
95
95
|
def initialize(*args)
|
96
96
|
super
|
97
97
|
# Try to set config values from yaml file in current directory
|
98
|
-
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
98
|
+
@yaml = File.join(File.dirname(self.class::_file || __FILE__), "..",
|
99
|
+
"..", YAML_CONFIG_FILE)
|
99
100
|
set_default_values_from_yaml_file(@yaml) if File.file?(@yaml)
|
100
101
|
self.organization_name_short ||= ORGANIZATION_NAME_SHORT
|
101
102
|
self.organization_name_long ||= ORGANIZATION_NAME_LONG
|
102
103
|
self.document_namespace ||= DOCUMENT_NAMESPACE
|
103
|
-
self.termsdefs_titles ||=
|
104
|
+
self.termsdefs_titles ||=
|
104
105
|
["Terms and definitions", "Terms, definitions, symbols and abbreviated terms",
|
105
106
|
"Terms, definitions, symbols and abbreviations", "Terms, definitions and symbols",
|
106
107
|
"Terms, definitions and abbreviations", "Terms, definitions and abbreviated terms"]
|
107
108
|
self.symbols_titles ||=
|
108
|
-
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
109
|
+
["Symbols and abbreviated terms", "Symbols", "Abbreviated terms",
|
110
|
+
"Abbreviations"]
|
109
111
|
self.normref_titles ||=
|
110
112
|
["Normative references"]
|
111
113
|
self.bibliography_titles ||= ["Bibliography"]
|
@@ -114,9 +116,11 @@ module Metanorma
|
|
114
116
|
def set_default_values_from_yaml_file(config_file)
|
115
117
|
root_path = File.dirname(self.class::_file || __FILE__)
|
116
118
|
default_config_options = YAML.load(File.read(config_file))
|
117
|
-
if default_config_options["doctypes"]
|
118
|
-
default_config_options["doctypes"] =
|
119
|
-
each_with_object({})
|
119
|
+
if default_config_options["doctypes"].is_a? Array
|
120
|
+
default_config_options["doctypes"] =
|
121
|
+
default_config_options["doctypes"].each_with_object({}) do |k, m|
|
122
|
+
m[k] = nil
|
123
|
+
end
|
120
124
|
end
|
121
125
|
CONFIG_ATTRS.each do |attr_name|
|
122
126
|
value = default_config_options[attr_name.to_s]
|
@@ -128,8 +132,8 @@ module Metanorma
|
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
131
|
-
def blank?(
|
132
|
-
|
135
|
+
def blank?(val)
|
136
|
+
val.nil? || val.respond_to?(:empty?) && val.empty?
|
133
137
|
end
|
134
138
|
|
135
139
|
def absolute_path(value, root_path)
|
@@ -145,14 +149,14 @@ module Metanorma
|
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
148
|
-
def absolute_path1(
|
149
|
-
|
152
|
+
def absolute_path1(hash, pref)
|
153
|
+
hash.reject { |_k, v| blank?(v) }
|
154
|
+
.each_with_object({}) do |(k, v), g|
|
150
155
|
g[k] = absolute_path(v, pref)
|
151
156
|
end
|
152
157
|
end
|
153
158
|
end
|
154
159
|
|
155
|
-
|
156
160
|
class << self
|
157
161
|
extend Forwardable
|
158
162
|
|
data/metanorma-generic.gemspec
CHANGED
@@ -27,8 +27,7 @@ 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.9.0"
|
30
|
+
spec.add_dependency "metanorma-standoc", "~> 1.11.0"
|
32
31
|
spec.add_dependency "ruby-jing"
|
33
32
|
|
34
33
|
spec.add_development_dependency "byebug", "~> 9.1"
|
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.0
|
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-10-25 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.6.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.6.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
|
@@ -251,7 +237,6 @@ files:
|
|
251
237
|
- lib/isodoc/generic/i18n.rb
|
252
238
|
- lib/isodoc/generic/init.rb
|
253
239
|
- lib/isodoc/generic/metadata.rb
|
254
|
-
- lib/isodoc/generic/pdf_convert.rb
|
255
240
|
- lib/isodoc/generic/presentation_xml_convert.rb
|
256
241
|
- lib/isodoc/generic/utils.rb
|
257
242
|
- lib/isodoc/generic/word_convert.rb
|
@@ -282,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
267
|
- !ruby/object:Gem::Version
|
283
268
|
version: '0'
|
284
269
|
requirements: []
|
285
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.2.22
|
286
271
|
signing_key:
|
287
272
|
specification_version: 4
|
288
273
|
summary: Metanorma template gem for customisation.
|
@@ -1,66 +0,0 @@
|
|
1
|
-
require_relative "base_convert"
|
2
|
-
require_relative "init"
|
3
|
-
require "isodoc"
|
4
|
-
|
5
|
-
module IsoDoc
|
6
|
-
module Generic
|
7
|
-
# A {Converter} implementation that generates PDF HTML output, and a
|
8
|
-
# document schema encapsulation of the document for validation
|
9
|
-
class PdfConvert < IsoDoc::PdfConvert
|
10
|
-
def initialize(options)
|
11
|
-
@libdir = File.dirname(__FILE__)
|
12
|
-
super
|
13
|
-
end
|
14
|
-
|
15
|
-
class << self
|
16
|
-
attr_accessor :_file
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.inherited( k )
|
20
|
-
k._file = caller_locations.first.absolute_path
|
21
|
-
end
|
22
|
-
|
23
|
-
def default_fonts(options)
|
24
|
-
{
|
25
|
-
bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif'
|
26
|
-
: configuration.html_bodyfont || '"Overpass",sans-serif'),
|
27
|
-
headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
28
|
-
configuration.html_headerfont || '"Overpass",sans-serif'),
|
29
|
-
monospacefont: configuration.html_monospacefont || '"Space Mono",monospace'
|
30
|
-
}.transform_values { |v| v&.empty? ? nil : v }
|
31
|
-
end
|
32
|
-
|
33
|
-
def default_file_locations(_options)
|
34
|
-
{
|
35
|
-
htmlstylesheet: baselocation(configuration.htmlstylesheet) ||
|
36
|
-
html_doc_path("htmlstyle.scss"),
|
37
|
-
htmlcoverpage: baselocation(configuration.htmlcoverpage) ||
|
38
|
-
html_doc_path("html_generic_titlepage.html"),
|
39
|
-
htmlintropage: baselocation(configuration.htmlintropage) ||
|
40
|
-
html_doc_path("html_generic_intro.html"),
|
41
|
-
scripts_pdf: baselocation(configuration.scripts_pdf) ||
|
42
|
-
html_doc_path("scripts.pdf.html")
|
43
|
-
}.transform_values { |v| v&.empty? ? nil : v }
|
44
|
-
end
|
45
|
-
|
46
|
-
def googlefonts
|
47
|
-
<<~HEAD.freeze
|
48
|
-
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet">
|
49
|
-
<link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
|
50
|
-
HEAD
|
51
|
-
end
|
52
|
-
|
53
|
-
def html_toc(docxml)
|
54
|
-
docxml
|
55
|
-
end
|
56
|
-
|
57
|
-
def configuration
|
58
|
-
Metanorma::Generic.configuration
|
59
|
-
end
|
60
|
-
|
61
|
-
include BaseConvert
|
62
|
-
include Init
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|