metanorma-standoc 1.3.14 → 1.3.15

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: 5f57016af79feef706f7aa6f7ed25429151d28a991a1256d18a7c7f360398a57
4
- data.tar.gz: deb09cc891267c6e447284b92cb4a62681ec2663c80be7ff6e1e6c9c6b0e58ef
3
+ metadata.gz: 1acc5a77f96ed36aad7d5c2aeb90ffc1e36e90e19d4b2c65ef42786a4b92b034
4
+ data.tar.gz: a7705016544389de2276b5aa684acbe9c62251cdb332c92bb24326622ab6712c
5
5
  SHA512:
6
- metadata.gz: 6f28f65b3aa564d8fba875a77237fe4841920cf05823cfc849a65c24b582ced8037ff719e6463526e673ee151f3f00898884141f395ac3ad996ef3e225e081b4
7
- data.tar.gz: 44124272721075937694660b04f7bb1ad3b3348069aa2f56a4353befdd8311f49575686db43a27006b84a5e95173c8a9a4eaf763475baf803f7ffb663f393b4c
6
+ metadata.gz: 5e4e53308b8066826879c486043238acf677be55aead2eeb080a58c006597da3d80e5238979ecf232552d2b0f87d3ca4294b71ad60615423de15ad3207deb741
7
+ data.tar.gz: 64a900f4af17327afd98276f8626130a82c773625bc1fdc8a62ef5d9448a90112084ac9d6f64462883a4a8600342b603e3f7e6260387b454b36840fa9f360c3e
@@ -102,6 +102,7 @@ module Asciidoctor
102
102
  @bibdb = nil
103
103
  @seen_headers = []
104
104
  @datauriimage = node.attr("data-uri-image")
105
+ @boilerplateauthority = node.attr("boilerplate-authority")
105
106
  init_bib_caches(node)
106
107
  init_iev_caches(node)
107
108
  lang = (node.attr("language") || "en")
@@ -57,10 +57,10 @@ module Asciidoctor
57
57
  script_cleanup(xmldoc)
58
58
  docidentifier_cleanup(xmldoc)
59
59
  bookmark_cleanup(xmldoc)
60
- smartquotes_cleanup(xmldoc)
61
60
  requirement_cleanup(xmldoc)
62
61
  bibdata_cleanup(xmldoc)
63
62
  boilerplate_cleanup(xmldoc)
63
+ smartquotes_cleanup(xmldoc)
64
64
  para_cleanup(xmldoc)
65
65
  xmldoc
66
66
  end
@@ -49,17 +49,57 @@ module Asciidoctor
49
49
  NORM_REF = "//bibliography/references[title = 'Normative References' or "\
50
50
  "title = 'Normative references']".freeze
51
51
 
52
- def boilerplate_cleanup(xmldoc)
53
- isodoc = IsoDoc::Convert.new({})
52
+ def boilerplate_isodoc(xmldoc)
53
+ x = xmldoc.dup
54
+ # TODO variable
55
+ x.root.add_namespace(nil, "http://riboseinc.com/isoxml")
56
+ xml = Nokogiri::XML(x.to_xml)
57
+ conv = html_converter(EmptyAttr.new)
54
58
  @lang = xmldoc&.at("//bibdata/language")&.text
55
59
  @script = xmldoc&.at("//bibdata/script")&.text
56
- isodoc.i18n_init(@lang, @script)
60
+ conv.i18n_init(@lang, @script)
61
+ conv.metadata_init(@lang, @script, {})
62
+ conv.info(xml, nil)
63
+ conv
64
+ end
65
+
66
+ def boilerplate_cleanup(xmldoc)
67
+ isodoc = boilerplate_isodoc(xmldoc)
57
68
  f = xmldoc.at(self.class::TERM_CLAUSE) and
58
69
  term_defs_boilerplate(f.at("./title"),
59
70
  xmldoc.xpath(".//termdocsource"),
60
71
  f.at(".//term"), f.at(".//p"), isodoc)
61
72
  f = xmldoc.at(self.class::NORM_REF) and
62
- norm_ref_preface(f)
73
+ norm_ref_preface(f)
74
+ initial_boilerplate(xmldoc, isodoc)
75
+ end
76
+
77
+ def initial_boilerplate(x, isodoc)
78
+ return if x.at("//boilerplate")
79
+ preface = x.at("//preface") || x.at("//sections") || x.at("//annex") ||
80
+ x.at("//references") || return
81
+ b = boilerplate(x, isodoc) or return
82
+ preface.previous = b
83
+ end
84
+
85
+ class EmptyAttr
86
+ def attr(_x)
87
+ nil
88
+ end
89
+ def attributes
90
+ {}
91
+ end
92
+ end
93
+
94
+ def boilerplate_file(xmldoc)
95
+ File.join(@libdir, "boilerplate.xml")
96
+ end
97
+
98
+ def boilerplate(xml, conv)
99
+ file = boilerplate_file(xml)
100
+ file = File.join(@localdir, @boilerplateauthority) if @boilerplateauthority
101
+ !file.nil? and File.exists?(file) or return
102
+ conv.populate_template((File.read(file, encoding: "UTF-8")), nil)
63
103
  end
64
104
 
65
105
  def bibdata_cleanup(xmldoc)
@@ -43,7 +43,16 @@ module Asciidoctor
43
43
  super
44
44
  basebackend "html"
45
45
  outfilesuffix ".xml"
46
- @libdir = File.dirname(__FILE__)
46
+ #@libdir = File.dirname(__FILE__)
47
+ @libdir = File.dirname(self.class::_file || __FILE__)
48
+ end
49
+
50
+ class << self
51
+ attr_accessor :_file
52
+ end
53
+
54
+ def self.inherited( k )
55
+ k._file = caller.first[/^[^:]+/]
47
56
  end
48
57
 
49
58
  # path to isodoc assets in child gems
@@ -88,7 +88,7 @@ module Asciidoctor
88
88
  end.join
89
89
  end
90
90
 
91
- def page_break(_node)
91
+ def page_break(node)
92
92
  noko { |xml| xml.pagebreak }.join
93
93
  end
94
94
 
@@ -42,8 +42,8 @@ module Asciidoctor
42
42
  end
43
43
 
44
44
  def docid(t, code)
45
- type, code1 = /^\[\d+\]$|^\(.+\)$/.match(code) ?
46
- ["metanorma", code.sub(/^\(/, "[").sub(/\)$/, "]")] :
45
+ type, code1 = /^\[\d+\]$|^\([^)]+\).*$/.match(code) ?
46
+ ["metanorma", Utils::mn_code(code)] :
47
47
  @bibdb&.docid_type(code) || [nil, code]
48
48
  code1.sub!(/^nofetch\((.+)\)$/, "\\1")
49
49
  t.docidentifier code1, **attr_code(type: type)
@@ -56,10 +56,11 @@ module Asciidoctor
56
56
 
57
57
  def isorefmatches(xml, m)
58
58
  yr = norm_year(m[:year])
59
- ref = fetch_ref xml, m[:code], yr, title: m[:text]
59
+ ref = fetch_ref xml, m[:code], yr, title: m[:text], usrlbl: m[:usrlbl]
60
60
  return use_my_anchor(ref, m[:anchor]) if ref
61
61
  xml.bibitem **attr_code(ref_attributes(m)) do |t|
62
62
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
63
+ docid(t, m[:usrlbl]) if m[:usrlbl]
63
64
  docid(t, id_and_year(m[:code], yr))
64
65
  yr and t.date **{ type: "published" } do |d|
65
66
  set_date_range(d, yr)
@@ -70,10 +71,12 @@ module Asciidoctor
70
71
 
71
72
  def isorefmatches2(xml, m)
72
73
  ref = fetch_ref xml, m[:code], nil, no_year: true, note: m[:fn],
73
- title: m[:text]
74
+ title: m[:text], usrlbl: m[:usrlbl]
74
75
  return use_my_anchor(ref, m[:anchor]) if ref
76
+
75
77
  xml.bibitem **attr_code(ref_attributes(m)) do |t|
76
78
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
79
+ docid(t, m[:usrlbl]) if m[:usrlbl]
77
80
  docid(t, id_and_year(m[:code], "--"))
78
81
  t.date **{ type: "published" } do |d|
79
82
  d.on "--"
@@ -98,10 +101,12 @@ module Asciidoctor
98
101
  hasyr = m.names.include?("year") && yr != "--"
99
102
  noyr = m.names.include?("year") && yr == "--"
100
103
  ref = fetch_ref xml, m[:code], hasyr ? yr : nil,
101
- all_parts: true, no_year: noyr, text: m[:text]
104
+ all_parts: true, no_year: noyr, text: m[:text], usrlbl: m[:usrlbl]
102
105
  return use_my_anchor(ref, m[:anchor]) if ref
106
+
103
107
  xml.bibitem(**attr_code(ref_attributes(m))) do |t|
104
108
  t.title(**plaintxt) { |i| i << ref_normalise(m[:text]) }
109
+ docid(t, m[:usrlbl]) if m[:usrlbl]
105
110
  docid(t, id_and_year(m[:code], yr) + " (all parts)")
106
111
  conditional_date(t, m, noyr)
107
112
  iso_publisher(t, m[:code])
@@ -115,9 +120,10 @@ module Asciidoctor
115
120
 
116
121
  def fetch_ref(xml, code, year, **opts)
117
122
  return nil if opts[:no_year]
123
+ code = code.sub(/^\([^)]+\)/, "")
118
124
  hit = @bibdb&.fetch(code, year, opts)
119
125
  return nil if hit.nil?
120
- xml.parent.add_child(Utils::smart_render_xml(hit, code, opts[:title]))
126
+ xml.parent.add_child(Utils::smart_render_xml(hit, code, opts[:title], opts[:usrlbl]))
121
127
  xml
122
128
  rescue RelatonBib::RequestError
123
129
  warn "Could not retrieve #{code}: no access to online site"
@@ -129,6 +135,7 @@ module Asciidoctor
129
135
  t.formattedref **{ format: "application/x-isodoc+xml" } do |i|
130
136
  i << ref_normalise_no_format(m[:text])
131
137
  end
138
+ docid(t, m[:usrlbl]) if m[:usrlbl]
132
139
  docid(t, /^\d+$/.match(m[:code]) ? "[#{m[:code]}]" : m[:code])
133
140
  end
134
141
  end
@@ -146,7 +153,7 @@ module Asciidoctor
146
153
  end
147
154
  unless m[:code] && /^\d+$/.match(m[:code])
148
155
  ref = fetch_ref xml, m[:code],
149
- m.names.include?("year") ? m[:year] : nil, { title: m[:text] }
156
+ m.names.include?("year") ? m[:year] : nil, title: m[:text], usrlbl: m[:usrlbl]
150
157
  return use_my_anchor(ref, m[:anchor]) if ref
151
158
  end
152
159
  refitem_render(xml, m)
@@ -154,33 +161,31 @@ module Asciidoctor
154
161
 
155
162
  def ref_normalise(ref)
156
163
  ref.
157
- # gsub(/&#8201;&#8212;&#8201;/, " -- ").
158
164
  gsub(/&amp;amp;/, "&amp;").
159
165
  gsub(%r{^<em>(.*)</em>}, "\\1")
160
166
  end
161
167
 
162
168
  def ref_normalise_no_format(ref)
163
169
  ref.
164
- # gsub(/&#8201;&#8212;&#8201;/, " -- ").
165
170
  gsub(/&amp;amp;/, "&amp;")
166
171
  end
167
172
 
168
173
  ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
169
- \[(?<code>(ISO|IEC)[^0-9]*\s[0-9-]+|IEV)
174
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC)[^0-9]*\s[0-9-]+|IEV)
170
175
  (:(?<year>[0-9][0-9-]+))?\]</ref>,?\s*
171
176
  (?<text>.*)$}xm
172
177
 
173
178
  ISO_REF_NO_YEAR = %r{^<ref\sid="(?<anchor>[^"]+)">
174
- \[(?<code>(ISO|IEC)[^0-9]*\s[0-9-]+):(--|\&\#821[12]\;)\]</ref>,?\s*
179
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC)[^0-9]*\s[0-9-]+):(--|\&\#821[12]\;)\]</ref>,?\s*
175
180
  (<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>)?,?\s?(?<text>.*)$}xm
176
181
 
177
182
  ISO_REF_ALL_PARTS = %r{^<ref\sid="(?<anchor>[^"]+)">
178
- \[(?<code>(ISO|IEC)[^0-9]*\s[0-9]+)(:(?<year>--|\&\#821[12]\;|[0-9][0-9-]+))?\s
183
+ \[(?<usrlbl>\([^)]+\))?(?<code>(ISO|IEC)[^0-9]*\s[0-9]+)(:(?<year>--|\&\#821[12]\;|[0-9][0-9-]+))?\s
179
184
  \(all\sparts\)\]</ref>,?\s*
180
185
  (<fn[^>]*>\s*<p>(?<fn>[^\]]+)</p>\s*</fn>,?\s?)?(?<text>.*)$}xm
181
186
 
182
187
  NON_ISO_REF = %r{^<ref\sid="(?<anchor>[^"]+)">
183
- \[(?<code>[^\]]+?)([:-](?<year>(19|20)[0-9][0-9]))?\]</ref>,?\s*
188
+ \[(?<usrlbl>\([^)]+\))?(?<code>[^\]]+?)([:-](?<year>(19|20)[0-9][0-9]))?\]</ref>,?\s*
184
189
  (?<text>.*)$}xm
185
190
 
186
191
  # @param item [String]
@@ -199,7 +204,6 @@ module Asciidoctor
199
204
  matched, matched2, matched3 = reference1_matches(item)
200
205
  if matched3.nil? && matched2.nil? && matched.nil?
201
206
  refitem(xml, item, node)
202
- # elsif fetch_ref(matched3 || matched2 || matched, xml)
203
207
  elsif !matched.nil? then isorefmatches(xml, matched)
204
208
  elsif !matched2.nil? then isorefmatches2(xml, matched2)
205
209
  elsif !matched3.nil? then isorefmatches3(xml, matched3)
@@ -76,7 +76,11 @@ module Asciidoctor
76
76
  end
77
77
  end
78
78
 
79
- def emend_biblio(xml, code, title)
79
+ def mn_code(code)
80
+ code.sub(/^\(/, "[").sub(/\).*$/, "]").sub(/^nofetch\((.+)\)$/, "\\1")
81
+ end
82
+
83
+ def emend_biblio(xml, code, title, usrlbl)
80
84
  unless xml.at("/bibitem/docidentifier[not(@type = 'DOI')][text()]")
81
85
  warn "ERROR: No document identifier retrieved for #{code}"
82
86
  xml.root << "<docidentifier>#{code}</docidentifier>"
@@ -85,6 +89,8 @@ module Asciidoctor
85
89
  warn "ERROR: No title retrieved for #{code}"
86
90
  xml.root << "<title>#{title || "(MISSING TITLE)"}</title>"
87
91
  end
92
+ usrlbl and xml.at("/bibitem/docidentifier").next =
93
+ "<docidentifier type='metanorma'>#{mn_code(usrlbl)}</docidentifier>"
88
94
  end
89
95
 
90
96
  def endash_date(elem)
@@ -93,10 +99,10 @@ module Asciidoctor
93
99
  end
94
100
  end
95
101
 
96
- def smart_render_xml(x, code, title)
102
+ def smart_render_xml(x, code, title, usrlbl)
97
103
  xstr = x.to_xml if x.respond_to? :to_xml
98
104
  xml = Nokogiri::XML(xstr)
99
- emend_biblio(xml, code, title)
105
+ emend_biblio(xml, code, title, usrlbl)
100
106
  xml.xpath("//date").each { |d| endash_date(d) }
101
107
  xml.traverse do |n|
102
108
  n.text? and n.replace(smartformat(n.text))
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Standoc
3
- VERSION = "1.3.14".freeze
3
+ VERSION = "1.3.15".freeze
4
4
  end
5
5
  end
@@ -1434,6 +1434,47 @@ it "removes bibdata bibitem IDs" do
1434
1434
  OUTPUT
1435
1435
  end
1436
1436
 
1437
+ it "imports boilerplate file" do
1438
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1439
+ = Document title
1440
+ Author
1441
+ :docfile: test.adoc
1442
+ :nodoc:
1443
+ :novalid:
1444
+ :no-isobib:
1445
+ :docstage: 10
1446
+ :boilerplate-authority: spec/assets/boilerplate.xml
1447
+
1448
+ == Clause 1
1449
+
1450
+ INPUT
1451
+ <standard-document xmlns='http://riboseinc.com/isoxml'>
1452
+ <bibdata type='standard'>
1453
+ <title language='en' format='text/plain'>Document title</title>
1454
+ <language>en</language>
1455
+ <script>Latn</script>
1456
+ <status>
1457
+ <stage>10</stage>
1458
+ </status>
1459
+ <copyright>
1460
+ <from>#{Date.today.year}</from>
1461
+ </copyright>
1462
+ <ext>
1463
+ <doctype>article</doctype>
1464
+ </ext>
1465
+ </bibdata>
1466
+ <boilerplate>
1467
+ <text>10</text>
1468
+ </boilerplate>
1469
+ <sections>
1470
+ <clause id='_' inline-header='false' obligation='normative'>
1471
+ <title>Clause 1</title>
1472
+ </clause>
1473
+ </sections>
1474
+ </standard-document>
1475
+ OUTPUT
1476
+ end
1477
+
1437
1478
 
1438
1479
  private
1439
1480
 
@@ -687,19 +687,19 @@ EOS
687
687
  private
688
688
 
689
689
  def mock_isobib_get_123
690
- expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", "2001", {:title=>"<em>Standard</em>"}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
690
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", "2001", {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_DATED))
691
691
  end
692
692
 
693
693
  def mock_isobib_get_123_undated
694
- expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>"}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
694
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_123_UNDATED))
695
695
  end
696
696
 
697
697
  def mock_isobib_get_124
698
- expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 124", "2014", {:title=>"<em>Standard</em>"}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
698
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 124", "2014", {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(ISO_124_DATED))
699
699
  end
700
700
 
701
701
  def mock_ietfbib_get_123
702
- expect(RelatonIetf::IetfBibliography).to receive(:get).with("RFC 123", nil, {:title=>"<em>Standard</em>"}).and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
702
+ expect(RelatonIetf::IetfBibliography).to receive(:get).with("RFC 123", nil, {:title=>"<em>Standard</em>", :usrlbl=>nil}).and_return(RelatonIsoBib::XMLParser.from_xml(IETF_123_SHORT))
703
703
  end
704
704
 
705
705
  end
@@ -10,6 +10,7 @@ RSpec.describe Asciidoctor::Standoc do
10
10
  == Normative References
11
11
 
12
12
  * [[[iso123,ISO 123]]] _Standard_
13
+ * [[[iso124,(1)ISO 123]]] _Standard_
13
14
  INPUT
14
15
  #{BLANK_HDR}
15
16
  <sections>
@@ -26,6 +27,17 @@ RSpec.describe Asciidoctor::Standoc do
26
27
  </organization>
27
28
  </contributor>
28
29
  </bibitem>
30
+ <bibitem id='iso124' type='standard'>
31
+ <title format='text/plain'>Standard</title>
32
+ <docidentifier type='metanorma'>[1]</docidentifier>
33
+ <docidentifier>ISO 123</docidentifier>
34
+ <contributor>
35
+ <role type='publisher'/>
36
+ <organization>
37
+ <name>ISO</name>
38
+ </organization>
39
+ </contributor>
40
+ </bibitem>
29
41
  </references>
30
42
  </bibliography>
31
43
  </standard-document>
@@ -39,6 +51,7 @@ RSpec.describe Asciidoctor::Standoc do
39
51
  == Normative References
40
52
 
41
53
  * [[[iso123,ISO 123:1066-1067]]] _Standard_
54
+ * [[[iso124,(1)ISO 123:1066-1067]]] _Standard_
42
55
  INPUT
43
56
  #{BLANK_HDR}
44
57
  <sections>
@@ -59,6 +72,22 @@ RSpec.describe Asciidoctor::Standoc do
59
72
  </organization>
60
73
  </contributor>
61
74
  </bibitem>
75
+ <bibitem id="iso124" type="standard">
76
+ <title format="text/plain">Standard</title>
77
+ <docidentifier type='metanorma'>[1]</docidentifier>
78
+ <docidentifier>ISO 123:1066-1067</docidentifier>
79
+ <date type="published">
80
+ <from>1066</from>
81
+ <to>1067</to>
82
+ </date>
83
+ <contributor>
84
+ <role type="publisher"/>
85
+ <organization>
86
+ <name>ISO</name>
87
+ </organization>
88
+ </contributor>
89
+ </bibitem>
90
+
62
91
  </references>
63
92
  </bibliography>
64
93
  </standard-document>
@@ -67,12 +96,14 @@ RSpec.describe Asciidoctor::Standoc do
67
96
 
68
97
  it "repairs simple fetched ISO reference" do
69
98
  mock_isobib_get_123_no_docid
99
+ mock_isobib_get_123_no_docid_lbl
70
100
  input = <<~"INPUT"
71
101
  #{ISOBIB_BLANK_HDR}
72
102
  [bibliography]
73
103
  == Normative References
74
104
 
75
105
  * [[[iso123,ISO 123]]] _Standard_
106
+ * [[[iso124,(1)ISO 123]]] _Standard_
76
107
  INPUT
77
108
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp( <<~"OUTPUT")
78
109
  #{BLANK_HDR}
@@ -122,7 +153,53 @@ RSpec.describe Asciidoctor::Standoc do
122
153
  </relation>
123
154
  <docidentifier>ISO 123</docidentifier>
124
155
  <title><em>Standard</em></title>
125
- </bibitem> </references></bibliography>
156
+ </bibitem>
157
+ <bibitem type="standard" id="iso124">
158
+ <uri type="src">https://www.iso.org/standard/23281.html</uri>
159
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
160
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
161
+ <date type="published">
162
+ <on>2001</on>
163
+ </date>
164
+ <contributor>
165
+ <role type="publisher"/>
166
+ <organization>
167
+ <name>International Organization for Standardization</name>
168
+ <abbreviation>ISO</abbreviation>
169
+ <uri>www.iso.org</uri>
170
+ </organization>
171
+ </contributor>
172
+ <edition>3</edition>
173
+ <language>en</language>
174
+ <language>fr</language>
175
+ <script>Latn</script>
176
+ <status>
177
+ <stage>Published</stage>
178
+ </status>
179
+ <copyright>
180
+ <from>2001</from>
181
+ <owner>
182
+ <organization>
183
+ <name>ISO</name>
184
+ <abbreviation/>
185
+ </organization>
186
+ </owner>
187
+ </copyright>
188
+ <relation type="obsoletes">
189
+ <bibitem type="standard">
190
+ <formattedref format="text/plain">ISO 123:1985</formattedref>
191
+ </bibitem>
192
+ </relation>
193
+ <relation type="updates">
194
+ <bibitem type="standard">
195
+ <formattedref format="text/plain">ISO 123:2001</formattedref>
196
+ </bibitem>
197
+ </relation>
198
+ <docidentifier>ISO 123</docidentifier>
199
+ <docidentifier type='metanorma'>[1]</docidentifier>
200
+ <title><em>Standard</em></title>
201
+ </bibitem>
202
+ </references></bibliography>
126
203
  </standard-document>
127
204
  OUTPUT
128
205
  expect { Asciidoctor.convert(input, backend: :standoc, header_footer: true) }.to output(/ERROR: No document identifier retrieved for ISO 123/).to_stderr
@@ -137,6 +214,7 @@ RSpec.describe Asciidoctor::Standoc do
137
214
  == Normative References
138
215
 
139
216
  * [[[iso123,ISO 123]]] _Standard_
217
+ * [[[iso123,(1)ISO 123]]] _Standard_
140
218
  INPUT
141
219
  #{BLANK_HDR}
142
220
  <sections>
@@ -189,7 +267,56 @@ RSpec.describe Asciidoctor::Standoc do
189
267
  </bibitem>
190
268
  </relation>
191
269
  <place>Geneva</place>
192
- </bibitem> </references></bibliography>
270
+ </bibitem>
271
+ <bibitem id="iso123" type="standard">
272
+ <fetched>#{Date.today}</fetched>
273
+ <title type="title-intro" format="text/plain" language="en" script="Latn">Rubber latex</title>
274
+ <title type="title-main" format="text/plain" language="en" script="Latn">Sampling</title>
275
+ <title type="main" format="text/plain" language="en" script="Latn">Rubber latex – Sampling</title>
276
+ <title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title>
277
+ <title type="title-main" format="text/plain" language="fr" script="Latn">Échantillonnage</title>
278
+ <title type="main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc – Échantillonnage</title>
279
+ <uri type="src">https://www.iso.org/standard/23281.html</uri>
280
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
281
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
282
+ <docidentifier type="ISO">ISO 123:2001</docidentifier>
283
+ <docidentifier type='metanorma'>[1]</docidentifier>
284
+ <docnumber>123</docnumber>
285
+ <date type="published">
286
+ <on>2001</on>
287
+ </date>
288
+ <contributor>
289
+ <role type="publisher"/>
290
+ <organization>
291
+ <name>International Organization for Standardization</name>
292
+ <abbreviation>ISO</abbreviation>
293
+ <uri>www.iso.org</uri>
294
+ </organization>
295
+ </contributor>
296
+ <edition>3</edition>
297
+ <language>en</language>
298
+ <language>fr</language>
299
+ <script>Latn</script>
300
+ <status>
301
+ <stage>90</stage>
302
+ <substage>93</substage>
303
+ </status>
304
+ <copyright>
305
+ <from>2001</from>
306
+ <owner>
307
+ <organization>
308
+ <name>ISO</name>
309
+ </organization>
310
+ </owner>
311
+ </copyright>
312
+ <relation type="obsoletes">
313
+ <bibitem type="standard">
314
+ <formattedref format="text/plain">ISO 123:1985</formattedref>
315
+ </bibitem>
316
+ </relation>
317
+ <place>Geneva</place>
318
+ </bibitem>
319
+ </references></bibliography>
193
320
  </standard-document>
194
321
  OUTPUT
195
322
  =begin
@@ -253,6 +380,7 @@ RSpec.describe Asciidoctor::Standoc do
253
380
  == Normative References
254
381
 
255
382
  * [[[iso123,IEC 123]]] _Standard_
383
+ * [[[iso124,(1)IEC 123]]] _Standard_
256
384
  INPUT
257
385
  #{BLANK_HDR}
258
386
  <sections>
@@ -269,6 +397,17 @@ RSpec.describe Asciidoctor::Standoc do
269
397
  </organization>
270
398
  </contributor>
271
399
  </bibitem>
400
+ <bibitem id='iso124' type='standard'>
401
+ <title format='text/plain'>Standard</title>
402
+ <docidentifier type='metanorma'>[1]</docidentifier>
403
+ <docidentifier>IEC 123</docidentifier>
404
+ <contributor>
405
+ <role type='publisher'/>
406
+ <organization>
407
+ <name>IEC</name>
408
+ </organization>
409
+ </contributor>
410
+ </bibitem>
272
411
  </references>
273
412
  </bibliography>
274
413
  </standard-document>
@@ -286,6 +425,8 @@ RSpec.describe Asciidoctor::Standoc do
286
425
 
287
426
  * [[[iso123,ISO/IEC TR 12382:1992]]] _Standard_
288
427
  * [[[iso124,ISO 124:2014]]] _Standard_
428
+ * [[[iso125,(1)ISO/IEC TR 12382:1992]]] _Standard_
429
+ * [[[iso126,(1)ISO 124:2014]]] _Standard_
289
430
  INPUT
290
431
  #{BLANK_HDR}
291
432
  <sections>
@@ -390,6 +531,106 @@ RSpec.describe Asciidoctor::Standoc do
390
531
  </bibitem>
391
532
  </relation>
392
533
  <place>Geneva</place>
534
+ </bibitem>
535
+ <bibitem type="standard" id="iso125">
536
+ <fetched>#{Date.today}</fetched>
537
+ <title type="title-main" format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
538
+ <title type="main" format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
539
+ <title type="title-main" format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l’information</title>
540
+ <title type="main" format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l’information</title>
541
+ <uri type="src">https://www.iso.org/standard/21071.html</uri>
542
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
543
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
544
+ <docidentifier type="ISO">ISO/IEC TR 12382:1992</docidentifier>
545
+ <docidentifier type='metanorma'>[1]</docidentifier>
546
+ <docnumber>12382</docnumber>
547
+ <date type="published">
548
+ <on>1992</on>
549
+ </date>
550
+ <contributor>
551
+ <role type="publisher"/>
552
+ <organization>
553
+ <name>International Organization for Standardization</name>
554
+ <abbreviation>ISO</abbreviation>
555
+ <uri>www.iso.org</uri>
556
+ </organization>
557
+ </contributor>
558
+ <contributor>
559
+ <role type="publisher"/>
560
+ <organization>
561
+ <name>International Electrotechnical Commission</name>
562
+ <abbreviation>IEC</abbreviation>
563
+ <uri>www.iec.ch</uri>
564
+ </organization>
565
+ </contributor>
566
+ <edition>2</edition>
567
+ <language>en</language>
568
+ <language>fr</language>
569
+ <script>Latn</script>
570
+ <abstract format="text/plain" language="en" script="Latn">Contains a permuted index of all terms included in the parts 1 — 28 of ISO 2382. If any of these parts has been revised, the present TR refers to the revision.</abstract>
571
+ <status>
572
+ <stage>90</stage>
573
+ <substage>93</substage>
574
+ </status>
575
+ <copyright>
576
+ <from>1992</from>
577
+ <owner>
578
+ <organization>
579
+ <name>ISO/IEC</name>
580
+ </organization>
581
+ </owner>
582
+ </copyright>
583
+ <place>Geneva</place>
584
+ </bibitem>
585
+ <bibitem type="standard" id="iso126">
586
+ <fetched>#{Date.today}</fetched>
587
+ <title type="title-intro" format="text/plain" language="en" script="Latn">Latex, rubber</title>
588
+ <title type="title-main" format="text/plain" language="en" script="Latn">Determination of total solids content</title>
589
+ <title type="main" format="text/plain" language="en" script="Latn">Latex, rubber – Determination of total solids content</title>
590
+ <title type="title-intro" format="text/plain" language="fr" script="Latn">Latex de caoutchouc</title>
591
+ <title type="title-main" format="text/plain" language="fr" script="Latn">Détermination des matières solides totales</title>
592
+ <title type="main" format="text/plain" language="fr" script="Latn">Latex de caoutchouc – Détermination des matières solides totales</title>
593
+ <uri type="src">https://www.iso.org/standard/61884.html</uri>
594
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
595
+ <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
596
+ <docidentifier type="ISO">ISO 124:2014</docidentifier>
597
+ <docidentifier type='metanorma'>[1]</docidentifier>
598
+ <docnumber>124</docnumber>
599
+ <date type="published">
600
+ <on>2014</on>
601
+ </date>
602
+ <contributor>
603
+ <role type="publisher"/>
604
+ <organization>
605
+ <name>International Organization for Standardization</name>
606
+ <abbreviation>ISO</abbreviation>
607
+ <uri>www.iso.org</uri>
608
+ </organization>
609
+ </contributor>
610
+ <edition>7</edition>
611
+ <language>en</language>
612
+ <language>fr</language>
613
+ <script>Latn</script>
614
+ <abstract format="text/plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract>
615
+ <abstract format="text/plain" language="fr" script="Latn">L’ISO 124:2014 spécifie des méthodes pour la détermination des matières solides totales dans le latex de plantation, le latex de concentré de caoutchouc naturel et le latex de caoutchouc synthétique. Ces méthodes ne conviennent pas nécessairement au latex d’origine naturelle autre que celui de l’Hevea brasiliensis, au latex vulcanisé, aux mélanges de latex, ou aux dispersions artificielles de caoutchouc.</abstract>
616
+ <status>
617
+ <stage>90</stage>
618
+ <substage>93</substage>
619
+ </status>
620
+ <copyright>
621
+ <from>2014</from>
622
+ <owner>
623
+ <organization>
624
+ <name>ISO</name>
625
+ </organization>
626
+ </owner>
627
+ </copyright>
628
+ <relation type="obsoletes">
629
+ <bibitem type="standard">
630
+ <formattedref format="text/plain">ISO 124:2011</formattedref>
631
+ </bibitem>
632
+ </relation>
633
+ <place>Geneva</place>
393
634
  </bibitem>
394
635
  </references></bibliography>
395
636
  </standard-document>
@@ -485,6 +726,7 @@ OUTPUT
485
726
  * [[[iso123,ISO 123:--]]] _Standard_
486
727
  * [[[iso124,ISO 124:—]]]{blank}footnote:[The standard is in press] _Standard_
487
728
  * [[[iso125,ISO 125:&ndash;]]], footnote:[The standard is in press] _Standard_
729
+ * [[[iso126,(1)ISO 123:--]]] _Standard_
488
730
  INPUT
489
731
  #{BLANK_HDR}
490
732
  <sections>
@@ -532,6 +774,20 @@ OUTPUT
532
774
  </contributor>
533
775
  <note format="text/plain">ISO DATE: The standard is in press</note>
534
776
  </bibitem>
777
+ <bibitem id='iso126' type='standard'>
778
+ <title format='text/plain'>Standard</title>
779
+ <docidentifier type='metanorma'>[1]</docidentifier>
780
+ <docidentifier>ISO 123:—</docidentifier>
781
+ <date type='published'>
782
+ <on>–</on>
783
+ </date>
784
+ <contributor>
785
+ <role type='publisher'/>
786
+ <organization>
787
+ <name>ISO</name>
788
+ </organization>
789
+ </contributor>
790
+ </bibitem>
535
791
  </references>
536
792
  </bibliography>
537
793
  </standard-document>
@@ -547,6 +803,7 @@ OUTPUT
547
803
  == Normative References
548
804
 
549
805
  * [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
806
+ * [[[iso124,(1)ISO 123:1066 (all parts)]]] _Standard_
550
807
  INPUT
551
808
  #{BLANK_HDR}
552
809
  <sections>
@@ -569,6 +826,23 @@ OUTPUT
569
826
  <referenceFrom>all</referenceFrom>
570
827
  </extent>
571
828
  </bibitem>
829
+ <bibitem id='iso124' type='standard'>
830
+ <title format='text/plain'>Standard</title>
831
+ <docidentifier type='metanorma'>[1]</docidentifier>
832
+ <docidentifier>ISO 123:1066 (all parts)</docidentifier>
833
+ <date type='published'>
834
+ <on>1066</on>
835
+ </date>
836
+ <contributor>
837
+ <role type='publisher'/>
838
+ <organization>
839
+ <name>ISO</name>
840
+ </organization>
841
+ </contributor>
842
+ <extent type='part'>
843
+ <referenceFrom>all</referenceFrom>
844
+ </extent>
845
+ </bibitem>
572
846
  </references>
573
847
  </bibliography>
574
848
  </standard-document>
@@ -584,6 +858,7 @@ OUTPUT
584
858
  == Normative References
585
859
 
586
860
  * [[[iso123,IETF(RFC 8341)]]], _Standard_
861
+ * [[[iso124,(1)IETF(RFC 8341)]]], _Standard_
587
862
 
588
863
  == Clause 4
589
864
 
@@ -651,6 +926,59 @@ OUTPUT
651
926
  <number>8341</number>
652
927
  </series>
653
928
  <place>Fremont, CA</place>
929
+ </bibitem>
930
+ <bibitem id="iso124" type="standard">
931
+ <fetched>#{Date.today}</fetched>
932
+ <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
933
+ <uri type='xml'>https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml</uri>
934
+ <uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
935
+ <docidentifier type="IETF">RFC 8341</docidentifier>
936
+ <docidentifier type='metanorma'>[1]</docidentifier>
937
+ <docidentifier type='rfc-anchor'>RFC8341</docidentifier>
938
+ <docidentifier type="DOI">10.17487/RFC8341</docidentifier>
939
+ <date type="published">
940
+ <on>2018-03</on>
941
+ </date>
942
+ <contributor>
943
+ <role type="author"/>
944
+ <person>
945
+ <name>
946
+ <completename language="en">A. Bierman</completename>
947
+ </name>
948
+ <affiliation>
949
+ <organization>
950
+ <name>IETF</name>
951
+ <abbreviation>IETF</abbreviation>
952
+ </organization>
953
+ </affiliation>
954
+ </person>
955
+ </contributor>
956
+ <contributor>
957
+ <role type="author"/>
958
+ <person>
959
+ <name>
960
+ <completename language="en">M. Bjorklund</completename>
961
+ </name>
962
+ <affiliation>
963
+ <organization>
964
+ <name>IETF</name>
965
+ <abbreviation>IETF</abbreviation>
966
+ </organization>
967
+ </affiliation>
968
+ </person>
969
+ </contributor>
970
+ <language>en</language>
971
+ <script>Latn</script>
972
+ <abstract format="text/plain" language="en" script="Latn">The standardization of network configuration interfaces for use with the Network Configuration Protocol (NETCONF) or the RESTCONF protocol requires a structured and secure operating environment that promotes human usability and multi-vendor interoperability. There is a need for standard mechanisms to restrict NETCONF or RESTCONF protocol access for particular users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content. This document defines such an access control model.This document obsoletes RFC 6536.</abstract>
973
+ <series type="main">
974
+ <title format="text/plain" language="en" script="Latn">STD</title>
975
+ <number>91</number>
976
+ </series>
977
+ <series type="main">
978
+ <title format="text/plain" language="en" script="Latn">RFC</title>
979
+ <number>8341</number>
980
+ </series>
981
+ <place>Fremont, CA</place>
654
982
  </bibitem>
655
983
  </references>
656
984
  </bibliography>
@@ -666,6 +994,7 @@ OUTPUT
666
994
  == Normative References
667
995
 
668
996
  * [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
997
+ * [[[iso124,(1)XYZ 123:1066 (all parts)]]] _Standard_
669
998
  INPUT
670
999
  #{BLANK_HDR}
671
1000
  <sections>
@@ -679,6 +1008,13 @@ OUTPUT
679
1008
  </formattedref>
680
1009
  <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
681
1010
  </bibitem>
1011
+ <bibitem id='iso124'>
1012
+ <formattedref format='application/x-isodoc+xml'>
1013
+ <em>Standard</em>
1014
+ </formattedref>
1015
+ <docidentifier type='metanorma'>[1]</docidentifier>
1016
+ <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
1017
+ </bibitem>
682
1018
  </references>
683
1019
  </bibliography>
684
1020
  </standard-document>
@@ -695,6 +1031,7 @@ OUTPUT
695
1031
  * [[[iso124,(B)]]] _Standard_
696
1032
  * [[[iso125,1]]] _Standard_
697
1033
  * [[[iso126,(A)]]] _Standard_
1034
+ * [[[iso127,(4)XYZ 123:1066 (all parts)]]] _Standard_
698
1035
  INPUT
699
1036
  #{BLANK_HDR}
700
1037
  <sections>
@@ -722,6 +1059,13 @@ OUTPUT
722
1059
  </formattedref>
723
1060
  <docidentifier type="metanorma">[A]</docidentifier>
724
1061
  </bibitem>
1062
+ <bibitem id='iso127'>
1063
+ <formattedref format='application/x-isodoc+xml'>
1064
+ <em>Standard</em>
1065
+ </formattedref>
1066
+ <docidentifier type='metanorma'>[5]</docidentifier>
1067
+ <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
1068
+ </bibitem>
725
1069
  </references>
726
1070
  </bibliography>
727
1071
  </standard-document>
@@ -738,6 +1082,7 @@ OUTPUT
738
1082
  == Normative References
739
1083
 
740
1084
  * [[[iso123,ISO 123]]] _Standard_
1085
+ * [[[iso124,(1)ISO 123]]] _Standard_
741
1086
  INPUT
742
1087
  <?xml version="1.0" encoding="UTF-8"?>
743
1088
  <standard-document xmlns="http://riboseinc.com/isoxml">
@@ -768,6 +1113,17 @@ OUTPUT
768
1113
  </organization>
769
1114
  </contributor>
770
1115
  </bibitem>
1116
+ <bibitem id='iso124' type='standard'>
1117
+ <title format='text/plain'>Standard</title>
1118
+ <docidentifier type='metanorma'>[1]</docidentifier>
1119
+ <docidentifier type='ISO'>ISO 123</docidentifier>
1120
+ <contributor>
1121
+ <role type='publisher'/>
1122
+ <organization>
1123
+ <name>ISO</name>
1124
+ </organization>
1125
+ </contributor>
1126
+ </bibitem>
771
1127
  </references></bibliography>
772
1128
  </standard-document>
773
1129
  OUTPUT
@@ -786,7 +1142,15 @@ OUTPUT
786
1142
  end
787
1143
 
788
1144
  def mock_isobib_get_123_no_docid
789
- expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>"}) do
1145
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>", usrlbl: nil}) do
1146
+ RelatonBib::XMLParser.from_xml(<<~"OUTPUT")
1147
+ <bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
1148
+ OUTPUT
1149
+ end.exactly(2).times
1150
+ end
1151
+
1152
+ def mock_isobib_get_123_no_docid_lbl
1153
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:title=>"<em>Standard</em>", usrlbl: "(1)"}) do
790
1154
  RelatonBib::XMLParser.from_xml(<<~"OUTPUT")
791
1155
  <bibitem type=\"standard\" id=\"ISO123\">\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status><stage>Published</stage></status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem type="standard">\n <formattedref format="text/plain">ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
792
1156
  OUTPUT