metanorma-standoc 1.11.2 → 1.11.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: 6a5cc91caf1f8d674aeff3b46209557d7be11087bf59728df07a73b26cec880a
4
- data.tar.gz: 7b674d7c013a3e5aee09394c085ee40dbbed6e241ffb14a14b363ca5956636f5
3
+ metadata.gz: 7756f8b45a6897bf3a40e48df348a746bc75b30820597fa8ceadedcbbceb89d9
4
+ data.tar.gz: e62b62dd699df95d46bd13c18656bf3504c3a34936ff0a094d224d12a9f44987
5
5
  SHA512:
6
- metadata.gz: dab0eafeeb100111eecdd7ae0eeb3a23dd1b60acdbf1fc884a7fba6084db22bc816c8255c230a16eb4ab0fc68555378586106145545672a5b39d444e8a3f97c8
7
- data.tar.gz: 1f6ffc49435ffebec0441fafbf4a6eb629216270d0d8fd38d68ad15a5d99e4e3162f3d685229827e0eb1df2a2c6d43aaf475795cbcdb143b772d5589787248ff
6
+ metadata.gz: 9776d2bfd161b5500e5ac9e8ea47a9597befe1642880a18fdc86839ceee0688e879d37de0bd9000420294f6a0094f455c840643e091a11da0b65489434a44bf9
7
+ data.tar.gz: 4f4d5f119ce92541ee1a89320fdc094352f3ca2ac885f1d52438279e4f70b995d0f87b4f7d034bafc63f05e2192b9ae8b7f4063dd1972525d773ec2f66e27dd1
data/Gemfile CHANGED
@@ -9,3 +9,5 @@ gemspec
9
9
  if File.exist? 'Gemfile.devel'
10
10
  eval File.read('Gemfile.devel'), nil, 'Gemfile.devel' # rubocop:disable Security/Eval
11
11
  end
12
+
13
+ gem "reline", "~> 0.2.8.pre.11"
@@ -8,6 +8,7 @@ require "relaton"
8
8
  require "fileutils"
9
9
  require "metanorma-utils"
10
10
  require "isodoc/xslfo_convert"
11
+ require_relative "render"
11
12
 
12
13
  module Asciidoctor
13
14
  module Standoc
@@ -24,85 +25,6 @@ module Asciidoctor
24
25
  self.class::XML_NAMESPACE
25
26
  end
26
27
 
27
- def html_extract_attributes(node)
28
- {
29
- script: node.attr("script"),
30
- bodyfont: node.attr("body-font"),
31
- headerfont: node.attr("header-font"),
32
- monospacefont: node.attr("monospace-font"),
33
- i18nyaml: node.attr("i18nyaml"),
34
- scope: node.attr("scope"),
35
- htmlstylesheet: node.attr("htmlstylesheet"),
36
- htmlstylesheet_override: node.attr("htmlstylesheet-override"),
37
- htmlcoverpage: node.attr("htmlcoverpage"),
38
- htmlintropage: node.attr("htmlintropage"),
39
- scripts: node.attr("scripts"),
40
- scripts_override: node.attr("scripts-override"),
41
- scripts_pdf: node.attr("scripts-pdf"),
42
- datauriimage: node.attr("data-uri-image") != "false",
43
- htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
44
- doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
45
- break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
46
- suppressasciimathdup: node.attr("suppress-asciimath-dup"),
47
- bare: node.attr("bare"),
48
- sectionsplit: node.attr("sectionsplit"),
49
- baseassetpath: node.attr("base-asset-path"),
50
- aligncrosselements: node.attr("align-cross-elements"),
51
- }
52
- end
53
-
54
- def html_converter(node)
55
- IsoDoc::HtmlConvert.new(html_extract_attributes(node))
56
- end
57
-
58
- def pdf_converter(node)
59
- return nil if node.attr("no-pdf")
60
-
61
- IsoDoc::Standoc::PdfConvert.new(doc_extract_attributes(node))
62
- end
63
-
64
- def doc_extract_attributes(node)
65
- attrs = {
66
- script: node.attr("script"),
67
- bodyfont: node.attr("body-font"),
68
- headerfont: node.attr("header-font"),
69
- monospacefont: node.attr("monospace-font"),
70
- i18nyaml: node.attr("i18nyaml"),
71
- scope: node.attr("scope"),
72
- wordstylesheet: node.attr("wordstylesheet"),
73
- wordstylesheet_override: node.attr("wordstylesheet-override"),
74
- standardstylesheet: node.attr("standardstylesheet"),
75
- header: node.attr("header"),
76
- wordcoverpage: node.attr("wordcoverpage"),
77
- wordintropage: node.attr("wordintropage"),
78
- ulstyle: node.attr("ulstyle"),
79
- olstyle: node.attr("olstyle"),
80
- htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
81
- doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
82
- break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
83
- suppressasciimathdup: node.attr("suppress-asciimath-dup"),
84
- bare: node.attr("bare"),
85
- baseassetpath: node.attr("base-asset-path"),
86
- aligncrosselements: node.attr("align-cross-elements"),
87
- }
88
-
89
- if fonts_manifest = node.attr(FONTS_MANIFEST)
90
- attrs[IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS] = {
91
- IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => fonts_manifest,
92
- }
93
- end
94
-
95
- attrs
96
- end
97
-
98
- def doc_converter(node)
99
- IsoDoc::WordConvert.new(doc_extract_attributes(node))
100
- end
101
-
102
- def presentation_xml_converter(node)
103
- IsoDoc::PresentationXMLConvert.new(html_extract_attributes(node))
104
- end
105
-
106
28
  def init(node)
107
29
  @fn_number ||= 0
108
30
  @draft = false
@@ -124,6 +46,7 @@ module Asciidoctor
124
46
  @output_dir = outputdir node
125
47
  @no_isobib_cache = node.attr("no-isobib-cache")
126
48
  @no_isobib = node.attr("no-isobib")
49
+ @index_terms = node.attr("index-terms")
127
50
  @sourcecode_markup_start = node.attr("sourcecode-markup-start") || "{{{"
128
51
  @sourcecode_markup_end = node.attr("sourcecode-markup-end") || "}}}"
129
52
  @bibdb = nil
@@ -136,31 +59,12 @@ module Asciidoctor
136
59
  init_bib_caches(node)
137
60
  init_iev_caches(node)
138
61
  @lang = (node.attr("language") || "en")
139
- @script = (node.attr("script") || default_script(node.attr("language")))
62
+ @script = (node.attr("script") ||
63
+ Metanorma::Utils.default_script(node.attr("language")))
140
64
  @isodoc = isodoc(@lang, @script, node.attr("i18nyaml"))
141
65
  @i18n = @isodoc.i18n
142
66
  end
143
67
 
144
- def default_fonts(node)
145
- b = node.attr("body-font") ||
146
- (node.attr("script") == "Hans" ? '"Source Han Sans",serif' : '"Cambria",serif')
147
- h = node.attr("header-font") ||
148
- (node.attr("script") == "Hans" ? '"Source Han Sans",sans-serif' : '"Cambria",serif')
149
- m = node.attr("monospace-font") || '"Courier New",monospace'
150
- "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
151
- end
152
-
153
- def outputs(node, ret)
154
- File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
155
- presentation_xml_converter(node).convert("#{@filename}.xml")
156
- html_converter(node).convert("#{@filename}.presentation.xml",
157
- nil, false, "#{@filename}.html")
158
- doc_converter(node).convert("#{@filename}.presentation.xml",
159
- nil, false, "#{@filename}.doc")
160
- pdf_converter(node)&.convert("#{@filename}.presentation.xml",
161
- nil, false, "#{@filename}.pdf")
162
- end
163
-
164
68
  def document(node)
165
69
  init(node)
166
70
  ret = makexml(node).to_xml(encoding: "US-ASCII", indent: 2)
@@ -48,6 +48,7 @@ module Asciidoctor
48
48
  termdef_cleanup(xmldoc)
49
49
  RelatonIev::iev_cleanup(xmldoc, @bibdb)
50
50
  element_name_cleanup(xmldoc)
51
+ index_cleanup(xmldoc)
51
52
  bpart_cleanup(xmldoc)
52
53
  quotesource_cleanup(xmldoc)
53
54
  callout_cleanup(xmldoc)
@@ -89,8 +89,7 @@ module Asciidoctor
89
89
  def note_cleanup(xmldoc)
90
90
  q = "//note[following-sibling::*[not(local-name() = 'note')]]"
91
91
  xmldoc.xpath(q).each do |n|
92
- next if n["keep-separate"] == "true"
93
- next unless n.ancestors("table").empty?
92
+ next if n["keep-separate"] == "true" || !n.ancestors("table").empty?
94
93
 
95
94
  prev = n.previous_element || next
96
95
  n.parent = prev if ELEMS_ALLOW_NOTES.include? prev.name
@@ -159,15 +159,25 @@ module Asciidoctor
159
159
  end
160
160
 
161
161
  def contenthash_id_cleanup(doc)
162
- ids = doc.xpath("//*[@id]").each_with_object({}) do |x, m|
162
+ ids = contenthash_id_make(doc)
163
+ contenthash_id_update_refs(doc, ids)
164
+ end
165
+
166
+ def contenthash_id_make(doc)
167
+ doc.xpath("//*[@id]").each_with_object({}) do |x, m|
163
168
  next unless guid?(x["id"])
164
169
 
165
170
  m[x["id"]] = contenthash(x)
166
171
  x["id"] = m[x["id"]]
167
172
  end
168
- [%w(review from), %(review to), %(callout target), %(eref bibitemid),
169
- %(citation bibitemid), %(xref target), %(xref to)].each do |a|
170
- doc.xpath("//#{a[0]}").each { |x| ids[a[1]] and x[a[1]] = ids[a[1]] }
173
+ end
174
+
175
+ def contenthash_id_update_refs(doc, ids)
176
+ [%w(review from), %w(review to), %w(callout target), %w(eref bibitemid),
177
+ %w(citation bibitemid), %w(xref target), %w(xref to)].each do |a|
178
+ doc.xpath("//#{a[0]}").each do |x|
179
+ ids[x[a[1]]] and x[a[1]] = ids[x[a[1]]]
180
+ end
171
181
  end
172
182
  end
173
183
 
@@ -48,10 +48,10 @@ module Asciidoctor
48
48
  end
49
49
 
50
50
  def requirement_description_wrap(reqt, text)
51
- return if text.element? && (reqt_subpart(text.name) ||
51
+ return if (text.element? && (reqt_subpart(text.name) ||
52
52
  %w(requirement recommendation
53
- permission).include?(text.name)) ||
54
- text.text.strip.empty?
53
+ permission).include?(text.name))) ||
54
+ (text.text.strip.empty? && !text.at(".//xref | .//eref | .//link"))
55
55
 
56
56
  t = Nokogiri::XML::Element.new("description", reqt)
57
57
  text.before(t)
@@ -27,7 +27,8 @@ module Asciidoctor
27
27
  end
28
28
 
29
29
  TERMDEF_BLOCKS =
30
- "./p | ./ol | ./dl | ./ul | ./figure | ./formula | ./table".freeze
30
+ "./p | ./ol | ./dl[not(@metadata = 'true')] | ./ul | ./figure | "\
31
+ "./formula | ./table".freeze
31
32
 
32
33
  def generate_termdefinitions(xmldoc)
33
34
  xmldoc.xpath("//term[not(definition)]").each do |d|
@@ -113,6 +114,27 @@ module Asciidoctor
113
114
  term_children_cleanup(xmldoc)
114
115
  termdocsource_cleanup(xmldoc)
115
116
  end
117
+
118
+ def index_cleanup(xmldoc)
119
+ return unless @index_terms
120
+
121
+ xmldoc.xpath("//preferred").each do |p|
122
+ index_cleanup1(p.at("./expression/name | ./letter-symbol/name"),
123
+ p.xpath("./field-of-application | ./usage-info")
124
+ &.map(&:text)&.join(", "))
125
+ end
126
+ xmldoc.xpath("//definitions/dl/dt").each do |p|
127
+ index_cleanup1(p, "")
128
+ end
129
+ end
130
+
131
+ def index_cleanup1(term, fieldofappl)
132
+ return unless term
133
+
134
+ idx = term.children.dup
135
+ fieldofappl.empty? or idx << ", &#x3c;#{fieldofappl}&#x3e;"
136
+ term << "<index><primary>#{idx.to_xml}</primary></index>"
137
+ end
116
138
  end
117
139
  end
118
140
  end
@@ -37,7 +37,8 @@ module Asciidoctor
37
37
  def term_dl_to_metadata(xmldoc)
38
38
  xmldoc.xpath("//term[dl[@metadata = 'true']]").each do |t|
39
39
  t.xpath("./dl[@metadata = 'true']").each do |dl|
40
- prev = dl_to_designation(dl) or next
40
+ prev = related2pref(dl_to_designation(dl)) or next
41
+ #require "debug"; binding.b if prev.parent.name == "related"
41
42
  term_dl_to_designation_metadata(prev, dl)
42
43
  term_dl_to_term_metadata(prev, dl)
43
44
  term_dl_to_expression_metadata(prev, dl)
@@ -58,7 +59,7 @@ module Asciidoctor
58
59
 
59
60
  def term_dl_to_designation_metadata(prev, dlist)
60
61
  %w(absent geographic-area).each do |a|
61
- dl_to_attrs(related2pref(prev), dlist, a)
62
+ dl_to_attrs(prev, dlist, a)
62
63
  end
63
64
  %w(field-of-application usage-info).reverse.each do |a|
64
65
  dl_to_elems(prev.at("./expression"), prev, dlist, a)
@@ -75,15 +76,28 @@ module Asciidoctor
75
76
  end
76
77
 
77
78
  def term_dl_to_expression_metadata(prev, dlist)
78
- %w(language script type isInternational).each do |a|
79
- dl_to_attrs(prev, dlist, a)
79
+ term_dl_to_expression_root_metadata(prev, dlist)
80
+ term_dl_to_expression_name_metadata(prev, dlist)
81
+ term_to_letter_symbol(prev, dlist)
82
+ end
83
+
84
+ def term_dl_to_expression_root_metadata(prev, dlist)
85
+ %w(isInternational).each do |a|
86
+ p = prev.at("./expression | ./letter-symbol | ./graphical-symbol")
87
+ dl_to_attrs(p, dlist, a)
80
88
  end
89
+ %w(language script type).each do |a|
90
+ p = prev.at("./expression") or next
91
+ dl_to_attrs(p, dlist, a)
92
+ end
93
+ end
94
+
95
+ def term_dl_to_expression_name_metadata(prev, dlist)
81
96
  %w(abbreviation-type pronunciation).reverse.each do |a|
82
97
  dl_to_elems(prev.at("./expression/name"), prev, dlist, a)
83
98
  end
84
99
  g = dlist.at("./dt[text()='grammar']/following::dd//dl") and
85
100
  term_dl_to_expression_grammar(prev, g)
86
- term_to_letter_symbol(prev, dlist)
87
101
  end
88
102
 
89
103
  def term_dl_to_expression_grammar(prev, dlist)
@@ -172,7 +186,7 @@ module Asciidoctor
172
186
  end
173
187
 
174
188
  def related2pref(elem)
175
- elem.name == "related" ? elem = elem.at("./preferred") : elem
189
+ elem&.name == "related" ? elem = elem.at("./preferred") : elem
176
190
  end
177
191
  end
178
192
  end
@@ -94,7 +94,7 @@ module Asciidoctor
94
94
 
95
95
  def metadata_script(node, xml)
96
96
  xml.script (node.attr("script") ||
97
- default_script(node.attr("language")))
97
+ Metanorma::Utils.default_script(node.attr("language")))
98
98
  end
99
99
 
100
100
  def relaton_relations
@@ -1796,6 +1796,20 @@
1796
1796
  <data type="ID"/>
1797
1797
  </attribute>
1798
1798
  </optional>
1799
+ <optional>
1800
+ <attribute name="language"/>
1801
+ </optional>
1802
+ <optional>
1803
+ <attribute name="script"/>
1804
+ </optional>
1805
+ <optional>
1806
+ <attribute name="tag"/>
1807
+ </optional>
1808
+ <optional>
1809
+ <attribute name="multilingual-rendering">
1810
+ <ref name="MultilingualRenderingType"/>
1811
+ </attribute>
1812
+ </optional>
1799
1813
  <oneOrMore>
1800
1814
  <ref name="preferred"/>
1801
1815
  </oneOrMore>
@@ -0,0 +1,117 @@
1
+ module Asciidoctor
2
+ module Standoc
3
+ module Base
4
+ def html_extract_attributes(node)
5
+ {
6
+ script: node.attr("script"),
7
+ bodyfont: node.attr("body-font"),
8
+ headerfont: node.attr("header-font"),
9
+ monospacefont: node.attr("monospace-font"),
10
+ i18nyaml: node.attr("i18nyaml"),
11
+ scope: node.attr("scope"),
12
+ htmlstylesheet: node.attr("htmlstylesheet"),
13
+ htmlstylesheet_override: node.attr("htmlstylesheet-override"),
14
+ htmlcoverpage: node.attr("htmlcoverpage"),
15
+ htmlintropage: node.attr("htmlintropage"),
16
+ scripts: node.attr("scripts"),
17
+ scripts_override: node.attr("scripts-override"),
18
+ scripts_pdf: node.attr("scripts-pdf"),
19
+ datauriimage: node.attr("data-uri-image") != "false",
20
+ htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
21
+ doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
22
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
23
+ suppressasciimathdup: node.attr("suppress-asciimath-dup"),
24
+ bare: node.attr("bare"),
25
+ sectionsplit: node.attr("sectionsplit"),
26
+ baseassetpath: node.attr("base-asset-path"),
27
+ aligncrosselements: node.attr("align-cross-elements"),
28
+ }
29
+ end
30
+
31
+ def html_converter(node)
32
+ IsoDoc::HtmlConvert.new(html_extract_attributes(node))
33
+ end
34
+
35
+ def pdf_converter(node)
36
+ return nil if node.attr("no-pdf")
37
+
38
+ IsoDoc::Standoc::PdfConvert.new(pdf_extract_attributes(node))
39
+ end
40
+
41
+ def doc_extract_attributes(node)
42
+ attrs = {
43
+ script: node.attr("script"),
44
+ bodyfont: node.attr("body-font"),
45
+ headerfont: node.attr("header-font"),
46
+ monospacefont: node.attr("monospace-font"),
47
+ i18nyaml: node.attr("i18nyaml"),
48
+ scope: node.attr("scope"),
49
+ wordstylesheet: node.attr("wordstylesheet"),
50
+ wordstylesheet_override: node.attr("wordstylesheet-override"),
51
+ standardstylesheet: node.attr("standardstylesheet"),
52
+ header: node.attr("header"),
53
+ wordcoverpage: node.attr("wordcoverpage"),
54
+ wordintropage: node.attr("wordintropage"),
55
+ ulstyle: node.attr("ulstyle"),
56
+ olstyle: node.attr("olstyle"),
57
+ htmltoclevels: node.attr("htmltoclevels") || node.attr("toclevels"),
58
+ doctoclevels: node.attr("doctoclevels") || node.attr("toclevels"),
59
+ break_up_urls_in_tables: node.attr("break-up-urls-in-tables"),
60
+ suppressasciimathdup: node.attr("suppress-asciimath-dup"),
61
+ bare: node.attr("bare"),
62
+ baseassetpath: node.attr("base-asset-path"),
63
+ aligncrosselements: node.attr("align-cross-elements"),
64
+ }
65
+
66
+ if fonts_manifest = node.attr(FONTS_MANIFEST)
67
+ attrs[IsoDoc::XslfoPdfConvert::MN2PDF_OPTIONS] = {
68
+ IsoDoc::XslfoPdfConvert::MN2PDF_FONT_MANIFEST => fonts_manifest,
69
+ }
70
+ end
71
+
72
+ attrs
73
+ end
74
+
75
+ def pdf_extract_attributes(node)
76
+ attrs =
77
+ %w(pdf-encrypt pdf-encryption-length pdf-user-password
78
+ pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
79
+ pdf-allow-assemble-document pdf-allow-edit-annotations
80
+ pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
81
+ pdf-allow-access-content pdf-encrypt-metadata)
82
+ .each_with_object({}) do |x, m|
83
+ m[x.gsub(/-/, "").to_i] = node.attr(x)
84
+ end
85
+ html_extract_attributes(node).merge(attrs)
86
+ end
87
+
88
+ def doc_converter(node)
89
+ IsoDoc::WordConvert.new(doc_extract_attributes(node))
90
+ end
91
+
92
+ def presentation_xml_converter(node)
93
+ IsoDoc::PresentationXMLConvert.new(html_extract_attributes(node))
94
+ end
95
+
96
+ def default_fonts(node)
97
+ b = node.attr("body-font") ||
98
+ (node.attr("script") == "Hans" ? '"Source Han Sans",serif' : '"Cambria",serif')
99
+ h = node.attr("header-font") ||
100
+ (node.attr("script") == "Hans" ? '"Source Han Sans",sans-serif' : '"Cambria",serif')
101
+ m = node.attr("monospace-font") || '"Courier New",monospace'
102
+ "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
103
+ end
104
+
105
+ def outputs(node, ret)
106
+ File.open("#{@filename}.xml", "w:UTF-8") { |f| f.write(ret) }
107
+ presentation_xml_converter(node).convert("#{@filename}.xml")
108
+ html_converter(node).convert("#{@filename}.presentation.xml",
109
+ nil, false, "#{@filename}.html")
110
+ doc_converter(node).convert("#{@filename}.presentation.xml",
111
+ nil, false, "#{@filename}.doc")
112
+ pdf_converter(node)&.convert("#{@filename}.presentation.xml",
113
+ nil, false, "#{@filename}.pdf")
114
+ end
115
+ end
116
+ end
117
+ end
@@ -54,8 +54,12 @@ module Asciidoctor
54
54
  node.level == 1
55
55
  true
56
56
  end),
57
- preface: (
58
- node.role == "preface" || node.attr("style") == "preface" ? true : nil) }
57
+ tag: node&.attr("tag"),
58
+ "multilingual-rendering": node&.attr("multilingual-rendering"),
59
+ preface: (if node.role == "preface" ||
60
+ node.attr("style") == "preface"
61
+ true
62
+ end) }
59
63
  return ret unless node.attributes["change"]
60
64
 
61
65
  ret.merge(change: node.attributes["change"],
@@ -64,22 +64,6 @@ module Asciidoctor
64
64
  conv
65
65
  end
66
66
 
67
- def default_script(lang)
68
- case lang
69
- when "ar", "fa" then "Arab"
70
- when "ur" then "Aran"
71
- when "ru", "bg" then "Cyrl"
72
- when "hi" then "Deva"
73
- when "el" then "Grek"
74
- when "zh" then "Hans"
75
- when "ko" then "Kore"
76
- when "he" then "Hebr"
77
- when "ja" then "Jpan"
78
- else
79
- "Latn"
80
- end
81
- end
82
-
83
67
  def dl_to_attrs(elem, dlist, name)
84
68
  e = dlist.at("./dt[text()='#{name}']") or return
85
69
  val = e.at("./following::dd/p") || e.at("./following::dd") or return
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "1.11.2".freeze
22
+ VERSION = "1.11.3".freeze
23
23
  end
24
24
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "concurrent-ruby"
38
38
  spec.add_dependency "latexmath"
39
39
  spec.add_dependency "mathml2asciimath"
40
- spec.add_dependency "metanorma-utils", "~> 1.2.0"
40
+ spec.add_dependency "metanorma-utils", "~> 1.2.8"
41
41
  spec.add_dependency "relaton-cli", "~> 1.9.0"
42
42
  spec.add_dependency "relaton-iev", "~> 1.1.0"
43
43
  spec.add_dependency "unicode2latex", "~> 0.0.1"
@@ -1444,7 +1444,7 @@ OUTPUT
1444
1444
  ====
1445
1445
  INPUT
1446
1446
  output = <<~"OUTPUT"
1447
- #{BLANK_HDR}
1447
+ #{BLANK_HDR}
1448
1448
  <sections>
1449
1449
  <recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
1450
1450
  <label>/ogc/recommendation/wfs/2</label>
@@ -1452,7 +1452,8 @@ OUTPUT
1452
1452
  <subject>developer, implementer</subject>
1453
1453
  <inherit>/ss/584/2015/level/1</inherit>
1454
1454
  <inherit>/ss/584/2015/level/2</inherit>
1455
- <description><p id="_">I recommend this</p></description>
1455
+ <description><p id="_">I recommend this</p>
1456
+ </description>
1456
1457
  </recommendation>
1457
1458
  </sections>
1458
1459
  </standard-document>
@@ -1470,6 +1471,9 @@ OUTPUT
1470
1471
  .Title
1471
1472
  ====
1472
1473
  I recommend this
1474
+
1475
+ . http://www.example.com[]
1476
+ . <<ABC>>
1473
1477
  ====
1474
1478
  INPUT
1475
1479
  output = <<~OUTPUT
@@ -1478,7 +1482,20 @@ OUTPUT
1478
1482
  <requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
1479
1483
  <title>Title</title>
1480
1484
  <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
1481
- <description><p id="_">I recommend this</p></description>
1485
+ <description><p id="_">I recommend this</p>
1486
+ <ol id='_' type='arabic'>
1487
+ <li>
1488
+ <p id='_'>
1489
+ <link target='http://www.example.com'/>
1490
+ </p>
1491
+ </li>
1492
+ <li>
1493
+ <p id='_'>
1494
+ <xref target='ABC'/>
1495
+ </p>
1496
+ </li>
1497
+ </ol>
1498
+ </description>
1482
1499
  </requirement>
1483
1500
  </sections>
1484
1501
  </standard-document>
@@ -1526,6 +1543,9 @@ OUTPUT
1526
1543
  [.permission]
1527
1544
  =====
1528
1545
  I also permit this
1546
+
1547
+ . List
1548
+ . List
1529
1549
  =====
1530
1550
 
1531
1551
  [requirement,type="general",label="/req/core/quantities-uom"]
@@ -1541,7 +1561,16 @@ OUTPUT
1541
1561
  <p id="_">Example 2</p>
1542
1562
  </example></description>
1543
1563
  <permission id="_">
1544
- <description><p id="_">I also permit this</p></description>
1564
+ <description><p id="_">I also permit this</p>
1565
+ <ol id='_' type='arabic'>
1566
+ <li>
1567
+ <p id='_'>List</p>
1568
+ </li>
1569
+ <li>
1570
+ <p id='_'>List</p>
1571
+ </li>
1572
+ </ol>
1573
+ </description>
1545
1574
  </permission>
1546
1575
  <requirement id='_' type='general'>
1547
1576
  <label>/req/core/quantities-uom</label>
@@ -1015,4 +1015,28 @@ RSpec.describe Asciidoctor::Standoc do
1015
1015
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1016
1016
  .to be_equivalent_to xmlpp(output)
1017
1017
  end
1018
+
1019
+ it "updates anchor reference along with anchor to match content" do
1020
+ input = <<~INPUT
1021
+ #{ASCIIDOC_BLANK_HDR}
1022
+
1023
+ [[samplecode]]
1024
+ .Sample Code
1025
+ ====
1026
+
1027
+ [source,ruby]
1028
+ --
1029
+ puts "Hello, world."
1030
+ %w{a b c}.each do |x| <1>
1031
+ puts x
1032
+ end
1033
+ --
1034
+ <1> This is an annotation
1035
+ ====
1036
+ INPUT
1037
+ output = Nokogiri::XML(Asciidoctor.convert(input, *OPTIONS))
1038
+ callout_id = output.at("//xmlns:callout/@target").text
1039
+ annotation_id = output.at("//xmlns:annotation/@id").text
1040
+ expect(callout_id).to eq(annotation_id)
1041
+ end
1018
1042
  end