metanorma-standoc 2.10.4 → 3.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11972c007dd10b95b91d8598f5dce3843e59f7867e53768f43f03d04c63bf321
4
- data.tar.gz: c22fd5262f6024f145c23d9f88471a9d8d061d51e7346fdac3535701715c36e5
3
+ metadata.gz: 35f94b1c019edeb4422907e08dea706e5aa5f1ebfda48b2c6f0d518b66beec9c
4
+ data.tar.gz: eb5f4dc2f20109119d5d562fc08ce9e425fe4c0b0353ed8283a5b8887bc293ef
5
5
  SHA512:
6
- metadata.gz: 2f39425e1441e9b6d251669be2e3fd02967cd41a1f4f5bd65c71e9546a4e510bcf42ab89203eade13afa4e755847b4b3557c0be3c2a9839efd5a64ec013b5d36
7
- data.tar.gz: bf360c1ce44587d5c7244e0edbb759109db93bd71c7c852c94bd3b020ca70fc4d981582891f98588492a923ee87e5224b2ed33617dd4cd37edf7480cc1e24955
6
+ metadata.gz: 197988a7da6707a851cd24b584436825c3130e74ce2b792ad24cb8a86d0fc92c168f9eb0b494798d4119c94e0a915a5537c91d9a4d2de1880873fecbc64fc102
7
+ data.tar.gz: e7688aaecf8a901914588538d39b52d21bd7b871692c0bf889ab3147f325cd6586fee88210a1aaba50fef05c70d5a37bbb7d5a867013000c7e8eea3a3904b009
@@ -14,18 +14,20 @@ require "mn-requirements"
14
14
  module Metanorma
15
15
  module Standoc
16
16
  module Base
17
- XML_ROOT_TAG = "standard-document".freeze
18
- XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
17
+ #XML_ROOT_TAG = "standard-document".freeze
18
+ #XML_NAMESPACE = "https://www.metanorma.org/ns/standoc".freeze
19
19
  FONTS_MANIFEST = "fonts-manifest".freeze
20
20
 
21
21
  attr_accessor :log
22
22
 
23
23
  def xml_root_tag
24
- self.class::XML_ROOT_TAG
24
+ #self.class::XML_ROOT_TAG
25
+ "metanorma"
25
26
  end
26
27
 
27
28
  def xml_namespace
28
- self.class::XML_NAMESPACE
29
+ #self.class::XML_NAMESPACE
30
+ "https://www.metanorma.org/ns/standoc"
29
31
  end
30
32
 
31
33
  def document(node)
@@ -87,7 +89,8 @@ module Metanorma
87
89
  def makexml1(node)
88
90
  result = ["<?xml version='1.0' encoding='UTF-8'?>",
89
91
  "<#{xml_root_tag} type='semantic' version='#{version}' " \
90
- "schema-version='#{schema_version}'>"]
92
+ "schema-version='#{schema_version}' " \
93
+ "flavor='#{processor.new.asciidoctor_backend}'>"]
91
94
  result << noko { |ixml| front node, ixml }
92
95
  result << noko { |ixml| middle node, ixml }
93
96
  result << "</#{xml_root_tag}>"
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -941,6 +947,8 @@ May be electronic (e.g. Twitter direct message, email) or voice (e.g. a remark m
941
947
  typically cited as "personal communication")</a:documentation>
942
948
  <value>conversation</value>
943
949
  <a:documentation>An exchange of messages between two or more persons. May be electronic (e.g. web chat) or voice (e.g. phone call)</a:documentation>
950
+ <value>collection</value>
951
+ <a:documentation>A compound resource consisting of other resources, which are themselves presupposed to have their type specified..</a:documentation>
944
952
  <value>misc</value>
945
953
  <a:documentation>Bibliographic type not adequately described in the foregoing</a:documentation>
946
954
  </choice>
@@ -1271,17 +1279,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1271
1279
  </define>
1272
1280
  <define name="validityBegins">
1273
1281
  <element name="validityBegins">
1274
- <ref name="ISO8601DateTime"/>
1282
+ <ref name="ISO8601Date"/>
1275
1283
  </element>
1276
1284
  </define>
1277
1285
  <define name="validityEnds">
1278
1286
  <element name="validityEnds">
1279
- <ref name="ISO8601DateTime"/>
1287
+ <ref name="ISO8601Date"/>
1280
1288
  </element>
1281
1289
  </define>
1282
1290
  <define name="validityRevision">
1283
1291
  <element name="revision">
1284
- <ref name="ISO8601DateTime"/>
1292
+ <ref name="ISO8601Date"/>
1285
1293
  </element>
1286
1294
  </define>
1287
1295
  <define name="TypedTitleString">
@@ -132,7 +132,7 @@ module Metanorma
132
132
  bibdata = bibdata.at("./relation[@type = 'derivedFrom']/bibitem")
133
133
  ident = bibdata.at("./docidentifier[@primary = 'true']") ||
134
134
  bibdata.at("./docidentifier")
135
- xmldoc.xpath("//xref[@target = '#{d}'][normalize-space(text()) = '']")
135
+ xmldoc.xpath("//xref[@target = '#{d}'][normalize-space(.//text()) = '']")
136
136
  .each { |x| x << ident.text }
137
137
  end
138
138
  end
@@ -46,7 +46,7 @@ module Metanorma
46
46
  xmldoc.at("//metanorma-extension/semantic-metadata/" \
47
47
  "headless[text() = 'true']") and return nil
48
48
  x = xmldoc.dup
49
- x.root.add_namespace(nil, self.class::XML_NAMESPACE)
49
+ x.root.add_namespace(nil, xml_namespace)
50
50
  xml = Nokogiri::XML(x.to_xml)
51
51
  @isodoc ||= isodoc(@lang, @script, @locale)
52
52
  @isodoc.info(xml, nil)
@@ -56,7 +56,7 @@ module Metanorma
56
56
  elsif depth < entry[:depth]
57
57
  ret += "<li><ul>" * (entry[:depth] - depth)
58
58
  end
59
- ret + "<li><xref target='#{entry[:target]}'>#{entry[:text]}</xref></li>"
59
+ ret + "<li><xref target='#{entry[:target]}'><display-text>#{entry[:text]}</display-text></xref></li>"
60
60
  end
61
61
 
62
62
  def toc_cleanup_clause(xmldoc)
@@ -70,10 +70,10 @@ module Metanorma
70
70
  end
71
71
 
72
72
  def toc_cleanup_clause_entry(xmldoc, list)
73
- list.xpath(".//xref[not(text())]").each do |x|
73
+ list.xpath(".//xref[not(text())][not(display-text)]").each do |x|
74
74
  c1 = xmldoc.at("//*[@id = '#{x['target']}']")
75
75
  t = c1.at("./variant-title[@type = 'toc']") || c1.at("./title")
76
- x << t.dup.children
76
+ x << "<display-text>#{to_xml(t.dup.children)}</display-text>"
77
77
  end
78
78
  end
79
79
 
@@ -35,11 +35,12 @@ module Metanorma
35
35
  def extract_localities(elem)
36
36
  elem.children.empty? and return
37
37
  f = elem.children.first
38
- f.text? or return
38
+ f.text? or return xref_display_text(elem, elem.children.remove)
39
39
  head = f.remove.text
40
40
  tail = elem.children.remove
41
- extract_localities1(elem, head)
42
- tail and elem << tail
41
+ d = extract_localities1(elem, head)
42
+ tail and d << tail
43
+ d.children.empty? and d.remove
43
44
  end
44
45
 
45
46
  LOCALITY_REGEX_STR_TRIPLEDASH = <<~REGEXP.freeze
@@ -69,7 +70,13 @@ module Metanorma
69
70
  b = elem.add_child("<localityStack/>").first if m[:punct] == ";"
70
71
  end
71
72
  fill_in_eref_connectives(elem)
72
- elem.add_child(text) if text
73
+ xref_display_text(elem, text)
74
+ end
75
+
76
+ def xref_display_text(elem, text)
77
+ d = elem.add_child("<display-text></display-text>").first
78
+ d.add_child(text) if text
79
+ d
73
80
  end
74
81
 
75
82
  # clause=3;and!5 => clause=3;and!clause=5
@@ -135,6 +142,9 @@ module Metanorma
135
142
  end
136
143
 
137
144
  def eref_stack(xmldoc)
145
+ xmldoc.xpath("//eref/display-text[eref]").each do |e|
146
+ e.replace(e.children)
147
+ end
138
148
  xmldoc.xpath("//eref[eref]").each do |e|
139
149
  e.name = "erefstack"
140
150
  e.delete("bibitemid")
@@ -196,6 +206,11 @@ module Metanorma
196
206
  xmldoc.xpath("//xref//xref").each do |x|
197
207
  x.name = "location"
198
208
  end
209
+ xmldoc.xpath("//xref[not(./display-text)]").each do |x|
210
+ c = x.xpath("./*[not(self::locality or self::localityStack or self::location)] | ./text()")
211
+ c.empty? and next
212
+ xref_display_text(x, c.remove)
213
+ end
199
214
  end
200
215
 
201
216
  def xref_cleanup1(xmldoc)
@@ -23,10 +23,8 @@ module Metanorma
23
23
  Asciidoctor::Extensions.register do
24
24
  preprocessor Metanorma::Standoc::ResolveIncludePreprocessor
25
25
  preprocessor Metanorma::Plugin::Lutaml::LutamlPreprocessor
26
- preprocessor Metanorma::Plugin::Lutaml::LutamlUmlAttributesTablePreprocessor
27
26
  preprocessor Metanorma::Plugin::Lutaml::LutamlUmlDatamodelDescriptionPreprocessor
28
27
  preprocessor Metanorma::Plugin::Lutaml::LutamlEaXmiPreprocessor
29
- preprocessor Metanorma::Plugin::Lutaml::LutamlUmlClassPreprocessor
30
28
  inline_macro Metanorma::Plugin::Lutaml::LutamlFigureInlineMacro
31
29
  inline_macro Metanorma::Plugin::Lutaml::LutamlTableInlineMacro
32
30
  block_macro Metanorma::Plugin::Lutaml::LutamlDiagramBlockMacro
@@ -6,7 +6,7 @@ module Metanorma
6
6
  def init(node)
7
7
  init_vars
8
8
  init_misc(node)
9
- init_processing(node)
9
+ init_processing(node) # feeds init_i18n
10
10
  init_log(node)
11
11
  init_image(node)
12
12
  init_reqt(node)
@@ -39,12 +39,13 @@ module Metanorma
39
39
  @embed_hdr = node.attr("embed_hdr")
40
40
  @embed_id = node.attr("embed_id")
41
41
  @document_scheme = document_scheme(node)
42
- @xrefstyle = node.attr("xrefstyle")
43
42
  @source_linenums = node.attr("source-linenums-option") == "true"
44
43
  @default_doctype = "standard"
45
44
  end
46
45
 
47
46
  def init_processing(node)
47
+ @localdir = Metanorma::Utils::localdir(node)
48
+ @xrefstyle = node.attr("xrefstyle")
48
49
  @novalid = node.attr("novalid")
49
50
  @smartquotes = node.attr("smartquotes") != "false"
50
51
  @sourcecode_markup_start = node.attr("sourcecode-markup-start") || "{{{"
@@ -100,7 +101,6 @@ module Metanorma
100
101
  File.basename(node.attr("docfile"))&.gsub(/\.adoc$/, "")
101
102
  else ""
102
103
  end
103
- @localdir = Metanorma::Utils::localdir(node)
104
104
  @output_dir = outputdir node
105
105
  end
106
106
 
@@ -109,7 +109,9 @@ module Metanorma
109
109
  @script = node.attr("script") ||
110
110
  Metanorma::Utils.default_script(node.attr("language"))
111
111
  @locale = node.attr("locale")
112
- @isodoc = isodoc(@lang, @script, @locale, node.attr("i18nyaml"))
112
+ i18nyaml = node.attr("i18nyaml")
113
+ i18nyaml &&= File.join(@localdir, i18nyaml)
114
+ @isodoc = isodoc(@lang, @script, @locale, i18nyaml)
113
115
  @i18n = @isodoc.i18n
114
116
  end
115
117
 
@@ -1,6 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar ns="https://www.metanorma.org/ns/standoc" xmlns="http://relaxng.org/ns/structure/1.0">
3
- <!-- default namespace isostandard = "https://www.metanorma.com/ns/iso" -->
4
3
  <include href="biblio-standoc.rng"/>
5
4
  <include href="isodoc.rng"/>
6
5
  </grammar>
@@ -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.4.1 -->
20
+ <!-- VERSION v2.0.0 -->
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">
@@ -459,11 +459,14 @@ gives an explicit page orientation</a:documentation>
459
459
  <a:documentation>Description of location in a reference, which can be combined with other locations in a single citation</a:documentation>
460
460
  </ref>
461
461
  </zeroOrMore>
462
- <zeroOrMore>
463
- <ref name="PureTextElement">
462
+ <optional>
463
+ <element name="display-text">
464
464
  <a:documentation>The textual content of the element. The `text` is what we wish to show the link as (e.g., the "content" of `&lt;xx&gt;my link text&lt;/xx&gt;`)</a:documentation>
465
- </ref>
466
- </zeroOrMore>
465
+ <oneOrMore>
466
+ <ref name="PureTextElement"/>
467
+ </oneOrMore>
468
+ </element>
469
+ </optional>
467
470
  </define>
468
471
  </include>
469
472
  <!-- end overrides -->
@@ -1205,10 +1208,13 @@ numbers</a:documentation>
1205
1208
  <value>presentation</value>
1206
1209
  </choice>
1207
1210
  </attribute>
1211
+ <attribute name="flavor">
1212
+ <a:documentation>Metanorma flavor, indicating SDO whose requiremnts the realisation aligns to</a:documentation>
1213
+ </attribute>
1208
1214
  </define>
1209
1215
  <define name="standard-document">
1210
1216
  <a:documentation>Representation of a standardisation document</a:documentation>
1211
- <element name="standard-document">
1217
+ <element name="metanorma">
1212
1218
  <ref name="Root-Attributes"/>
1213
1219
  <ref name="bibdata">
1214
1220
  <a:documentation>Bibliographic description of the document itself, expressed in the Relaton model</a:documentation>
@@ -2,12 +2,14 @@ module Metanorma
2
2
  module Standoc
3
3
  module Base
4
4
  def html_extract_attributes(node)
5
+ i18nyaml = node.attr("i18nyaml")
6
+ i18nyaml &&= File.join(@localdir, i18nyaml)
5
7
  {
6
8
  script: node.attr("script"),
7
9
  bodyfont: node.attr("body-font"),
8
10
  headerfont: node.attr("header-font"),
9
11
  monospacefont: node.attr("monospace-font"),
10
- i18nyaml: node.attr("i18nyaml"),
12
+ i18nyaml: i18nyaml,
11
13
  scope: node.attr("scope"),
12
14
  htmlstylesheet: node.attr("htmlstylesheet"),
13
15
  htmlstylesheet_override: node.attr("htmlstylesheet-override"),
@@ -48,12 +50,14 @@ module Metanorma
48
50
  end
49
51
 
50
52
  def doc_extract_attributes(node)
53
+ i18nyaml = node.attr("i18nyaml")
54
+ i18nyaml &&= File.join(@localdir, i18nyaml)
51
55
  attrs = {
52
56
  script: node.attr("script"),
53
57
  bodyfont: node.attr("body-font"),
54
58
  headerfont: node.attr("header-font"),
55
59
  monospacefont: node.attr("monospace-font"),
56
- i18nyaml: node.attr("i18nyaml"),
60
+ i18nyaml: i18nyaml,
57
61
  scope: node.attr("scope"),
58
62
  wordstylesheet: node.attr("wordstylesheet"),
59
63
  wordstylesheet_override: node.attr("wordstylesheet-override"),
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.10.4".freeze
22
+ VERSION = "3.0.0".freeze
23
23
  end
24
24
  end
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "addressable", "~> 2.8.0"
32
32
  spec.add_dependency "asciidoctor", "~> 2.0.0"
33
33
  spec.add_dependency "crass", "~> 1.0.0"
34
- spec.add_dependency "iev", "~> 0.3.0"
35
- spec.add_dependency "isodoc", "~> 2.12.4"
34
+ spec.add_dependency "iev", "~> 0.3.5"
35
+ spec.add_dependency "isodoc", "~> 3.0.0"
36
36
  spec.add_dependency "metanorma", ">= 1.6.0"
37
37
  spec.add_dependency "metanorma-plugin-datastruct", "~> 0.3.0"
38
38
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.2.0"
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.10.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-24 00:00:00.000000000 Z
11
+ date: 2025-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.3.0
61
+ version: 0.3.5
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.3.0
68
+ version: 0.3.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: isodoc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.12.4
75
+ version: 3.0.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.12.4
82
+ version: 3.0.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: metanorma
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -590,7 +590,7 @@ homepage: https://github.com/metanorma/metanorma-standoc
590
590
  licenses:
591
591
  - BSD-2-Clause
592
592
  metadata: {}
593
- post_install_message:
593
+ post_install_message:
594
594
  rdoc_options: []
595
595
  require_paths:
596
596
  - lib
@@ -606,7 +606,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
606
606
  version: '0'
607
607
  requirements: []
608
608
  rubygems_version: 3.3.27
609
- signing_key:
609
+ signing_key:
610
610
  specification_version: 4
611
611
  summary: metanorma-standoc realises standards following the Metanorma standoc model
612
612
  test_files: []