metanorma-ietf 2.2.3 → 2.2.8

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: a672cb965e33f37303d7053c81f86be083a5b1c43ec5144ccc430920e7d29512
4
- data.tar.gz: c127be595fc086aa3f00620dfe0583bbcf1416bad56987a25e0a409b32305848
3
+ metadata.gz: 9c9dcce65b694a86bbd5e775df30789d1b3897ac892e16257aea794b75e4e018
4
+ data.tar.gz: d54c59198afab5b11a607814860800dec25990e12af5c7bbeef3f8f9ff83f528
5
5
  SHA512:
6
- metadata.gz: 1b403ed5675f6bda04b6908c8c9907bfe9e495f3bea974eebd0a65105ffc9384ba735ea8ceff883f4e261056e2772c232ccf2b94b734d3051ec3dc9f407a257f
7
- data.tar.gz: eb7ee9cd557bda127f8127bd10014d7d1e1f58aff032acea3105764950d014a2db0137d0a77de8172635803fc33d751e4c5b50f1d9c481d138af95861582a6d9
6
+ metadata.gz: 6dae30756289a169dd5d503dae1a1608c0f32bad9d6f36ca7141e3062f7998fdca933dbee69c695989802e68fbc62acbfe48f8622c772f3e104797b5c6e7a985
7
+ data.tar.gz: 8b3329781f6d9e2337e3c553ca301186938317a2a528cd801ceaceb2352492cc693a837067469aef18d991a441f38473671adafb42499c689680d9f26290c89d
@@ -0,0 +1,108 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
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: [ '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '2.7'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '2.7'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '2.7'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+
33
+ steps:
34
+ - uses: actions/checkout@master
35
+
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: ${{ matrix.ruby }}
39
+
40
+ - if: matrix.os == 'macos-latest'
41
+ run: brew install autoconf automake libtool
42
+
43
+ - uses: actions/cache@v2
44
+ with:
45
+ path: vendor/bundle
46
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
47
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
48
+
49
+ - run: bundle config set path 'vendor/bundle'
50
+
51
+ - run: bundle install --jobs 4 --retry 3
52
+
53
+ - uses: actions/setup-python@v1
54
+ with:
55
+ python-version: '3.6'
56
+ architecture: 'x64'
57
+
58
+ - name: set PIP_DOWNLOAD_CACHE
59
+ shell: python
60
+ run: |
61
+ import os
62
+ import platform
63
+ from os.path import expanduser
64
+
65
+ home = expanduser("~")
66
+ cache_path = {
67
+ "Linux": f"{home}/.cache/pip",
68
+ "Darwin": f"{home}Library/Caches/pip",
69
+ "Windows": f"{home}\\AppData\\Local\\pip\\Cache"
70
+ }[platform.system()]
71
+
72
+ os.system(f"echo PIP_DOWNLOAD_CACHE={cache_path} >> {os.environ['GITHUB_ENV']}")
73
+
74
+ - uses: actions/cache@v2
75
+ with:
76
+ path: ${{ env.PIP_DOWNLOAD_CACHE }}
77
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
78
+ restore-keys: ${{ runner.os }}-pip-
79
+
80
+ - uses: actions/cache@v2
81
+ with:
82
+ path: ~/.cache/xml2rfc
83
+ key: xml2rfc
84
+ restore-key: xml2rfc
85
+
86
+ - if: matrix.os == 'macos-latest'
87
+ run: brew install libmagic
88
+
89
+ - if: matrix.os == 'windows-latest'
90
+ run: pip install python-magic-bin
91
+
92
+ - run: pip install xml2rfc
93
+
94
+ - run: bundle exec rake
95
+
96
+ tests-passed:
97
+ needs: rake
98
+ runs-on: ubuntu-latest
99
+ continue-on-error: true
100
+ steps:
101
+ - name: Trigger tests passed event
102
+ uses: Sibz/github-status-action@v1
103
+ with:
104
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
105
+ context: 'tests-passed-successfully'
106
+ description: 'Tests passed successfully'
107
+ state: 'success'
108
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -2,26 +2,21 @@
2
2
  :source-highlighter: coderay
3
3
  :icons: font
4
4
 
5
- `metanorma-ietf` lets you write Internet-Drafts and RFCs in AsciiDoc, the
6
- "`http://asciidoctor.org/[asciidoctor]-way`".
5
+ `metanorma-ietf` lets you write IETF Internet-Drafts and RFCs via Metanorma.
7
6
 
8
7
  image:https://img.shields.io/gem/v/metanorma-ietf.svg["Gem Version", link="https://rubygems.org/gems/metanorma-ietf"]
9
- image:https://github.com/metanorma/metanorma-ietf/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=macos"]
10
- image:https://github.com/metanorma/metanorma-ietf/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=ubuntu"]
11
- image:https://github.com/metanorma/metanorma-ietf/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=windows"]
8
+ image:https://github.com/metanorma/metanorma-ietf/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-ietf/actions?workflow=rake"]
12
9
  image:https://codeclimate.com/github/metanorma/metanorma-ietf/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-ietf"]
13
10
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-ietf.svg["Pull Requests", link="https://github.com/metanorma/metanorma-ietf/pulls"]
14
11
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-ietf/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-ietf/releases"]
15
12
 
16
- _Formerly known as_ `asciidoctor-rfc`.
17
-
18
-
19
13
  == Functionality
20
14
 
21
- This gem processes http://asciidoctor.org/[Asciidoctor] documents following
22
- a template for generating IETF International Standards.
15
+ This gem processes https://www.metanorma.com[Metanorma documents] following
16
+ a template for generating IETF deliverables.
23
17
 
24
- This AsciiDoc syntax for writing IETF standards is called "`AsciiRFC`".
18
+ Metanorma-IETF adheres to AsciiRFC syntax, an AsciiDoc syntax for writing IETF documents
19
+ developed by the Metanorma team.
25
20
 
26
21
  The gem currently inherits from the https://github.com/metanorma/metanorma-standoc
27
22
  gem, and aligns closely to it.
@@ -221,3 +216,6 @@ This gem is developed, maintained and funded by https://www.ribose.com[Ribose In
221
216
 
222
217
  * Document templates are available at the https://github.com/metanorma/mn-templates-ietf[mn-templates-ietf] repository.
223
218
 
219
+ == Notes
220
+
221
+ Metanorma-IETF was formerly published as the `asciidoctor-rfc` gem.
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,13 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
732
  <optional>
733
- <attribute name="secondary"/>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
737
+ <element name="primary">
738
+ <oneOrMore>
739
+ <ref name="PureTextElement"/>
740
+ </oneOrMore>
741
+ </element>
742
+ <optional>
743
+ <element name="secondary">
744
+ <oneOrMore>
745
+ <ref name="PureTextElement"/>
746
+ </oneOrMore>
747
+ </element>
748
+ </optional>
749
+ <optional>
750
+ <element name="tertiary">
751
+ <oneOrMore>
752
+ <ref name="PureTextElement"/>
753
+ </oneOrMore>
754
+ </element>
755
+ </optional>
756
+ </element>
757
+ </define>
758
+ <define name="index-xref">
759
+ <element name="index-xref">
760
+ <attribute name="also">
761
+ <data type="boolean"/>
762
+ </attribute>
763
+ <element name="primary">
764
+ <oneOrMore>
765
+ <ref name="PureTextElement"/>
766
+ </oneOrMore>
767
+ </element>
768
+ <optional>
769
+ <element name="secondary">
770
+ <oneOrMore>
771
+ <ref name="PureTextElement"/>
772
+ </oneOrMore>
773
+ </element>
734
774
  </optional>
735
775
  <optional>
736
- <attribute name="tertiary"/>
776
+ <element name="tertiary">
777
+ <oneOrMore>
778
+ <ref name="PureTextElement"/>
779
+ </oneOrMore>
780
+ </element>
737
781
  </optional>
782
+ <element name="target">
783
+ <oneOrMore>
784
+ <ref name="PureTextElement"/>
785
+ </oneOrMore>
786
+ </element>
738
787
  </element>
739
788
  </define>
740
789
  <!-- bare ID element, used for referencing arbitrary spans of text -->
@@ -6,17 +6,17 @@ module Asciidoctor
6
6
  node.attr("keep-with-next"),
7
7
  "keep-with-previous": node.attr("keepWithPrevious") ||
8
8
  node.attr("keep-with-previous"),
9
- id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node))
9
+ id: ::Metanorma::Utils::anchor_or_uuid(node))
10
10
  end
11
11
 
12
12
  def ul_attrs(node)
13
- attr_code(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node),
13
+ attr_code(id: ::Metanorma::Utils::anchor_or_uuid(node),
14
14
  nobullet: node.attr("nobullet"),
15
15
  spacing: node.attr("spacing"))
16
16
  end
17
17
 
18
18
  def ol_attrs(node)
19
- attr_code(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node),
19
+ attr_code(id: ::Metanorma::Utils::anchor_or_uuid(node),
20
20
  type: node.attr("format") || olist_style(node.style),
21
21
  group: node.attr("group"),
22
22
  spacing: node.attr("spacing"),
@@ -24,7 +24,7 @@ module Asciidoctor
24
24
  end
25
25
 
26
26
  def dl_attrs(node)
27
- attr_code(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node),
27
+ attr_code(id: ::Metanorma::Utils::anchor_or_uuid(node),
28
28
  newline: node.attr("newline"),
29
29
  indent: node.attr("indent"),
30
30
  spacing: node.attr("spacing"))
@@ -46,7 +46,7 @@ module Asciidoctor
46
46
 
47
47
  def note(n)
48
48
  noko do |xml|
49
- xml.note **attr_code(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(n),
49
+ xml.note **attr_code(id: ::Metanorma::Utils::anchor_or_uuid(n),
50
50
  removeInRFC: n.attr("remove-in-rfc")) do |c|
51
51
  n.title.nil? or c.name { |name| name << n.title }
52
52
  wrap_in_para(n, c)
@@ -60,7 +60,7 @@ module Asciidoctor
60
60
  figure_title(node, f)
61
61
  f.pre node.lines.join("\n"),
62
62
  **attr_code(align: node.attr("align"),
63
- id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(nil),
63
+ id: ::Metanorma::Utils::anchor_or_uuid(nil),
64
64
  alt: node.attr("alt"))
65
65
  end
66
66
  end
@@ -114,9 +114,9 @@ module Asciidoctor
114
114
 
115
115
  def cleanup(xmldoc)
116
116
  bcp14_cleanup(xmldoc)
117
- rfc_anchor_cleanup(xmldoc)
118
117
  abstract_cleanup(xmldoc)
119
118
  super
119
+ rfc_anchor_cleanup(xmldoc)
120
120
  end
121
121
 
122
122
  BCP_KEYWORDS = ["MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
@@ -211,6 +211,13 @@ module Asciidoctor
211
211
  def rfc_converter(node)
212
212
  IsoDoc::Ietf::RfcConvert.new(html_extract_attributes(node))
213
213
  end
214
+
215
+ def isodoc(lang, script, i18nyaml = nil)
216
+ conv = rfc_converter(EmptyAttr.new)
217
+ i18n = conv.i18n_init(lang, script, i18nyaml)
218
+ conv.metadata_init(lang, script, i18n)
219
+ conv
220
+ end
214
221
  end
215
222
  end
216
223
  end
@@ -51,8 +51,8 @@ module Asciidoctor
51
51
  ["en"].each do |lang|
52
52
  at = { language: lang, format: "text/plain" }
53
53
  xml.title **attr_code(at.merge(type: "main")) do |t|
54
- t << (::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title")) ||
55
- ::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-en")) ||
54
+ t << (::Metanorma::Utils::asciidoc_sub(node.attr("title")) ||
55
+ ::Metanorma::Utils::asciidoc_sub(node.attr("title-en")) ||
56
56
  node.title)
57
57
  end
58
58
  a = node.attr("abbrev") and
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -42,12 +50,18 @@
42
50
  </define>
43
51
  <define name="xref">
44
52
  <element name="xref">
45
- <!-- attribute target { xsd:IDREF }, -->
46
53
  <attribute name="target">
47
54
  <data type="string">
48
55
  <param name="pattern">\i\c*|\c+#\c+</param>
49
56
  </data>
50
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
51
65
  <optional>
52
66
  <attribute name="type">
53
67
  <ref name="ReferenceFormat"/>
@@ -142,6 +156,11 @@
142
156
  <data type="boolean"/>
143
157
  </attribute>
144
158
  </optional>
159
+ <optional>
160
+ <attribute name="key">
161
+ <data type="boolean"/>
162
+ </attribute>
163
+ </optional>
145
164
  <oneOrMore>
146
165
  <ref name="dt"/>
147
166
  <ref name="dd"/>
@@ -234,6 +253,12 @@
234
253
  <data type="boolean"/>
235
254
  </attribute>
236
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
237
262
  <optional>
238
263
  <ref name="tname"/>
239
264
  </optional>
@@ -752,6 +777,21 @@
752
777
  </define>
753
778
  </include>
754
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
755
795
  <define name="TextElement" combine="choice">
756
796
  <ref name="concept"/>
757
797
  </define>
@@ -802,6 +842,9 @@
802
842
  <data type="boolean"/>
803
843
  </attribute>
804
844
  </optional>
845
+ <optional>
846
+ <attribute name="number"/>
847
+ </optional>
805
848
  <optional>
806
849
  <attribute name="obligation">
807
850
  <choice>
@@ -857,9 +900,11 @@
857
900
  <element name="code">
858
901
  <text/>
859
902
  </element>
860
- <element name="text">
861
- <text/>
862
- </element>
903
+ <optional>
904
+ <element name="text">
905
+ <text/>
906
+ </element>
907
+ </optional>
863
908
  </element>
864
909
  </define>
865
910
  <define name="standard-document">
@@ -1029,6 +1074,9 @@
1029
1074
  </choice>
1030
1075
  </attribute>
1031
1076
  </optional>
1077
+ <optional>
1078
+ <attribute name="number"/>
1079
+ </optional>
1032
1080
  <optional>
1033
1081
  <attribute name="type"/>
1034
1082
  </optional>
@@ -1082,6 +1130,9 @@
1082
1130
  <optional>
1083
1131
  <attribute name="type"/>
1084
1132
  </optional>
1133
+ <optional>
1134
+ <attribute name="number"/>
1135
+ </optional>
1085
1136
  <optional>
1086
1137
  <ref name="section-title"/>
1087
1138
  </optional>
@@ -1165,49 +1216,7 @@
1165
1216
  </define>
1166
1217
  <define name="annex">
1167
1218
  <element name="annex">
1168
- <optional>
1169
- <attribute name="id">
1170
- <data type="ID"/>
1171
- </attribute>
1172
- </optional>
1173
- <optional>
1174
- <attribute name="language"/>
1175
- </optional>
1176
- <optional>
1177
- <attribute name="script"/>
1178
- </optional>
1179
- <optional>
1180
- <attribute name="inline-header">
1181
- <data type="boolean"/>
1182
- </attribute>
1183
- </optional>
1184
- <attribute name="obligation">
1185
- <choice>
1186
- <value>normative</value>
1187
- <value>informative</value>
1188
- </choice>
1189
- </attribute>
1190
- <optional>
1191
- <ref name="section-title"/>
1192
- </optional>
1193
- <group>
1194
- <group>
1195
- <zeroOrMore>
1196
- <ref name="BasicBlock"/>
1197
- </zeroOrMore>
1198
- <zeroOrMore>
1199
- <ref name="note"/>
1200
- </zeroOrMore>
1201
- </group>
1202
- <zeroOrMore>
1203
- <choice>
1204
- <ref name="annex-subsection"/>
1205
- <ref name="terms"/>
1206
- <ref name="definitions"/>
1207
- <ref name="references"/>
1208
- </choice>
1209
- </zeroOrMore>
1210
- </group>
1219
+ <ref name="Annex-Section"/>
1211
1220
  </element>
1212
1221
  </define>
1213
1222
  <define name="terms">
@@ -1226,6 +1235,9 @@
1226
1235
  <optional>
1227
1236
  <attribute name="type"/>
1228
1237
  </optional>
1238
+ <optional>
1239
+ <attribute name="number"/>
1240
+ </optional>
1229
1241
  <optional>
1230
1242
  <attribute name="obligation">
1231
1243
  <choice>
@@ -1554,6 +1566,7 @@
1554
1566
  <value>add</value>
1555
1567
  <value>modify</value>
1556
1568
  <value>delete</value>
1569
+ <value>replace</value>
1557
1570
  </choice>
1558
1571
  </attribute>
1559
1572
  <optional>
@@ -1584,6 +1597,11 @@
1584
1597
  </optional>
1585
1598
  <optional>
1586
1599
  <element name="newcontent">
1600
+ <optional>
1601
+ <attribute name="id">
1602
+ <data type="ID"/>
1603
+ </attribute>
1604
+ </optional>
1587
1605
  <zeroOrMore>
1588
1606
  <ref name="BasicBlock"/>
1589
1607
  </zeroOrMore>
@@ -135,12 +135,12 @@ module IsoDoc::Ietf
135
135
  end
136
136
 
137
137
  def postal(addr, out)
138
- if line = addr.at(ns("./formattedAddress"))
139
- line.text.split(/\n/).each do |l|
140
- out.postalLine l, **attr_code(ascii: l.transliterate)
141
- end
142
- else
143
- out.postal do |p|
138
+ out.postal do |p|
139
+ if line = addr.at(ns("./formattedAddress"))
140
+ line.text.split(/\n/).each do |l|
141
+ p.postalLine l, **attr_code(ascii: l.transliterate)
142
+ end
143
+ else
144
144
  postal_detailed(addr, p)
145
145
  end
146
146
  end
@@ -0,0 +1,5 @@
1
+ term_def_boilerplate:
2
+ no_terms_boilerplate:
3
+ internal_terms_boilerplate:
4
+ external_terms_boilerplate:
5
+ internal_external_terms_boilerplate:
@@ -0,0 +1,14 @@
1
+ module IsoDoc
2
+ module Ietf
3
+ class I18n < IsoDoc::I18n
4
+ def load_yaml1(lang, script)
5
+ y = if lang == "en"
6
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
7
+ else
8
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
9
+ end
10
+ super.merge(y)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,16 @@
1
+ require "isodoc"
2
+ require_relative "i18n"
3
+
4
+ module IsoDoc
5
+ module Ietf
6
+ module Init
7
+ def i18n_init(lang, script, i18nyaml = nil)
8
+ @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
9
+ end
10
+
11
+ def fileloc(loc)
12
+ File.join(File.dirname(__FILE__), loc)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -156,8 +156,8 @@ module IsoDoc::Ietf
156
156
  end
157
157
 
158
158
  def index_parse(node, out)
159
- out.iref nil, **attr_code(item: node["primary"],
160
- subitem: node["secondary"])
159
+ out.iref nil, **attr_code(item: node.at(ns("./primary")).text,
160
+ subitem: node&.at(ns("./secondary"))&.text)
161
161
  end
162
162
 
163
163
  def bookmark_parse(node, out)
@@ -3,16 +3,27 @@ module IsoDoc::Ietf
3
3
  # TODO displayreference will be implemented as combination of autofetch and user-provided citations
4
4
 
5
5
  def bibliography(isoxml, out)
6
- isoxml.xpath(ns("//references")).each do |f|
7
- out.references **attr_code(anchor: f["id"]) do |div|
8
- title = f.at(ns("./title")) and div.name do |name|
9
- title.children.each { |n| parse(n, name) }
10
- end
11
- f.elements.reject do |e|
12
- %w(reference title bibitem note).include? e.name
13
- end.each { |e| parse(e, div) }
14
- biblio_list(f, div, true)
6
+ isoxml.xpath(ns("//bibliography/references | "\
7
+ "//bibliography/clause[.//references] | "\
8
+ "//annex/clause[.//references] | "\
9
+ "//annex/references | "\
10
+ "//sections/clause[.//references]")).each do |f|
11
+ bibliography1(f, out)
12
+ end
13
+ end
14
+
15
+ def bibliography1(f, out)
16
+ out.references **attr_code(anchor: f["id"]) do |div|
17
+ title = f.at(ns("./title")) and div.name do |name|
18
+ title.children.each { |n| parse(n, name) }
15
19
  end
20
+ f.elements.select do |e|
21
+ %w(references clause).include? e.name
22
+ end.each { |e| bibliography1(e, out) }
23
+ f.elements.reject do |e|
24
+ %w(references title bibitem note).include? e.name
25
+ end.each { |e| parse(e, div) }
26
+ biblio_list(f, div, true)
16
27
  end
17
28
  end
18
29
 
@@ -11,6 +11,7 @@ require_relative "./references"
11
11
  require_relative "./section"
12
12
  require_relative "./validation"
13
13
  require_relative "./xref"
14
+ require_relative "./init"
14
15
 
15
16
  module IsoDoc::Ietf
16
17
  class RfcConvert < ::IsoDoc::Convert
@@ -81,5 +82,7 @@ module IsoDoc::Ietf
81
82
  @format = :rfc
82
83
  @suffix = "rfc.xml"
83
84
  end
85
+
86
+ include ::IsoDoc::Ietf::Init
84
87
  end
85
88
  end
@@ -141,6 +141,7 @@ module IsoDoc::Ietf
141
141
  end
142
142
 
143
143
  def clause_parse(node, out)
144
+ return if node.at(ns(".//references"))
144
145
  out.section **attr_code( anchor: node["id"], numbered: node["numbered"],
145
146
  removeInRFC: node["removeInRFC"], toc: node["toc"]) do |div|
146
147
  clause_parse_title(node, div, node.at(ns("./title")), out)
@@ -153,23 +154,16 @@ module IsoDoc::Ietf
153
154
  def clause(isoxml, out)
154
155
  isoxml.xpath("//xmlns:preface/child::*[not(name() = 'abstract' or name() = 'foreword')] "\
155
156
  "| //xmlns:sections/child::*").each do |c|
156
- clause1(c, out)
157
- end
158
- end
159
-
160
- def clause1(c, out)
161
- out.section **attr_code( anchor: c["id"], numbered: c["numbered"],
162
- removeInRFC: c["removeInRFC"], toc: c["toc"]) do |div|
163
- clause_parse_title(c, div, c.at(ns("./title")), out)
164
- c.elements.reject { |c1| c1.name == "title" }.each do |c1|
165
- parse(c1, div)
166
- end
157
+ #cdup = c.dup
158
+ #cdup.xpath(ns(".//references")).each { |r| r.remove }
159
+ #cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
160
+ clause_parse(c, out)
167
161
  end
168
162
  end
169
163
 
170
164
  def annex(isoxml, out)
171
165
  isoxml.xpath(ns("//annex")).each do |c|
172
- clause1(c, out)
166
+ clause_parse(c, out)
173
167
  end
174
168
  end
175
169
  end
@@ -90,6 +90,8 @@ module IsoDoc::Ietf
90
90
  xml.at(".//*[@pn = '#{x['target']}']") or
91
91
  ret << "#{x.name} target #{x['target']} does not exist in the document"
92
92
  next unless t
93
+ x.delete("relative") if x["relative"]&.empty?
94
+ x.delete("section") if x["section"]&.empty?
93
95
  if x["format"] == "title" && t.name == "reference"
94
96
  t.at("./front/title") or
95
97
  ret << "reference #{t['anchor']} has been referenced by #{x.name} "\
@@ -133,7 +135,7 @@ module IsoDoc::Ietf
133
135
  "since it does not point to a RFC or Internet-Draft reference"
134
136
  end
135
137
  end
136
- if x["relative"]
138
+ if x["relative"]
137
139
  unless t.at(".//seriesInfo[@name = 'RFC' or @name = "\
138
140
  "'Internet-Draft']") || t["target"]
139
141
  ret << "need an explicit target= URL attribute in the reference "\
@@ -58,42 +58,31 @@ module Metanorma
58
58
  IsoDoc::Ietf::RfcConvert.new(options).convert(inname, isodoc_node, nil, outname)
59
59
  @done_rfc = true
60
60
 
61
- when :txt
61
+ when :txt, :pdf, :html
62
62
  unless xml2rfc_present?
63
63
  warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
64
64
  return
65
65
  end
66
66
 
67
67
  rfcname = inname.sub(/\.xml$/, ".rfc.xml")
68
- output(isodoc_node, inname, rfcname, :rfc, options) unless @done_rfc
69
-
70
- outname ||= inname.sub(/\.xml$/, ".txt")
71
- system("xml2rfc --text #{rfcname} -o #{outname}")
72
-
73
- when :pdf
74
- unless xml2rfc_present?
75
- warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
76
- return
68
+ unless @done_rfc && File.exist?(rfcname)
69
+ output(isodoc_node, inname, rfcname, :rfc, options)
77
70
  end
78
71
 
79
- rfcname = inname.sub(/\.xml$/, ".rfc.xml")
80
- output(isodoc_node, inname, rfcname, :rfc, options) unless @done_rfc
81
-
82
- outname ||= inname.sub(/\.xml$/, ".pdf")
83
- system("xml2rfc --pdf #{rfcname} -o #{outname}")
84
-
85
- when :html
86
- unless xml2rfc_present?
87
- warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
88
- return
72
+ outext = case format
73
+ when :txt then ".txt"
74
+ when :pdf then ".pdf"
75
+ when :html then ".html"
89
76
  end
90
77
 
91
- rfcname = inname.sub(/\.xml$/, ".rfc.xml")
92
- output(isodoc_node, inname, rfcname, :rfc, options) unless @done_rfc
93
-
94
- outname ||= inname.sub(/\.xml$/, ".html")
95
- system("xml2rfc --html #{rfcname} -o #{outname}")
78
+ outflag = case format
79
+ when :txt then "--text"
80
+ when :pdf then "--pdf"
81
+ when :html then "--html"
82
+ end
96
83
 
84
+ outname ||= inname.sub(/\.xml$/, outext)
85
+ system("xml2rfc #{outflag} #{rfcname} -o #{outname}")
97
86
  else
98
87
  super
99
88
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.2.3".freeze
3
+ VERSION = "2.2.8".freeze
4
4
  end
5
5
  end
@@ -35,8 +35,8 @@ Gem::Specification.new do |spec|
35
35
  spec.require_paths = ["lib"]
36
36
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
37
37
 
38
- spec.add_dependency "metanorma-standoc", "~> 1.6.0"
39
- spec.add_dependency "isodoc", "~> 1.2.0"
38
+ spec.add_dependency "metanorma-standoc", "~> 1.8.0"
39
+ spec.add_dependency "isodoc", "~> 1.5.0"
40
40
  spec.add_dependency "mathml2asciimath"
41
41
 
42
42
  spec.add_development_dependency "byebug"
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.2.3
4
+ version: 2.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-26 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.0
19
+ version: 1.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.0
26
+ version: 1.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: isodoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mathml2asciimath
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -223,9 +223,7 @@ executables: []
223
223
  extensions: []
224
224
  extra_rdoc_files: []
225
225
  files:
226
- - ".github/workflows/macos.yml"
227
- - ".github/workflows/ubuntu.yml"
228
- - ".github/workflows/windows.yml"
226
+ - ".github/workflows/rake.yml"
229
227
  - ".gitignore"
230
228
  - ".hound.yml"
231
229
  - ".oss-guides.rubocop.yml"
@@ -262,6 +260,9 @@ files:
262
260
  - lib/isodoc/ietf/cleanup.rb
263
261
  - lib/isodoc/ietf/footnotes.rb
264
262
  - lib/isodoc/ietf/front.rb
263
+ - lib/isodoc/ietf/i18n-en.yaml
264
+ - lib/isodoc/ietf/i18n.rb
265
+ - lib/isodoc/ietf/init.rb
265
266
  - lib/isodoc/ietf/inline.rb
266
267
  - lib/isodoc/ietf/metadata.rb
267
268
  - lib/isodoc/ietf/references.rb
@@ -1,54 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: macos
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/ubuntu.yml
11
- - .github/workflows/windows.yml
12
-
13
- jobs:
14
- test-macos:
15
- name: Test on Ruby ${{ matrix.ruby }} macOS
16
- runs-on: macos-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Cache xml2rfc
29
- id: cache-xml2rfc
30
- uses: actions/cache@v1
31
- with:
32
- path: ~/.cache/xml2rfc
33
- key: xml2rfc
34
- restore-key: xml2rfc
35
- - name: Use Ruby
36
- uses: actions/setup-ruby@v1
37
- with:
38
- ruby-version: ${{ matrix.ruby }}
39
- - name: Update gems
40
- run: |
41
- sudo gem install bundler --force
42
- bundle install --jobs 4 --retry 3
43
- - name: Use Python
44
- uses: actions/setup-python@v1
45
- with:
46
- python-version: '3.6'
47
- architecture: 'x64'
48
- - name: Install xml2rfc
49
- run: |
50
- pip install xml2rfc
51
- - name: Run specs
52
- run: |
53
- bundle exec rake
54
-
@@ -1,52 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: ubuntu
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/macos.yml
11
- - .github/workflows/windows.yml
12
- jobs:
13
- test-linux:
14
- name: Test on Ruby ${{ matrix.ruby }} Ubuntu
15
- runs-on: ubuntu-latest
16
- continue-on-error: ${{ matrix.experimental }}
17
- strategy:
18
- fail-fast: false
19
- matrix:
20
- ruby: [ '2.6', '2.5', '2.4' ]
21
- experimental: [false]
22
- include:
23
- - ruby: '2.7'
24
- experimental: true
25
- steps:
26
- - uses: actions/checkout@master
27
- - name: Cache xml2rfc
28
- id: cache-xml2rfc
29
- uses: actions/cache@v1
30
- with:
31
- path: ~/.cache/xml2rfc
32
- key: xml2rfc
33
- restore-key: xml2rfc
34
- - name: Use Ruby
35
- uses: actions/setup-ruby@v1
36
- with:
37
- ruby-version: ${{ matrix.ruby }}
38
- - name: Update gems
39
- run: |
40
- gem install bundler
41
- bundle install --jobs 4 --retry 3
42
- - name: Use Python
43
- uses: actions/setup-python@v1
44
- with:
45
- python-version: '3.6'
46
- architecture: 'x64'
47
- - name: Install xml2rfc
48
- run: |
49
- pip install xml2rfc
50
- - name: Run specs
51
- run: |
52
- bundle exec rake
@@ -1,54 +0,0 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
- name: windows
4
-
5
- on:
6
- push:
7
- branches: [ master ]
8
- pull_request:
9
- paths-ignore:
10
- - .github/workflows/macos.yml
11
- - .github/workflows/ubuntu.yml
12
-
13
- jobs:
14
- test-windows:
15
- name: Test on Ruby ${{ matrix.ruby }} Windows
16
- runs-on: windows-latest
17
- continue-on-error: ${{ matrix.experimental }}
18
- strategy:
19
- fail-fast: false
20
- matrix:
21
- ruby: [ '2.6', '2.5', '2.4' ]
22
- experimental: [false]
23
- include:
24
- - ruby: '2.7'
25
- experimental: true
26
- steps:
27
- - uses: actions/checkout@master
28
- - name: Cache xml2rfc
29
- id: cache-xml2rfc
30
- uses: actions/cache@v1
31
- with:
32
- path: ~/.cache/xml2rfc
33
- key: xml2rfc
34
- restore-key: xml2rfc
35
- - name: Use Ruby
36
- uses: actions/setup-ruby@v1
37
- with:
38
- ruby-version: ${{ matrix.ruby }}
39
- - name: Update gems
40
- shell: pwsh
41
- run: |
42
- gem install bundler
43
- bundle install --jobs 4 --retry 3
44
- - name: Use Python
45
- uses: actions/setup-python@v1
46
- with:
47
- ruby-version: '3.6'
48
- architecture: 'x64'
49
- - name: Install xml2rfc
50
- run: |
51
- pip install xml2rfc
52
- - name: Run specs
53
- run: |
54
- bundle exec rake