metanorma-standoc 2.7.1 → 2.7.2

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +2 -3
  3. data/lib/metanorma/standoc/biblio.rng +13 -0
  4. data/lib/metanorma/standoc/cleanup_asciibib.rb +5 -3
  5. data/lib/metanorma/standoc/cleanup_bibitem.rb +144 -0
  6. data/lib/metanorma/standoc/cleanup_block.rb +1 -1
  7. data/lib/metanorma/standoc/cleanup_boilerplate.rb +1 -1
  8. data/lib/metanorma/standoc/cleanup_footnotes.rb +1 -1
  9. data/lib/metanorma/standoc/cleanup_inline.rb +1 -3
  10. data/lib/metanorma/standoc/cleanup_maths.rb +1 -3
  11. data/lib/metanorma/standoc/cleanup_ref.rb +18 -142
  12. data/lib/metanorma/standoc/cleanup_terms_designations.rb +6 -6
  13. data/lib/metanorma/standoc/cleanup_text.rb +6 -6
  14. data/lib/metanorma/standoc/converter.rb +1 -1
  15. data/lib/metanorma/standoc/front.rb +3 -5
  16. data/lib/metanorma/standoc/front_contributor.rb +1 -159
  17. data/lib/metanorma/standoc/front_organisation.rb +163 -0
  18. data/lib/metanorma/standoc/inline.rb +8 -7
  19. data/lib/metanorma/standoc/isodoc.rng +11 -1
  20. data/lib/metanorma/standoc/localbib.rb +3 -6
  21. data/lib/metanorma/standoc/macros.rb +7 -0
  22. data/lib/metanorma/standoc/ref.rb +1 -1
  23. data/lib/metanorma/standoc/ref_queue.rb +2 -2
  24. data/lib/metanorma/standoc/render.rb +2 -1
  25. data/lib/metanorma/standoc/term_lookup_cleanup.rb +3 -4
  26. data/lib/metanorma/standoc/terms.rb +1 -1
  27. data/lib/metanorma/standoc/validate.rb +12 -12
  28. data/lib/metanorma/standoc/validate_section.rb +2 -6
  29. data/lib/metanorma/standoc/validate_table.rb +2 -5
  30. data/lib/metanorma/standoc/validate_term.rb +4 -8
  31. data/lib/metanorma/standoc/version.rb +1 -1
  32. metadata +4 -2
@@ -1,42 +1,8 @@
1
- require "date"
1
+ require_relative "./front_organisation"
2
2
 
3
3
  module Metanorma
4
4
  module Standoc
5
5
  module Front
6
- def committee_component(compname, node, out)
7
- i = 1
8
- suffix = ""
9
- while node.attr(compname + suffix)
10
- out.send compname.gsub(/-/, "_"), node.attr(compname + suffix),
11
- **attr_code(number: node.attr("#{compname}-number#{suffix}"),
12
- type: node.attr("#{compname}-type#{suffix}"))
13
- i += 1
14
- suffix = "_#{i}"
15
- end
16
- end
17
-
18
- def organization(org, orgname, node = nil, default_org = nil)
19
- abbrevs = org_abbrev
20
- n = abbrevs.invert[orgname] and orgname = n
21
- org.name orgname
22
- default_org and a = node&.attr("subdivision") and org.subdivision a
23
- abbr = org_abbrev[orgname]
24
- default_org && b = node&.attr("subdivision-abbr") and abbr = b
25
- abbr and org.abbreviation abbr
26
- end
27
-
28
- def org_address(org, xml)
29
- p = org[:address] and xml.address do |ad|
30
- ad.formattedAddress do |f|
31
- f << p.gsub(/ \+\n/, "<br/>")
32
- end
33
- end
34
- p = org[:phone] and xml.phone p
35
- p = org[:fax] and xml.phone p, type: "fax"
36
- p = org[:email] and xml.email p
37
- p = org[:uri] and xml.uri p
38
- end
39
-
40
6
  def metadata_author(node, xml)
41
7
  org_contributor(node, xml,
42
8
  { source: ["publisher", "pub"], role: "author",
@@ -108,55 +74,6 @@ module Metanorma
108
74
  end
109
75
  end
110
76
 
111
- def person_organization(node, suffix, xml)
112
- xml.name node.attr("affiliation#{suffix}")
113
- abbr = node.attr("affiliation_abbrev#{suffix}") and
114
- xml.abbreviation abbr
115
- csv_split(node.attr("affiliation_subdiv#{suffix}"))&.each do |s|
116
- xml.subdivision s
117
- end
118
- person_address(node, suffix, xml)
119
- person_org_logo(node, suffix, xml)
120
- end
121
-
122
- def person_address(node, suffix, xml)
123
- if node.attr("address#{suffix}")
124
- xml.address do |ad|
125
- ad.formattedAddress do |f|
126
- f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
127
- end
128
- end
129
- elsif node.attr("country#{suffix}") || node.attr("city#{suffix}")
130
- person_address_components(node, suffix, xml)
131
- end
132
- end
133
-
134
- def person_address_components(node, suffix, xml)
135
- xml.address do |ad|
136
- %w(street city state country postcode).each do |k|
137
- s = node.attr("#{k}#{suffix}") and ad.send k, s
138
- end
139
- end
140
- end
141
-
142
- def person_org_logo(node, suffix, xml)
143
- p = node.attr("affiliation_logo#{suffix}") and org_logo(xml, p)
144
- end
145
-
146
- def org_logo(xml, logo)
147
- logo and xml.logo do |l|
148
- l.image src: logo
149
- end
150
- end
151
-
152
- def default_publisher
153
- nil
154
- end
155
-
156
- def org_abbrev
157
- {}
158
- end
159
-
160
77
  def metadata_publisher(node, xml)
161
78
  o = { source: ["publisher", "pub"], role: "publisher",
162
79
  default: default_publisher }
@@ -168,81 +85,6 @@ module Metanorma
168
85
  org_contributor(node, xml, o)
169
86
  end
170
87
 
171
- def org_contributor(node, xml, opts)
172
- org_attrs_parse(node, opts).each do |o|
173
- xml.contributor do |c|
174
- org_contributor_role(c, o)
175
- c.organization do |a|
176
- org_organization(node, a, o)
177
- end
178
- end
179
- end
180
- end
181
-
182
- def org_contributor_role(xml, org)
183
- xml.role type: org[:role] do |r|
184
- org[:desc] and r.description do |d|
185
- d << org[:desc]
186
- end
187
- end
188
- end
189
-
190
- def org_organization(node, xml, org)
191
- organization(xml, org[:name], node, !node.attr("publisher"))
192
- org_address(org, xml)
193
- org_logo(xml, org[:logo])
194
- end
195
-
196
- def org_attrs_parse(node, opts)
197
- source = opts[:source]&.detect { |s| node.attr(s) }
198
- org_attrs_simple_parse(node, opts, source) ||
199
- org_attrs_complex_parse(node, opts, source)
200
- end
201
-
202
- def org_attrs_simple_parse(node, opts, source)
203
- !source and return org_attrs_simple_parse_no_source(node, opts)
204
- orgs = csv_split(node.attr(source))
205
- orgs.size > 1 and return orgs.map do |o|
206
- { name: o, role: opts[:role], desc: opts[:desc] }
207
- end
208
- nil
209
- end
210
-
211
- def org_attrs_simple_parse_no_source(node, opts)
212
- !opts[:default] && !opts[:name] and return []
213
- [{ name: opts[:name] || opts[:default],
214
- role: opts[:role], desc: opts[:desc] }
215
- .compact.merge(extract_org_attrs_address(node, opts, ""))]
216
- end
217
-
218
- def org_attrs_complex_parse(node, opts, source)
219
- i = 1
220
- suffix = ""
221
- ret = []
222
- while node.attr(source + suffix)
223
- ret << extract_org_attrs_complex(node, opts, source, suffix)
224
- i += 1
225
- suffix = "_#{i}"
226
- end
227
- ret
228
- end
229
-
230
- def extract_org_attrs_complex(node, opts, source, suffix)
231
- { name: node.attr(source + suffix),
232
- role: opts[:role], desc: opts[:desc],
233
- logo: node.attr("#{source}_logo#{suffix}") }.compact
234
- .merge(extract_org_attrs_address(node, opts, suffix))
235
- end
236
-
237
- def extract_org_attrs_address(node, opts, suffix)
238
- %w(address phone fax email uri).each_with_object({}) do |a, m|
239
- opts[:source]&.each do |s|
240
- p = node.attr("#{s}-#{a}#{suffix}") and
241
- m[a.to_sym] = p
242
- end
243
- end
244
- end
245
-
246
88
  def copyright_parse(node)
247
89
  opt = { source: ["copyright-holder", "publisher", "pub"],
248
90
  role: "publisher", default: default_publisher }
@@ -0,0 +1,163 @@
1
+ module Metanorma
2
+ module Standoc
3
+ module Front
4
+ def committee_component(compname, node, out)
5
+ i = 1
6
+ suffix = ""
7
+ while node.attr(compname + suffix)
8
+ out.send compname.gsub(/-/, "_"), node.attr(compname + suffix),
9
+ **attr_code(number: node.attr("#{compname}-number#{suffix}"),
10
+ type: node.attr("#{compname}-type#{suffix}"))
11
+ i += 1
12
+ suffix = "_#{i}"
13
+ end
14
+ end
15
+
16
+ def organization(org, orgname, node = nil, default_org = nil)
17
+ abbrevs = org_abbrev
18
+ n = abbrevs.invert[orgname] and orgname = n
19
+ org.name orgname
20
+ default_org and a = node&.attr("subdivision") and org.subdivision a
21
+ abbr = org_abbrev[orgname]
22
+ default_org && b = node&.attr("subdivision-abbr") and abbr = b
23
+ abbr and org.abbreviation abbr
24
+ end
25
+
26
+ def org_address(org, xml)
27
+ p = org[:address] and xml.address do |ad|
28
+ ad.formattedAddress do |f|
29
+ f << p.gsub(/ \+\n/, "<br/>")
30
+ end
31
+ end
32
+ p = org[:phone] and xml.phone p
33
+ p = org[:fax] and xml.phone p, type: "fax"
34
+ p = org[:email] and xml.email p
35
+ p = org[:uri] and xml.uri p
36
+ end
37
+
38
+ def person_organization(node, suffix, xml)
39
+ xml.name node.attr("affiliation#{suffix}")
40
+ abbr = node.attr("affiliation_abbrev#{suffix}") and
41
+ xml.abbreviation abbr
42
+ csv_split(node.attr("affiliation_subdiv#{suffix}"))&.each do |s|
43
+ xml.subdivision s
44
+ end
45
+ person_address(node, suffix, xml)
46
+ person_org_logo(node, suffix, xml)
47
+ end
48
+
49
+ def person_address(node, suffix, xml)
50
+ if node.attr("address#{suffix}")
51
+ xml.address do |ad|
52
+ ad.formattedAddress do |f|
53
+ f << node.attr("address#{suffix}").gsub(/ \+\n/, "<br/>")
54
+ end
55
+ end
56
+ elsif node.attr("country#{suffix}") || node.attr("city#{suffix}")
57
+ person_address_components(node, suffix, xml)
58
+ end
59
+ end
60
+
61
+ def person_address_components(node, suffix, xml)
62
+ xml.address do |ad|
63
+ %w(street city state country postcode).each do |k|
64
+ s = node.attr("#{k}#{suffix}") and ad.send k, s
65
+ end
66
+ end
67
+ end
68
+
69
+ def person_org_logo(node, suffix, xml)
70
+ p = node.attr("affiliation_logo#{suffix}") and org_logo(xml, p)
71
+ end
72
+
73
+ def org_logo(xml, logo)
74
+ logo and xml.logo do |l|
75
+ l.image src: logo
76
+ end
77
+ end
78
+
79
+ def default_publisher
80
+ nil
81
+ end
82
+
83
+ def org_abbrev
84
+ {}
85
+ end
86
+
87
+ def org_contributor(node, xml, opts)
88
+ org_attrs_parse(node, opts).each do |o|
89
+ xml.contributor do |c|
90
+ org_contributor_role(c, o)
91
+ c.organization do |a|
92
+ org_organization(node, a, o)
93
+ end
94
+ end
95
+ end
96
+ end
97
+
98
+ def org_contributor_role(xml, org)
99
+ xml.role type: org[:role] do |r|
100
+ org[:desc] and r.description do |d|
101
+ d << org[:desc]
102
+ end
103
+ end
104
+ end
105
+
106
+ def org_organization(node, xml, org)
107
+ organization(xml, org[:name], node, !node.attr("publisher"))
108
+ org_address(org, xml)
109
+ org_logo(xml, org[:logo])
110
+ end
111
+
112
+ def org_attrs_parse(node, opts)
113
+ source = opts[:source]&.detect { |s| node.attr(s) }
114
+ org_attrs_simple_parse(node, opts, source) ||
115
+ org_attrs_complex_parse(node, opts, source)
116
+ end
117
+
118
+ def org_attrs_simple_parse(node, opts, source)
119
+ !source and return org_attrs_simple_parse_no_source(node, opts)
120
+ orgs = csv_split(node.attr(source))
121
+ orgs.size > 1 and return orgs.map do |o|
122
+ { name: o, role: opts[:role], desc: opts[:desc] }
123
+ end
124
+ nil
125
+ end
126
+
127
+ def org_attrs_simple_parse_no_source(node, opts)
128
+ !opts[:default] && !opts[:name] and return []
129
+ [{ name: opts[:name] || opts[:default],
130
+ role: opts[:role], desc: opts[:desc] }
131
+ .compact.merge(extract_org_attrs_address(node, opts, ""))]
132
+ end
133
+
134
+ def org_attrs_complex_parse(node, opts, source)
135
+ i = 1
136
+ suffix = ""
137
+ ret = []
138
+ while node.attr(source + suffix)
139
+ ret << extract_org_attrs_complex(node, opts, source, suffix)
140
+ i += 1
141
+ suffix = "_#{i}"
142
+ end
143
+ ret
144
+ end
145
+
146
+ def extract_org_attrs_complex(node, opts, source, suffix)
147
+ { name: node.attr(source + suffix),
148
+ role: opts[:role], desc: opts[:desc],
149
+ logo: node.attr("#{source}_logo#{suffix}") }.compact
150
+ .merge(extract_org_attrs_address(node, opts, suffix))
151
+ end
152
+
153
+ def extract_org_attrs_address(node, opts, suffix)
154
+ %w(address phone fax email uri).each_with_object({}) do |a, m|
155
+ opts[:source]&.each do |s|
156
+ p = node.attr("#{s}-#{a}#{suffix}") and
157
+ m[a.to_sym] = p
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
@@ -27,11 +27,12 @@ module Metanorma
27
27
 
28
28
  def latex_parse1(text, block)
29
29
  lxm_input = Unicode2LaTeX.unicode2latex(@c.decode(text))
30
- results = Plurimath::Math.parse(lxm_input, "latex").
31
- to_mathml(display_style: block)
30
+ results = Plurimath::Math.parse(lxm_input, "latex")
31
+ .to_mathml(display_style: block)
32
32
  if results.nil?
33
33
  @log.add("Math", nil,
34
- "latexmlmath failed to process equation:\n#{lxm_input}")
34
+ "latexmlmath failed to process equation:\n#{lxm_input}",
35
+ severity: 1)
35
36
  return
36
37
  end
37
38
  results.sub(%r{<math ([^>]+ )?display="block"}, "<math \\1")
@@ -54,8 +55,8 @@ module Metanorma
54
55
  latex = latex_parse1(text, block) or
55
56
  return xml.stem type: "MathML", block: block
56
57
  xml.stem type: "MathML", block: block do |s|
57
- math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, "")).
58
- elements[0]
58
+ math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
59
+ .elements[0]
59
60
  math.delete("alttext")
60
61
  s.parent.children = math
61
62
  s << "<latexmath>#{text}</latexmath>"
@@ -104,8 +105,8 @@ module Metanorma
104
105
  end
105
106
 
106
107
  def hash2styles(role)
107
- CSV.parse_line(role, liberal_parsing: true).
108
- each_with_object({}) do |r, m|
108
+ CSV.parse_line(role, liberal_parsing: true)
109
+ .each_with_object({}) do |r, m|
109
110
  kv = r.split(":", 2).map(&:strip)
110
111
  case kv[0]
111
112
  when "custom-charset"
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.2.8 -->
20
+ <!-- VERSION v1.2.9 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -1958,6 +1958,16 @@
1958
1958
  <data type="boolean"/>
1959
1959
  </attribute>
1960
1960
  </optional>
1961
+ <optional>
1962
+ <attribute name="type">
1963
+ <choice>
1964
+ <value>letter</value>
1965
+ <value>symbol</value>
1966
+ <value>formula</value>
1967
+ <value>equation</value>
1968
+ </choice>
1969
+ </attribute>
1970
+ </optional>
1961
1971
  <element name="name">
1962
1972
  <oneOrMore>
1963
1973
  <choice>
@@ -50,16 +50,14 @@ module Metanorma
50
50
  def file_error(config)
51
51
  msg = "Cannot process file #{config['file']} for local relaton " \
52
52
  "data source #{config['key']}"
53
- @parent.fatalerror << msg
54
- @parent.log.add("Bibliography", nil, msg)
53
+ @parent.log.add("Bibliography", nil, msg, severity: 0)
55
54
  ""
56
55
  end
57
56
 
58
57
  def format_error(config)
59
58
  msg = "Cannot process format #{config['format']} for local relaton " \
60
59
  "data source #{config['key']}"
61
- @parent.fatalerror << msg
62
- @parent.log.add("Bibliography", nil, msg)
60
+ @parent.log.add("Bibliography", nil, msg, severity: 0)
63
61
  {}
64
62
  end
65
63
 
@@ -68,8 +66,7 @@ module Metanorma
68
66
 
69
67
  msg = "Cannot find reference #{id} for local relaton " \
70
68
  "data source #{file}"
71
- @parent.fatalerror << msg
72
- @parent.log.add("Bibliography", nil, msg)
69
+ @parent.log.add("Bibliography", nil, msg, severity: 0)
73
70
  Nokogiri::XML("<bibitem/>")
74
71
  end
75
72
  end
@@ -97,6 +97,8 @@ module Metanorma
97
97
 
98
98
  def pass_status(status, text)
99
99
  text == "++++" && !status[:delimln] and status[:pass] = !status[:pass]
100
+ status[:midline_docattr] && !/^:[^ :]+: /.match?(text) and
101
+ status[:midline_docattr] = false
100
102
  if (status[:is_delim] && /^(-+|\*+|=+|_+)$/.match?(text)) ||
101
103
  (!status[:is_delim] && !status[:delimln] && text == "----")
102
104
  status[:delimln] = text
@@ -106,9 +108,14 @@ module Metanorma
106
108
  elsif status[:delimln] && text == status[:delimln]
107
109
  status[:pass] = false
108
110
  status[:delimln] = nil
111
+ elsif /^:[^ :]+: /.match?(text) &&
112
+ (status[:prev_line].empty? || status[:midline_docattr])
113
+ status[:pass] = true
114
+ status[:midline_docattr] = true
109
115
  end
110
116
  status[:is_delim] = /^\[(source|listing|literal|pass)\b/.match?(text)
111
117
  status[:pass_delim] = /^\[(pass)\b/.match?(text)
118
+ status[:prev_line] = text.strip
112
119
  status
113
120
  end
114
121
 
@@ -142,7 +142,7 @@ module Metanorma
142
142
  def refitemcode(item, node)
143
143
  m = NON_ISO_REF.match(item) and return refitem1code(item, m).compact
144
144
  m = NON_ISO_REF1.match(item) and return refitem1code(item, m).compact
145
- @log.add("AsciiDoc Input", node, "#{MALFORMED_REF}: #{item}")
145
+ @log.add("AsciiDoc Input", node, "#{MALFORMED_REF}: #{item}", severity: 1)
146
146
  {}
147
147
  end
148
148
 
@@ -43,7 +43,7 @@ module Metanorma
43
43
  m[i.to_i] = { ref: ref }
44
44
  if doc.is_a?(RelatonBib::RequestError)
45
45
  @log.add("Bibliography", nil, "Could not retrieve #{ref[:code]}: " \
46
- "no access to online site")
46
+ "no access to online site", severity: 1)
47
47
  else m[i.to_i][:doc] = doc end
48
48
  end
49
49
  end
@@ -138,7 +138,7 @@ module Metanorma
138
138
  xml
139
139
  rescue RelatonBib::RequestError
140
140
  @log.add("Bibliography", nil, "Could not retrieve #{code}: " \
141
- "no access to online site")
141
+ "no access to online site", severity: 1)
142
142
  nil
143
143
  end
144
144
 
@@ -104,7 +104,8 @@ module Metanorma
104
104
  def presentation_xml_converter(node)
105
105
  IsoDoc::PresentationXMLConvert
106
106
  .new(html_extract_attributes(node)
107
- .merge(output_formats: ::Metanorma::Standoc::Processor.new.output_formats) )
107
+ .merge(output_formats: ::Metanorma::Standoc::Processor.new
108
+ .output_formats))
108
109
  end
109
110
 
110
111
  def default_fonts(node)
@@ -112,11 +112,11 @@ module Metanorma
112
112
  def remove_missing_ref(node, target)
113
113
  if node.at("./parent::concept[@type = 'symbol']")
114
114
  log.add("AsciiDoc Input", node,
115
- remove_missing_ref_msg(node, target, :symbol))
115
+ remove_missing_ref_msg(node, target, :symbol), severity: 1)
116
116
  remove_missing_ref_term(node, target, "symbol")
117
117
  else
118
118
  log.add("AsciiDoc Input", node,
119
- remove_missing_ref_msg(node, target, :term))
119
+ remove_missing_ref_msg(node, target, :term), severity: 1)
120
120
  remove_missing_ref_term(node, target, "term")
121
121
  end
122
122
  end
@@ -253,9 +253,8 @@ module Metanorma
253
253
  @idhash["#{prefix}-#{text}"] or
254
254
  return "#{prefix}-#{text}"
255
255
  (1..Float::INFINITY).lazy.each do |index|
256
- unless @idhash["#{prefix}-#{text}-#{index}"]
256
+ @idhash["#{prefix}-#{text}-#{index}"] or
257
257
  break("#{prefix}-#{text}-#{index}")
258
- end
259
258
  end
260
259
  end
261
260
 
@@ -153,7 +153,7 @@ module Metanorma
153
153
  matched = TERM_REFERENCE_RE.match text
154
154
  matched.nil? and @log.add("AsciiDoc Input", node,
155
155
  "term reference not in expected format:" \
156
- "#{text}")
156
+ "#{text}", severity: 1)
157
157
  matched
158
158
  end
159
159
 
@@ -22,11 +22,14 @@ module Metanorma
22
22
  concept_validate(doc, "related", "preferred//name")
23
23
  preferred_validate(doc)
24
24
  table_validate(doc)
25
- @fatalerror += requirement_validate(doc)
25
+ requirement_validate(doc).each do |e|
26
+ @log.add("Requirements", nil, e, severity: 0)
27
+ end
26
28
  image_validate(doc)
27
29
  math_validate(doc)
28
- @fatalerror.empty? or
29
- clean_abort(@fatalerror.join("\n"), doc)
30
+ fatalerrors = @log.abort_messages
31
+ fatalerrors.empty? or
32
+ clean_abort(fatalerrors.join("\n"), doc)
30
33
  end
31
34
 
32
35
  MATHML_NS = "http://www.w3.org/1998/Math/MathML".freeze
@@ -53,8 +56,7 @@ module Metanorma
53
56
  a and orig += "\n\tAsciimath original: #{@c.decode(a.children.to_xml)}"
54
57
  l and orig += "\n\tLatexmath original: #{@c.decode(l.children.to_xml)}"
55
58
  @log.add("Mathematics", elem,
56
- "Invalid MathML: #{math}\n #{error}#{orig}")
57
- @fatalerror << "Invalid MathML: #{math}"
59
+ "Invalid MathML: #{math}\n #{error}#{orig}", severity: 0)
58
60
  end
59
61
 
60
62
  def nested_asset_validate(doc)
@@ -92,7 +94,6 @@ module Metanorma
92
94
  err2 = "There is a crossreference to an instance of #{inner.name} " \
93
95
  "nested within #{outer.name}: #{i.to_xml}"
94
96
  @log.add("Style", i, err2)
95
- # @fatalerror << err2
96
97
  end
97
98
 
98
99
  def schema_validate(doc, schema)
@@ -149,8 +150,7 @@ module Metanorma
149
150
  Metanorma::Utils::datauri?(i["src"]) and next
150
151
  expand_path(i["src"]) and next
151
152
  @log.add("Images", i.parent,
152
- "Image not found: #{i['src']}")
153
- @fatalerror << "Image not found: #{i['src']}"
153
+ "Image not found: #{i['src']}", severity: 0)
154
154
  end
155
155
  end
156
156
 
@@ -189,9 +189,9 @@ module Metanorma
189
189
 
190
190
  def repeat_id_validate1(elem)
191
191
  if @doc_ids[elem["id"]]
192
- @log.add("Anchors", elem, "Anchor #{elem['id']} has already been " \
193
- "used at line #{@doc_ids[elem['id']]}")
194
- @fatalerror << "Multiple instances of same ID: #{elem['id']}"
192
+ @log.add("Anchors", elem,
193
+ "Anchor #{elem['id']} has already been " \
194
+ "used at line #{@doc_ids[elem['id']]}", severity: 0)
195
195
  end
196
196
  @doc_ids[elem["id"]] = elem.line
197
197
  end
@@ -210,7 +210,7 @@ module Metanorma
210
210
  m[x.text] = x
211
211
  @doc_ids[x.text] and next
212
212
  @log.add("Anchors", x.parent,
213
- "Crossreference target #{x} is undefined")
213
+ "Crossreference target #{x} is undefined", severity: 1)
214
214
  end
215
215
  end
216
216
  end
@@ -21,8 +21,7 @@ module Metanorma
21
21
  if callouts.size != annotations.size && !annotations.empty?
22
22
  err = "mismatch of callouts (#{callouts.size}) and annotations " \
23
23
  "(#{annotations.size})"
24
- @log.add("AsciiDoc Input", elem, err)
25
- @fatalerror << err
24
+ @log.add("AsciiDoc Input", elem, err, severity: 0)
26
25
  end
27
26
  end
28
27
 
@@ -58,15 +57,12 @@ module Metanorma
58
57
  end
59
58
 
60
59
  def norm_ref_validate(doc)
61
- found = false
62
60
  doc.xpath("//references[@normative = 'true']/bibitem").each do |b|
63
61
  docid = b.at("./docidentifier[@type = 'metanorma']") or next
64
62
  /^\[\d+\]$/.match?(docid.text) or next
65
63
  @log.add("Bibliography", b,
66
- "Numeric reference in normative references")
67
- found = true
64
+ "Numeric reference in normative references", severity: 0)
68
65
  end
69
- found and @fatalerror << "Numeric reference in normative references"
70
66
  end
71
67
  end
72
68
  end
@@ -72,8 +72,7 @@ module Metanorma
72
72
  mode == "thead_row" and err = "cannot go outside #{tablechild}"
73
73
  err = "Table rows in table #{err}: check rowspan"
74
74
  if cells2d.any? { |x| x.size != cells2d.first.size }
75
- @log.add("Table", table, err)
76
- @fatalerror << err
75
+ @log.add("Table", table, err, severity: 0)
77
76
  end
78
77
  end
79
78
 
@@ -81,9 +80,7 @@ module Metanorma
81
80
  def maxcols_check(col, maxcols, tcell)
82
81
  if maxcols.positive? && col > maxcols
83
82
  @log.add("Table", tcell, "Table exceeds maximum number of columns "\
84
- "defined (#{maxcols})")
85
- @fatalerror << "Table exceeds maximum number of columns defined "\
86
- "(#{maxcols})"
83
+ "defined (#{maxcols})", severity: 0)
87
84
  end
88
85
  end
89
86
  end