metanorma-standoc 2.9.7 → 2.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/standoc/biblio-standoc.rng +13 -0
- data/lib/metanorma/standoc/biblio.rng +19 -12
- data/lib/metanorma/standoc/cleanup_bibdata.rb +2 -0
- data/lib/metanorma/standoc/cleanup_maths.rb +2 -1
- data/lib/metanorma/standoc/front.rb +6 -0
- data/lib/metanorma/standoc/macros_embed.rb +2 -2
- data/lib/metanorma/standoc/render.rb +1 -1
- data/lib/metanorma/standoc/spans_to_bibitem.rb +7 -0
- data/lib/metanorma/standoc/spans_to_bibitem_preprocessing.rb +13 -4
- data/lib/metanorma/standoc/utils.rb +10 -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: efa906e1b3067735301a14f3f21119e10cb6d100744f8e732dc4e404bf7c38ae
|
4
|
+
data.tar.gz: 96cd516c49dffa778854b6097f3264203cf892f7d643572d07e7712d18b3cd2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0103f46742310fd7fd639c59c58d54eb1275b3629c1bfdb47bacf613e185bf4b1e9f407d85f6370247aadcd7331968ff84927a09b0f277401e6762afdc6af1ad
|
7
|
+
data.tar.gz: aae472585794e5a22e2c0b8fbb666a332915f330a2af058d493076246b8b34333df3321bca5aacd0e53f90fef07ee28265ef1bca0f4a003693b10d6204c017b8
|
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
|
|
72
72
|
from other documents in the same doctype</a:documentation>
|
73
73
|
</ref>
|
74
74
|
</optional>
|
75
|
+
<ref name="flavor">
|
76
|
+
<a:documentation>Flavour of Metanorma used to process this document</a:documentation>
|
77
|
+
</ref>
|
75
78
|
<optional>
|
76
79
|
<ref name="editorialgroup">
|
77
80
|
<a:documentation>Groups associated with the production of the standards document, typically within
|
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
|
|
113
116
|
<define name="DocumentSubtype">
|
114
117
|
<text/>
|
115
118
|
</define>
|
119
|
+
<define name="flavor">
|
120
|
+
<element name="flavor">
|
121
|
+
<ref name="MetanormaFlavor"/>
|
122
|
+
</element>
|
123
|
+
</define>
|
124
|
+
<define name="MetanormaFlavor">
|
125
|
+
<a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
|
126
|
+
However we prefer not to hardcode it, given ongoing extension.</a:documentation>
|
127
|
+
<text/>
|
128
|
+
</define>
|
116
129
|
<define name="editorialgroup">
|
117
130
|
<a:documentation>A group associated with the production of the standards document, typically within
|
118
131
|
a standards definition organization</a:documentation>
|
@@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
|
|
1382
1382
|
<define name="bdate">
|
1383
1383
|
<a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
|
1384
1384
|
<element name="date">
|
1385
|
-
<
|
1386
|
-
<a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
|
1387
|
-
<choice>
|
1388
|
-
<ref name="BibliographicDateType"/>
|
1389
|
-
<text/>
|
1390
|
-
</choice>
|
1391
|
-
</attribute>
|
1392
|
-
<optional>
|
1393
|
-
<attribute name="text">
|
1394
|
-
<a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
|
1395
|
-
</attribute>
|
1396
|
-
</optional>
|
1385
|
+
<ref name="bDateAttributes"/>
|
1397
1386
|
<optional>
|
1398
1387
|
<choice>
|
1399
1388
|
<group>
|
@@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
|
|
1416
1405
|
</optional>
|
1417
1406
|
</element>
|
1418
1407
|
</define>
|
1408
|
+
<define name="bDateAttributes">
|
1409
|
+
<attribute name="type">
|
1410
|
+
<a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
|
1411
|
+
<choice>
|
1412
|
+
<ref name="BibliographicDateType"/>
|
1413
|
+
<text/>
|
1414
|
+
</choice>
|
1415
|
+
</attribute>
|
1416
|
+
<optional>
|
1417
|
+
<attribute name="text">
|
1418
|
+
<a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
|
1419
|
+
</attribute>
|
1420
|
+
</optional>
|
1421
|
+
</define>
|
1419
1422
|
<define name="docidentifier">
|
1420
1423
|
<a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
|
1421
1424
|
<element name="docidentifier">
|
@@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
|
|
1884
1887
|
<value>hasAnnotation</value>
|
1885
1888
|
<value>draftOf</value>
|
1886
1889
|
<value>hasDraft</value>
|
1890
|
+
<value>preliminaryDraftOf</value>
|
1891
|
+
<value>hasPreliminaryDraft</value>
|
1892
|
+
<value>revisionDraftOf</value>
|
1893
|
+
<value>hasRevisionDraft</value>
|
1887
1894
|
<value>editionOf</value>
|
1888
1895
|
<value>hasEdition</value>
|
1889
1896
|
<value>updates</value>
|
@@ -101,6 +101,8 @@ module Metanorma
|
|
101
101
|
m = /:mn-document-class: (\S+)/.match(hdr[:text])
|
102
102
|
if m then m[1].to_sym
|
103
103
|
else Processor.new.asciidoctor_backend
|
104
|
+
# don't want processor() : we will leave embedded headers as standoc,
|
105
|
+
# not local flavour
|
104
106
|
end
|
105
107
|
end
|
106
108
|
|
@@ -127,6 +127,7 @@ module Metanorma
|
|
127
127
|
def relation_normalise(type)
|
128
128
|
type.sub(/-by$/, "By").sub(/-of$/, "Of").sub(/-from$/, "From")
|
129
129
|
.sub(/-in$/, "In")
|
130
|
+
.sub(/^has-([a-z])/) { "has#{$1.upcase}" }
|
130
131
|
end
|
131
132
|
|
132
133
|
def metadata_getrelation(node, xml, type, desc = nil)
|
@@ -189,6 +190,7 @@ module Metanorma
|
|
189
190
|
def metadata_ext(node, ext)
|
190
191
|
metadata_doctype(node, ext)
|
191
192
|
metadata_subdoctype(node, ext)
|
193
|
+
metadata_flavor(node, ext)
|
192
194
|
metadata_committee(node, ext)
|
193
195
|
metadata_ics(node, ext)
|
194
196
|
end
|
@@ -201,6 +203,10 @@ module Metanorma
|
|
201
203
|
s = node.attr("docsubtype") and xml.subdoctype s
|
202
204
|
end
|
203
205
|
|
206
|
+
def metadata_flavor(_node, ext)
|
207
|
+
ext.flavor processor.new.asciidoctor_backend
|
208
|
+
end
|
209
|
+
|
204
210
|
def metadata_note(node, xml); end
|
205
211
|
|
206
212
|
def metadata_series(node, xml); end
|
@@ -66,8 +66,8 @@ module Metanorma
|
|
66
66
|
# -- but it won't: https://github.com/metanorma/metanorma-standoc/issues/802
|
67
67
|
def read_flattened_embeds(ret, doc)
|
68
68
|
reader = ::Asciidoctor::PreprocessorReader.new doc
|
69
|
-
|
70
|
-
ret.
|
69
|
+
Pathname.new doc.base_dir
|
70
|
+
ret.reverse_each do |l|
|
71
71
|
# if l[:file]
|
72
72
|
# new = Pathname.new(l[:path]).relative_path_from(b).to_s
|
73
73
|
# reader.push_include l[:lines], new, l[:path]
|
@@ -93,7 +93,7 @@ module Metanorma
|
|
93
93
|
pdf-allow-print pdf-allow-print-hq
|
94
94
|
pdf-allow-access-content pdf-encrypt-metadata fonts
|
95
95
|
font-license-agreement).each_with_object({}) do |x, m|
|
96
|
-
m[x.
|
96
|
+
m[x.delete("-").to_i] = node.attr(x)
|
97
97
|
end
|
98
98
|
|
99
99
|
pdf_options.merge(fonts_manifest_option(node) || {})
|
@@ -38,10 +38,17 @@ module Metanorma
|
|
38
38
|
ret += spans_to_bibitem_docid(spans)
|
39
39
|
ret += spans_to_contribs(spans)
|
40
40
|
ret += spans_to_bibitem_edn(spans)
|
41
|
+
spans[:abstract] and ret += "<abstract>#{spans[:abstract]}</abstract>"
|
41
42
|
ret += spans_to_series(spans)
|
42
43
|
spans[:pubplace] and ret += "<place>#{spans[:pubplace]}</place>"
|
43
44
|
ret += spans_to_bibitem_host(spans)
|
44
45
|
ret += spans_to_bibitem_extent(spans[:extent])
|
46
|
+
spans[:classification]&.each do |s|
|
47
|
+
ret += span_to_docid(s, "classification")
|
48
|
+
end
|
49
|
+
spans[:image]&.each do |s|
|
50
|
+
ret += "<depiction>#{s[:val]}</depiction>"
|
51
|
+
end
|
45
52
|
ret
|
46
53
|
end
|
47
54
|
|
@@ -3,10 +3,15 @@ module Metanorma
|
|
3
3
|
module Cleanup
|
4
4
|
class SpansToBibitem
|
5
5
|
def extract_spans(bib)
|
6
|
-
bib.xpath("./formattedref//span").each_with_object([]) do |s, m|
|
6
|
+
ret = bib.xpath("./formattedref//span").each_with_object([]) do |s, m|
|
7
7
|
s.at("./ancestor::span") and next
|
8
8
|
extract_spans1(s, m)
|
9
9
|
end
|
10
|
+
bib.xpath("./formattedref//image").each do |i|
|
11
|
+
i.delete("id")
|
12
|
+
ret << { key: "image", type: nil, val: i.remove.to_xml }
|
13
|
+
end
|
14
|
+
ret
|
10
15
|
end
|
11
16
|
|
12
17
|
def extract_spans1(span, acc)
|
@@ -25,7 +30,8 @@ module Metanorma
|
|
25
30
|
end
|
26
31
|
|
27
32
|
def empty_span_hash
|
28
|
-
{ contrib: [], docid: [], uri: [], date: [],
|
33
|
+
{ contrib: [], docid: [], uri: [], date: [], classification: [],
|
34
|
+
image: [], extent: {}, in: {} }
|
29
35
|
end
|
30
36
|
|
31
37
|
def spans_preprocess(spans)
|
@@ -36,7 +42,7 @@ module Metanorma
|
|
36
42
|
|
37
43
|
def span_preprocess1(span, ret)
|
38
44
|
case span[:key]
|
39
|
-
when "uri", "docid"
|
45
|
+
when "uri", "docid", "classification"
|
40
46
|
val = link_unwrap(Nokogiri::XML.fragment(span[:val])).to_xml
|
41
47
|
ret[span[:key].to_sym] << { type: span[:type], val: }
|
42
48
|
when "date"
|
@@ -45,8 +51,11 @@ module Metanorma
|
|
45
51
|
when "pages", "volume", "issue"
|
46
52
|
ret[:extent][span[:key].to_sym] ||= []
|
47
53
|
ret[:extent][span[:key].to_sym] << span[:val]
|
48
|
-
when "pubplace", "title", "type", "series", "edition", "version"
|
54
|
+
when "pubplace", "title", "type", "series", "edition", "version",
|
55
|
+
"abstract"
|
49
56
|
ret[span[:key].to_sym] = span[:val]
|
57
|
+
when "image"
|
58
|
+
ret[span[:key].to_sym] << { type: span[:type], val: span[:val] }
|
50
59
|
when "note"
|
51
60
|
ret[span[:key].to_sym] = { type: span[:type], val: span[:val] }
|
52
61
|
when "in_title"
|
@@ -13,6 +13,16 @@ module Metanorma
|
|
13
13
|
opts.empty? ? (send transform, node) : (send transform, node, opts)
|
14
14
|
end
|
15
15
|
|
16
|
+
def processor
|
17
|
+
parent_type = self.class.name.split("::")[0...-1]
|
18
|
+
parent_type << "Processor"
|
19
|
+
begin
|
20
|
+
Object.const_get(parent_type.join("::"))
|
21
|
+
rescue NameError
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
16
26
|
def document_ns_attributes(_doc)
|
17
27
|
nil
|
18
28
|
end
|
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: 2.9.
|
4
|
+
version: 2.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|