metanorma-standoc 3.1.8 → 3.1.9
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/lib/metanorma/standoc/biblio.rng +1 -1
- data/lib/metanorma/standoc/blocks.rb +4 -8
- data/lib/metanorma/standoc/cleanup_block.rb +14 -0
- data/lib/metanorma/standoc/cleanup_xref.rb +5 -2
- data/lib/metanorma/standoc/converter.rb +1 -0
- data/lib/metanorma/standoc/front.rb +7 -1
- data/lib/metanorma/standoc/isodoc.rng +35 -10
- data/lib/metanorma/standoc/spans_to_bibitem.rb +3 -0
- data/lib/metanorma/standoc/spans_to_bibitem_preprocessing.rb +2 -2
- data/lib/metanorma/standoc/validate_term.rb +1 -0
- data/lib/metanorma/standoc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de01a94e3cb7bcfb9a89059997ab380a4ad0e4bc1b978e9564b1c6e868e1b4d2
|
4
|
+
data.tar.gz: 92d49d407c518a7296398da6c24ad78d8d05a97216a6019469574325762a2acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5941a5e7f2a3736b23ec67b9a54418570e0cbabaec1ee178c4685497db541c3db15788bff3ac0a3a49a068e367d71144bb8b2dbcff7fea82b7c26bb945fd76
|
7
|
+
data.tar.gz: 9ddd293a80d0947882a033cec025e2d7cf26de022bb86791c80f8eb4f51df994aebdf72be5c492f711dbc4a52b196ab156e70cc5854d7b78b8d78f5039d9b7b7
|
@@ -869,7 +869,7 @@ depending on whether the items exist as independent documents, or are parts of a
|
|
869
869
|
</zeroOrMore>
|
870
870
|
</element>
|
871
871
|
</define>
|
872
|
-
<define name="BibItemType"
|
872
|
+
<define name="BibItemType">
|
873
873
|
<a:documentation>Type of bibliographic item.
|
874
874
|
The value list complies with the types provided in ISO 690:2021.
|
875
875
|
NOTE: These values represent a strict superset to BibTeX
|
@@ -9,8 +9,7 @@ module Metanorma
|
|
9
9
|
anchor = node&.id
|
10
10
|
{ id: "_#{UUIDTools::UUID.random_create}",
|
11
11
|
anchor: anchor && !anchor.empty? ? anchor : nil,
|
12
|
-
tag: node&.attr("tag"),
|
13
|
-
columns: node&.attr("columns"),
|
12
|
+
tag: node&.attr("tag"), columns: node&.attr("columns"),
|
14
13
|
"multilingual-rendering": node&.attr("multilingual-rendering") }
|
15
14
|
.compact
|
16
15
|
end
|
@@ -95,9 +94,7 @@ module Metanorma
|
|
95
94
|
def term_example(node)
|
96
95
|
noko do |xml|
|
97
96
|
xml.termexample **attr_code(id_attr(node)
|
98
|
-
.merge(
|
99
|
-
keepasterm: node.option?("termexample") || nil,
|
100
|
-
)) do |ex|
|
97
|
+
.merge(keepasterm: node.option?("termexample") || nil)) do |ex|
|
101
98
|
wrap_in_para(node, ex)
|
102
99
|
end
|
103
100
|
end
|
@@ -235,7 +232,7 @@ module Metanorma
|
|
235
232
|
end
|
236
233
|
end
|
237
234
|
|
238
|
-
|
235
|
+
PASSTHRU_ERR = <<~ERRMSG.freeze
|
239
236
|
This is not valid Metanorma XML. If you intended a different format, such as HTML, you need to specify `format=` on the pass markup;
|
240
237
|
refer to https://www.metanorma.org/author/topics/blocks/passthroughs/
|
241
238
|
ERRMSG
|
@@ -247,8 +244,7 @@ module Metanorma
|
|
247
244
|
# as it may be fragment, e.g. unterminated start of element markup
|
248
245
|
def passthrough_validate(node, content, encoded_content)
|
249
246
|
valid, = validate_document_fragment(content.dup)
|
250
|
-
err =
|
251
|
-
"Invalid passthrough content: #{encoded_content}\n#{PASSTHROUGH_ERR}"
|
247
|
+
err = "Invalid passthrough content: #{encoded_content}\n#{PASSTHRU_ERR}"
|
252
248
|
!valid and
|
253
249
|
@log.add("Metanorma XML Syntax", node, err, severity: 0)
|
254
250
|
end
|
@@ -84,7 +84,21 @@ module Metanorma
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
def figure_table_cleanup(xmldoc)
|
88
|
+
xmldoc.xpath("//figure").each do |f|
|
89
|
+
t = f.at("./table") or next
|
90
|
+
t["plain"] = true
|
91
|
+
t.xpath(".//td | .//th").each do |d|
|
92
|
+
d["align"] = "center"
|
93
|
+
d["valign"] = "bottom"
|
94
|
+
end
|
95
|
+
t.xpath("./note | ./footnote | ./dl | ./source")
|
96
|
+
.each { |n| f << n }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
87
100
|
def figure_cleanup(xmldoc)
|
101
|
+
figure_table_cleanup(xmldoc)
|
88
102
|
figure_footnote_cleanup(xmldoc)
|
89
103
|
subfigure_cleanup(xmldoc)
|
90
104
|
figure_dl_cleanup1(xmldoc)
|
@@ -149,17 +149,20 @@ module Metanorma
|
|
149
149
|
|
150
150
|
def xref_compound_cleanup1(xref, locations)
|
151
151
|
xref.children.empty? and xref.children = "<sentinel/>"
|
152
|
-
xref_parse_compound_locations(locations).reverse_each do |y|
|
152
|
+
xref_parse_compound_locations(locations, xref).reverse_each do |y|
|
153
153
|
xref.add_first_child "<xref target='#{y[1]}' connective='#{y[0]}'/>"
|
154
154
|
end
|
155
155
|
xref&.at("./sentinel")&.remove
|
156
156
|
end
|
157
157
|
|
158
|
-
def xref_parse_compound_locations(locations)
|
158
|
+
def xref_parse_compound_locations(locations, xref)
|
159
159
|
l = locations.map { |y| y.split("!", 2) }
|
160
160
|
l.map.with_index do |y, i|
|
161
161
|
y.size == 1 and
|
162
162
|
y.unshift(l.dig(i + 1, 0) == "to" ? "from" : "and")
|
163
|
+
%w(and from to or).include?(y[0]) or
|
164
|
+
@log.add("Crossreferences", xref,
|
165
|
+
"Illegal cross-reference connective: #{y[0]}", severity: 0)
|
163
166
|
y
|
164
167
|
end
|
165
168
|
end
|
@@ -42,6 +42,7 @@ module Metanorma
|
|
42
42
|
preprocessor Metanorma::Plugin::Lutaml::Json2TextPreprocessor
|
43
43
|
preprocessor Metanorma::Plugin::Lutaml::Yaml2TextPreprocessor
|
44
44
|
preprocessor Metanorma::Plugin::Lutaml::Data2TextPreprocessor
|
45
|
+
preprocessor Metanorma::Plugin::Lutaml::LutamlXmiUmlPreprocessor
|
45
46
|
preprocessor Metanorma::Plugin::Glossarist::DatasetPreprocessor
|
46
47
|
preprocessor Metanorma::Standoc::NamedEscapePreprocessor
|
47
48
|
inline_macro Metanorma::Standoc::PreferredTermInlineMacro
|
@@ -180,11 +180,12 @@ module Metanorma
|
|
180
180
|
def title(node, xml)
|
181
181
|
title_main(node, xml)
|
182
182
|
title_other(node, xml)
|
183
|
+
title_fallback(node, xml)
|
183
184
|
end
|
184
185
|
|
185
186
|
# English plain title: :title: or implicit, typed as main
|
186
187
|
def title_main(node, xml)
|
187
|
-
title = node.attr("title")
|
188
|
+
title = node.attr("title")
|
188
189
|
node.attr("title-en") and return
|
189
190
|
add_title_xml(xml, title, "en", "main")
|
190
191
|
end
|
@@ -206,6 +207,11 @@ module Metanorma
|
|
206
207
|
t << Metanorma::Utils::asciidoc_sub(content)
|
207
208
|
end
|
208
209
|
end
|
210
|
+
|
211
|
+
def title_fallback(node, xml)
|
212
|
+
xml.parent.at("./title[not(normalize-space(.)='')]") and return
|
213
|
+
add_title_xml(xml, node.attr("doctitle"), @lang, "main")
|
214
|
+
end
|
209
215
|
end
|
210
216
|
end
|
211
217
|
end
|
@@ -311,17 +311,28 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
311
311
|
</ref>
|
312
312
|
</optional>
|
313
313
|
<choice>
|
314
|
-
<a:documentation>Content of the figure</a:documentation>
|
315
|
-
<ref name="image"
|
314
|
+
<a:documentation>Content of the figure </a:documentation>
|
315
|
+
<ref name="image">
|
316
|
+
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
317
|
+
</ref>
|
316
318
|
<ref name="video"/>
|
317
319
|
<ref name="audio"/>
|
318
|
-
<ref name="pre"
|
320
|
+
<ref name="pre">
|
321
|
+
<a:documentation>figures can contain ASCII art</a:documentation>
|
322
|
+
</ref>
|
319
323
|
<oneOrMore>
|
320
|
-
<ref name="paragraph-with-footnote"
|
324
|
+
<ref name="paragraph-with-footnote">
|
325
|
+
<a:documentation>figures can contain discursive art</a:documentation>
|
326
|
+
</ref>
|
321
327
|
</oneOrMore>
|
322
328
|
<zeroOrMore>
|
323
|
-
<ref name="figure"
|
329
|
+
<ref name="figure">
|
330
|
+
<a:documentation>subfigures, nested directly within a figure</a:documentation>
|
331
|
+
</ref>
|
324
332
|
</zeroOrMore>
|
333
|
+
<ref name="table">
|
334
|
+
<a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
|
335
|
+
</ref>
|
325
336
|
</choice>
|
326
337
|
<zeroOrMore>
|
327
338
|
<ref name="fn">
|
@@ -354,17 +365,28 @@ and is intended to be referenced by a callout within the source code</a:document
|
|
354
365
|
</ref>
|
355
366
|
</optional>
|
356
367
|
<choice>
|
357
|
-
<a:documentation>Content of the figure</a:documentation>
|
358
|
-
<ref name="image-no-id"
|
368
|
+
<a:documentation>Content of the figure </a:documentation>
|
369
|
+
<ref name="image-no-id">
|
370
|
+
<a:documentation>by default the content of a figure is a media file</a:documentation>
|
371
|
+
</ref>
|
359
372
|
<ref name="video-no-id"/>
|
360
373
|
<ref name="audio-no-id"/>
|
361
|
-
<ref name="pre-no-id"
|
374
|
+
<ref name="pre-no-id">
|
375
|
+
<a:documentation>figures can contain ASCII art</a:documentation>
|
376
|
+
</ref>
|
362
377
|
<oneOrMore>
|
363
|
-
<ref name="paragraph-with-footnote-no-id"
|
378
|
+
<ref name="paragraph-with-footnote-no-id">
|
379
|
+
<a:documentation>figures can contain discursive art</a:documentation>
|
380
|
+
</ref>
|
364
381
|
</oneOrMore>
|
365
382
|
<zeroOrMore>
|
366
|
-
<ref name="figure-no-id"
|
383
|
+
<ref name="figure-no-id">
|
384
|
+
<a:documentation>subfigures, nested directly within a figure</a:documentation>
|
385
|
+
</ref>
|
367
386
|
</zeroOrMore>
|
387
|
+
<ref name="table-no-id">
|
388
|
+
<a:documentation>Table is understood in this context to be a tabular arrangement of subfigures</a:documentation>
|
389
|
+
</ref>
|
368
390
|
</choice>
|
369
391
|
<zeroOrMore>
|
370
392
|
<ref name="fn">
|
@@ -876,6 +898,9 @@ titlecase, or lowercase</a:documentation>
|
|
876
898
|
<data type="boolean"/>
|
877
899
|
</attribute>
|
878
900
|
</optional>
|
901
|
+
<ref name="LocalizedStringAttributes">
|
902
|
+
<a:documentation>Specify language of bibitem, can be used to render it with language-specific bibliographic style</a:documentation>
|
903
|
+
</ref>
|
879
904
|
<ref name="ReducedBibliographicItem"/>
|
880
905
|
</element>
|
881
906
|
</define>
|
@@ -54,6 +54,9 @@ module Metanorma
|
|
54
54
|
spans[:classification]&.each do |s|
|
55
55
|
ret += span_to_docid(s, "classification")
|
56
56
|
end
|
57
|
+
spans[:keyword]&.each do |s|
|
58
|
+
ret += span_to_docid(s, "keyword")
|
59
|
+
end
|
57
60
|
spans[:image]&.each do |s|
|
58
61
|
ret += "<depiction>#{s[:val]}</depiction>"
|
59
62
|
end
|
@@ -31,7 +31,7 @@ module Metanorma
|
|
31
31
|
|
32
32
|
def empty_span_hash
|
33
33
|
{ contrib: [], docid: [], uri: [], date: [], classification: [],
|
34
|
-
image: [], extent: {}, in: {} }
|
34
|
+
keyword: [], image: [], extent: {}, in: {} }
|
35
35
|
end
|
36
36
|
|
37
37
|
def spans_preprocess(spans)
|
@@ -42,7 +42,7 @@ module Metanorma
|
|
42
42
|
|
43
43
|
def span_preprocess1(span, ret)
|
44
44
|
case span[:key]
|
45
|
-
when "uri", "docid", "classification"
|
45
|
+
when "uri", "docid", "classification", "keyword"
|
46
46
|
val = link_unwrap(Nokogiri::XML.fragment(span[:val])).to_xml
|
47
47
|
ret[span[:key].to_sym] << { type: span[:type], val: }
|
48
48
|
when "date"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-standoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|