metanorma-standoc 3.0.8 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6effed725121e1f1924a44b86be0de3ebd4bcf5cc1349b07c3933a1b8666ffdf
4
- data.tar.gz: 3def10482963835400c5f5e9c7f1283ba26311a1bd82da6319633ab6186ea561
3
+ metadata.gz: 4234211796c2c39d12d6bf987d799c6cc5c65745105540ca7e2078794ed38511
4
+ data.tar.gz: 3785018f24e1689ff70f7ad53dd4a82ec86e845815f939edecf08562aa57d7c4
5
5
  SHA512:
6
- metadata.gz: 39cd5c14eebf34d92214d6c76c9f8cd2aa72e4eed77d31998d629174096439dcab567326d565c7540e3ffe1aa7dfcd87c11f7f31148f6bc4a1895adad240dab6
7
- data.tar.gz: f88823d2442c1ce9eadb24b34985cc5aba32a121531c01341a1da0483ce9273dc881a90f32ce22319018458028bffd0feb313584c11e39aa088badf298b3f4eb
6
+ metadata.gz: 7655c4607ed54692a82c533a29345f9f89f5ba6b506b3137d225e27ae47717d303abd17ddae1488b627b4b5a998e486f5b11db9c64fee6871f5f5aee2139feea
7
+ data.tar.gz: 5730669dbca0c7bf59204fb88464e382b67c0c2e4a7a6cbce6acb8b5e84c84d83112beebc7f8f2e2df6824ca41d9dda042fb621345d2b86cbc909d89d8601fcf
@@ -320,8 +320,6 @@ h6:hover > a.anchor,
320
320
 
321
321
  svg {
322
322
  width: 100%;
323
- padding-bottom: 92%;
324
- height: 1px;
325
323
  overflow: visible;
326
324
  }
327
325
 
@@ -232,7 +232,7 @@ module Metanorma
232
232
 
233
233
  # need to validate Metanorma XML before it passes to textcleanup,
234
234
  # where passthrough wrapper and escaped tags are removed:
235
- # <passthrough format="metanorma>&lt;tag&gt</passthrough> => <tag>
235
+ # <passthrough formats="metanorma>&lt;tag&gt</passthrough> => <tag>
236
236
  # Do not treat not well-formed XML as invalid,
237
237
  # as it may be fragment, e.g. unterminated start of element markup
238
238
  def passthrough_validate(node, content, encoded_content)
@@ -29,10 +29,12 @@ module Metanorma
29
29
  def cleanup(xmldoc)
30
30
  @doctype = xmldoc.at("//bibdata/ext/doctype")&.text
31
31
  element_name_cleanup(xmldoc)
32
- passthrough_cleanup(xmldoc)
32
+ source_include_cleanup(xmldoc) # feeds: misccontainer_cleanup
33
+ passthrough_cleanup(xmldoc) # feeds: smartquotes_cleanup
33
34
  unnumbered_blocks_cleanup(xmldoc)
34
35
  termdocsource_cleanup(xmldoc) # feeds: metadata_cleanup
35
36
  metadata_cleanup(xmldoc) # feeds: boilerplate_cleanup
37
+ misccontainer_cleanup(xmldoc)
36
38
  sections_cleanup(xmldoc) # feeds: obligations_cleanup, toc_cleanup,
37
39
  # floatingtitle_cleanup
38
40
  obligations_cleanup(xmldoc)
@@ -89,10 +91,12 @@ module Metanorma
89
91
  linebreak_cleanup(xmldoc)
90
92
  variant_cleanup(xmldoc)
91
93
  para_cleanup(xmldoc)
94
+ source_id_cleanup(xmldoc)
92
95
  empty_element_cleanup(xmldoc)
93
96
  img_cleanup(xmldoc)
94
97
  anchor_cleanup(xmldoc)
95
98
  link_cleanup(xmldoc)
99
+ passthrough_metanorma_cleanup(xmldoc)
96
100
  xmldoc
97
101
  end
98
102
 
@@ -137,7 +137,6 @@ module Metanorma
137
137
 
138
138
  def contenthash_id_cleanup(doc)
139
139
  @contenthash_ids = contenthash_id_make(doc)
140
- #contenthash_id_update_idrefs(doc, @contenthash_ids)
141
140
  end
142
141
 
143
142
  def contenthash_id_make(doc)
@@ -150,14 +149,6 @@ module Metanorma
150
149
  end
151
150
  end
152
151
 
153
- def contenthash_id_update_idrefs(doc, ids)
154
- Metanorma::Utils::anchor_attributes.each do |a|
155
- doc.xpath("//#{a[0]}").each do |x|
156
- ids[x[a[1]]] and x[a[1]] = ids[x[a[1]]]
157
- end
158
- end
159
- end
160
-
161
152
  def contenthash(elem)
162
153
  Digest::MD5.hexdigest("#{elem.path}////#{elem.text}")
163
154
  .sub(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, "_\\1-\\2-\\3-\\4-\\5")
@@ -168,14 +159,17 @@ module Metanorma
168
159
  p.name = "passthrough"
169
160
  p.children = select_odd_chars(p.children.to_xml)
170
161
  end
171
- doc.xpath("//passthrough[@format = 'metanorma']").each do |p|
172
- p.replace(p.children)
173
- end
174
162
  doc.xpath("//identifier").each do |p|
175
163
  p.children = select_odd_chars(p.children.to_xml)
176
164
  end
177
165
  end
178
166
 
167
+ def passthrough_metanorma_cleanup(doc)
168
+ doc.xpath("//passthrough[@formats = 'metanorma']").each do |p|
169
+ p.replace(p.children)
170
+ end
171
+ end
172
+
179
173
  def link_cleanup(xmldoc)
180
174
  uri_cleanup(xmldoc)
181
175
  end
@@ -193,6 +187,13 @@ module Metanorma
193
187
  CGI.escape(comp).gsub("+", "%20")
194
188
  end
195
189
 
190
+ def source_id_cleanup(xmldoc)
191
+ xmldoc.xpath("//span[normalize-space(.)=''][@source]").each do |s|
192
+ s.parent["source"] = s["source"]
193
+ s.remove
194
+ end
195
+ end
196
+
196
197
  private
197
198
 
198
199
  # skip ZWNJ inserted to prevent regexes operating in asciidoctor
@@ -124,7 +124,6 @@ module Metanorma
124
124
  end
125
125
 
126
126
  def sections_cleanup(xml)
127
- misccontainer_cleanup(xml)
128
127
  sections_order_cleanup(xml)
129
128
  sections_level_cleanup(xml)
130
129
  sections_names_cleanup(xml)
@@ -133,9 +132,32 @@ module Metanorma
133
132
  end
134
133
 
135
134
  def misccontainer_cleanup(xml)
136
- m = xml.at("//misc-container-clause") or return
135
+ m = xml.xpath("//metanorma-extension-clause")
136
+ m.empty? and return
137
137
  ins = add_misc_container(xml)
138
- ins << m.remove.children
138
+ m.each do |m1|
139
+ ins << m1.remove.children
140
+ end
141
+ end
142
+
143
+ def source_include_cleanup(xml)
144
+ xml.xpath("//source-include").each do |s|
145
+ f = File.join(@localdir, s["path"])
146
+ s.remove
147
+ r = source_sanitise(File.read(f))
148
+ xml.root << <<~XML
149
+ <metanorma-extension-clause>
150
+ <clause>
151
+ <title>#{s['path']}</title>
152
+ <source>#{r} </source>
153
+ </clause>
154
+ </metanorma-extension-clause>
155
+ XML
156
+ end
157
+ end
158
+
159
+ def source_sanitise(code)
160
+ code
139
161
  end
140
162
 
141
163
  def single_clause_annex(xml)
@@ -32,19 +32,21 @@ module Metanorma
32
32
  e[:skip] and next
33
33
  lines = lines_strip_textspan(e, block[i + 1])
34
34
  out = Metanorma::Utils.line_sanitise(lines)
35
- # e[:last] or out.pop
35
+ e[:last] or out.pop
36
+ /\s$/.match?(e[:text][-1]) or out[-1].rstrip!
36
37
  e[:elem].replace(out.join)
37
38
  end
38
39
  end
39
40
 
40
- def lines_strip_textspan(span, _nextspan)
41
+ def lines_strip_textspan(span, nextspan)
41
42
  lines = span[:text].lines[0..-2].map(&:rstrip) <<
42
43
  span[:text].lines[-1]&.sub(/\n$/, "")
43
44
  # no final line rstrip: can be space linking to next line
44
- # span[:last] or lines << nextspan[:text].lines.first # next token context
45
+ span[:last] or lines << nextspan[:text].lines.first # next token context
45
46
  lines
46
47
  end
47
48
 
49
+ # TODO: we are not counting empty xref, eref here
48
50
  def gather_text_for_linebreak_cleanup(block)
49
51
  x = block.xpath(".//text()").map do |e|
50
52
  { elem: e, text: e.text, stem: ancestor_include?(e, %w(stem)),
@@ -37,9 +37,9 @@ module Metanorma
37
37
  preprocessor Metanorma::Standoc::LinkProtectPreprocessor
38
38
  preprocessor Metanorma::Standoc::Datamodel::AttributesTablePreprocessor
39
39
  preprocessor Metanorma::Standoc::Datamodel::DiagramPreprocessor
40
- preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
41
- preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
42
- preprocessor Metanorma::Plugin::Datastruct::Data2TextPreprocessor
40
+ preprocessor Metanorma::Plugin::Lutaml::Json2TextPreprocessor
41
+ preprocessor Metanorma::Plugin::Lutaml::Yaml2TextPreprocessor
42
+ preprocessor Metanorma::Plugin::Lutaml::Data2TextPreprocessor
43
43
  preprocessor Metanorma::Plugin::Glossarist::DatasetPreprocessor
44
44
  preprocessor Metanorma::Standoc::NamedEscapePreprocessor
45
45
  inline_macro Metanorma::Standoc::PreferredTermInlineMacro
@@ -74,6 +74,9 @@ module Metanorma
74
74
  inline_macro Metanorma::Standoc::NumberInlineMacro
75
75
  inline_macro Metanorma::Standoc::TrStyleInlineMacro
76
76
  inline_macro Metanorma::Standoc::TdStyleInlineMacro
77
+ inline_macro Metanorma::Standoc::AnchorInlineMacro
78
+ inline_macro Metanorma::Standoc::SourceIdInlineMacro
79
+ inline_macro Metanorma::Standoc::SourceIncludeInlineMacro
77
80
  block Metanorma::Standoc::ToDoAdmonitionBlock
78
81
  block Metanorma::Standoc::EditorAdmonitionBlock
79
82
  treeprocessor Metanorma::Standoc::EditorInlineAdmonitionBlock
@@ -103,15 +106,20 @@ module Metanorma
103
106
  $xreftext = {}
104
107
 
105
108
  def initialize(backend, opts)
109
+ doc = opts&.dig(:document)
110
+ doc&.delete_attribute("sectids") # no autoassign sect ids from title
106
111
  super
107
112
  basebackend "html"
108
113
  outfilesuffix ".xml"
109
114
  @libdir = File.dirname(self.class::_file || __FILE__)
110
115
  @c = HTMLEntities.new
111
- unless opts && @log = opts[:document]&.options&.dig(:log)
112
- @log = Metanorma::Utils::Log.new
113
- @local_log = true
114
- end
116
+ local_log(doc)
117
+ end
118
+
119
+ def local_log(doc)
120
+ @log = doc&.options&.dig(:log) and return
121
+ @log = Metanorma::Utils::Log.new
122
+ @local_log = true
115
123
  end
116
124
 
117
125
  class << self
@@ -13,6 +13,11 @@ module Metanorma
13
13
  end
14
14
  end
15
15
 
16
+ def pass(node)
17
+ require "debug"; binding.b
18
+ "<passthrough-inline formats='metanorma'>#{node.content}</passthrough-inline>"
19
+ end
20
+
16
21
  def page_break(node)
17
22
  attrs = {}
18
23
  node.option?("landscape") and attrs[:orientation] = "landscape"
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.0.5 -->
3
+ <!-- VERSION v2.0.6 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -801,6 +801,12 @@ titlecase, or lowercase</a:documentation>
801
801
  <a:documentation>User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
802
802
  </attribute>
803
803
  </optional>
804
+ <optional>
805
+ <attribute name="source">
806
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
807
+ <ref name="IdRefType"/>
808
+ </attribute>
809
+ </optional>
804
810
  </define>
805
811
  <define name="OptionalId" combine="interleave">
806
812
  <optional>
@@ -808,6 +814,12 @@ titlecase, or lowercase</a:documentation>
808
814
  <a:documentation> User-supplied anchor of element; replaced by content-based id, with all references to the anchor updated accordingly</a:documentation>
809
815
  </attribute>
810
816
  </optional>
817
+ <optional>
818
+ <attribute name="source">
819
+ <a:documentation>Sourcing of the current element in an external data model</a:documentation>
820
+ <ref name="IdRefType"/>
821
+ </attribute>
822
+ </optional>
811
823
  </define>
812
824
  <define name="ObligationType">
813
825
  <a:documentation>The force of a clause in a standard document: whether it has normative or informative effect</a:documentation>
@@ -954,6 +966,7 @@ titlecase, or lowercase</a:documentation>
954
966
  is used in particular to capture mutually agreed definitions of codepoints in Unicode Private Use Area</a:documentation>
955
967
  </attribute>
956
968
  </optional>
969
+ <ref name="OptionalId"/>
957
970
  <oneOrMore>
958
971
  <ref name="TextElement">
959
972
  <a:documentation>Textual content of span</a:documentation>
@@ -10,7 +10,6 @@ require_relative "macros_embed"
10
10
  require_relative "macros_link"
11
11
  require_relative "datamodel/attributes_table_preprocessor"
12
12
  require_relative "datamodel/diagram_preprocessor"
13
- require "metanorma-plugin-datastruct"
14
13
  require "metanorma-plugin-glossarist"
15
14
  require "metanorma-plugin-lutaml"
16
15
 
@@ -58,6 +58,30 @@ module Metanorma
58
58
  end
59
59
  end
60
60
 
61
+ class AnchorInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
62
+ use_dsl
63
+ named :anchor
64
+ parse_content_as :text
65
+
66
+ def process(parent, target, attrs)
67
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
68
+ id = "_#{UUIDTools::UUID.random_create}"
69
+ %{<span id='#{id}' anchor='#{target}'>#{out}</span>}
70
+ end
71
+ end
72
+
73
+ class SourceIdInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
74
+ use_dsl
75
+ named :"source-id"
76
+ parse_content_as :text
77
+
78
+ def process(parent, target, attrs)
79
+ out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
80
+ id = "_#{UUIDTools::UUID.random_create}"
81
+ %{<span id='#{id}' source='#{target}'>#{out}</span>}
82
+ end
83
+ end
84
+
61
85
  class VariantInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
62
86
  use_dsl
63
87
  named :lang
@@ -117,7 +141,6 @@ module Metanorma
117
141
  parse_content_as :text
118
142
 
119
143
  def process(parent, target, attrs)
120
- #require "debug"; binding.b
121
144
  format = target || "metanorma"
122
145
  out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
123
146
  .gsub(/((?![<>&])[[:punct:]])/, "\\1&#x200c;")
@@ -76,5 +76,14 @@ module Metanorma
76
76
  create_anchor(parent, "hidden=#{t}", type: :xref, target: target)
77
77
  end
78
78
  end
79
+
80
+ class SourceIncludeInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
81
+ use_dsl
82
+ named :source_include
83
+
84
+ def process(_parent, target, _attrs)
85
+ "<source-include path='#{target}'/>"
86
+ end
87
+ end
79
88
  end
80
89
  end
@@ -15,8 +15,13 @@ module Metanorma
15
15
  end
16
16
  end
17
17
 
18
- def self.run(umlfile, outfile)
19
- system "#{plantuml_bin} #{umlfile.path}" or (warn $? and return false)
18
+ def self.run(umlfile, outfile, fmt)
19
+ valid_formats = %w[png svg eps]
20
+ unless valid_formats.include?(fmt)
21
+ raise ArgumentError, "Invalid format: #{fmt}. Allowed formats are: #{valid_formats.join(', ')}"
22
+ end
23
+ system(plantuml_bin, umlfile.path, "-t#{fmt}") or
24
+ (warn $? and return false)
20
25
  i = 0
21
26
  until !Gem.win_platform? || File.exist?(outfile) || i == 15
22
27
  sleep(1)
@@ -34,16 +39,24 @@ module Metanorma
34
39
  # Windows Ruby 2.4 will crash if a Tempfile is "mv"ed.
35
40
  # This is why we need to copy and then unlink.
36
41
  def self.generate_file(parent, reader)
37
- ldir = localdir(parent)
38
- imagesdir = parent.document.attr("imagesdir")
39
- umlfile, outfile = save_plantuml parent, reader, ldir
40
- run(umlfile, outfile) or
42
+ ldir, imagesdir, fmt = generate_file_prep(parent)
43
+ umlfile, outfile = save_plantuml parent, reader, ldir, fmt
44
+ run(umlfile, outfile, fmt) or
41
45
  raise "No image output from PlantUML (#{umlfile}, #{outfile})!"
42
46
  umlfile.unlink
43
- path = path_prep(ldir, imagesdir)
47
+ absolute_path, relative_path = path_prep(ldir, imagesdir)
44
48
  filename = File.basename(outfile.to_s)
45
- FileUtils.cp(outfile, path) and outfile.unlink
46
- imagesdir ? filename : File.join(path, filename)
49
+ FileUtils.cp(outfile, absolute_path) and outfile.unlink
50
+ #imagesdir ? filename : File.join(path, filename)
51
+ File.join(relative_path, filename)
52
+ end
53
+
54
+ def self.generate_file_prep(parent)
55
+ ldir = localdir(parent)
56
+ imagesdir = parent.document.attr("imagesdir")
57
+ fmt = parent.document.attr("plantuml-image-format")&.strip&.downcase ||
58
+ "png"
59
+ [ldir, imagesdir, fmt]
47
60
  end
48
61
 
49
62
  def self.localdir(parent)
@@ -54,21 +67,22 @@ module Metanorma
54
67
  end
55
68
 
56
69
  def self.path_prep(localdir, imagesdir)
57
- path = Pathname.new(localdir) + (imagesdir || "plantuml")
70
+ #path = Pathname.new(localdir) + (imagesdir || "plantuml")
71
+ path = Pathname.new(File.join(localdir, "_plantuml_images"))
72
+ sourcepath = imagesdir ? File.join(localdir, imagesdir) : localdir
58
73
  path.mkpath
59
74
  File.writable?(path) or
60
75
  raise "Destination path #{path} not writable for PlantUML!"
61
- # File.exist?(path) or raise "Destination path #{path} already exists for PlantUML!"
62
- path
76
+ [path, Pathname.new(path).relative_path_from(Pathname.new(sourcepath)).to_s]
63
77
  end
64
78
 
65
- def self.save_plantuml(_parent, reader, _localdir)
79
+ def self.save_plantuml(_parent, reader, _localdir, fmt)
66
80
  src = prep_source(reader)
67
81
  /^@startuml (?<fn>[^\n]+)\n/ =~ src
68
82
  Tempfile.open(["plantuml", ".pml"], encoding: "utf-8") do |f|
69
83
  f.write(src)
70
84
  [f, File.join(File.dirname(f.path),
71
- "#{fn || File.basename(f.path, '.pml')}.png")]
85
+ "#{fn || File.basename(f.path, '.pml')}.#{fmt}")]
72
86
  end
73
87
  end
74
88
 
@@ -35,8 +35,8 @@ module Metanorma
35
35
  a = section_attributes(node)
36
36
  noko do |xml|
37
37
  case sectiontype(node)
38
- when "misc-container", "metanorma-extension"
39
- misccontainer_parse(a, xml, node)
38
+ when "metanorma-extension"
39
+ metanorma_extension_parse(a, xml, node)
40
40
  when "introduction" then introduction_parse(a, xml, node)
41
41
  when "foreword" then foreword_parse(a, xml, node)
42
42
  when "scope" then scope_parse(a, xml, node)
@@ -96,8 +96,8 @@ module Metanorma
96
96
  end
97
97
  end
98
98
 
99
- def misccontainer_parse(_attrs, xml, node)
100
- xml.send :"misc-container-clause" do |xml_section|
99
+ def metanorma_extension_parse(_attrs, xml, node)
100
+ xml.send :"metanorma-extension-clause" do |xml_section|
101
101
  xml_section << node.content
102
102
  end
103
103
  end
@@ -14,7 +14,9 @@ module Metanorma
14
14
  def sectiontype(node, level = true)
15
15
  ret = sectiontype1(node)
16
16
  ret1 = preface_main_filter(sectiontype_streamline(ret), node)
17
- ret1 == "symbols and abbreviated terms" and return ret1
17
+ # permit multiple instances
18
+ ["symbols and abbreviated terms",
19
+ "metanorma-extension"].include?(ret1) and return ret1
18
20
  !level || node.level == 1 || node.attr("heading") or return nil
19
21
  !node.attr("heading") && @seen_headers.include?(ret) and return nil
20
22
  @seen_headers << ret unless ret1.nil?
@@ -22,31 +24,37 @@ module Metanorma
22
24
  ret1
23
25
  end
24
26
 
27
+ SECTIONTYPE_STREAMLINE =
28
+ { "terms and definitions":
29
+ ["terms, definitions, symbols and abbreviated terms",
30
+ "terms, definitions, symbols and abbreviations",
31
+ "terms, definitions and symbols",
32
+ "terms, definitions and abbreviations",
33
+ "terms, definitions and abbreviated terms",
34
+ "terms and definitions"],
35
+ "symbols and abbreviated terms":
36
+ ["symbols and abbreviated terms",
37
+ "symbols", "abbreviated terms", "abbreviations",
38
+ "symbols and abbreviations",
39
+ "symbols and abbreviated terms"],
40
+ "acknowledgements":
41
+ ["acknowledgements", "acknowledgments"],
42
+ "executivesummary":
43
+ ["executive summary", "executive-summary",
44
+ "executive_summary"],
45
+ "metanorma-extension":
46
+ ["misc-container", "metanorma-extension"] }.freeze
47
+
25
48
  def sectiontype_streamline(ret)
26
- case ret
27
- when "terms and definitions",
28
- "terms, definitions, symbols and abbreviated terms",
29
- "terms, definitions, symbols and abbreviations",
30
- "terms, definitions and symbols",
31
- "terms, definitions and abbreviations",
32
- "terms, definitions and abbreviated terms"
33
- "terms and definitions"
34
- when "symbols and abbreviated terms",
35
- "symbols", "abbreviated terms", "abbreviations",
36
- "symbols and abbreviations"
37
- "symbols and abbreviated terms"
38
- when "acknowledgements", "acknowledgments"
39
- "acknowledgements"
40
- when "executive summary", "executive-summary", "executive_summary"
41
- "executivesummary"
42
- else
43
- ret
49
+ SECTIONTYPE_STREAMLINE.each do |k, v|
50
+ v.include?(ret) and return k.to_s
44
51
  end
52
+ ret
45
53
  end
46
54
 
47
55
  PREFACE_CLAUSE_NAMES =
48
56
  %w(abstract foreword introduction metanorma-extension termdocsource
49
- misc-container metanorma-extension acknowledgements executivesummary)
57
+ metanorma-extension acknowledgements executivesummary)
50
58
  .freeze
51
59
 
52
60
  MAIN_CLAUSE_NAMES =
@@ -16,13 +16,11 @@ module Metanorma
16
16
  @unique_designs = {}
17
17
  @c = HTMLEntities.new
18
18
  @terms_tags = xmldoc.xpath("//terms").each_with_object({}) do |t, m|
19
- #m[t["id"]] = true
20
19
  m[t["anchor"]] = true
21
20
  end
22
21
  end
23
22
 
24
23
  def call
25
- #require "debug"; binding.b
26
24
  @idhash = populate_idhash
27
25
  @unique_designs = unique_designators
28
26
  @lookup = replace_automatic_generated_ids_terms
@@ -72,11 +70,8 @@ module Metanorma
72
70
  end
73
71
 
74
72
  def populate_idhash
75
- #xmldoc.xpath("//*[@id]").each_with_object({}) do |n, mem|
76
73
  xmldoc.xpath("//*[@anchor]").each_with_object({}) do |n, mem|
77
- #/^(term|symbol)-/.match?(n["id"]) or next
78
74
  /^(term|symbol)-/.match?(n["anchor"]) or next
79
- #mem[n["id"]] = true
80
75
  mem[n["anchor"]] = true
81
76
  end
82
77
  end
@@ -213,21 +208,17 @@ module Metanorma
213
208
 
214
209
  def norm_id_memorize_init(node, res_table, selector, prefix, use_domain)
215
210
  term_text = norm_ref_id(node, selector, use_domain) or return
216
- #unless AUTO_GEN_ID_REGEXP.match(node["id"]).nil? && !node["id"].nil?
217
211
  unless AUTO_GEN_ID_REGEXP.match(node["anchor"]).nil? && !node["anchor"].nil?
218
212
  id = unique_text_id(term_text, prefix)
219
- #node["id"] = id
220
213
  node["anchor"] = id
221
214
  @idhash[id] = true
222
215
  end
223
- #res_table[term_text] = node["id"]
224
216
  res_table[term_text] = node["anchor"]
225
217
  end
226
218
 
227
219
  def memorize_other_pref_terms(node, res_table, text_selector, use_domain)
228
220
  node.xpath(text_selector).each_with_index do |p, i|
229
221
  i.positive? or next
230
- #res_table[norm_ref_id1(p, use_domain ? node : nil)] = node["id"]
231
222
  res_table[norm_ref_id1(p, use_domain ? node : nil)] = node["anchor"]
232
223
  end
233
224
  end
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.0.8".freeze
22
+ VERSION = "3.0.9".freeze
23
23
  end
24
24
  end
@@ -34,9 +34,8 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "iev", "~> 0.3.5"
35
35
  spec.add_dependency "isodoc", "~> 3.1.4"
36
36
  spec.add_dependency "metanorma", ">= 1.6.0"
37
- spec.add_dependency "metanorma-plugin-datastruct", "~> 0.3.0"
38
37
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.2.3"
39
- spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.0"
38
+ spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.31"
40
39
  spec.add_dependency "metanorma-utils", "~> 1.11.0"
41
40
  spec.add_dependency "ruby-jing"
42
41
  # relaton-cli not just relaton, to avoid circular reference in metanorma
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.0.8
4
+ version: 3.0.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-05-12 00:00:00.000000000 Z
11
+ date: 2025-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.6.0
97
- - !ruby/object:Gem::Dependency
98
- name: metanorma-plugin-datastruct
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 0.3.0
104
- type: :runtime
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 0.3.0
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: metanorma-plugin-glossarist
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +114,14 @@ dependencies:
128
114
  requirements:
129
115
  - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: 0.7.0
117
+ version: 0.7.31
132
118
  type: :runtime
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: 0.7.0
124
+ version: 0.7.31
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: metanorma-utils
141
127
  requirement: !ruby/object:Gem::Requirement