metanorma-standoc 2.6.2 → 2.6.3

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: bd044342634fd4dd1a67955a5f07785ae4762a0f63520e8254efe6e016853b1a
4
- data.tar.gz: 89625dee3748cca3301727fc88650b0f916b8d2f60a258a9731ac09783c2465a
3
+ metadata.gz: c8505150e755f57c7d7d9a02212bc3915ee49d8547f4c2143369ea00f4d9b623
4
+ data.tar.gz: d2dd6aae079a71359d5012f03ea6f937eb998f2a9912d1b5886246de9797d81c
5
5
  SHA512:
6
- metadata.gz: 9958565ebd72f63b2a17af3f6cc89d5055d36f77ba15f4b80763ca64f3d45368b084e321ef05b0f49655943df029556a1ddd1c9cf27a7466299977b48aee57cc
7
- data.tar.gz: 3979efde78ee18714f49a321ce89c51aa2039cc153863d118ddc788d610fae7788134688454bff075a9c95ace5bb097e5b24b169df9877f17a4321632b230b14
6
+ metadata.gz: 33a2b3eae8bb5f0092e5bd36ceb05f9a653fb3f5af645d035641f2e64076b2746738bb23dd75d83191a835873aef921a28a2baed313fb1b3fb939c747543acee
7
+ data.tar.gz: ba20076eab6ecc6a2ffcda225012863094ef6f24abcb85feb7da4f4fd46dd1caa259938a7aa970911841665e7cdce328f95e0e899dc6250ba2c8776eb574895a
@@ -0,0 +1,112 @@
1
+ require "asciidoctor/extensions"
2
+
3
+ module Metanorma
4
+ module Standoc
5
+ module Inline
6
+ def inline_anchor(node)
7
+ case node.type
8
+ when :ref then inline_anchor_ref node
9
+ when :xref then inline_anchor_xref node
10
+ when :link then inline_anchor_link node
11
+ when :bibref then inline_anchor_bibref node
12
+ end
13
+ end
14
+
15
+ def inline_anchor_ref(node)
16
+ noko do |xml|
17
+ xml.bookmark nil, **attr_code(id: node.id)
18
+ end.join
19
+ end
20
+
21
+ def inline_anchor_xref(node)
22
+ noko do |xml|
23
+ attrs = inline_anchor_xref_attrs(node)
24
+ c = attrs[:text]
25
+ attrs.delete(:text) unless c.nil?
26
+ xml.xref **attr_code(attrs) do |x|
27
+ x << c
28
+ end
29
+ end.join
30
+ end
31
+
32
+ def inline_anchor_xref_attrs(node)
33
+ text = concatenate_attributes_to_xref_text(node)
34
+ m = inline_anchor_xref_match(text)
35
+ t = node.target.gsub(/^#/, "").gsub(%r{(\.xml|\.adoc)(#.*$)}, "\\2")
36
+ m.nil? and return { target: t, type: "inline", text: text }
37
+ inline_anchor_xref_attrs1(m, t, text)
38
+ end
39
+
40
+ def concatenate_attributes_to_xref_text(node)
41
+ node.attributes.each_with_object([]) do |(k, v), m|
42
+ %w(path fragment refid).include?(k) and next
43
+ m << "#{k}=#{v}%"
44
+ end.map { |x| x.sub(/%+/, "%") }.join + (node.text || "")
45
+ end
46
+
47
+ def inline_anchor_xref_attrs1(match, target, text)
48
+ { target: target, hidden: match[:hidden],
49
+ type: match[:fn].nil? ? "inline" : "footnote",
50
+ case: match[:case]&.sub(/%$/, ""),
51
+ style: match[:style]&.sub(/^style=/, "")&.sub(/%$/, "") || @xrefstyle,
52
+ droploc: match[:drop].nil? && match[:drop2].nil? ? nil : true,
53
+ text: inline_anchor_xref_text(match, text) }
54
+ end
55
+
56
+ def inline_anchor_xref_match(text)
57
+ /^(?:hidden%(?<hidden>[^,]+),?)?
58
+ (?<style>style=[^%]+%)?
59
+ (?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
60
+ (?<fn>fn:?\s*)?(?<text>.*)$/x.match text
61
+ end
62
+
63
+ def inline_anchor_xref_text(match, text)
64
+ if %i[case fn drop drop2 hidden style].any? { |x| !match[x].nil? }
65
+ match[:text]
66
+ else text
67
+ end
68
+ end
69
+
70
+ def inline_anchor_link(node)
71
+ contents = node.text
72
+ contents = "" if node.target.gsub(%r{^mailto:}, "") == node.text
73
+ attributes = { target: node.target, alt: node.attr("title"),
74
+ "update-type": node.attr("updatetype") ||
75
+ node.attr("update-type") }
76
+ noko do |xml|
77
+ xml.link **attr_code(attributes) do |l|
78
+ l << contents
79
+ end
80
+ end.join
81
+ end
82
+
83
+ def inline_anchor_bibref(node)
84
+ eref_contents =
85
+ @c.decode(node.text || node.target || node.id)
86
+ &.sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
87
+ @refids << (node.target || node.id)
88
+ noko do |xml|
89
+ xml.ref **attr_code(id: node.target || node.id) do |r|
90
+ r << eref_contents
91
+ end
92
+ end.join
93
+ end
94
+
95
+ def inline_callout(node)
96
+ noko do |xml|
97
+ xml.callout node.text
98
+ end.join
99
+ end
100
+
101
+ def inline_footnote(node)
102
+ @fn_number ||= 0
103
+ noko do |xml|
104
+ @fn_number += 1
105
+ xml.fn reference: @fn_number do |fn|
106
+ fn.p { |p| p << node.text }
107
+ end
108
+ end.join
109
+ end
110
+ end
111
+ end
112
+ end
@@ -914,44 +914,47 @@
914
914
  -->
915
915
  <define name="image">
916
916
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
917
+ <ref name="Image"/>
918
+ </element>
919
+ </define>
920
+ <define name="Image">
921
+ <attribute name="id">
922
+ <data type="ID"/>
923
+ </attribute>
924
+ <attribute name="src">
925
+ <data type="anyURI"/>
926
+ </attribute>
927
+ <attribute name="mimetype"/>
928
+ <optional>
929
+ <attribute name="filename"/>
930
+ </optional>
931
+ <optional>
932
+ <attribute name="width">
933
+ <choice>
934
+ <data type="int"/>
935
+ <value>auto</value>
936
+ </choice>
919
937
  </attribute>
920
- <attribute name="src">
938
+ </optional>
939
+ <optional>
940
+ <attribute name="height">
941
+ <choice>
942
+ <data type="int"/>
943
+ <value>auto</value>
944
+ </choice>
945
+ </attribute>
946
+ </optional>
947
+ <optional>
948
+ <attribute name="alt"/>
949
+ </optional>
950
+ <optional>
951
+ <attribute name="title"/>
952
+ </optional>
953
+ <optional>
954
+ <attribute name="longdesc">
921
955
  <data type="anyURI"/>
922
956
  </attribute>
923
- <attribute name="mimetype"/>
924
- <optional>
925
- <attribute name="filename"/>
926
- </optional>
927
- <optional>
928
- <attribute name="width">
929
- <choice>
930
- <data type="int"/>
931
- <value>auto</value>
932
- </choice>
933
- </attribute>
934
- </optional>
935
- <optional>
936
- <attribute name="height">
937
- <choice>
938
- <data type="int"/>
939
- <value>auto</value>
940
- </choice>
941
- </attribute>
942
- </optional>
943
- <optional>
944
- <attribute name="alt"/>
945
- </optional>
946
- <optional>
947
- <attribute name="title"/>
948
- </optional>
949
- <optional>
950
- <attribute name="longdesc">
951
- <data type="anyURI"/>
952
- </attribute>
953
- </optional>
954
- </element>
957
+ </optional>
955
958
  </define>
956
959
  <define name="video">
957
960
  <element name="video">
@@ -348,6 +348,9 @@
348
348
  <zeroOrMore>
349
349
  <ref name="contact"/>
350
350
  </zeroOrMore>
351
+ <optional>
352
+ <ref name="logo"/>
353
+ </optional>
351
354
  </element>
352
355
  </define>
353
356
  <define name="orgname">
@@ -366,6 +369,11 @@
366
369
  </choice>
367
370
  </element>
368
371
  </define>
372
+ <define name="logo">
373
+ <element name="logo">
374
+ <ref name="image"/>
375
+ </element>
376
+ </define>
369
377
  <define name="NameWithVariants">
370
378
  <element name="primary">
371
379
  <ref name="LocalizedString"/>
@@ -942,6 +950,7 @@
942
950
  <value>obsoleted</value>
943
951
  <value>confirmed</value>
944
952
  <value>updated</value>
953
+ <value>corrected</value>
945
954
  <value>issued</value>
946
955
  <value>transmitted</value>
947
956
  <value>copied</value>
@@ -1,5 +1,6 @@
1
1
  require "uri" if /^2\./.match?(RUBY_VERSION)
2
2
  require_relative "./blocks_notes"
3
+ require_relative "./blocks_image"
3
4
 
4
5
  module Metanorma
5
6
  module Standoc
@@ -93,10 +94,10 @@ module Metanorma
93
94
  end
94
95
 
95
96
  def example(node)
96
- (in_terms? || node.option?("termexample")) and return term_example(node)
97
97
  role = node.role || node.attr("style")
98
98
  ret = example_to_requirement(node, role) ||
99
99
  example_by_role(node, role) and return ret
100
+ (in_terms? || node.option?("termexample")) and return term_example(node)
100
101
  reqt_subpart?(role) and return requirement_subpart(node)
101
102
  example_proper(node)
102
103
  end
@@ -119,25 +120,6 @@ module Metanorma
119
120
  @reqt_models.requirement_roles[role.to_sym], role)
120
121
  end
121
122
 
122
- def svgmap_attrs(node)
123
- attr_code(id_attr(node)
124
- .merge(id: node.id, number: node.attr("number"),
125
- unnumbered: node.option?("unnumbered") ? "true" : nil,
126
- subsequence: node.attr("subsequence"))
127
- .merge(keep_attrs(node)))
128
- end
129
-
130
- def svgmap_example(node)
131
- noko do |xml|
132
- xml.svgmap **attr_code(svgmap_attrs(node).merge(
133
- src: node.attr("src"), alt: node.attr("alt"),
134
- )) do |ex|
135
- figure_title(node, ex)
136
- ex << node.content
137
- end
138
- end.join("\n")
139
- end
140
-
141
123
  # prevent A's and other subs inappropriate for pseudocode
142
124
  def pseudocode_example(node)
143
125
  node.blocks.each { |b| b.remove_sub(:replacements) }
@@ -162,34 +144,6 @@ module Metanorma
162
144
  end.join("\n")
163
145
  end
164
146
 
165
- def figure_example(node)
166
- noko do |xml|
167
- xml.figure **figure_attrs(node) do |ex|
168
- node.title.nil? or ex.name { |name| name << node.title }
169
- wrap_in_para(node, ex)
170
- end
171
- end.join("\n")
172
- end
173
-
174
- def figure_title(node, out)
175
- node.title.nil? and return
176
- out.name { |name| name << node.title }
177
- end
178
-
179
- def figure_attrs(node)
180
- attr_code(id_unnum_attrs(node).merge(keep_attrs(node))
181
- .merge(class: node.attr("class")))
182
- end
183
-
184
- def image(node)
185
- noko do |xml|
186
- xml.figure **figure_attrs(node) do |f|
187
- figure_title(node, f)
188
- f.image **image_attributes(node)
189
- end
190
- end
191
- end
192
-
193
147
  def para_attrs(node)
194
148
  attr_code(id_attr(node).merge(keep_attrs(node)
195
149
  .merge(align: node.attr("align"),
@@ -0,0 +1,52 @@
1
+ module Metanorma
2
+ module Standoc
3
+ module Blocks
4
+ def svgmap_attrs(node)
5
+ attr_code(id_attr(node)
6
+ .merge(id: node.id, number: node.attr("number"),
7
+ unnumbered: node.option?("unnumbered") ? "true" : nil,
8
+ subsequence: node.attr("subsequence"))
9
+ .merge(keep_attrs(node)))
10
+ end
11
+
12
+ def svgmap_example(node)
13
+ noko do |xml|
14
+ xml.svgmap **attr_code(svgmap_attrs(node).merge(
15
+ src: node.attr("src"), alt: node.attr("alt"),
16
+ )) do |ex|
17
+ figure_title(node, ex)
18
+ ex << node.content
19
+ end
20
+ end.join("\n")
21
+ end
22
+
23
+ def figure_example(node)
24
+ noko do |xml|
25
+ xml.figure **figure_attrs(node) do |ex|
26
+ node.title.nil? or ex.name { |name| name << node.title }
27
+ wrap_in_para(node, ex)
28
+ end
29
+ end.join("\n")
30
+ end
31
+
32
+ def figure_title(node, out)
33
+ node.title.nil? and return
34
+ out.name { |name| name << node.title }
35
+ end
36
+
37
+ def figure_attrs(node)
38
+ attr_code(id_unnum_attrs(node).merge(keep_attrs(node))
39
+ .merge(class: node.attr("class")))
40
+ end
41
+
42
+ def image(node)
43
+ noko do |xml|
44
+ xml.figure **figure_attrs(node) do |f|
45
+ figure_title(node, f)
46
+ f.image **image_attributes(node)
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -158,8 +158,7 @@ module Metanorma
158
158
  end
159
159
 
160
160
  def metadata_cleanup(xmldoc)
161
- return if @metadata_attrs.nil? || @metadata_attrs.empty?
162
-
161
+ (@metadata_attrs.nil? || @metadata_attrs.empty?) and return
163
162
  ins = add_misc_container(xmldoc)
164
163
  ins << @metadata_attrs
165
164
  end
@@ -35,12 +35,12 @@ module Metanorma
35
35
 
36
36
  IGNORE_QUOTES_ELEMENTS =
37
37
  %w(pre tt sourcecode stem asciimath figure bibdata passthrough
38
- identifier).freeze
38
+ identifier presentation-metadata semantic-metadata).freeze
39
39
 
40
40
  def uninterrupt_quotes_around_xml_skip(elem)
41
41
  !(/\A['"]/.match?(elem.text) &&
42
- elem.previous.path.gsub(/\[\d+\]/, "").split(%r{/})[1..-2]
43
- .intersection(IGNORE_QUOTES_ELEMENTS).empty? &&
42
+ elem.previous.path.gsub(/\[\d+\]/, "").split(%r{/})[1..-2].
43
+ intersection(IGNORE_QUOTES_ELEMENTS).empty? &&
44
44
  ((elem.previous.text.strip.empty? &&
45
45
  !empty_tag_with_text_content?(elem.previous)) ||
46
46
  ignoretext?(elem.previous)))
@@ -50,8 +50,8 @@ module Metanorma
50
50
  prev = elem.at(".//preceding::text()[1]") or return
51
51
  /\S\Z/.match?(prev.text) or return
52
52
  foll = elem.at(".//following::text()[1]")
53
- m = /\A(["'][[:punct:]]*)(\s|\Z)/
54
- .match(@c.decode(foll&.text)) or return
53
+ m = /\A(["'][[:punct:]]*)(\s|\Z)/.
54
+ match(@c.decode(foll&.text)) or return
55
55
  foll.content = foll.text.sub(/\A(["'][[:punct:]]*)/, "")
56
56
  prev.content = "#{prev.text}#{m[1]}"
57
57
  end
@@ -103,8 +103,8 @@ module Metanorma
103
103
  next unless n.text? && /\u2019/.match?(n.text)
104
104
 
105
105
  n.replace(@c.encode(
106
- @c.decode(n.text)
107
- .gsub(/(?<=\p{Alnum})\u2019(?=\p{Alpha})/, "'"),
106
+ @c.decode(n.text).
107
+ gsub(/(?<=\p{Alnum})\u2019(?=\p{Alpha})/, "'"),
108
108
  :basic, :hexadecimal
109
109
  ))
110
110
  end
@@ -78,8 +78,7 @@ module Metanorma
78
78
  end
79
79
 
80
80
  def toc_metadata(xmldoc)
81
- return unless @htmltoclevels || @doctoclevels || @toclevels
82
-
81
+ @htmltoclevels || @doctoclevels || @toclevels or return
83
82
  ins = add_misc_container(xmldoc)
84
83
  toc_metadata1(ins)
85
84
  end
@@ -5,6 +5,7 @@ require_relative "front"
5
5
  require_relative "lists"
6
6
  require_relative "ref"
7
7
  require_relative "inline"
8
+ require_relative "anchor"
8
9
  require_relative "blocks"
9
10
  require_relative "section"
10
11
  require_relative "table"
@@ -21,13 +22,13 @@ module Metanorma
21
22
  class Converter
22
23
  Asciidoctor::Extensions.register do
23
24
  preprocessor Metanorma::Standoc::EmbedIncludeProcessor
24
- preprocessor Metanorma::Standoc::NamedEscapePreprocessor
25
25
  preprocessor Metanorma::Standoc::LinkProtectPreprocessor
26
26
  preprocessor Metanorma::Standoc::Datamodel::AttributesTablePreprocessor
27
27
  preprocessor Metanorma::Standoc::Datamodel::DiagramPreprocessor
28
28
  preprocessor Metanorma::Plugin::Datastruct::Json2TextPreprocessor
29
29
  preprocessor Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
30
30
  preprocessor Metanorma::Plugin::Glossarist::DatasetPreprocessor
31
+ preprocessor Metanorma::Standoc::NamedEscapePreprocessor
31
32
  inline_macro Metanorma::Standoc::PreferredTermInlineMacro
32
33
  inline_macro Metanorma::Standoc::DateInlineMacro
33
34
  inline_macro Metanorma::Standoc::SpanInlineMacro
@@ -81,7 +81,7 @@ module Metanorma
81
81
 
82
82
  def datetypes
83
83
  %w{ published accessed created implemented obsoleted
84
- confirmed updated issued circulated unchanged received
84
+ confirmed updated corrected issued circulated unchanged received
85
85
  vote-started vote-ended announced }
86
86
  end
87
87
 
@@ -1,4 +1,3 @@
1
- require "asciidoctor/extensions"
2
1
  require "unicode2latex"
3
2
  require "mime/types"
4
3
  require "base64"
@@ -8,115 +7,6 @@ require "plurimath"
8
7
  module Metanorma
9
8
  module Standoc
10
9
  module Inline
11
- def refid?(ref)
12
- @refids.include? ref
13
- end
14
-
15
- def inline_anchor(node)
16
- case node.type
17
- when :ref then inline_anchor_ref node
18
- when :xref then inline_anchor_xref node
19
- when :link then inline_anchor_link node
20
- when :bibref then inline_anchor_bibref node
21
- end
22
- end
23
-
24
- def inline_anchor_ref(node)
25
- noko do |xml|
26
- xml.bookmark nil, **attr_code(id: node.id)
27
- end.join
28
- end
29
-
30
- def inline_anchor_xref(node)
31
- noko do |xml|
32
- attrs = inline_anchor_xref_attrs(node)
33
- c = attrs[:text]
34
- attrs.delete(:text) unless c.nil?
35
- xml.xref **attr_code(attrs) do |x|
36
- x << c
37
- end
38
- end.join
39
- end
40
-
41
- def inline_anchor_xref_attrs(node)
42
- text = concatenate_attributes_to_xref_text(node)
43
- m = inline_anchor_xref_match(text)
44
- t = node.target.gsub(/^#/, "").gsub(%r{(\.xml|\.adoc)(#.*$)}, "\\2")
45
- m.nil? and return { target: t, type: "inline", text: text }
46
- inline_anchor_xref_attrs1(m, t, text)
47
- end
48
-
49
- def concatenate_attributes_to_xref_text(node)
50
- node.attributes.each_with_object([]) do |(k, v), m|
51
- %w(path fragment refid).include?(k) and next
52
- m << "#{k}=#{v}%"
53
- end.map { |x| x.sub(/%+/, "%") }.join + (node.text || "")
54
- end
55
-
56
- def inline_anchor_xref_attrs1(match, target, text)
57
- { target: target, hidden: match[:hidden],
58
- type: match[:fn].nil? ? "inline" : "footnote",
59
- case: match[:case]&.sub(/%$/, ""),
60
- style: match[:style]&.sub(/^style=/, "")&.sub(/%$/, "") || @xrefstyle,
61
- droploc: match[:drop].nil? && match[:drop2].nil? ? nil : true,
62
- text: inline_anchor_xref_text(match, text) }
63
- end
64
-
65
- def inline_anchor_xref_match(text)
66
- /^(?:hidden%(?<hidden>[^,]+),?)?
67
- (?<style>style=[^%]+%)?
68
- (?<drop>droploc%)?(?<case>capital%|lowercase%)?(?<drop2>droploc%)?
69
- (?<fn>fn:?\s*)?(?<text>.*)$/x.match text
70
- end
71
-
72
- def inline_anchor_xref_text(match, text)
73
- if %i[case fn drop drop2 hidden style].any? { |x| !match[x].nil? }
74
- match[:text]
75
- else text
76
- end
77
- end
78
-
79
- def inline_anchor_link(node)
80
- contents = node.text
81
- contents = "" if node.target.gsub(%r{^mailto:}, "") == node.text
82
- attributes = { target: node.target, alt: node.attr("title"),
83
- "update-type": node.attr("updatetype") ||
84
- node.attr("update-type") }
85
- noko do |xml|
86
- xml.link **attr_code(attributes) do |l|
87
- l << contents
88
- end
89
- end.join
90
- end
91
-
92
- def inline_anchor_bibref(node)
93
- eref_contents =
94
- @c.decode(node.text || node.target || node.id)
95
- &.sub(/^\[?([^\[\]]+?)\]?$/, "[\\1]")
96
- @refids << (node.target || node.id)
97
- noko do |xml|
98
- xml.ref **attr_code(id: node.target || node.id) do |r|
99
- r << eref_contents
100
- end
101
- end.join
102
- end
103
-
104
- def inline_callout(node)
105
- noko do |xml|
106
- xml.callout node.text
107
- end.join
108
- end
109
-
110
- def inline_footnote(node)
111
- @fn_number ||= 0
112
- noko do |xml|
113
- @fn_number += 1
114
- xml.fn reference: @fn_number do |fn|
115
- fn.p { |p| p << node.text }
116
- end
117
- end.join
118
- end
119
-
120
10
  def inline_break(node)
121
11
  noko do |xml|
122
12
  xml << node.text
@@ -137,8 +27,8 @@ module Metanorma
137
27
 
138
28
  def latex_parse1(text, block)
139
29
  lxm_input = Unicode2LaTeX.unicode2latex(@c.decode(text))
140
- results = Plurimath::Math.parse(lxm_input, "latex")
141
- .to_mathml(display_style: block)
30
+ results = Plurimath::Math.parse(lxm_input, "latex").
31
+ to_mathml(display_style: block)
142
32
  if results.nil?
143
33
  @log.add("Math", nil,
144
34
  "latexmlmath failed to process equation:\n#{lxm_input}")
@@ -164,8 +54,8 @@ module Metanorma
164
54
  latex = latex_parse1(text, block) or
165
55
  return xml.stem type: "MathML", block: block
166
56
  xml.stem type: "MathML", block: block do |s|
167
- math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
168
- .elements[0]
57
+ math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, "")).
58
+ elements[0]
169
59
  math.delete("alttext")
170
60
  s.parent.children = math
171
61
  s << "<latexmath>#{text}</latexmath>"
@@ -202,6 +92,10 @@ module Metanorma
202
92
  xml.span style: node.role.sub(/^css /, "") do |s|
203
93
  s << node.text
204
94
  end
95
+ when /:/
96
+ xml.span **attr_code(hash2styles(node.role)) do |s|
97
+ s << node.text
98
+ end
205
99
  else
206
100
  xml << node.text
207
101
  end
@@ -209,6 +103,17 @@ module Metanorma
209
103
  end.join
210
104
  end
211
105
 
106
+ def hash2styles(role)
107
+ CSV.parse_line(role, liberal_parsing: true).
108
+ each_with_object({}) do |r, m|
109
+ kv = r.split(":", 2).map(&:strip)
110
+ case kv[0]
111
+ when "custom-charset"
112
+ m[kv[0]] = kv[1]
113
+ end
114
+ end
115
+ end
116
+
212
117
  def image_attributes(node)
213
118
  nodetarget = node.attr("target") || node.target
214
119
  if Gem.win_platform? && /^[a-zA-Z]:/.match?(nodetarget)
@@ -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.2.6 -->
20
+ <!-- VERSION v1.2.8 -->
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">
@@ -1054,6 +1054,17 @@
1054
1054
  <ref name="date_inline"/>
1055
1055
  </choice>
1056
1056
  </define>
1057
+ <define name="PureTextElement" combine="choice">
1058
+ <ref name="passthrough_inline"/>
1059
+ </define>
1060
+ <define name="passthrough_inline">
1061
+ <element name="passthrough">
1062
+ <optional>
1063
+ <attribute name="formats"/>
1064
+ </optional>
1065
+ <text/>
1066
+ </element>
1067
+ </define>
1057
1068
  <define name="add">
1058
1069
  <element name="add">
1059
1070
  <choice>
@@ -1092,6 +1103,9 @@
1092
1103
  <optional>
1093
1104
  <attribute name="style"/>
1094
1105
  </optional>
1106
+ <optional>
1107
+ <attribute name="custom-charset"/>
1108
+ </optional>
1095
1109
  <oneOrMore>
1096
1110
  <ref name="TextElement"/>
1097
1111
  </oneOrMore>
@@ -1394,6 +1408,9 @@
1394
1408
  <optional>
1395
1409
  <attribute name="number"/>
1396
1410
  </optional>
1411
+ <optional>
1412
+ <attribute name="branch-number"/>
1413
+ </optional>
1397
1414
  <optional>
1398
1415
  <attribute name="obligation">
1399
1416
  <choice>
@@ -1617,6 +1634,9 @@
1617
1634
  <optional>
1618
1635
  <attribute name="number"/>
1619
1636
  </optional>
1637
+ <optional>
1638
+ <attribute name="branch-number"/>
1639
+ </optional>
1620
1640
  <optional>
1621
1641
  <attribute name="type"/>
1622
1642
  </optional>
@@ -1668,6 +1688,9 @@
1668
1688
  <optional>
1669
1689
  <attribute name="number"/>
1670
1690
  </optional>
1691
+ <optional>
1692
+ <attribute name="branch-number"/>
1693
+ </optional>
1671
1694
  <optional>
1672
1695
  <ref name="section-title"/>
1673
1696
  </optional>
@@ -1765,6 +1788,9 @@
1765
1788
  <optional>
1766
1789
  <attribute name="number"/>
1767
1790
  </optional>
1791
+ <optional>
1792
+ <attribute name="branch-number"/>
1793
+ </optional>
1768
1794
  <optional>
1769
1795
  <attribute name="obligation">
1770
1796
  <choice>
@@ -97,7 +97,8 @@ module Metanorma
97
97
 
98
98
  def pass_status(status, text)
99
99
  text == "++++" && !status[:delimln] and status[:pass] = !status[:pass]
100
- if status[:is_delim] && /^(-+|\*+|=+|_+)$/.match?(text)
100
+ if (status[:is_delim] && /^(-+|\*+|=+|_+)$/.match?(text)) ||
101
+ (!status[:is_delim] && !status[:delimln] && text == "----")
101
102
  status[:delimln] = text
102
103
  status[:pass] = true
103
104
  elsif status[:pass_delim]
@@ -84,6 +84,7 @@ module Metanorma
84
84
  language: node.attributes["language"],
85
85
  script: node.attributes["script"],
86
86
  number: node.attributes["number"],
87
+ "branch-number": node.attributes["branch-number"],
87
88
  type: node.attributes["type"],
88
89
  annex: (if (node.attr("style") == "appendix" ||
89
90
  node.role == "appendix") &&
@@ -69,11 +69,11 @@ module Metanorma
69
69
  end
70
70
 
71
71
  def xml_encode(text)
72
- @c.encode(text, :basic, :hexadecimal)
73
- .gsub("&amp;gt;", ">").gsub("&amp;lt;", "<").gsub("&amp;amp;", "&")
74
- .gsub("&gt;", ">").gsub("&lt;", "<").gsub("&amp;", "&")
75
- .gsub("&quot;", '"').gsub("&#xa;", "\n").gsub("&amp;#", "&#")
76
- .gsub("&apos;", "'")
72
+ @c.encode(text, :basic, :hexadecimal).
73
+ gsub("&amp;gt;", ">").gsub("&amp;lt;", "<").gsub("&amp;amp;", "&").
74
+ gsub("&gt;", ">").gsub("&lt;", "<").gsub("&amp;", "&").
75
+ gsub("&quot;", '"').gsub("&#xa;", "\n").gsub("&amp;#", "&#").
76
+ gsub("&apos;", "'")
77
77
  end
78
78
 
79
79
  # wrapped in <sections>
@@ -104,6 +104,10 @@ module Metanorma
104
104
  psi|omega)\b/xi, "&\\1;")
105
105
  end
106
106
 
107
+ def refid?(ref)
108
+ @refids.include? ref
109
+ end
110
+
107
111
  module_function :adoc2xml
108
112
 
109
113
  class EmptyAttr
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "2.6.2".freeze
22
+ VERSION = "2.6.3".freeze
23
23
  end
24
24
  end
@@ -31,7 +31,7 @@ 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 "iev", "~> 0.3.0"
34
- spec.add_dependency "isodoc", "~> 2.6.3"
34
+ spec.add_dependency "isodoc", "~> 2.7.0"
35
35
  spec.add_dependency "metanorma", ">= 1.6.0"
36
36
  spec.add_dependency "metanorma-plugin-datastruct", "~> 0.2.0"
37
37
  spec.add_dependency "metanorma-plugin-glossarist", "~> 0.1.1"
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.6.2
4
+ version: 2.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-23 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.6.3
61
+ version: 2.7.0
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: 2.6.3
68
+ version: 2.7.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: metanorma
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -466,11 +466,13 @@ files:
466
466
  - lib/isodoc/pdf_convert.rb
467
467
  - lib/metanorma-standoc.rb
468
468
  - lib/metanorma/standoc.rb
469
+ - lib/metanorma/standoc/anchor.rb
469
470
  - lib/metanorma/standoc/base.rb
470
471
  - lib/metanorma/standoc/basicdoc.rng
471
472
  - lib/metanorma/standoc/biblio-standoc.rng
472
473
  - lib/metanorma/standoc/biblio.rng
473
474
  - lib/metanorma/standoc/blocks.rb
475
+ - lib/metanorma/standoc/blocks_image.rb
474
476
  - lib/metanorma/standoc/blocks_notes.rb
475
477
  - lib/metanorma/standoc/cleanup.rb
476
478
  - lib/metanorma/standoc/cleanup_amend.rb