isodoc 1.8.4 → 2.0.2

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: 3189a7f65994e9185f29009eb40bb6589c83f579996199d34c669b44883a6548
4
- data.tar.gz: 8462af8b54793cbc7dda2e98a2005a8ec11d4d17657a3fb63b3f2865950cf8c9
3
+ metadata.gz: 24d03a8703e3e07a41ac1344228f49be574f4902673eff50ec8423b9f313e02f
4
+ data.tar.gz: a1b243c61998b9321e08e95d16f6239a5f14642203e9c2df8c4cec467e8ab10e
5
5
  SHA512:
6
- metadata.gz: 4cd5b57e05c214e49e703f808799195e4b1d7b158a9e07fd4e728a369b8f1406d735eb7576e182abe28ba40529dc22a70db28f50e77f2548aed08ae0ff139d5c
7
- data.tar.gz: 12eb151374efdde8fd26302aeecdde46e25a7db4147f4bbf1dd54256f460f8ef5f29880bbaa170171abb5d451bf11b1d1b29ff24bbba15746d28249f5ec283f6
6
+ metadata.gz: 51994dfea115e9442ce50fc4ad92f4c478708df0640946c9fdc08965f943cdcf374bc3173ad80abc522af5c45d6224e638411c6c250277b9b11f3037c9b4f548
7
+ data.tar.gz: 1cb56a7760c7bec32a1f1fc144bb74c5d85eed4eddd4b856f0946e560423bece052efe4b7b2fe111d7a50838dbe4110f51fe9fff3577dbc866a0a85dfc6c477b
@@ -10,34 +10,6 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: [ '3.0', '2.7', '2.6', '2.5' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- steps:
23
- - uses: actions/checkout@master
24
-
25
- - uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby }}
28
- bundler-cache: true
29
-
30
- - uses: metanorma/metanorma-build-scripts/inkscape-setup-action@master
31
-
32
- - run: bundle exec rake
33
-
34
- tests-passed:
35
- needs: rake
36
- runs-on: ubuntu-latest
37
- steps:
38
- - uses: peter-evans/repository-dispatch@v1
39
- with:
40
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
41
- repository: ${{ github.repository }}
42
- event-type: tests-passed
43
- client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
13
+ uses: metanorma/metanorma-build-scripts/.github/workflows/inkscape-rake.yml@main
14
+ secrets:
15
+ pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/Gemfile CHANGED
@@ -10,4 +10,3 @@ if File.exist? "Gemfile.devel"
10
10
  eval File.read("Gemfile.devel"), nil, "Gemfile.devel" # rubocop:disable Security/Eval
11
11
  end
12
12
 
13
- gem "reline", "~> 0.2.8.pre.11"
data/isodoc.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
30
30
 
31
31
  spec.add_dependency "asciimath"
32
- spec.add_dependency "html2doc", "~> 1.2.0"
32
+ spec.add_dependency "html2doc", "~> 1.3.0"
33
33
  spec.add_dependency "htmlentities", "~> 4.3.4"
34
34
  spec.add_dependency "liquid", "~> 4"
35
35
  # spec.add_dependency "metanorma", ">= 1.2.0"
@@ -14,27 +14,28 @@ module IsoDoc
14
14
  def nonstd_bibitem(list, bib, ordinal, biblio)
15
15
  list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
16
16
  ids = bibitem_ref_code(bib)
17
- identifiers = render_identifier(ids)
18
- if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
17
+ idents = render_identifier(ids)
18
+ if biblio then ref_entry_code(ref, ordinal, idents, ids)
19
19
  else
20
- ref << (identifiers[0] || identifiers[1]).to_s
21
- ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
20
+ ref << (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
21
+ ref << ", #{idents[sdo]}" if idents[:ordinal] && idents[:sdo]
22
22
  end
23
- ref << ", " unless biblio && !identifiers[1]
23
+ ref << ", " unless biblio && !idents[:sdo]
24
24
  reference_format(bib, ref)
25
25
  end
26
26
  end
27
27
 
28
28
  def std_bibitem_entry(list, bib, ordinal, biblio)
29
29
  list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref|
30
- identifiers = render_identifier(bibitem_ref_code(bib))
31
- if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
30
+ idents = render_identifier(bibitem_ref_code(bib))
31
+ if biblio then ref_entry_code(ref, ordinal, idents, nil)
32
32
  else
33
- ref << (identifiers[0] || identifiers[1]).to_s
34
- ref << ", #{identifiers[1]}" if identifiers[0] && identifiers[1]
33
+ ref << (idents[:ordinal] || idents[:metanorma] || idents[:sdo]).to_s
34
+ ref << ", #{idents[:sdo]}" if (idents[:ordinal] ||
35
+ idents[:metanorma]) && idents[:sdo]
35
36
  end
36
37
  date_note_process(bib, ref)
37
- ref << ", " unless biblio && !identifiers[1]
38
+ ref << ", " unless biblio && !idents[:sdo]
38
39
  reference_format(bib, ref)
39
40
  end
40
41
  end
@@ -42,13 +43,15 @@ module IsoDoc
42
43
  # if ids is just a number, only use that ([1] Non-Standard)
43
44
  # else, use both ordinal, as prefix, and ids
44
45
  def ref_entry_code(ref, ordinal, ids, _id)
45
- prefix_bracketed_ref(ref, ids[0] || "[#{ordinal}]")
46
- ids[1] and ref << (ids[1]).to_s
46
+ prefix_bracketed_ref(ref, ids[:ordinal] || ids[:metanorma] ||
47
+ "[#{ordinal}]")
48
+ ids[:sdo] and ref << (ids[:sdo]).to_s
47
49
  end
48
50
 
49
51
  def pref_ref_code(bib)
50
52
  bib.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
51
- "or @type = 'ISSN' or @type = 'ISBN' or "\
53
+ "or @type = 'metanorma-ordinal' or "\
54
+ "@type = 'ISSN' or @type = 'ISBN' or "\
52
55
  "@type = 'rfc-anchor')]"))
53
56
  end
54
57
 
@@ -58,11 +61,12 @@ module IsoDoc
58
61
  id1 = pref_ref_code(bib)
59
62
  id2 = bib.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or "\
60
63
  "@type = 'ISBN']"))
61
- return [id, id1, id2] if id || id1 || id2
64
+ id3 = bib.at(ns("./docidentifier[@type = 'metanorma-ordinal']"))
65
+ return [id, id1, id2, id3] if id || id1 || id2 || id3
62
66
 
63
67
  id = Nokogiri::XML::Node.new("docidentifier", bib.document)
64
68
  id << "(NO ID)"
65
- [nil, id, nil]
69
+ [nil, id, nil, nil]
66
70
  end
67
71
 
68
72
  def bracket_if_num(num)
@@ -74,10 +78,15 @@ module IsoDoc
74
78
  num
75
79
  end
76
80
 
81
+ def unbracket(ident)
82
+ ident&.text&.sub(/^\[/, "")&.sub(/\]$/, "")
83
+ end
84
+
77
85
  def render_identifier(ident)
78
- [bracket_if_num(ident[0]),
79
- ident[1].nil? ? nil : ident[1].text.sub(/^\[/, "").sub(/\]$/, ""),
80
- ident[2].nil? ? nil : ident[2].text.sub(/^\[/, "").sub(/\]$/, "")]
86
+ { metanorma: bracket_if_num(ident[0]),
87
+ sdo: unbracket(ident[1]),
88
+ doi: unbracket(ident[2]),
89
+ ordinal: bracket_if_num(ident[3]) }
81
90
  end
82
91
 
83
92
  def docid_prefix(prefix, docid)
@@ -89,7 +98,7 @@ module IsoDoc
89
98
  def omit_docid_prefix(prefix)
90
99
  return true if prefix.nil? || prefix.empty?
91
100
 
92
- %w(ISO IEC IEV ITU W3C csd metanorma repository rfc-anchor)
101
+ %w(ISO IEC IEV ITU W3C csd metanorma repository metanorma-ordinal)
93
102
  .include? prefix
94
103
  end
95
104
 
@@ -133,7 +142,7 @@ module IsoDoc
133
142
  end
134
143
  end
135
144
 
136
- def is_standard(bib)
145
+ def standard?(bib)
137
146
  ret = false
138
147
  drop = %w(metanorma DOI ISSN ISBN)
139
148
  bib.xpath(ns("./docidentifier")).each do |id|
@@ -151,7 +160,7 @@ module IsoDoc
151
160
  next if implicit_reference(b)
152
161
 
153
162
  i += 1
154
- if is_standard(b) then std_bibitem_entry(div, b, i, biblio)
163
+ if standard?(b) then std_bibitem_entry(div, b, i, biblio)
155
164
  else nonstd_bibitem(div, b, i, biblio)
156
165
  end
157
166
  else
@@ -166,7 +175,7 @@ module IsoDoc
166
175
  end
167
176
 
168
177
  def norm_ref(isoxml, out, num)
169
- f = isoxml.at(ns(norm_ref_xpath)) and f["hidden"] != "true" or
178
+ (f = isoxml.at(ns(norm_ref_xpath)) and f["hidden"] != "true") or
170
179
  return num
171
180
  out.div do |div|
172
181
  num = num + 1
@@ -186,7 +195,7 @@ module IsoDoc
186
195
  end
187
196
 
188
197
  def bibliography(isoxml, out)
189
- f = isoxml.at(ns(bibliography_xpath)) and f["hidden"] != "true" or
198
+ (f = isoxml.at(ns(bibliography_xpath)) and f["hidden"] != "true") or
190
199
  return
191
200
  page_break(out)
192
201
  out.div do |div|
@@ -54,11 +54,12 @@ module IsoDoc
54
54
  end
55
55
  end
56
56
 
57
+ # top level clause names
57
58
  def clause_name(_num, title, div, header_class)
59
+ preceding_floating_titles(title, div)
58
60
  header_class = {} if header_class.nil?
59
61
  div.h1 **attr_code(header_class) do |h1|
60
- if title.is_a?(String)
61
- h1 << title
62
+ if title.is_a?(String) then h1 << title
62
63
  else
63
64
  title&.children&.each { |c2| parse(c2, h1) }
64
65
  clause_parse_subtitle(title, h1)
@@ -68,6 +69,7 @@ module IsoDoc
68
69
  end
69
70
 
70
71
  def annex_name(_annex, name, div)
72
+ preceding_floating_titles(name, div)
71
73
  return if name.nil?
72
74
 
73
75
  div.h1 **{ class: "Annex" } do |t|
@@ -76,7 +78,24 @@ module IsoDoc
76
78
  end
77
79
  end
78
80
 
79
- def variant_title(_node, _out); end
81
+ def variant_title(node, out)
82
+ out.p **attr_code(style: "display:none;",
83
+ class: "variant-title-#{node['type']}") do |p|
84
+ node.children.each { |c| parse(c, p) }
85
+ end
86
+ end
87
+
88
+ def preceding_floating_titles(name, div)
89
+ return if name.nil? || name.is_a?(String)
90
+
91
+ out = name.parent.xpath("./preceding-sibling::*")
92
+ .reverse.each_with_object([]) do |p, m|
93
+ break m unless p.name == "p"
94
+
95
+ m << p
96
+ end or return
97
+ out.each { |c| parse(c, div) }
98
+ end
80
99
  end
81
100
  end
82
101
  end
@@ -129,6 +129,7 @@ module IsoDoc
129
129
 
130
130
  def header_strip(hdr)
131
131
  h1 = to_xhtml_fragment(hdr.to_s.gsub(%r{<br\s*/>}, " ")
132
+ .gsub(%r{</?p(\s[^>]+)?>}, "")
132
133
  .gsub(/<\/?h[123456][^>]*>/, "").gsub(/<\/?b[^>]*>/, "").dup)
133
134
  h1.traverse do |x|
134
135
  if x.name == "span" && /mso-tab-count/.match(x["style"])
@@ -122,8 +122,10 @@ module IsoDoc
122
122
  end
123
123
 
124
124
  def html_toc_entry(level, header)
125
+ content = header.at("./following-sibling::p"\
126
+ "[@class = 'variant-title-toc']") || header
125
127
  %(<li class="#{level}"><a href="##{header['id']}">\
126
- #{header_strip(header)}</a></li>)
128
+ #{header_strip(content)}</a></li>)
127
129
  end
128
130
 
129
131
  def toclevel_classes
@@ -144,7 +146,7 @@ module IsoDoc
144
146
  idx = docxml.at("//div[@id = 'toc']") or return docxml
145
147
  toc = "<ul>"
146
148
  path = toclevel_classes.map do |l|
147
- "//main//#{l}[not(@class = 'TermNum')][not(@class = 'noTOC')][text()]"
149
+ "//main//#{l}#{toc_exclude_class}"
148
150
  end
149
151
  docxml.xpath(path.join(" | ")).each_with_index do |h, tocidx|
150
152
  h["id"] ||= "toc#{tocidx}"
@@ -154,6 +156,11 @@ module IsoDoc
154
156
  docxml
155
157
  end
156
158
 
159
+ def toc_exclude_class
160
+ "[not(@class = 'TermNum')][not(@class = 'noTOC')]"\
161
+ "[string-length(normalize-space(.))>0]"
162
+ end
163
+
157
164
  # presupposes that the image source is local
158
165
  def move_images(docxml)
159
166
  FileUtils.rm_rf tmpimagedir
@@ -10,12 +10,6 @@ module IsoDoc
10
10
  "</localized-strings>"
11
11
  end
12
12
 
13
- def docid_prefixes(docxml)
14
- docxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
15
- i.children = @xrefs.klass.docid_prefix(i["type"], i.text)
16
- end
17
- end
18
-
19
13
  def address_precompose(bib)
20
14
  bib.xpath(ns("//bibdata//address")).each do |b|
21
15
  next if b.at(ns("./formattedAddress"))
@@ -26,12 +26,14 @@ module IsoDoc
26
26
  .each do |f|
27
27
  floattitle1(f)
28
28
  end
29
+ # top-level
30
+ docxml.xpath(ns("//sections | //preface")).each { |f| floattitle1(f) }
29
31
  end
30
32
 
31
33
  def floattitle1(elem)
32
- level = @xrefs.anchor(elem["id"], :level, false) || "1"
33
- elem.xpath(ns("./p[@type = 'floating-title']")).each do |p|
34
- p["depth"] = level.to_i + 1
34
+ elem.xpath(ns(".//floating-title")).each do |p|
35
+ p.name = "p"
36
+ p["type"] = "floating-title"
35
37
  end
36
38
  end
37
39
 
@@ -60,7 +62,29 @@ module IsoDoc
60
62
  prefix_name(elem, "", "#{lbl}#{clausedelim}", "name")
61
63
  end
62
64
 
63
- def references(docxml); end
65
+ def references(docxml)
66
+ bibliography_bibitem_number(docxml)
67
+ end
68
+
69
+ def bibliography_bibitem_number_skip(bibitem)
70
+ @xrefs.klass.implicit_reference(bibitem) ||
71
+ bibitem.at(ns(".//docidentifier[@type = 'metanorma']")) ||
72
+ bibitem.at(ns(".//docidentifier[@type = 'metanorma-ordinal']"))
73
+ # || @xrefs.klass.standard?(bibitem)
74
+ end
75
+
76
+ def bibliography_bibitem_number(docxml)
77
+ i = 0
78
+ docxml.xpath(ns("//references[@normative = 'false']/bibitem")).each do |b|
79
+ next if bibliography_bibitem_number_skip(b)
80
+
81
+ i += 1
82
+ id = b.at(ns(".//docidentifier"))
83
+ id.previous =
84
+ "<docidentifier type='metanorma-ordinal'>[#{i}]</docidentifier>"
85
+ end
86
+ @xrefs.references docxml
87
+ end
64
88
 
65
89
  def docid_prefixes(docxml)
66
90
  docxml.xpath(ns("//references/bibitem/docidentifier")).each do |i|
@@ -102,9 +126,7 @@ module IsoDoc
102
126
  display_order_xpath(docxml, "//indexsect", i)
103
127
  end
104
128
 
105
- def clausetitle(docxml)
106
- docxml.xpath(ns("//variant-title[@type = 'toc']")).each(&:remove)
107
- end
129
+ def clausetitle(docxml); end
108
130
 
109
131
  def toc(docxml)
110
132
  docxml.xpath(ns("//toc//xref[text()]")).each do |x|
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.8.4".freeze
2
+ VERSION = "2.0.2".freeze
3
3
  end
@@ -9,6 +9,10 @@ module IsoDoc
9
9
  docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
10
10
  preface_names(b)
11
11
  end
12
+ references(docxml)
13
+ end
14
+
15
+ def references(docxml)
12
16
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
13
17
  reference_names(ref)
14
18
  end
@@ -148,11 +152,11 @@ module IsoDoc
148
152
  "xmlns:name = 'International Electrotechnical Commission']".freeze
149
153
 
150
154
  def reference_names(ref)
151
- # isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
152
155
  ids = @klass.bibitem_ref_code(ref)
153
156
  identifiers = @klass.render_identifier(ids)
154
- # date = ref.at(ns("./date[@type = 'published']"))
155
- reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
157
+ reference = @klass
158
+ .docid_l10n(identifiers[:metanorma] || identifiers[:sdo] ||
159
+ identifiers[:ordinal] || identifiers[:doi])
156
160
  @anchors[ref["id"]] = { xref: reference }
157
161
  end
158
162
  end
@@ -1691,7 +1691,7 @@ RSpec.describe IsoDoc do
1691
1691
  </foreword></preface>
1692
1692
  <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder="2">
1693
1693
  <title>Bibliography</title>
1694
- <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1694
+ <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">RFC 2616</docidentifier> <docidentifier type="IETF" scope="anchor">RFC2616</docidentifier> <docidentifier type="DOI">10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1695
1695
  </references></bibliography>
1696
1696
  </iso-standard>
1697
1697
  INPUT
@@ -1752,7 +1752,7 @@ RSpec.describe IsoDoc do
1752
1752
  </foreword></preface>
1753
1753
  <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1754
1754
  <title depth='1'>Bibliography</title>
1755
- <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">DOI 10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1755
+ <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type='metanorma-ordinal'>[1]</docidentifier> <docidentifier type="IETF">IETF RFC 2616</docidentifier> <docidentifier type="IETF" scope="anchor">IETF RFC2616</docidentifier> <docidentifier type="DOI">DOI 10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1756
1756
  </references></bibliography>
1757
1757
  </iso-standard>
1758
1758
  OUTPUT
@@ -2518,6 +2518,7 @@ RSpec.describe IsoDoc do
2518
2518
  <bibliography>
2519
2519
  <references hidden='true' normative='false' displayorder="1">
2520
2520
  <bibitem id='express_action_schema' type='internal'>
2521
+ <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
2521
2522
  <docidentifier type='repository'>express/action_schema</docidentifier>
2522
2523
  </bibitem>
2523
2524
  </references>
@@ -474,6 +474,33 @@ RSpec.describe IsoDoc do
474
474
  OUTPUT
475
475
  end
476
476
 
477
+ =begin
478
+ it "populates HTML ToC" do
479
+ FileUtils.rm_f "test.doc"
480
+ FileUtils.rm_f "test.html"
481
+ IsoDoc::HtmlConvert.new({ htmltoclevels: 3 })
482
+ .convert("test", <<~"INPUT", false)
483
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
484
+ <preface><foreword><title>Foreword</title>
485
+ <variant-title type="toc">FORVORT</variant-title>
486
+ </foreword></preface>
487
+ <sections>
488
+ <clause><title>First Clause</title>
489
+ <clause><title>First Subclause</title>
490
+ <variant-title type="toc">SUBCLOZ</variant-title>
491
+ </clause>
492
+ </clause>
493
+ </sections>
494
+ </iso-standard>
495
+ INPUT
496
+ html = Nokogiri::XML(File.read("test.html")).
497
+ at("//div[@id = 'toc']")
498
+ expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~OUTPUT)
499
+ HAJSHJAS
500
+ OUTPUT
501
+ end
502
+ =end
503
+
477
504
  it "populates Word ToC" do
478
505
  FileUtils.rm_f "test.doc"
479
506
  IsoDoc::WordConvert.new(
@@ -495,6 +522,7 @@ RSpec.describe IsoDoc do
495
522
  </fn></p>
496
523
  <clause id="P" inline-header="false" obligation="normative">
497
524
  <title>Clause 4.2.1</title>
525
+ <variant-title type="toc">SUBCLOZ</variant-title>
498
526
  </clause>
499
527
  </clause></clause>
500
528
  </sections>