metanorma-generic 1.10.2 → 1.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- <optional>
75
+ <zeroOrMore>
68
76
  <ref name="subject"/>
69
- </optional>
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
- <text/>
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
- <text/>
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
- <text/>
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
- <ref name="BasicBlock"/>
197
+ <choice>
198
+ <ref name="BasicBlock"/>
199
+ <ref name="component"/>
200
+ </choice>
169
201
  </oneOrMore>
170
202
  </define>
171
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.add_child("&nbsp;")
16
- h2.add_child(d.remove)
15
+ d["id"] = h2["id"]
16
+ d.children.first.previous =
17
+ "<strong>#{h2.remove.children.to_xml}</strong>&nbsp;"
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
  }
@@ -1,6 +1,5 @@
1
1
  require "isodoc/generic/metadata"
2
2
  require "isodoc/generic/html_convert"
3
- require "isodoc/generic/pdf_convert"
4
3
  require "isodoc/generic/word_convert"
5
4
  require "isodoc/generic/presentation_xml_convert"
6
5
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Generic
3
- VERSION = "1.10.2".freeze
3
+ VERSION = "1.11.1".freeze
4
4
  end
5
5
  end
@@ -1,14 +1,14 @@
1
1
  require "metanorma/generic/processor"
2
2
  require "metanorma/generic/version"
3
- require 'forwardable'
4
- require 'yaml'
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 = 'metanorma.yml'
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
- return %i[
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( k )
92
- k._file = caller_locations.first.absolute_path
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__), "..", "..", YAML_CONFIG_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", "Abbreviations"]
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"]&.is_a? Array
118
- default_config_options["doctypes"] = default_config_options["doctypes"].
119
- each_with_object({}) { |k, m| m[k] = nil }
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?(v)
132
- v.nil? || v.respond_to?(:empty?) && v.empty?
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(h, pref)
149
- h.reject { |k, v| blank?(v) }.each_with_object({}) do |(k, v), g|
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
 
@@ -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 "isodoc", "~> 1.7.0"
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 "byebug", "~> 9.1"
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.10.2
4
+ version: 1.11.1
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-07-05 00:00:00.000000000 Z
11
+ date: 2021-11-29 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.10.0
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.10.0
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: byebug
56
+ name: debug
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: '9.1'
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: '9.1'
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: equivalent-xml
85
71
  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.1.4
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
-