metanorma-standoc 2.9.7 → 2.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd70e2c82071482dcc338e1c8db424097e23a0fe5c8875960c47716903a05316
4
- data.tar.gz: 249db61a4f2a706d67ce495535b169c934e0f85a257983827f43b93f1a186a26
3
+ metadata.gz: a7ea12bf51408c095b7c95aaa93ae80274cfdea888c7fc2ce268387f27f59404
4
+ data.tar.gz: 3bbbb4f465143a199a585313fbb118cc2517ca63a47cbfd2ff6d8f27c0310cf9
5
5
  SHA512:
6
- metadata.gz: ce2dc1394947485b5accdf9abf22de21729d3513f62965b633c2d4eb2ec5fa7a2a2858923596e064e598ce15c0ad51f4887660ac6ce6a4d6928d21f6a5a622c5
7
- data.tar.gz: d5d49c9c2ebd8d2790c964d08457d080ff8b94009bd009c902f9c235195322e504314c79242932ce66bb995d3dab13263f00e7bb142437c7adde3049d94b867f
6
+ metadata.gz: dee30eacb6d886527e49813809b03a505c0f75a2bf1582bf9da97253ec45cdf852ba9510805f12043da72e2531242a2c63675cf26a1ee876f868ecac4a17edce
7
+ data.tar.gz: aaf678d5931ac11dc684a71878a321b2bd311b6ad4e1b631b199b2a92268ce1a3388ac2dd01eebb5b0c75b60bc6286ee505b3ec68a34692af857cd8fc1dd188e
@@ -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
- <attribute name="type">
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
 
@@ -40,7 +40,8 @@ module Metanorma
40
40
  MATH
41
41
  else
42
42
  Plurimath::Math.parse(expr, "asciimath")
43
- .to_mathml(display_style: elem["block"])
43
+ .to_mathml(display_style: elem["block"],
44
+ unitsml_xml: expr.include?("unitsml"))
44
45
  end
45
46
  end
46
47
 
@@ -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
- b = Pathname.new doc.base_dir
70
- ret.reverse.each do |l|
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.gsub("-", "").to_i] = node.attr(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: [], extent: {}, in: {} }
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
@@ -14,11 +14,11 @@ module Metanorma
14
14
 
15
15
  def versioned(mod, flavour)
16
16
  all_modules(mod).select { |c| defined? c::VERSION }
17
- .select { |c| c.name =~ /::#{flavour}$/ }
17
+ .select { |c| c.name =~ /Metanorma::#{flavour}$/ }
18
18
  end
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.9.7".freeze
22
+ VERSION = "2.9.9".freeze
23
23
  end
24
24
  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.7
4
+ version: 2.9.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: 2024-09-30 00:00:00.000000000 Z
11
+ date: 2024-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable