metanorma-ietf 2.5.1 → 3.0.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: c2d4894fa5f829d7b49228514a64317990ec1747c1f3f327545a919b714aa054
4
- data.tar.gz: 7058f5103647d0917da435023afef57236c803413e59b6dab3382e5ab8a84d0f
3
+ metadata.gz: 51d0713bcfae4cec3a50c1c840c445df4b12d0b7c8b31ae75eae87ef5dde0a67
4
+ data.tar.gz: 62ca2ad04f15976d681a621d399bb463cf339d496b98a8111cf4ec8ef9792c8a
5
5
  SHA512:
6
- metadata.gz: cd64d4822df68c4df3338ac56abe2159991ed4065c8eacfb5eb1474a1900410ab732a186883486492538538b8344d60fb2b9090008c673fcae1ac1120c1c3e18
7
- data.tar.gz: 73051c3782f02ae2d4ad8f2592f534eb3d2f1abd34620c1bc15c3d8034d51ad1aac2e3d552d11c489ea0f81b940844ea7198d0b598d9a9f1a4a30a4dd2b304b2
6
+ metadata.gz: dfb117a7bae17c2ad66302424b97672dc35bbc4b710af759c4e191c9a01dfa4d30326324786760cc5437b845e7941472fd524dc8b6ee9b85cb94f8ef29424dd4
7
+ data.tar.gz: a4ecb6cc11f97bde100cb8c9a8870379ddd732fcf638abf6b928502b056c95e80ed82c044a65998f5b1e871bf2a9b6dc21d3ac58a4c388168ea97e09191ffac5
@@ -8,75 +8,9 @@ on:
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
11
+
11
12
  jobs:
12
13
  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
-
23
- steps:
24
- - uses: actions/checkout@master
25
-
26
- - uses: ruby/setup-ruby@v1
27
- with:
28
- ruby-version: ${{ matrix.ruby }}
29
- bundler-cache: true
30
-
31
- - uses: actions/setup-python@v1
32
- with:
33
- python-version: '3.6'
34
-
35
- - name: set PIP_DOWNLOAD_CACHE
36
- shell: python
37
- run: |
38
- import os
39
- import platform
40
- from os.path import expanduser
41
-
42
- home = expanduser("~")
43
- cache_path = {
44
- "Linux": f"{home}/.cache/pip",
45
- "Darwin": f"{home}Library/Caches/pip",
46
- "Windows": f"{home}\\AppData\\Local\\pip\\Cache"
47
- }[platform.system()]
48
-
49
- os.system(f"echo PIP_DOWNLOAD_CACHE={cache_path} >> {os.environ['GITHUB_ENV']}")
50
-
51
- - uses: actions/cache@v2
52
- with:
53
- path: ${{ env.PIP_DOWNLOAD_CACHE }}
54
- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
55
- restore-keys: ${{ runner.os }}-pip-
56
-
57
- - uses: actions/cache@v2
58
- with:
59
- path: ~/.cache/xml2rfc
60
- key: xml2rfc
61
- restore-keys: xml2rfc
62
-
63
- - if: matrix.os == 'macos-latest'
64
- run: brew install libmagic
65
-
66
- - if: matrix.os == 'windows-latest'
67
- run: pip install python-magic-bin
68
-
69
- - run: pip install xml2rfc
70
-
71
- - run: bundle exec rake
72
-
73
- tests-passed:
74
- needs: rake
75
- runs-on: ubuntu-latest
76
- steps:
77
- - uses: peter-evans/repository-dispatch@v1
78
- with:
79
- token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
80
- repository: ${{ github.repository }}
81
- event-type: tests-passed
82
- client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
14
+ uses: metanorma/metanorma-build-scripts/.github/workflows/xml2rfc-rake.yml@main
15
+ secrets:
16
+ pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/.gitignore CHANGED
@@ -18,3 +18,8 @@
18
18
  **/.byebug_history
19
19
 
20
20
  .rubocop-https--*
21
+
22
+ /Gemfile.devel
23
+ /Gemfile.lock
24
+ /test.err
25
+ /test.rfc.xml.err
@@ -107,10 +107,10 @@ module IsoDoc
107
107
  end
108
108
 
109
109
  def get_linkend(node)
110
- contents = node.children.reject do |c|
111
- %w{locality localityStack}.include? c.name
112
- end
113
- .select { |c| !c.text? || /\S/.match(c) }
110
+ no_loc_contents = node.children.reject do |c|
111
+ %w{locality localityStack location}.include? c.name
112
+ end
113
+ contents = no_loc_contents.select { |c| !c.text? || /\S/.match(c) }
114
114
  !contents.empty? and
115
115
  return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
116
116
  ""
@@ -122,9 +122,10 @@ module IsoDoc
122
122
  end
123
123
  relative = node["relative"] ||
124
124
  node.at(ns(".//locality[@type = 'anchor']/referenceFrom"))&.text || ""
125
- section = eref_clause(node.xpath(ns("./locality | ./localityStack")),
126
- nil) || ""
127
- #section = "" unless relative.empty?
125
+ section = @isodoc.eref_localities(
126
+ node.xpath(ns("./locality | ./localityStack")), nil, node
127
+ )&.sub(/^,/, "")&.sub(/^\s*(Section|Clause)/, "")&.strip&.sub(/,$/, "") || ""
128
+ # section = "" unless relative.empty?
128
129
  out.relref **attr_code(target: node["bibitemid"], section: section,
129
130
  relative: relative,
130
131
  displayFormat: node["displayFormat"]) do |l|
@@ -132,30 +133,6 @@ module IsoDoc
132
133
  end
133
134
  end
134
135
 
135
- def eref_clause(refs, target)
136
- ret = []
137
- ret1 = ""
138
- refs.each do |l|
139
- if l.name == "localityStack"
140
- ret << ret1
141
- ret1 = ""
142
- ret << eref_clause1(l.elements, target)
143
- else ret1 += eref_clause1([l], target)
144
- end
145
- end
146
- ret << ret1
147
- ret.reject { |c| c.nil? || c.empty? }.join("; ")
148
- end
149
-
150
- def eref_clause1(refs, _target)
151
- refs.each do |l|
152
- next unless %w(clause section).include? l["type"]
153
-
154
- return l&.at(ns("./referenceFrom"))&.text
155
- end
156
- ""
157
- end
158
-
159
136
  def index_parse(node, out)
160
137
  out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
161
138
  primary: node["primary"],
@@ -62,12 +62,12 @@ module IsoDoc
62
62
  def docidentifier_render(bib, out)
63
63
  docidentifiers = bib.xpath(ns("./docidentifier"))
64
64
  id = render_identifier(bibitem_ref_code(bib))
65
- !id[1].nil? && id[1] != "(NO ID)" and out.refcontent id[1]
65
+ !id[:sdo].nil? && id[:sdo] != "(NO ID)" and out.refcontent id[:sdo]
66
66
  docidentifiers&.each do |u|
67
67
  u["type"] == "DOI" and
68
68
  out.seriesInfo nil, **attr_code(value: u.text.sub(/^DOI /, ""),
69
69
  name: "DOI")
70
- u["type"] == "IETF" and docidentifier_ietf(u, out)
70
+ %w(IETF RFC).include?(u["type"]) and docidentifier_ietf(u, out)
71
71
  end
72
72
  end
73
73
 
@@ -13,85 +13,89 @@ require_relative "./validation"
13
13
  require_relative "./xref"
14
14
  require_relative "./init"
15
15
 
16
- module IsoDoc::Ietf
17
- class RfcConvert < ::IsoDoc::Convert
18
- def convert1(docxml, _filename, _dir)
19
- @xrefs.parse docxml
20
- info docxml, nil
21
- xml = noko do |xml|
22
- xml.rfc **attr_code(rfc_attributes(docxml)) do |html|
23
- make_link(html, docxml)
24
- make_front(html, docxml)
25
- make_middle(html, docxml)
26
- make_back(html, docxml)
27
- end
28
- end.join("\n").sub(/<!DOCTYPE[^>]+>\n/, "")
29
- set_pis(docxml, Nokogiri::XML(xml))
30
- end
16
+ module IsoDoc
17
+ module Ietf
18
+ class RfcConvert < ::IsoDoc::Convert
19
+ def convert1(docxml, _filename, _dir)
20
+ @xrefs.parse docxml
21
+ info docxml, nil
22
+ ret = noko do |xml|
23
+ xml.rfc **attr_code(rfc_attributes(docxml)) do |html|
24
+ make_link(html, docxml)
25
+ make_front(html, docxml)
26
+ make_middle(html, docxml)
27
+ make_back(html, docxml)
28
+ end
29
+ end.join("\n").sub(/<!DOCTYPE[^>]+>\n/, "")
30
+ set_pis(docxml, Nokogiri::XML(ret))
31
+ end
31
32
 
32
- def metadata_init(lang, script, i18n)
33
- @meta = Metadata.new(lang, script, i18n)
34
- end
33
+ def metadata_init(lang, script, i18n)
34
+ @meta = Metadata.new(lang, script, i18n)
35
+ end
35
36
 
36
- def xref_init(lang, script, klass, i18n, options)
37
- @xrefs = Xref.new(lang, script, klass, i18n, options)
38
- end
37
+ def xref_init(lang, script, klass, i18n, options)
38
+ @xrefs = Xref.new(lang, script, klass, i18n, options)
39
+ end
39
40
 
40
- def extract_delims(text)
41
- @openmathdelim = "$$"
42
- @closemathdelim = "$$"
43
- while %r{#{Regexp.escape(@openmathdelim)}}m.match(text) ||
44
- %r{#{Regexp.escape(@closemathdelim)}}m.match(text)
45
- @openmathdelim += "$"
46
- @closemathdelim += "$"
41
+ def extract_delims(text)
42
+ @openmathdelim = "$$"
43
+ @closemathdelim = "$$"
44
+ while %r{#{Regexp.escape(@openmathdelim)}}m.match(text) ||
45
+ %r{#{Regexp.escape(@closemathdelim)}}m.match(text)
46
+ @openmathdelim += "$"
47
+ @closemathdelim += "$"
48
+ end
49
+ [@openmathdelim, @closemathdelim]
47
50
  end
48
- [@openmathdelim, @closemathdelim]
49
- end
50
51
 
51
- def error_parse(node, out)
52
- case node.name
53
- when "bcp14" then bcp14_parse(node, out)
54
- when "concept" then concept_parse(node, out)
55
- when "verbal-definition", "non-verbal-representation"
56
- node.elements.each { |n| parse(n, out) }
57
- else
58
- text = node.to_xml.gsub(/</, "&lt;").gsub(/>/, "&gt;")
59
- out.t { |p| p << text }
52
+ def error_parse(node, out)
53
+ case node.name
54
+ when "bcp14" then bcp14_parse(node, out)
55
+ when "concept" then concept_parse(node, out)
56
+ when "verbal-definition", "non-verbal-representation"
57
+ node.elements.each { |n| parse(n, out) }
58
+ else
59
+ text = node.to_xml.gsub(/</, "&lt;").gsub(/>/, "&gt;")
60
+ out.t { |p| p << text }
61
+ end
60
62
  end
61
- end
62
63
 
63
- def omit_docid_prefix(prefix)
64
- return true if prefix == "IETF"
64
+ def omit_docid_prefix(prefix)
65
+ return true if %w(IETF RFC).include?(prefix)
65
66
 
66
- super
67
- end
67
+ super
68
+ end
68
69
 
69
- def textcleanup(docxml)
70
- passthrough_cleanup(docxml)
71
- end
70
+ def textcleanup(docxml)
71
+ passthrough_cleanup(docxml)
72
+ end
72
73
 
73
- def postprocess(result, filename, _dir)
74
- result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
75
- .sub(/<!DOCTYPE[^>]+>\n/, "")
76
- .sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
77
- File.open(filename, "w:UTF-8") { |f| f.write(result) }
78
- schema_validate(filename)
79
- @files_to_delete.each { |f| FileUtils.rm_rf f }
80
- content_validate(to_xhtml(result), filename)
81
- end
74
+ def postprocess(result, filename, _dir)
75
+ result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
76
+ .sub(/<!DOCTYPE[^>]+>\n/, "")
77
+ .sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
78
+ File.open(filename, "w:UTF-8") { |f| f.write(result) }
79
+ schema_validate(filename)
80
+ @files_to_delete.each { |f| FileUtils.rm_rf f }
81
+ content_validate(to_xhtml(result), filename)
82
+ end
82
83
 
83
- def init_file(filename, debug)
84
- filename = filename.sub(/\.rfc\.xml$/, ".rfc")
85
- super
86
- end
84
+ def init_file(filename, debug)
85
+ filename = filename.sub(/\.rfc\.xml$/, ".rfc")
86
+ super
87
+ end
87
88
 
88
- def initialize(options)
89
- super
90
- @xinclude = options[:use_xinclude] == "true"
91
- @format = :rfc
92
- @suffix = "rfc.xml"
93
- end
89
+ def initialize(options)
90
+ super
91
+ @xinclude = options[:use_xinclude] == "true"
92
+ @format = :rfc
93
+ @suffix = "rfc.xml"
94
+ @isodoc = IsoDoc::PresentationXMLConvert.new({})
95
+ @isodoc.i18n_init("en", "Latn")
96
+ end
94
97
 
95
- include ::IsoDoc::Ietf::Init
98
+ include ::IsoDoc::Ietf::Init
99
+ end
96
100
  end
97
101
  end
@@ -47,7 +47,7 @@ module IsoDoc
47
47
  def termdef_parse(node, out)
48
48
  set_termdomain("")
49
49
  node.xpath(ns("./definition")).size > 1 and
50
- IsoDoc::PresentationXMLConvert.new({}).multidef(node)
50
+ @isodoc.multidef(node)
51
51
  clause_parse(node, out)
52
52
  end
53
53
 
@@ -9,6 +9,7 @@ module IsoDoc
9
9
  notes = t.xpath(ns(".//termnote"))
10
10
  notes.each do |n|
11
11
  next if n["id"].nil? || n["id"].empty?
12
+
12
13
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
13
14
  @anchors[n["id"]] =
14
15
  anchor_struct(idx, n, @labels["note_xref"], "note", false)
@@ -173,9 +173,11 @@
173
173
  <data type="dateTime"/>
174
174
  </attribute>
175
175
  </optional>
176
- <attribute name="from">
177
- <data type="IDREF"/>
178
- </attribute>
176
+ <optional>
177
+ <attribute name="from">
178
+ <data type="IDREF"/>
179
+ </attribute>
180
+ </optional>
179
181
  <optional>
180
182
  <attribute name="to">
181
183
  <data type="IDREF"/>
@@ -209,9 +209,6 @@
209
209
  <zeroOrMore>
210
210
  <ref name="contact"/>
211
211
  </zeroOrMore>
212
- <zeroOrMore>
213
- <ref name="uri"/>
214
- </zeroOrMore>
215
212
  </element>
216
213
  </define>
217
214
  <define name="fullname">
@@ -401,9 +398,9 @@
401
398
  <choice>
402
399
  <!-- iso191606 TODO -->
403
400
  <group>
404
- <oneOrMore>
401
+ <zeroOrMore>
405
402
  <ref name="street"/>
406
- </oneOrMore>
403
+ </zeroOrMore>
407
404
  <ref name="city"/>
408
405
  <optional>
409
406
  <ref name="state"/>
@@ -828,6 +825,11 @@
828
825
  <optional>
829
826
  <attribute name="scope"/>
830
827
  </optional>
828
+ <optional>
829
+ <attribute name="primary">
830
+ <data type="boolean"/>
831
+ </attribute>
832
+ </optional>
831
833
  <text/>
832
834
  </element>
833
835
  </define>
@@ -1,6 +1,6 @@
1
- module Asciidoctor
1
+ module Metanorma
2
2
  module Ietf
3
- class Converter < ::Asciidoctor::Standoc::Converter
3
+ class Converter < ::Metanorma::Standoc::Converter
4
4
  def para_attrs(node)
5
5
  attr_code( "keep-with-next": node.attr("keepWithNext") ||
6
6
  node.attr("keep-with-next"),
@@ -1,6 +1,6 @@
1
- module Asciidoctor
1
+ module Metanorma
2
2
  module Ietf
3
- class Converter < ::Asciidoctor::Standoc::Converter
3
+ class Converter < ::Metanorma::Standoc::Converter
4
4
  def cleanup(xmldoc)
5
5
  bcp14_cleanup(xmldoc)
6
6
  abstract_cleanup(xmldoc)
@@ -42,19 +42,19 @@ module Asciidoctor
42
42
  end
43
43
  end
44
44
 
45
- def rfc_anchor_cleanup(xmldoc)
46
- map = xmldoc.xpath("//bibitem[docidentifier/@type = 'rfc-anchor']")
47
- .each_with_object({}) do |b, m|
45
+ def rfc_anchor_cleanup(xml)
46
+ map = xml.xpath("//bibitem[docidentifier[@type = 'IETF' or @type = 'RFC']"\
47
+ "[@scope = 'anchor']]").each_with_object({}) do |b, m|
48
48
  next if b.at("./ancestor::bibdata | ./ancestor::bibitem")
49
49
 
50
- id = b.at("./docidentifier[@type = 'rfc-anchor']").text
50
+ id = b.at("./docidentifier[@type = 'IETF' or @type = 'RFC'][@scope = 'anchor']").text
51
51
  m[b["id"]] = id
52
52
  b["id"] = id
53
53
  end
54
- xmldoc.xpath("//eref | //origin").each do |x|
54
+ xml.xpath("//eref | //origin").each do |x|
55
55
  map[x["bibitemid"]] and x["bibitemid"] = map[x["bibitemid"]]
56
56
  end
57
- xmldoc
57
+ xml
58
58
  end
59
59
 
60
60
  def smartquotes_cleanup(xmldoc)
@@ -1,5 +1,5 @@
1
1
  require "asciidoctor"
2
- require "asciidoctor/standoc/converter"
2
+ require "metanorma/standoc/converter"
3
3
  require "isodoc/ietf/rfc_convert"
4
4
  require_relative "./front"
5
5
  require_relative "./blocks"
@@ -7,11 +7,11 @@ require_relative "./validate"
7
7
  require_relative "./cleanup"
8
8
  require_relative "./macros"
9
9
 
10
- module Asciidoctor
10
+ module Metanorma
11
11
  module Ietf
12
- class Converter < ::Asciidoctor::Standoc::Converter
12
+ class Converter < ::Metanorma::Standoc::Converter
13
13
  Asciidoctor::Extensions.register do
14
- inline_macro Asciidoctor::Ietf::InlineCrefMacro
14
+ inline_macro Metanorma::Ietf::InlineCrefMacro
15
15
  end
16
16
 
17
17
  XML_ROOT_TAG = "ietf-standard".freeze
@@ -1,6 +1,6 @@
1
- module Asciidoctor
1
+ module Metanorma
2
2
  module Ietf
3
- class Converter < ::Asciidoctor::Standoc::Converter
3
+ class Converter < ::Metanorma::Standoc::Converter
4
4
  def relaton_relations
5
5
  %w(included-in described-by derived-from instance obsoletes updates)
6
6
  end
@@ -345,7 +345,7 @@
345
345
  <optional>
346
346
  <attribute name="format"/>
347
347
  </optional>
348
- <text/>
348
+ <ref name="XrefBody"/>
349
349
  </element>
350
350
  </define>
351
351
  <define name="erefType">
@@ -32,6 +32,56 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="index">
36
+ <element name="index">
37
+ <optional>
38
+ <attribute name="to">
39
+ <data type="IDREF"/>
40
+ </attribute>
41
+ </optional>
42
+ <element name="primary">
43
+ <oneOrMore>
44
+ <choice>
45
+ <ref name="PureTextElement"/>
46
+ <ref name="stem"/>
47
+ </choice>
48
+ </oneOrMore>
49
+ </element>
50
+ <optional>
51
+ <element name="secondary">
52
+ <oneOrMore>
53
+ <choice>
54
+ <ref name="PureTextElement"/>
55
+ <ref name="stem"/>
56
+ </choice>
57
+ </oneOrMore>
58
+ </element>
59
+ </optional>
60
+ <optional>
61
+ <element name="tertiary">
62
+ <oneOrMore>
63
+ <choice>
64
+ <ref name="PureTextElement"/>
65
+ <ref name="stem"/>
66
+ </choice>
67
+ </oneOrMore>
68
+ </element>
69
+ </optional>
70
+ </element>
71
+ </define>
72
+ <define name="bibitem">
73
+ <element name="bibitem">
74
+ <attribute name="id">
75
+ <data type="ID"/>
76
+ </attribute>
77
+ <optional>
78
+ <attribute name="hidden">
79
+ <data type="boolean"/>
80
+ </attribute>
81
+ </optional>
82
+ <ref name="BibliographicItem"/>
83
+ </element>
84
+ </define>
35
85
  <define name="section-title">
36
86
  <element name="title">
37
87
  <zeroOrMore>
@@ -102,9 +152,7 @@
102
152
  <data type="boolean"/>
103
153
  </attribute>
104
154
  </optional>
105
- <oneOrMore>
106
- <ref name="PureTextElement"/>
107
- </oneOrMore>
155
+ <ref name="XrefBody"/>
108
156
  </element>
109
157
  </define>
110
158
  <define name="erefType">
@@ -138,6 +186,42 @@
138
186
  <ref name="PureTextElement"/>
139
187
  </oneOrMore>
140
188
  </define>
189
+ <define name="localityStack">
190
+ <element name="localityStack">
191
+ <optional>
192
+ <attribute name="connective">
193
+ <choice>
194
+ <value>and</value>
195
+ <value>or</value>
196
+ <value>from</value>
197
+ <value>to</value>
198
+ <value/>
199
+ </choice>
200
+ </attribute>
201
+ </optional>
202
+ <zeroOrMore>
203
+ <ref name="locality"/>
204
+ </zeroOrMore>
205
+ </element>
206
+ </define>
207
+ <define name="sourceLocalityStack">
208
+ <element name="sourceLocalityStack">
209
+ <optional>
210
+ <attribute name="connective">
211
+ <choice>
212
+ <value>and</value>
213
+ <value>or</value>
214
+ <value>from</value>
215
+ <value>to</value>
216
+ <value/>
217
+ </choice>
218
+ </attribute>
219
+ </optional>
220
+ <zeroOrMore>
221
+ <ref name="sourceLocality"/>
222
+ </zeroOrMore>
223
+ </element>
224
+ </define>
141
225
  <define name="ul">
142
226
  <element name="ul">
143
227
  <attribute name="id">
@@ -690,6 +774,7 @@
690
774
  <ref name="terms"/>
691
775
  <ref name="term-clause"/>
692
776
  <ref name="definitions"/>
777
+ <ref name="floating-title"/>
693
778
  </choice>
694
779
  </oneOrMore>
695
780
  </element>
@@ -1013,6 +1098,26 @@
1013
1098
  </zeroOrMore>
1014
1099
  </element>
1015
1100
  </define>
1101
+ <define name="sub">
1102
+ <element name="sub">
1103
+ <zeroOrMore>
1104
+ <choice>
1105
+ <ref name="PureTextElement"/>
1106
+ <ref name="stem"/>
1107
+ </choice>
1108
+ </zeroOrMore>
1109
+ </element>
1110
+ </define>
1111
+ <define name="sup">
1112
+ <element name="sup">
1113
+ <zeroOrMore>
1114
+ <choice>
1115
+ <ref name="PureTextElement"/>
1116
+ <ref name="stem"/>
1117
+ </choice>
1118
+ </zeroOrMore>
1119
+ </element>
1120
+ </define>
1016
1121
  <define name="pagebreak">
1017
1122
  <element name="pagebreak">
1018
1123
  <optional>
@@ -1027,6 +1132,16 @@
1027
1132
  </define>
1028
1133
  </include>
1029
1134
  <!-- end overrides -->
1135
+ <define name="image" combine="choice">
1136
+ <element name="svg">
1137
+ <oneOrMore>
1138
+ <choice>
1139
+ <text/>
1140
+ <ref name="AnyElement"/>
1141
+ </choice>
1142
+ </oneOrMore>
1143
+ </element>
1144
+ </define>
1030
1145
  <define name="MultilingualRenderingType">
1031
1146
  <choice>
1032
1147
  <value>common</value>
@@ -1680,6 +1795,7 @@
1680
1795
  <ref name="clause-subsection"/>
1681
1796
  <ref name="terms"/>
1682
1797
  <ref name="definitions"/>
1798
+ <ref name="floating-title"/>
1683
1799
  </choice>
1684
1800
  </oneOrMore>
1685
1801
  </choice>
@@ -1722,6 +1838,7 @@
1722
1838
  <ref name="terms"/>
1723
1839
  <ref name="definitions"/>
1724
1840
  <ref name="references"/>
1841
+ <ref name="floating-title"/>
1725
1842
  </choice>
1726
1843
  </zeroOrMore>
1727
1844
  </group>
@@ -1796,6 +1913,20 @@
1796
1913
  <data type="ID"/>
1797
1914
  </attribute>
1798
1915
  </optional>
1916
+ <optional>
1917
+ <attribute name="language"/>
1918
+ </optional>
1919
+ <optional>
1920
+ <attribute name="script"/>
1921
+ </optional>
1922
+ <optional>
1923
+ <attribute name="tag"/>
1924
+ </optional>
1925
+ <optional>
1926
+ <attribute name="multilingual-rendering">
1927
+ <ref name="MultilingualRenderingType"/>
1928
+ </attribute>
1929
+ </optional>
1799
1930
  <oneOrMore>
1800
1931
  <ref name="preferred"/>
1801
1932
  </oneOrMore>
@@ -1959,7 +2090,11 @@
1959
2090
  </optional>
1960
2091
  <element name="name">
1961
2092
  <zeroOrMore>
1962
- <ref name="PureTextElement"/>
2093
+ <choice>
2094
+ <ref name="PureTextElement"/>
2095
+ <ref name="stem"/>
2096
+ <ref name="index"/>
2097
+ </choice>
1963
2098
  </zeroOrMore>
1964
2099
  </element>
1965
2100
  <optional>
@@ -1973,7 +2108,7 @@
1973
2108
  </element>
1974
2109
  </optional>
1975
2110
  <optional>
1976
- <element name="grammar-info">
2111
+ <element name="grammar">
1977
2112
  <ref name="Grammar"/>
1978
2113
  </element>
1979
2114
  </optional>
@@ -2182,7 +2317,18 @@
2182
2317
  <ref name="MultilingualRenderingType"/>
2183
2318
  </attribute>
2184
2319
  </optional>
2185
- <ref name="paragraph"/>
2320
+ <oneOrMore>
2321
+ <choice>
2322
+ <ref name="formula"/>
2323
+ <ref name="ul"/>
2324
+ <ref name="ol"/>
2325
+ <ref name="dl"/>
2326
+ <ref name="quote"/>
2327
+ <ref name="sourcecode"/>
2328
+ <ref name="paragraph"/>
2329
+ <ref name="figure"/>
2330
+ </choice>
2331
+ </oneOrMore>
2186
2332
  </element>
2187
2333
  </define>
2188
2334
  <define name="termsource">
@@ -2516,4 +2662,43 @@
2516
2662
  </oneOrMore>
2517
2663
  </element>
2518
2664
  </define>
2665
+ <define name="floating-title">
2666
+ <element name="floating-title">
2667
+ <attribute name="id">
2668
+ <data type="ID"/>
2669
+ </attribute>
2670
+ <attribute name="depth">
2671
+ <data type="int"/>
2672
+ </attribute>
2673
+ <zeroOrMore>
2674
+ <ref name="TextElement"/>
2675
+ </zeroOrMore>
2676
+ </element>
2677
+ </define>
2678
+ <define name="XrefBody">
2679
+ <zeroOrMore>
2680
+ <ref name="XrefTarget"/>
2681
+ </zeroOrMore>
2682
+ <oneOrMore>
2683
+ <ref name="PureTextElement"/>
2684
+ </oneOrMore>
2685
+ </define>
2686
+ <define name="XrefTarget">
2687
+ <element name="location">
2688
+ <attribute name="target">
2689
+ <data type="string">
2690
+ <param name="pattern">\i\c*|\c+#\c+</param>
2691
+ </data>
2692
+ </attribute>
2693
+ <attribute name="connective">
2694
+ <choice>
2695
+ <value>and</value>
2696
+ <value>or</value>
2697
+ <value>from</value>
2698
+ <value>to</value>
2699
+ <value/>
2700
+ </choice>
2701
+ </attribute>
2702
+ </element>
2703
+ </define>
2519
2704
  </grammar>
@@ -1,6 +1,6 @@
1
1
  require "asciidoctor/extensions"
2
2
 
3
- module Asciidoctor
3
+ module Metanorma
4
4
  module Ietf
5
5
  class InlineCrefMacro < Asciidoctor::Extensions::InlineMacroProcessor
6
6
  use_dsl
File without changes
@@ -1,8 +1,8 @@
1
1
  require "metanorma/ietf/data/workgroups"
2
2
 
3
- module Asciidoctor
3
+ module Metanorma
4
4
  module Ietf
5
- class Converter < ::Asciidoctor::Standoc::Converter
5
+ class Converter < ::Metanorma::Standoc::Converter
6
6
  def content_validate(doc)
7
7
  super
8
8
  image_validate(doc)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.5.1".freeze
3
+ VERSION = "3.0.3".freeze
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@ require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require "metanorma"
3
3
 
4
4
  require_relative "metanorma/ietf"
5
- require_relative "asciidoctor/ietf/converter"
5
+ require_relative "metanorma/ietf/converter"
6
6
  require_relative "isodoc/ietf/rfc_convert"
7
7
 
8
8
  Metanorma::Registry.instance.register(Metanorma::Ietf::Processor)
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.license = "BSD-2-Clause"
29
29
 
30
30
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
31
- f.match(%r{^(test|spec|features)/})
31
+ f.match(%r{^(bin|test|spec|features)/})
32
32
  end
33
33
  spec.bindir = "exe"
34
34
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_dependency "mathml2asciimath"
39
39
  spec.add_dependency "metanorma-ietf-data"
40
- spec.add_dependency "metanorma-standoc", "~> 1.11.0"
40
+ spec.add_dependency "metanorma-standoc", "~> 2.0.0"
41
41
 
42
42
  spec.add_development_dependency "debug"
43
43
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-29 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mathml2asciimath
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.11.0
47
+ version: 2.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.11.0
54
+ version: 2.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: debug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -235,26 +235,9 @@ files:
235
235
  - LICENSE
236
236
  - README.adoc
237
237
  - Rakefile
238
- - bin/asciidoctor-rfc2
239
- - bin/asciidoctor-rfc2.bat
240
- - bin/asciidoctor-rfc3
241
- - bin/console
242
- - bin/rspec
243
- - bin/setup
244
238
  - docs/installation.md
245
239
  - docs/navigation.md
246
240
  - docs/overview.md
247
- - lib/asciidoctor/ietf/basicdoc.rng
248
- - lib/asciidoctor/ietf/biblio.rng
249
- - lib/asciidoctor/ietf/blocks.rb
250
- - lib/asciidoctor/ietf/cleanup.rb
251
- - lib/asciidoctor/ietf/converter.rb
252
- - lib/asciidoctor/ietf/front.rb
253
- - lib/asciidoctor/ietf/ietf.rng
254
- - lib/asciidoctor/ietf/isodoc.rng
255
- - lib/asciidoctor/ietf/macros.rb
256
- - lib/asciidoctor/ietf/reqt.rng
257
- - lib/asciidoctor/ietf/validate.rb
258
241
  - lib/isodoc/ietf/SVG-1.2-RFC.rng
259
242
  - lib/isodoc/ietf/blocks.rb
260
243
  - lib/isodoc/ietf/cleanup.rb
@@ -277,7 +260,18 @@ files:
277
260
  - lib/isodoc/ietf/xref.rb
278
261
  - lib/metanorma-ietf.rb
279
262
  - lib/metanorma/ietf.rb
263
+ - lib/metanorma/ietf/basicdoc.rng
264
+ - lib/metanorma/ietf/biblio.rng
265
+ - lib/metanorma/ietf/blocks.rb
266
+ - lib/metanorma/ietf/cleanup.rb
267
+ - lib/metanorma/ietf/converter.rb
268
+ - lib/metanorma/ietf/front.rb
269
+ - lib/metanorma/ietf/ietf.rng
270
+ - lib/metanorma/ietf/isodoc.rng
271
+ - lib/metanorma/ietf/macros.rb
280
272
  - lib/metanorma/ietf/processor.rb
273
+ - lib/metanorma/ietf/reqt.rng
274
+ - lib/metanorma/ietf/validate.rb
281
275
  - lib/metanorma/ietf/version.rb
282
276
  - metanorma-ietf.gemspec
283
277
  - rfc2629-other.ent
@@ -302,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
296
  - !ruby/object:Gem::Version
303
297
  version: '0'
304
298
  requirements: []
305
- rubygems_version: 3.2.22
299
+ rubygems_version: 3.2.32
306
300
  signing_key:
307
301
  specification_version: 4
308
302
  summary: metanorma-ietf lets you write IETF documents, such as Internet-Drafts and
data/bin/asciidoctor-rfc2 DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "metanorma-ietf"
4
- require "asciidoctor/cli"
5
-
6
- options = Asciidoctor::Cli::Options.new backend: "rfc2", header_footer: true
7
- # FIXME This is a really bizarre API. Please make me simpler.
8
-
9
- exit 0 if options.parse!(ARGV) == 0
10
-
11
- invoker = Asciidoctor::Cli::Invoker.new options
12
- GC.start
13
- invoker.invoke!
14
- exit invoker.code
@@ -1,2 +0,0 @@
1
- @echo off
2
- ruby %~dp0\asciidoctor-rfc2 %*
data/bin/asciidoctor-rfc3 DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "metanorma-ietf"
4
- require "asciidoctor/cli"
5
-
6
- options = Asciidoctor::Cli::Options.new backend: "rfc3", header_footer: true
7
- # FIXME This is a really bizarre API. Please make me simpler.
8
-
9
- exit 0 if options.parse!(ARGV) == 0
10
-
11
- invoker = Asciidoctor::Cli::Invoker.new options
12
- GC.start
13
- invoker.invoke!
14
- exit invoker.code
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "metanorma-ietf"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/rspec DELETED
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'rspec' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require "pathname"
10
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
11
- "../../Gemfile", Pathname.new(__FILE__).realpath
12
- )
13
-
14
- require "rubygems"
15
- require "bundler/setup"
16
-
17
- load Gem.bin_path("rspec-core", "rspec")
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here