metanorma-ietf 2.2.2 → 2.2.7

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: 632a1a83824ce8f51934be44526afeea1ce136b240834729432c140c6d8ca4e6
4
- data.tar.gz: da8544516988c9d44389aea405a0473fbe146ff230183a6f163d9218c9c4950b
3
+ metadata.gz: cf74564b365111cd476e2a8beb46d61ab8c7d78bc2ca920f0ef8a1e79c417f8a
4
+ data.tar.gz: 0dc7800dc710e5ee211481335b86d23c444e3633a35ed7c5beae318c5c70665d
5
5
  SHA512:
6
- metadata.gz: 15757ce0afc5e69a804c80a8658e8c8b348ab3fc51da79ff9cf057955611736338e23516a51d4fa7c751b630e621378032ffb130d121b5c0b20c0bdc1ac5b86a
7
- data.tar.gz: b17b4e657f8a69d1a97e25828b7fb0c7f501479cbb332d11b450a5be1f005ca398dd0664d91607c639c52748519f82d3f9d2e36fc05863ba79b223df90b00589
6
+ metadata.gz: f35911333abe66b3f27bb3b27fe6190a64f68504e04be8df120a0f9a4bb44dabb478b156161e5b636c3d2cca7efd5c8503dab393dc2f08265cef7ece8a74b2ad
7
+ data.tar.gz: 7a2a46fcfdf29645223e3d5df4e703f40d942811a48be24fa094fd13cb63f7c78aec2282e97a5b597676b93d241882f5cfc9184281f65a338dc88d43cad62efb
@@ -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.
@@ -402,6 +402,16 @@
402
402
  </choice>
403
403
  </attribute>
404
404
  </optional>
405
+ <optional>
406
+ <attribute name="valign">
407
+ <choice>
408
+ <value>top</value>
409
+ <value>middle</value>
410
+ <value>bottom</value>
411
+ <value>baseline</value>
412
+ </choice>
413
+ </attribute>
414
+ </optional>
405
415
  <choice>
406
416
  <zeroOrMore>
407
417
  <ref name="TextElement"/>
@@ -429,6 +439,16 @@
429
439
  </choice>
430
440
  </attribute>
431
441
  </optional>
442
+ <optional>
443
+ <attribute name="valign">
444
+ <choice>
445
+ <value>top</value>
446
+ <value>middle</value>
447
+ <value>bottom</value>
448
+ <value>baseline</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
432
452
  <choice>
433
453
  <zeroOrMore>
434
454
  <ref name="TextElement"/>
@@ -576,6 +596,7 @@
576
596
  <ref name="bookmark"/>
577
597
  <ref name="image"/>
578
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
579
600
  </choice>
580
601
  </define>
581
602
  <define name="PureTextElement">
@@ -708,15 +729,61 @@
708
729
  </define>
709
730
  <define name="index">
710
731
  <element name="index">
711
- <attribute name="primary"/>
732
+ <attribute name="to">
733
+ <data type="IDREF"/>
734
+ </attribute>
735
+ <element name="primary">
736
+ <oneOrMore>
737
+ <ref name="PureTextElement"/>
738
+ </oneOrMore>
739
+ </element>
712
740
  <optional>
713
- <attribute name="secondary"/>
741
+ <element name="secondary">
742
+ <oneOrMore>
743
+ <ref name="PureTextElement"/>
744
+ </oneOrMore>
745
+ </element>
714
746
  </optional>
715
747
  <optional>
716
- <attribute name="tertiary"/>
748
+ <element name="tertiary">
749
+ <oneOrMore>
750
+ <ref name="PureTextElement"/>
751
+ </oneOrMore>
752
+ </element>
717
753
  </optional>
718
754
  </element>
719
755
  </define>
756
+ <define name="index-xref">
757
+ <element name="index-xref">
758
+ <attribute name="also">
759
+ <data type="boolean"/>
760
+ </attribute>
761
+ <element name="primary">
762
+ <oneOrMore>
763
+ <ref name="PureTextElement"/>
764
+ </oneOrMore>
765
+ </element>
766
+ <optional>
767
+ <element name="secondary">
768
+ <oneOrMore>
769
+ <ref name="PureTextElement"/>
770
+ </oneOrMore>
771
+ </element>
772
+ </optional>
773
+ <optional>
774
+ <element name="tertiary">
775
+ <oneOrMore>
776
+ <ref name="PureTextElement"/>
777
+ </oneOrMore>
778
+ </element>
779
+ </optional>
780
+ <element name="target">
781
+ <oneOrMore>
782
+ <ref name="PureTextElement"/>
783
+ </oneOrMore>
784
+ </element>
785
+ </element>
786
+ </define>
720
787
  <!-- bare ID element, used for referencing arbitrary spans of text -->
721
788
  <define name="bookmark">
722
789
  <element name="bookmark">
@@ -998,6 +1065,9 @@
998
1065
  <value>alphabet_upper</value>
999
1066
  </choice>
1000
1067
  </attribute>
1068
+ <optional>
1069
+ <attribute name="start"/>
1070
+ </optional>
1001
1071
  <oneOrMore>
1002
1072
  <ref name="li"/>
1003
1073
  </oneOrMore>
@@ -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
@@ -31,14 +31,8 @@ module Asciidoctor
31
31
  end
32
32
  end
33
33
 
34
- def organization(org, orgname)
35
- if ["IETF",
36
- "Internet Engineering Task Force"].include? orgname
37
- org.name "Internet Engineering Task Force"
38
- org.abbreviation "IETF"
39
- else
40
- org.name orgname
41
- end
34
+ def org_abbrev
35
+ { "Internet Engineering Task Force" => "IETF" }
42
36
  end
43
37
 
44
38
  def metadata_series(node, xml)
@@ -868,6 +868,13 @@
868
868
  </define>
869
869
  <define name="ietf-standard">
870
870
  <element name="ietf-standard">
871
+ <attribute name="version"/>
872
+ <attribute name="type">
873
+ <choice>
874
+ <value>semantic</value>
875
+ <value>presentation</value>
876
+ </choice>
877
+ </attribute>
871
878
  <ref name="bibdata"/>
872
879
  <zeroOrMore>
873
880
  <ref name="termdocsource"/>
@@ -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"/>
@@ -64,6 +78,11 @@
64
78
  </choice>
65
79
  </attribute>
66
80
  </optional>
81
+ <optional>
82
+ <attribute name="droploc">
83
+ <data type="boolean"/>
84
+ </attribute>
85
+ </optional>
67
86
  <text/>
68
87
  </element>
69
88
  </define>
@@ -137,6 +156,11 @@
137
156
  <data type="boolean"/>
138
157
  </attribute>
139
158
  </optional>
159
+ <optional>
160
+ <attribute name="key">
161
+ <data type="boolean"/>
162
+ </attribute>
163
+ </optional>
140
164
  <oneOrMore>
141
165
  <ref name="dt"/>
142
166
  <ref name="dd"/>
@@ -229,6 +253,12 @@
229
253
  <data type="boolean"/>
230
254
  </attribute>
231
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
232
262
  <optional>
233
263
  <ref name="tname"/>
234
264
  </optional>
@@ -581,6 +611,8 @@
581
611
  <ref name="ol"/>
582
612
  <ref name="dl"/>
583
613
  <ref name="formula"/>
614
+ <ref name="quote"/>
615
+ <ref name="sourcecode"/>
584
616
  </choice>
585
617
  </oneOrMore>
586
618
  </element>
@@ -664,6 +696,16 @@
664
696
  </choice>
665
697
  </attribute>
666
698
  </optional>
699
+ <optional>
700
+ <attribute name="valign">
701
+ <choice>
702
+ <value>top</value>
703
+ <value>middle</value>
704
+ <value>bottom</value>
705
+ <value>baseline</value>
706
+ </choice>
707
+ </attribute>
708
+ </optional>
667
709
  <choice>
668
710
  <zeroOrMore>
669
711
  <choice>
@@ -700,6 +742,16 @@
700
742
  </choice>
701
743
  </attribute>
702
744
  </optional>
745
+ <optional>
746
+ <attribute name="valign">
747
+ <choice>
748
+ <value>top</value>
749
+ <value>middle</value>
750
+ <value>bottom</value>
751
+ <value>baseline</value>
752
+ </choice>
753
+ </attribute>
754
+ </optional>
703
755
  <choice>
704
756
  <zeroOrMore>
705
757
  <choice>
@@ -725,6 +777,18 @@
725
777
  </define>
726
778
  </include>
727
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>
728
792
  <define name="TextElement" combine="choice">
729
793
  <ref name="concept"/>
730
794
  </define>
@@ -775,6 +839,9 @@
775
839
  <data type="boolean"/>
776
840
  </attribute>
777
841
  </optional>
842
+ <optional>
843
+ <attribute name="number"/>
844
+ </optional>
778
845
  <optional>
779
846
  <attribute name="obligation">
780
847
  <choice>
@@ -830,13 +897,22 @@
830
897
  <element name="code">
831
898
  <text/>
832
899
  </element>
833
- <element name="text">
834
- <text/>
835
- </element>
900
+ <optional>
901
+ <element name="text">
902
+ <text/>
903
+ </element>
904
+ </optional>
836
905
  </element>
837
906
  </define>
838
907
  <define name="standard-document">
839
908
  <element name="standard-document">
909
+ <attribute name="version"/>
910
+ <attribute name="type">
911
+ <choice>
912
+ <value>semantic</value>
913
+ <value>presentation</value>
914
+ </choice>
915
+ </attribute>
840
916
  <ref name="bibdata"/>
841
917
  <optional>
842
918
  <ref name="boilerplate"/>
@@ -858,7 +934,7 @@
858
934
  <oneOrMore>
859
935
  <choice>
860
936
  <ref name="content"/>
861
- <ref name="preface_abstract"/>
937
+ <ref name="abstract"/>
862
938
  <ref name="foreword"/>
863
939
  <ref name="introduction"/>
864
940
  <ref name="acknowledgements"/>
@@ -995,6 +1071,9 @@
995
1071
  </choice>
996
1072
  </attribute>
997
1073
  </optional>
1074
+ <optional>
1075
+ <attribute name="number"/>
1076
+ </optional>
998
1077
  <optional>
999
1078
  <attribute name="type"/>
1000
1079
  </optional>
@@ -1048,18 +1127,24 @@
1048
1127
  <optional>
1049
1128
  <attribute name="type"/>
1050
1129
  </optional>
1130
+ <optional>
1131
+ <attribute name="number"/>
1132
+ </optional>
1051
1133
  <optional>
1052
1134
  <ref name="section-title"/>
1053
1135
  </optional>
1054
1136
  <group>
1055
- <group>
1056
- <zeroOrMore>
1057
- <ref name="BasicBlock"/>
1058
- </zeroOrMore>
1059
- <zeroOrMore>
1060
- <ref name="note"/>
1061
- </zeroOrMore>
1062
- </group>
1137
+ <choice>
1138
+ <group>
1139
+ <zeroOrMore>
1140
+ <ref name="BasicBlock"/>
1141
+ </zeroOrMore>
1142
+ <zeroOrMore>
1143
+ <ref name="note"/>
1144
+ </zeroOrMore>
1145
+ </group>
1146
+ <ref name="amend"/>
1147
+ </choice>
1063
1148
  <zeroOrMore>
1064
1149
  <choice>
1065
1150
  <ref name="clause-subsection"/>
@@ -1128,49 +1213,7 @@
1128
1213
  </define>
1129
1214
  <define name="annex">
1130
1215
  <element name="annex">
1131
- <optional>
1132
- <attribute name="id">
1133
- <data type="ID"/>
1134
- </attribute>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="language"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="script"/>
1141
- </optional>
1142
- <optional>
1143
- <attribute name="inline-header">
1144
- <data type="boolean"/>
1145
- </attribute>
1146
- </optional>
1147
- <attribute name="obligation">
1148
- <choice>
1149
- <value>normative</value>
1150
- <value>informative</value>
1151
- </choice>
1152
- </attribute>
1153
- <optional>
1154
- <ref name="section-title"/>
1155
- </optional>
1156
- <group>
1157
- <group>
1158
- <zeroOrMore>
1159
- <ref name="BasicBlock"/>
1160
- </zeroOrMore>
1161
- <zeroOrMore>
1162
- <ref name="note"/>
1163
- </zeroOrMore>
1164
- </group>
1165
- <zeroOrMore>
1166
- <choice>
1167
- <ref name="annex-subsection"/>
1168
- <ref name="terms"/>
1169
- <ref name="definitions"/>
1170
- <ref name="references"/>
1171
- </choice>
1172
- </zeroOrMore>
1173
- </group>
1216
+ <ref name="Annex-Section"/>
1174
1217
  </element>
1175
1218
  </define>
1176
1219
  <define name="terms">
@@ -1189,6 +1232,9 @@
1189
1232
  <optional>
1190
1233
  <attribute name="type"/>
1191
1234
  </optional>
1235
+ <optional>
1236
+ <attribute name="number"/>
1237
+ </optional>
1192
1238
  <optional>
1193
1239
  <attribute name="obligation">
1194
1240
  <choice>
@@ -1456,11 +1502,6 @@
1456
1502
  </optional>
1457
1503
  </element>
1458
1504
  </define>
1459
- <define name="preface_abstract">
1460
- <element name="abstract">
1461
- <ref name="Basic-Section"/>
1462
- </element>
1463
- </define>
1464
1505
  <define name="term-clause">
1465
1506
  <element name="clause">
1466
1507
  <optional>
@@ -1510,4 +1551,85 @@
1510
1551
  <ref name="CitationType"/>
1511
1552
  </element>
1512
1553
  </define>
1554
+ <define name="amend">
1555
+ <element name="amend">
1556
+ <optional>
1557
+ <attribute name="id">
1558
+ <data type="ID"/>
1559
+ </attribute>
1560
+ </optional>
1561
+ <attribute name="change">
1562
+ <choice>
1563
+ <value>add</value>
1564
+ <value>modify</value>
1565
+ <value>delete</value>
1566
+ <value>replace</value>
1567
+ </choice>
1568
+ </attribute>
1569
+ <optional>
1570
+ <attribute name="path"/>
1571
+ </optional>
1572
+ <optional>
1573
+ <attribute name="path_end"/>
1574
+ </optional>
1575
+ <optional>
1576
+ <attribute name="title"/>
1577
+ </optional>
1578
+ <optional>
1579
+ <element name="location">
1580
+ <zeroOrMore>
1581
+ <ref name="locality"/>
1582
+ </zeroOrMore>
1583
+ </element>
1584
+ </optional>
1585
+ <zeroOrMore>
1586
+ <ref name="autonumber"/>
1587
+ </zeroOrMore>
1588
+ <optional>
1589
+ <element name="description">
1590
+ <zeroOrMore>
1591
+ <ref name="BasicBlock"/>
1592
+ </zeroOrMore>
1593
+ </element>
1594
+ </optional>
1595
+ <optional>
1596
+ <element name="newcontent">
1597
+ <optional>
1598
+ <attribute name="id">
1599
+ <data type="ID"/>
1600
+ </attribute>
1601
+ </optional>
1602
+ <zeroOrMore>
1603
+ <ref name="BasicBlock"/>
1604
+ </zeroOrMore>
1605
+ </element>
1606
+ </optional>
1607
+ <optional>
1608
+ <element name="description">
1609
+ <zeroOrMore>
1610
+ <ref name="BasicBlock"/>
1611
+ </zeroOrMore>
1612
+ </element>
1613
+ </optional>
1614
+ </element>
1615
+ </define>
1616
+ <define name="autonumber">
1617
+ <element name="autonumber">
1618
+ <attribute name="type">
1619
+ <choice>
1620
+ <value>requirement</value>
1621
+ <value>recommendation</value>
1622
+ <value>permission</value>
1623
+ <value>table</value>
1624
+ <value>figure</value>
1625
+ <value>admonition</value>
1626
+ <value>formula</value>
1627
+ <value>sourcecode</value>
1628
+ <value>example</value>
1629
+ <value>note</value>
1630
+ </choice>
1631
+ </attribute>
1632
+ <text/>
1633
+ </element>
1634
+ </define>
1513
1635
  </grammar>
@@ -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.2".freeze
3
+ VERSION = "2.2.7".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.5.0"
39
- spec.add_dependency "isodoc", "~> 1.2.0"
38
+ spec.add_dependency "metanorma-standoc", "~> 1.7.0"
39
+ spec.add_dependency "isodoc", "~> 1.4.2"
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.2
4
+ version: 2.2.7
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-08-27 00:00:00.000000000 Z
11
+ date: 2021-01-11 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.5.0
19
+ version: 1.7.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.5.0
26
+ version: 1.7.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.4.2
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.4.2
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