metanorma-standoc 3.3.1 → 3.3.2

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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/html/htmlstyle.css +5 -0
  3. data/lib/isodoc/{pdf_convert.rb → standoc/pdf_convert.rb} +1 -1
  4. data/lib/metanorma/cleanup/amend.rb +1 -1
  5. data/lib/metanorma/cleanup/image.rb +70 -13
  6. data/lib/metanorma/cleanup/text.rb +32 -17
  7. data/lib/metanorma/converter/blocks.rb +4 -2
  8. data/lib/metanorma/converter/blocks_image.rb +12 -0
  9. data/lib/metanorma/converter/{blocks_notes_examples.rb → blocks_notes.rb} +0 -60
  10. data/lib/metanorma/converter/init.rb +2 -1
  11. data/lib/metanorma/converter/inline.rb +15 -11
  12. data/lib/metanorma/converter/section.rb +1 -0
  13. data/lib/metanorma/converter/version.rb +1 -1
  14. data/lib/metanorma/validate/biblio.rng +4 -4
  15. data/lib/metanorma/validate/image.rb +3 -3
  16. data/lib/metanorma/validate/isodoc.rng +77 -28
  17. data/lib/metanorma/validate/validate.rb +1 -1
  18. data/lib/metanorma-standoc.rb +1 -1
  19. metadata +4 -49
  20. data/lib/asciidoctor/standoc/base.rb +0 -2
  21. data/lib/asciidoctor/standoc/blocks.rb +0 -2
  22. data/lib/asciidoctor/standoc/blocks_notes.rb +0 -2
  23. data/lib/asciidoctor/standoc/cleanup.rb +0 -2
  24. data/lib/asciidoctor/standoc/cleanup_amend.rb +0 -2
  25. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -2
  26. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +0 -2
  27. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -2
  28. data/lib/asciidoctor/standoc/cleanup_image.rb +0 -2
  29. data/lib/asciidoctor/standoc/cleanup_inline.rb +0 -2
  30. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -2
  31. data/lib/asciidoctor/standoc/cleanup_ref.rb +0 -2
  32. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +0 -2
  33. data/lib/asciidoctor/standoc/cleanup_reqt.rb +0 -2
  34. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -2
  35. data/lib/asciidoctor/standoc/cleanup_section_names.rb +0 -2
  36. data/lib/asciidoctor/standoc/cleanup_symbols.rb +0 -2
  37. data/lib/asciidoctor/standoc/cleanup_table.rb +0 -2
  38. data/lib/asciidoctor/standoc/cleanup_terms.rb +0 -2
  39. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +0 -2
  40. data/lib/asciidoctor/standoc/cleanup_text.rb +0 -2
  41. data/lib/asciidoctor/standoc/cleanup_toc.rb +0 -2
  42. data/lib/asciidoctor/standoc/cleanup_xref.rb +0 -2
  43. data/lib/asciidoctor/standoc/converter.rb +0 -2
  44. data/lib/asciidoctor/standoc/deprecated.rb +0 -7
  45. data/lib/asciidoctor/standoc/front.rb +0 -2
  46. data/lib/asciidoctor/standoc/front_contributor.rb +0 -2
  47. data/lib/asciidoctor/standoc/inline.rb +0 -2
  48. data/lib/asciidoctor/standoc/lists.rb +0 -2
  49. data/lib/asciidoctor/standoc/macros.rb +0 -2
  50. data/lib/asciidoctor/standoc/macros_form.rb +0 -2
  51. data/lib/asciidoctor/standoc/macros_note.rb +0 -2
  52. data/lib/asciidoctor/standoc/macros_terms.rb +0 -2
  53. data/lib/asciidoctor/standoc/ref.rb +0 -2
  54. data/lib/asciidoctor/standoc/ref_sect.rb +0 -2
  55. data/lib/asciidoctor/standoc/ref_utility.rb +0 -2
  56. data/lib/asciidoctor/standoc/render.rb +0 -2
  57. data/lib/asciidoctor/standoc/reqt.rb +0 -2
  58. data/lib/asciidoctor/standoc/section.rb +0 -2
  59. data/lib/asciidoctor/standoc/table.rb +0 -2
  60. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +0 -2
  61. data/lib/asciidoctor/standoc/terms.rb +0 -2
  62. data/lib/asciidoctor/standoc/utils.rb +0 -2
  63. data/lib/asciidoctor/standoc/validate.rb +0 -2
  64. data/lib/asciidoctor/standoc/validate_section.rb +0 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ebe9c752511841d783fa0d9820ee7bd26448703e6990bbd406ae0d92ab35417
4
- data.tar.gz: b6e82ef1d270969216902f745314145917cbdc376fe92fe11b76964cdd8bb6f1
3
+ metadata.gz: a7f6a1a5d54bb2ad0e64f98ebe39c519bea34a6252781a294bacae9342072c13
4
+ data.tar.gz: a3f32b49f251c6555799c53dcc1d00b08edaf5500a267bd9e459faff33d364c0
5
5
  SHA512:
6
- metadata.gz: 7b35e03b90cf332d1c100003d1e5bd72a524ffb085eb3b85428ebaac975f51d69562404e31f761894b22d51a9245be804f27a6e230299ed904ab497ebfc1d3c5
7
- data.tar.gz: 29a42e39bbc67f18b07d557f32da4dbd3a6747f913108b4cfa2a74f610484cfd114d127e78fe8b21e4bf45ef255de955947967402f78d4f4cf3bfb07b77a6694
6
+ metadata.gz: 58d985cce5eb147eb952d9494e1a64207d95a35f054f9aec84378562bb6bdedfd0073306df23ee9214631c6ba73201cd4e98a3abcea8fd56d968235724885202
7
+ data.tar.gz: 87a87b2e41d1e763c8bdff7254a64d6c2bd7710b33c6f81909313bd889feba22c932ddc70c725fa0bc40434a404872ffdc80884c1cd9d6f16da4f42828c2fd39
@@ -319,6 +319,11 @@ svg {
319
319
  display: block; /* ← removes unwanted inline spacing */
320
320
  }
321
321
 
322
+ /* style dfn by override in flavor */
323
+ dfn {
324
+ font-style: inherit;
325
+ }
326
+
322
327
  #standard-band {
323
328
  background-color: #0AC442;
324
329
  }
@@ -7,7 +7,7 @@ module IsoDoc
7
7
  #
8
8
  class PdfConvert < IsoDoc::XslfoPdfConvert
9
9
  def initialize(options)
10
- @libdir = File.dirname(__FILE__)
10
+ @libdir = File.dirname(__FILE__, 2)
11
11
  super
12
12
  end
13
13
 
@@ -58,7 +58,7 @@ module Metanorma
58
58
  end
59
59
 
60
60
  def move_attrs_to_amend(clause, amend)
61
- %w(change path path_end title).each do |e|
61
+ %w(change path path_end title position).each do |e|
62
62
  clause[e] or next
63
63
  amend[e] = clause[e]
64
64
  clause.delete(e)
@@ -55,38 +55,95 @@ module Metanorma
55
55
  end
56
56
 
57
57
  def img_cleanup(xmldoc)
58
- if @datauriimage
59
- xmldoc.xpath("//image").each do |i|
60
- # do not datauri encode SVG, we need to deduplicate its IDs
61
- unless read_in_if_svg(i, @localdir)
62
- i["src"] = Vectory::Utils::datauri(i["src"], @localdir)
63
- end
64
- end
65
- end
58
+ altmedia_cleanup(xmldoc)
59
+ @datauriimage and datauri_image(xmldoc)
66
60
  svg_cleanup(xmldoc)
67
61
  xmldoc
68
62
  end
69
63
 
64
+ def datauri_image(xmldoc)
65
+ xmldoc.xpath("//image | //altsource").each do |i|
66
+ # do not datauri encode SVG, we need to deduplicate its IDs
67
+ unless read_in_if_svg?(i, @localdir)
68
+ i["src"] &&= Vectory::Utils::datauri(i["src"], @localdir)
69
+ end
70
+ end
71
+ end
72
+
73
+ def altmedia_cleanup(xmldoc)
74
+ xmldoc.xpath("//image[@altmedia]").each do |i|
75
+ altmedia_root_cleanup(i)
76
+ d = altmedia_prep(i)
77
+ d or next
78
+ altsource_populate(i, d)
79
+ end
80
+ end
81
+
82
+ def altsource_populate(img, dlist)
83
+ dlist.each do |e|
84
+ e[:dd].nil? and next
85
+ img << "<altsource tag='#{e[:dt]}'/>"
86
+ image_attr_copy(e[:dd], img.elements.last)
87
+ altsource_attr_copy(e[:dd], img.elements.last, img)
88
+ end
89
+ end
90
+
91
+ def image_attr_copy(src, dest)
92
+ %w(src mimetype filename alt).each do |k|
93
+ src[k] and dest[k] = src[k]
94
+ end
95
+ end
96
+
97
+ def altsource_attr_copy(src, dest, img)
98
+ %w(media).each do |k|
99
+ src[k] and dest[k] = src[k]
100
+ end
101
+ %w(height width).each do |k|
102
+ dest[k] = img[k]
103
+ src[k] or next
104
+ src[k] == "auto" and next
105
+ dest[k] = src[k]
106
+ end
107
+ end
108
+
109
+ def altmedia_root_cleanup(img)
110
+ %w(altmedia src filename mimetype).each do |k|
111
+ img.delete(k)
112
+ end
113
+ end
114
+
115
+ def altmedia_prep(img)
116
+ dl = img.at("./dl") or return
117
+ d = extract_symbols_list(dl.remove).map do |e|
118
+ { dt: e[:dt].text, dd: e[:dd].at(".//image") }
119
+ end
120
+ unless d.detect { |e| e[:dt] == "default" }
121
+ d << d.first.dup
122
+ d[-1][:dt] = "default"
123
+ end
124
+ d
125
+ end
126
+
70
127
  def svg_cleanup(xmldoc)
71
128
  svg_uniqueids(xmldoc)
72
129
  svg_classupdate(xmldoc)
73
130
  end
74
131
 
75
- def read_in_if_svg(img, localdir)
132
+ def read_in_if_svg?(img, localdir)
76
133
  img["src"] or return false
77
134
  path = Vectory::Utils.svgmap_rewrite0_path(img["src"], localdir)
78
135
  File.file?(path) or return false
79
136
  types = MIME::Types.type_for(path) or return false
80
137
  types.first == "image/svg+xml" or return false
81
138
  svg = File.read(path, encoding: "utf-8") or return false
82
- img.children = (Nokogiri::XML(svg).root)
139
+ img.add_first_child Nokogiri::XML(svg).root
83
140
  true
84
141
  end
85
142
 
86
143
  def svg_classupdate(xmldoc)
87
144
  xmldoc.xpath("//m:svg[m:style]", "m" => SVG_NS)
88
145
  .each_with_index do |s, i|
89
- svg_classupdate1(s, s.at("./m:style", "m" => SVG_NS), i)
146
+ svg_classupdate1(s, s.at("./m:style", "m" => SVG_NS), i)
90
147
  end
91
148
  end
92
149
 
@@ -101,7 +158,7 @@ module Metanorma
101
158
  end
102
159
 
103
160
  def svg_suffix_css_style(node, idx)
104
- node[:node] == :style_rule && /\./.match?(node[:selector][:value]) or
161
+ (node[:node] == :style_rule && /\./.match?(node[:selector][:value])) or
105
162
  return
106
163
  v = node[:selector][:value]
107
164
  .gsub(/([^.\s]*\.\S+)/, "\\1_inject_#{idx}")
@@ -149,7 +206,7 @@ module Metanorma
149
206
  svg_uniqueids2(svg, iri_properties, idx, ids)
150
207
  new_ids = id_elems.map { |x| x["id"] }
151
208
  .map { |x| x + (ids[x] ? "_inject_#{idx}" : "") }
152
- ids.merge(new_ids.each.map { |value| [value, true] }.to_h)
209
+ ids.merge(new_ids.each.to_h { |value| [value, true] })
153
210
  end
154
211
 
155
212
  def svg_uniqueids2(svg, iri_properties, idx, ids)
@@ -3,7 +3,7 @@ module Metanorma
3
3
  module Text
4
4
  def ancestor_include?(elem, ancestors)
5
5
  path = elem.path.gsub(/\[\d+\]/, "").split(%r{/})[1..-2]
6
- !path.intersection(ancestors).empty?
6
+ path.intersect?(ancestors)
7
7
  end
8
8
 
9
9
  # process example/p, example/sourcecode, not example on its own:
@@ -30,29 +30,41 @@ module Metanorma
30
30
  end
31
31
 
32
32
  def lines_strip_textspan(span, nextspan)
33
- lines = span[:text].lines[0..-2].map(&:rstrip) <<
34
- span[:text].lines[-1]&.sub(/\n$/, "")
33
+ #AAA
34
+ lines = []
35
+ span[:text] and
36
+ lines = span[:text].lines[0..-2].map(&:rstrip) <<
37
+ span[:text].lines[-1]&.sub(/\n$/, "")
38
+ #lines = span[:text].lines[0..-2].map(&:rstrip) <<
39
+ #span[:text].lines[-1]&.sub(/\n$/, "")
35
40
  # no final line rstrip: can be space linking to next line
36
41
  span[:last] or lines << nextspan[:text].lines.first # next token context
37
42
  lines
38
43
  end
39
44
 
40
- # TODO: we are not counting empty xref, eref here
41
45
  def gather_text_for_linebreak_cleanup(block)
42
- x = block.xpath(".//text()").map do |e|
43
- { elem: e, text: e.text, stem: ancestor_include?(e, %w(stem)),
44
- skip: ancestor_include?(e, PRESERVE_LINEBREAK_ELEMENTS) }
45
- end
46
+ x = gather_text_for_linebreak_cleanup1(block)
46
47
  x.empty? and return x
47
- x.each { |e| e[:skip] ||= !e[:text].include?("\n") }
48
48
  x.each_with_index do |e, i|
49
+ e[:skip] ||= !e[:text].include?("\n")
49
50
  # do not treat stem linebreaks as meaningful
50
51
  e[:skip] ||= x[i + 1]&.dig(:stem)
52
+ e[:skip] ||= !e[:elem].text?
51
53
  end
52
54
  x[-1][:last] = true
53
55
  x
54
56
  end
55
57
 
58
+ def gather_text_for_linebreak_cleanup1(block)
59
+ block.xpath(".//text() | .//eref[not(text())] | " \
60
+ ".//xref[not(text())] | .//termref[not(text())] | " \
61
+ ".//link[not(text())] ").map do |e|
62
+ #x = block.xpath(".//text()").map do |e|
63
+ { elem: e, text: e.text, stem: ancestor_include?(e, %w(stem)),
64
+ skip: ancestor_include?(e, PRESERVE_LINEBREAK_ELEMENTS) }
65
+ end
66
+ end
67
+
56
68
  def smartquotes_cleanup(xmldoc)
57
69
  xmldoc.xpath("//date").each { |d| Metanorma::Utils::endash_date(d) }
58
70
  if @smartquotes then smartquotes_cleanup1(xmldoc)
@@ -79,14 +91,16 @@ module Metanorma
79
91
  end
80
92
  end
81
93
 
82
- # "abc<tag/>", def => "abc",<tag/> def
83
- # TODO?
84
- def uninterrupt_quotes_around_xml1(xmldoc)
85
- xmldoc.xpath("//text()[preceding-sibling::*[1]]").each do |n|
86
- uninterrupt_quotes_around_xml_skip(n) and next
87
- uninterrupt_quotes_around_xml1(n.previous)
88
- end
89
- end
94
+ #AAA
95
+ # "abc<tag/>", def => "abc",<tag/> def
96
+ # TODO?
97
+ #def uninterrupt_quotes_around_xml1(xmldoc)
98
+ #xmldoc.xpath("//text()[preceding-sibling::*[1]]").each do |n|
99
+ #uninterrupt_quotes_around_xml_skip(n) and next
100
+ #uninterrupt_quotes_around_xml1(n.previous)
101
+ #end
102
+ #end
103
+
90
104
 
91
105
  IGNORE_QUOTES_ELEMENTS =
92
106
  %w(pre tt sourcecode stem asciimath figure bibdata passthrough
@@ -111,6 +125,7 @@ module Metanorma
111
125
  ignoretext?(elem.previous)))
112
126
  end
113
127
 
128
+ # "abc<tag/>", def => "abc",<tag/> def
114
129
  def uninterrupt_quotes_around_xml1(elem)
115
130
  prev = elem.at(".//preceding::text()[1]") or return
116
131
  /\S\Z/.match?(prev.text) or return
@@ -1,6 +1,7 @@
1
1
  require "uri"
2
- require_relative "./blocks_notes_examples"
3
- require_relative "./blocks_image"
2
+ require_relative "blocks_notes"
3
+ require_relative "blocks_examples"
4
+ require_relative "blocks_image"
4
5
 
5
6
  module Metanorma
6
7
  module Standoc
@@ -42,6 +43,7 @@ module Metanorma
42
43
  role == "definition" and return termdefinition(node)
43
44
  role == "boilerplate" and return boilerplate_note(node)
44
45
  role == "key" and return key_block(node)
46
+ role == "altmedia" and return altmedia_block(node)
45
47
  open1(node)
46
48
  end
47
49
 
@@ -28,6 +28,7 @@ module Metanorma
28
28
  def figure_attrs(node)
29
29
  attr_code(id_unnum_attrs(node).merge(keep_attrs(node))
30
30
  .merge(class: node.attr("class"),
31
+ height: node.attr("height"),
31
32
  width: node.attr("width")))
32
33
  end
33
34
 
@@ -39,6 +40,17 @@ module Metanorma
39
40
  end
40
41
  end
41
42
  end
43
+
44
+ def altmedia_block(node)
45
+ noko do |xml|
46
+ xml.figure **figure_attrs(node) do |f|
47
+ block_title(node, f)
48
+ f.image **image_attributes(node, src: false, altmedia: true) do |i|
49
+ i << node.content
50
+ end
51
+ end
52
+ end
53
+ end
42
54
  end
43
55
  end
44
56
  end
@@ -120,66 +120,6 @@ module Metanorma
120
120
  node.attr("name") == "todo" and return todo(node)
121
121
  nil
122
122
  end
123
-
124
- def term_example(node)
125
- noko do |xml|
126
- xml.termexample **attr_code(id_attr(node)
127
- .merge(keepasterm: node.option?("termexample") || nil)) do |ex|
128
- wrap_in_para(node, ex)
129
- end
130
- end
131
- end
132
-
133
- def example(node)
134
- role = node.role || node.attr("style")
135
- ret = example_to_requirement(node, role) ||
136
- example_by_role(node, role) and return ret
137
- (in_terms? || node.option?("termexample")) and return term_example(node)
138
- reqt_subpart?(role) and return requirement_subpart(node)
139
- example_proper(node)
140
- end
141
-
142
- def example_by_role(node, role)
143
- case role
144
- when "pseudocode" then pseudocode_example(node)
145
- when "svgmap" then svgmap_example(node)
146
- when "form" then form(node)
147
- when "definition" then termdefinition(node)
148
- when "figure" then figure_example(node)
149
- end
150
- end
151
-
152
- def example_to_requirement(node, role)
153
- @reqt_models.requirement_roles.key?(role&.to_sym) or return
154
- # need to call here for proper recursion ordering
155
- select_requirement_model(node)
156
- requirement(node,
157
- @reqt_models.requirement_roles[role.to_sym], role)
158
- end
159
-
160
- # prevent A's and other subs inappropriate for pseudocode
161
- def pseudocode_example(node)
162
- node.blocks.each { |b| b.remove_sub(:replacements) }
163
- noko do |xml|
164
- xml.figure **example_attrs(node).merge(class: "pseudocode") do |ex|
165
- block_title(node, ex)
166
- wrap_in_para(node, ex)
167
- end
168
- end
169
- end
170
-
171
- def example_attrs(node)
172
- attr_code(id_unnum_attrs(node).merge(keep_attrs(node)))
173
- end
174
-
175
- def example_proper(node)
176
- noko do |xml|
177
- xml.example **example_attrs(node) do |ex|
178
- block_title(node, xml)
179
- wrap_in_para(node, ex)
180
- end
181
- end
182
- end
183
123
  end
184
124
  end
185
125
  end
@@ -196,7 +196,8 @@ module Metanorma
196
196
  def biblio_cutoff(node)
197
197
  dates = %w(revdate published-date accessed-date created-date
198
198
  implemented-date confirmed-date updated-date issued-date
199
- circulated-date unchanged-date).each_with_object([]) do |k, m|
199
+ circulated-date unchanged-date copyright-year)
200
+ .each_with_object([]) do |k, m|
200
201
  date = node.attr(k) or next
201
202
  m << date
202
203
  end
@@ -44,13 +44,13 @@ module Metanorma
44
44
  attrs, text = stem_attrs(node, text)
45
45
  if /&lt;([^:>&]+:)?math(\s+[^>&]+)?&gt; |
46
46
  <([^:>&]+:)?math(\s+[^>&]+)?>/x.match? text
47
- xml.stem **attrs.merge(type: "MathML") do |s|
47
+ xml.stem **attrs, type: "MathML" do |s|
48
48
  s << xml_encode(text)
49
49
  end
50
50
  elsif style == :latexmath then latex_parse(text, xml, attrs)
51
51
  else
52
52
  xml.stem text&.gsub("&amp;#", "&#") || "",
53
- **attrs.merge(type: "AsciiMath")
53
+ **attrs, type: "AsciiMath"
54
54
  end
55
55
  end
56
56
 
@@ -69,8 +69,8 @@ module Metanorma
69
69
 
70
70
  def latex_parse(text, xml, attr)
71
71
  latex = latex_parse1(text, attr[:block]) or
72
- return xml.stem **attr.merge(type: "MathML")
73
- xml.stem **attr.merge(type: "MathML") do |s|
72
+ return xml.stem **attr, type: "MathML"
73
+ xml.stem **attr, type: "MathML" do |s|
74
74
  math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
75
75
  .elements[0]
76
76
  math.delete("alttext")
@@ -138,12 +138,14 @@ module Metanorma
138
138
  types.first.to_s
139
139
  end
140
140
 
141
- def image_attributes(node)
142
- sourceuri = image_src_uri(node)
143
- uri = sourceuri
144
- type = image_mimetype(uri)
145
- uri = uri.sub(%r{^data:image/\*;}, "data:#{type};")
146
- image_attributes1(node, uri, sourceuri, type)
141
+ def image_attributes(node, src: true, altmedia: nil)
142
+ if src
143
+ sourceuri = image_src_uri(node)
144
+ uri = sourceuri
145
+ type = image_mimetype(uri)
146
+ uri = uri.sub(%r{^data:image/\*;}, "data:#{type};")
147
+ end
148
+ image_attributes1(node, uri, sourceuri, type, altmedia)
147
149
  end
148
150
 
149
151
  def image_src_uri(node)
@@ -158,7 +160,7 @@ module Metanorma
158
160
  uri
159
161
  end
160
162
 
161
- def image_attributes1(node, uri, sourceuri, type)
163
+ def image_attributes1(node, uri, sourceuri, type, altmedia)
162
164
  /^data:/.match?(sourceuri) and sourceuri = nil
163
165
  attr_code(id_attr(node)
164
166
  .merge(src: uri, mimetype: type,
@@ -166,6 +168,8 @@ module Metanorma
166
168
  width: node.attr("width") || "auto",
167
169
  filename: node.attr("filename") || sourceuri,
168
170
  title: node.attr("titleattr"),
171
+ media: node.attr("media"),
172
+ altmedia: altmedia,
169
173
  alt: node.alt == node.attr("default-alt") ? nil : node.alt))
170
174
  end
171
175
 
@@ -28,6 +28,7 @@ module Metanorma
28
28
  ret.merge(change: node.attributes["change"],
29
29
  path: node.attributes["path"],
30
30
  path_end: node.attributes["path_end"],
31
+ position: node.attributes["position"],
31
32
  title: node.attributes["title"])
32
33
  end
33
34
 
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "3.3.1".freeze
22
+ VERSION = "3.3.2".freeze
23
23
  end
24
24
  end
@@ -1939,10 +1939,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1939
1939
  <value>hasAnnotation</value>
1940
1940
  <value>draftOf</value>
1941
1941
  <value>hasDraft</value>
1942
- <value>preliminaryDraftOf</value>
1943
- <value>hasPreliminaryDraft</value>
1944
- <value>revisionDraftOf</value>
1945
- <value>hasRevisionDraft</value>
1942
+ <value>predecessorDraftOf</value>
1943
+ <value>hasPredecessorDraft</value>
1944
+ <value>successorDraftOf</value>
1945
+ <value>hasSuccessorDraft</value>
1946
1946
  <value>editionOf</value>
1947
1947
  <value>hasEdition</value>
1948
1948
  <value>updates</value>
@@ -15,7 +15,7 @@ module Metanorma
15
15
  end
16
16
 
17
17
  def image_exists(doc)
18
- doc.xpath("//image").each do |i|
18
+ doc.xpath("//image[@src] | //altmedia[@src]").each do |i|
19
19
  Vectory::Utils::url?(i["src"]) and next
20
20
  Vectory::Utils::datauri?(i["src"]) and next
21
21
  expand_path(i["src"]) and next
@@ -31,7 +31,7 @@ module Metanorma
31
31
  end
32
32
 
33
33
  def png_validate(doc)
34
- doc.xpath("//image[@mimetype = 'image/png']").each do |i|
34
+ doc.xpath("//image[@mimetype = 'image/png'][@src]").each do |i|
35
35
  Vectory::Utils::url?(i["src"]) and next
36
36
  uri = Vectory::Utils::datauri?(i["src"])
37
37
  path = uri ? save_dataimage(i["src"]) : expand_path(i["src"])
@@ -55,7 +55,7 @@ module Metanorma
55
55
 
56
56
  def image_toobig(doc)
57
57
  @dataurimaxsize.zero? and return
58
- doc.xpath("//image").each do |i|
58
+ doc.xpath("//image[@src]").each do |i|
59
59
  i["src"].size > @dataurimaxsize and
60
60
  @log.add("STANDOC_46", i.parent)
61
61
  end
@@ -641,8 +641,85 @@ This is done if the footnote reference is already presented in some other form,
641
641
  </ref>
642
642
  </zeroOrMore>
643
643
  </define>
644
+ <define name="altsource">
645
+ <a:documentation>Alternative file to use as media</a:documentation>
646
+ <element name="altsource">
647
+ <ref name="MediaAttributes"/>
648
+ <optional>
649
+ <attribute name="tag">
650
+ <a:documentation>Comma-delimited tag to indicate when the alternate file is to be used,
651
+ at minimum allows contain `html`, `doc`, `pdf` as the main target formats of Metanorma,
652
+ and `default` for the fallback. The presence of an altsource tagged `default` is required</a:documentation>
653
+ </attribute>
654
+ </optional>
655
+ <optional>
656
+ <attribute name="media">
657
+ <a:documentation>CSS media query to indicate when the alternate file is to be used</a:documentation>
658
+ </attribute>
659
+ </optional>
660
+ </element>
661
+ </define>
662
+ <define name="image">
663
+ <a:documentation>Container for image content</a:documentation>
664
+ <choice>
665
+ <element name="image">
666
+ <ref name="RequiredId"/>
667
+ <ref name="ImageAttributes">
668
+ <a:documentation>When specified along with altsource, ImageAttributes give the default image to be rendered</a:documentation>
669
+ </ref>
670
+ <ref name="ImageBody"/>
671
+ </element>
672
+ <element name="svg">
673
+ <a:documentation>Add svg mark up to image</a:documentation>
674
+ <oneOrMore>
675
+ <choice>
676
+ <text/>
677
+ <ref name="AnyElement"/>
678
+ </choice>
679
+ </oneOrMore>
680
+ </element>
681
+ </choice>
682
+ </define>
683
+ <define name="ImageAttributes">
684
+ <optional>
685
+ <ref name="MediaAttributes">
686
+ <a:documentation>If the image contains altsource, the media attributes are given on each of the altsource elements instead of the root node</a:documentation>
687
+ </ref>
688
+ </optional>
689
+ <ref name="MediaAccessibilityAttributes"/>
690
+ <optional>
691
+ <attribute name="width">
692
+ <a:documentation>Height of image</a:documentation>
693
+ <ref name="ImageSize"/>
694
+ </attribute>
695
+ </optional>
696
+ <optional>
697
+ <attribute name="height">
698
+ <a:documentation>Width of image</a:documentation>
699
+ <ref name="ImageSize"/>
700
+ </attribute>
701
+ </optional>
702
+ </define>
644
703
  </include>
645
704
  <!-- end overrides -->
705
+ <define name="ImageBody">
706
+ <optional>
707
+ <element name="svg">
708
+ <a:documentation>image can contain SVG XML, which is used to access its identifiers within the Metanorma XML</a:documentation>
709
+ <oneOrMore>
710
+ <choice>
711
+ <text/>
712
+ <ref name="AnyElement"/>
713
+ </choice>
714
+ </oneOrMore>
715
+ </element>
716
+ </optional>
717
+ <zeroOrMore>
718
+ <ref name="altsource">
719
+ <a:documentation>Alternative files to use as media</a:documentation>
720
+ </ref>
721
+ </zeroOrMore>
722
+ </define>
646
723
  <define name="key">
647
724
  <a:documentation>Key to a table, figure, or formula</a:documentation>
648
725
  <element name="key">
@@ -930,34 +1007,6 @@ titlecase, or lowercase</a:documentation>
930
1007
  <ref name="ReducedBibliographicItem"/>
931
1008
  </element>
932
1009
  </define>
933
- <define name="image" combine="choice">
934
- <choice>
935
- <element name="image">
936
- <ref name="RequiredId"/>
937
- <ref name="ImageAttributes"/>
938
- <optional>
939
- <element name="svg">
940
- <a:documentation>Allow svg in image/svg, for consistency</a:documentation>
941
- <oneOrMore>
942
- <choice>
943
- <text/>
944
- <ref name="AnyElement"/>
945
- </choice>
946
- </oneOrMore>
947
- </element>
948
- </optional>
949
- </element>
950
- <element name="svg">
951
- <a:documentation>Add svg mark up to image</a:documentation>
952
- <oneOrMore>
953
- <choice>
954
- <text/>
955
- <ref name="AnyElement"/>
956
- </choice>
957
- </oneOrMore>
958
- </element>
959
- </choice>
960
- </define>
961
1010
  <define name="ParagraphFnBody" combine="interleave">
962
1011
  <ref name="BlockSource">
963
1012
  <a:documentation>Bibliographic source for the information in the paragraph
@@ -1,4 +1,4 @@
1
- require "metanorma/converter/utils"
1
+ require_relative "../converter/utils"
2
2
  require_relative "image"
3
3
  require_relative "section"
4
4
  require_relative "table"
@@ -1,5 +1,5 @@
1
1
  require "asciidoctor" unless defined? Asciidoctor::Converter
2
- require_relative "isodoc/pdf_convert"
2
+ require_relative "isodoc/standoc/pdf_convert"
3
3
  require_relative "metanorma/converter/converter"
4
4
  require_relative "metanorma/converter/version"
5
5
  require "asciidoctor/extensions"
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.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-02 00:00:00.000000000 Z
11
+ date: 2026-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -465,57 +465,12 @@ files:
465
465
  - LICENSE
466
466
  - Makefile
467
467
  - README.adoc
468
- - lib/asciidoctor/standoc/base.rb
469
- - lib/asciidoctor/standoc/blocks.rb
470
- - lib/asciidoctor/standoc/blocks_notes.rb
471
- - lib/asciidoctor/standoc/cleanup.rb
472
- - lib/asciidoctor/standoc/cleanup_amend.rb
473
- - lib/asciidoctor/standoc/cleanup_block.rb
474
- - lib/asciidoctor/standoc/cleanup_boilerplate.rb
475
- - lib/asciidoctor/standoc/cleanup_footnotes.rb
476
- - lib/asciidoctor/standoc/cleanup_image.rb
477
- - lib/asciidoctor/standoc/cleanup_inline.rb
478
- - lib/asciidoctor/standoc/cleanup_maths.rb
479
- - lib/asciidoctor/standoc/cleanup_ref.rb
480
- - lib/asciidoctor/standoc/cleanup_ref_dl.rb
481
- - lib/asciidoctor/standoc/cleanup_reqt.rb
482
- - lib/asciidoctor/standoc/cleanup_section.rb
483
- - lib/asciidoctor/standoc/cleanup_section_names.rb
484
- - lib/asciidoctor/standoc/cleanup_symbols.rb
485
- - lib/asciidoctor/standoc/cleanup_table.rb
486
- - lib/asciidoctor/standoc/cleanup_terms.rb
487
- - lib/asciidoctor/standoc/cleanup_terms_designations.rb
488
- - lib/asciidoctor/standoc/cleanup_text.rb
489
- - lib/asciidoctor/standoc/cleanup_toc.rb
490
- - lib/asciidoctor/standoc/cleanup_xref.rb
491
- - lib/asciidoctor/standoc/converter.rb
492
- - lib/asciidoctor/standoc/deprecated.rb
493
- - lib/asciidoctor/standoc/front.rb
494
- - lib/asciidoctor/standoc/front_contributor.rb
495
- - lib/asciidoctor/standoc/inline.rb
496
- - lib/asciidoctor/standoc/lists.rb
497
- - lib/asciidoctor/standoc/macros.rb
498
- - lib/asciidoctor/standoc/macros_form.rb
499
- - lib/asciidoctor/standoc/macros_note.rb
500
- - lib/asciidoctor/standoc/macros_terms.rb
501
- - lib/asciidoctor/standoc/ref.rb
502
- - lib/asciidoctor/standoc/ref_sect.rb
503
- - lib/asciidoctor/standoc/ref_utility.rb
504
- - lib/asciidoctor/standoc/render.rb
505
- - lib/asciidoctor/standoc/reqt.rb
506
- - lib/asciidoctor/standoc/section.rb
507
- - lib/asciidoctor/standoc/table.rb
508
- - lib/asciidoctor/standoc/term_lookup_cleanup.rb
509
- - lib/asciidoctor/standoc/terms.rb
510
- - lib/asciidoctor/standoc/utils.rb
511
- - lib/asciidoctor/standoc/validate.rb
512
- - lib/asciidoctor/standoc/validate_section.rb
513
468
  - lib/isodoc/base.standard.xsl
514
469
  - lib/isodoc/html/html_titlepage.html
515
470
  - lib/isodoc/html/htmlstyle.css
516
471
  - lib/isodoc/html/htmlstyle.scss
517
472
  - lib/isodoc/html/scripts.html
518
- - lib/isodoc/pdf_convert.rb
473
+ - lib/isodoc/standoc/pdf_convert.rb
519
474
  - lib/metanorma-standoc.rb
520
475
  - lib/metanorma/cleanup/amend.rb
521
476
  - lib/metanorma/cleanup/asciibib.rb
@@ -558,7 +513,7 @@ files:
558
513
  - lib/metanorma/converter/blocks.rb
559
514
  - lib/metanorma/converter/blocks_examples.rb
560
515
  - lib/metanorma/converter/blocks_image.rb
561
- - lib/metanorma/converter/blocks_notes_examples.rb
516
+ - lib/metanorma/converter/blocks_notes.rb
562
517
  - lib/metanorma/converter/converter.rb
563
518
  - lib/metanorma/converter/date_utils.rb
564
519
  - lib/metanorma/converter/front.rb
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/base"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/blocks"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/blocks_notes"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_amend"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_block"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_boilerplate"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_footnotes"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_image"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_inline"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_maths"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_ref"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_ref_dl"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_reqt"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_section"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_section_names"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_symbols"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_table"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_terms"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_terms_designations"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_text"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_toc"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/cleanup_xref"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/converter"
@@ -1,7 +0,0 @@
1
- warn "Please replace your references to Asciidoctor::Standoc with "\
2
- "Metanorma::Standoc and your instances of require 'asciidoctor/standoc' "\
3
- "with require 'metanorma/standoc'"
4
-
5
- exit 127 if ENV["METANORMA_DEPRECATION_FAIL"]
6
-
7
- Asciidoctor::Standoc = Metanorma::Standoc unless defined? Asciidoctor::Standoc
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/front"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/front_contributor"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/inline"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/lists"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/macros"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/macros_form"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/macros_note"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/macros_terms"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/ref"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/ref_sect"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/ref_utility"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/render"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/reqt"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/section"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/table"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/term_lookup_cleanup"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/terms"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/utils"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/validate"
@@ -1,2 +0,0 @@
1
- require "asciidoctor/standoc/deprecated"
2
- require "metanorma/standoc/validate_section"