metanorma-ietf 2.2.0 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64b7510c103e030759b4c5430edf1165dd55859f28a6914f091a8f028400ef95
4
- data.tar.gz: '088ba7ce77c62226026e0fab41af28429a16623bc6379cc95d99f4bfa1a8fbe9'
3
+ metadata.gz: 3753bf3629ba6b3dbe10ef6f2dd1086eaff21428be99dcfd4d790cf300812b74
4
+ data.tar.gz: b6ea9b53ecf08906ae978fdad57e1cdc21c0f34c4e6891203fd7ac406cf83bcb
5
5
  SHA512:
6
- metadata.gz: c12d417a764debe8f8c4003e88730df92e34168c6fa85ecb322f94f63c7775c5c3d425faf2096b561edc7bd1598e95157a07bca6833acb26e2b7e5903b768ceb
7
- data.tar.gz: 7117f344165e8150e0acd0fbc397cb73a2ec12e22763c4069d8d05e6f283df5622b998f7ed83eb067730f51e596ed8d9874ced2389e5a8f0d05da286f0bf82d4
6
+ metadata.gz: 842e23d7fc1f0f5bc2ad809b70b527531ef05ae17fbdacb20d43dae5e98bcb14b983c3120177b36d0c5709e04ee104cafc85b2eb350f93bc6a7d73ea6a243ab9
7
+ data.tar.gz: 03efa75db6f4e55dd3417d8cd651b9d52508dbc760314b763fc3f71d4acddb5a731ddc9097661ff94cdbd46b2fd8bc4ac4f52f9af6c69da7e2893df18cd63c5b
@@ -0,0 +1,91 @@
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
+ - uses: actions/cache@v2
41
+ with:
42
+ path: vendor/bundle
43
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
44
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
45
+
46
+ - run: bundle config set path 'vendor/bundle'
47
+
48
+ - run: bundle install --jobs 4 --retry 3
49
+
50
+ - uses: actions/setup-python@v1
51
+ with:
52
+ python-version: '3.6'
53
+ architecture: 'x64'
54
+
55
+ - name: set PIP_DOWNLOAD_CACHE
56
+ shell: python
57
+ run: |
58
+ import os
59
+ import platform
60
+ from os.path import expanduser
61
+
62
+ home = expanduser("~")
63
+ cache_path = {
64
+ "Linux": f"{home}/.cache/pip",
65
+ "Darwin": f"{home}Library/Caches/pip",
66
+ "Windows": f"{home}\\AppData\\Local\\pip\\Cache"
67
+ }[platform.system()]
68
+
69
+ os.system(f"echo PIP_DOWNLOAD_CACHE={cache_path} >> {os.environ['GITHUB_ENV']}")
70
+
71
+ - uses: actions/cache@v2
72
+ with:
73
+ path: ${{ env.PIP_DOWNLOAD_CACHE }}
74
+ key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
75
+ restore-keys: ${{ runner.os }}-pip-
76
+
77
+ - uses: actions/cache@v2
78
+ with:
79
+ path: ~/.cache/xml2rfc
80
+ key: xml2rfc
81
+ restore-key: xml2rfc
82
+
83
+ - if: matrix.os == 'macos-latest'
84
+ run: brew install libmagic
85
+
86
+ - if: matrix.os == 'windows-latest'
87
+ run: pip install python-magic-bin
88
+
89
+ - run: pip install xml2rfc
90
+
91
+ - run: bundle exec rake
@@ -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"/>
@@ -998,6 +1018,9 @@
998
1018
  <value>alphabet_upper</value>
999
1019
  </choice>
1000
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1001
1024
  <oneOrMore>
1002
1025
  <ref name="li"/>
1003
1026
  </oneOrMore>
@@ -32,8 +32,8 @@ module Asciidoctor
32
32
  end
33
33
 
34
34
  def doctype(node)
35
- ret = node.attr("doctype")
36
- ret = "Internet-Draft" if ret == "article"
35
+ ret = super
36
+ ret = "internet-draft" if ret == "article"
37
37
  ret
38
38
  end
39
39
 
@@ -114,13 +114,21 @@ module Asciidoctor
114
114
 
115
115
  def cleanup(xmldoc)
116
116
  bcp14_cleanup(xmldoc)
117
- rfc_anchor_cleanup(xmldoc)
117
+ abstract_cleanup(xmldoc)
118
118
  super
119
+ rfc_anchor_cleanup(xmldoc)
119
120
  end
120
121
 
121
122
  BCP_KEYWORDS = ["MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
122
123
  "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", "OPTIONAL"].freeze
123
124
 
125
+ def abstract_cleanup(xmldoc)
126
+ xmldoc.xpath("//abstract[not(text())]").each do |x|
127
+ x.remove
128
+ warn "Empty abstract section removed"
129
+ end
130
+ end
131
+
124
132
  def bcp14_cleanup(xmldoc)
125
133
  return unless @bcp_bold
126
134
  xmldoc.xpath("//strong").each do |s|
@@ -174,6 +182,13 @@ module Asciidoctor
174
182
  super
175
183
  end
176
184
 
185
+ def annex_parse(attrs, xml, node)
186
+ attrs[:numbered] = node.attr("numbered")
187
+ attrs[:removeInRFC] = node.attr("removeInRFC")
188
+ attrs[:toc] = node.attr("toc")
189
+ super
190
+ end
191
+
177
192
  def introduction_parse(attrs, xml, node)
178
193
  clause_parse(attrs, xml, node)
179
194
  end
@@ -11,7 +11,7 @@ module Asciidoctor
11
11
 
12
12
  def metadata_publisher(node, xml)
13
13
  publishers = node.attr("publisher") || "IETF"
14
- publishers.split(/,[ ]?/).each do |p|
14
+ csv_split(publishers)&.each do |p|
15
15
  xml.contributor do |c|
16
16
  c.role **{ type: "publisher" }
17
17
  c.organization { |a| organization(a, p) }
@@ -20,8 +20,8 @@ module Asciidoctor
20
20
  end
21
21
 
22
22
  def metadata_copyright(node, xml)
23
- publishers = node.attr("publisher") || "IETF"
24
- publishers.split(/,[ ]?/).each do |p|
23
+ publishers = node.attr("copyright-holder") || node.attr("publisher") || "IETF"
24
+ csv_split(publishers)&.each do |p|
25
25
  xml.copyright do |c|
26
26
  c.from (node.attr("copyright-year") || Date.today.year)
27
27
  c.owner do |owner|
@@ -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)
@@ -80,7 +74,7 @@ module Asciidoctor
80
74
  x = node.attr("area") and x.split(/,\s*/).each do |a|
81
75
  xml.area a
82
76
  end
83
- x = node.attr("ipr") and xml.ipr x
77
+ xml.ipr (node.attr("ipr") || "trust200902")
84
78
  x = node.attr("consensus") and xml.consensus x
85
79
  x = node.attr("index-include") and xml.indexInclude x
86
80
  x = node.attr("ipr-extract") and xml.iprExtract x
@@ -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">
@@ -43,7 +51,9 @@
43
51
  <define name="xref">
44
52
  <element name="xref">
45
53
  <attribute name="target">
46
- <data type="IDREF"/>
54
+ <data type="string">
55
+ <param name="pattern">\i\c*|\c+#\c+</param>
56
+ </data>
47
57
  </attribute>
48
58
  <optional>
49
59
  <attribute name="type">
@@ -61,6 +71,11 @@
61
71
  </choice>
62
72
  </attribute>
63
73
  </optional>
74
+ <optional>
75
+ <attribute name="droploc">
76
+ <data type="boolean"/>
77
+ </attribute>
78
+ </optional>
64
79
  <text/>
65
80
  </element>
66
81
  </define>
@@ -134,6 +149,11 @@
134
149
  <data type="boolean"/>
135
150
  </attribute>
136
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
137
157
  <oneOrMore>
138
158
  <ref name="dt"/>
139
159
  <ref name="dd"/>
@@ -578,6 +598,8 @@
578
598
  <ref name="ol"/>
579
599
  <ref name="dl"/>
580
600
  <ref name="formula"/>
601
+ <ref name="quote"/>
602
+ <ref name="sourcecode"/>
581
603
  </choice>
582
604
  </oneOrMore>
583
605
  </element>
@@ -661,6 +683,16 @@
661
683
  </choice>
662
684
  </attribute>
663
685
  </optional>
686
+ <optional>
687
+ <attribute name="valign">
688
+ <choice>
689
+ <value>top</value>
690
+ <value>middle</value>
691
+ <value>bottom</value>
692
+ <value>baseline</value>
693
+ </choice>
694
+ </attribute>
695
+ </optional>
664
696
  <choice>
665
697
  <zeroOrMore>
666
698
  <choice>
@@ -697,6 +729,16 @@
697
729
  </choice>
698
730
  </attribute>
699
731
  </optional>
732
+ <optional>
733
+ <attribute name="valign">
734
+ <choice>
735
+ <value>top</value>
736
+ <value>middle</value>
737
+ <value>bottom</value>
738
+ <value>baseline</value>
739
+ </choice>
740
+ </attribute>
741
+ </optional>
700
742
  <choice>
701
743
  <zeroOrMore>
702
744
  <choice>
@@ -834,6 +876,13 @@
834
876
  </define>
835
877
  <define name="standard-document">
836
878
  <element name="standard-document">
879
+ <attribute name="version"/>
880
+ <attribute name="type">
881
+ <choice>
882
+ <value>semantic</value>
883
+ <value>presentation</value>
884
+ </choice>
885
+ </attribute>
837
886
  <ref name="bibdata"/>
838
887
  <optional>
839
888
  <ref name="boilerplate"/>
@@ -855,7 +904,7 @@
855
904
  <oneOrMore>
856
905
  <choice>
857
906
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
907
+ <ref name="abstract"/>
859
908
  <ref name="foreword"/>
860
909
  <ref name="introduction"/>
861
910
  <ref name="acknowledgements"/>
@@ -1049,14 +1098,17 @@
1049
1098
  <ref name="section-title"/>
1050
1099
  </optional>
1051
1100
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1101
+ <choice>
1102
+ <group>
1103
+ <zeroOrMore>
1104
+ <ref name="BasicBlock"/>
1105
+ </zeroOrMore>
1106
+ <zeroOrMore>
1107
+ <ref name="note"/>
1108
+ </zeroOrMore>
1109
+ </group>
1110
+ <ref name="amend"/>
1111
+ </choice>
1060
1112
  <zeroOrMore>
1061
1113
  <choice>
1062
1114
  <ref name="clause-subsection"/>
@@ -1125,49 +1177,7 @@
1125
1177
  </define>
1126
1178
  <define name="annex">
1127
1179
  <element name="annex">
1128
- <optional>
1129
- <attribute name="id">
1130
- <data type="ID"/>
1131
- </attribute>
1132
- </optional>
1133
- <optional>
1134
- <attribute name="language"/>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="script"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="inline-header">
1141
- <data type="boolean"/>
1142
- </attribute>
1143
- </optional>
1144
- <attribute name="obligation">
1145
- <choice>
1146
- <value>normative</value>
1147
- <value>informative</value>
1148
- </choice>
1149
- </attribute>
1150
- <optional>
1151
- <ref name="section-title"/>
1152
- </optional>
1153
- <group>
1154
- <group>
1155
- <zeroOrMore>
1156
- <ref name="BasicBlock"/>
1157
- </zeroOrMore>
1158
- <zeroOrMore>
1159
- <ref name="note"/>
1160
- </zeroOrMore>
1161
- </group>
1162
- <zeroOrMore>
1163
- <choice>
1164
- <ref name="annex-subsection"/>
1165
- <ref name="terms"/>
1166
- <ref name="definitions"/>
1167
- <ref name="references"/>
1168
- </choice>
1169
- </zeroOrMore>
1170
- </group>
1180
+ <ref name="Annex-Section"/>
1171
1181
  </element>
1172
1182
  </define>
1173
1183
  <define name="terms">
@@ -1453,11 +1463,6 @@
1453
1463
  </optional>
1454
1464
  </element>
1455
1465
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1466
  <define name="term-clause">
1462
1467
  <element name="clause">
1463
1468
  <optional>
@@ -1507,4 +1512,79 @@
1507
1512
  <ref name="CitationType"/>
1508
1513
  </element>
1509
1514
  </define>
1515
+ <define name="amend">
1516
+ <element name="amend">
1517
+ <optional>
1518
+ <attribute name="id">
1519
+ <data type="ID"/>
1520
+ </attribute>
1521
+ </optional>
1522
+ <attribute name="change">
1523
+ <choice>
1524
+ <value>add</value>
1525
+ <value>modify</value>
1526
+ <value>delete</value>
1527
+ </choice>
1528
+ </attribute>
1529
+ <optional>
1530
+ <attribute name="path"/>
1531
+ </optional>
1532
+ <optional>
1533
+ <attribute name="path_end"/>
1534
+ </optional>
1535
+ <optional>
1536
+ <attribute name="title"/>
1537
+ </optional>
1538
+ <optional>
1539
+ <element name="location">
1540
+ <zeroOrMore>
1541
+ <ref name="locality"/>
1542
+ </zeroOrMore>
1543
+ </element>
1544
+ </optional>
1545
+ <zeroOrMore>
1546
+ <ref name="autonumber"/>
1547
+ </zeroOrMore>
1548
+ <optional>
1549
+ <element name="description">
1550
+ <zeroOrMore>
1551
+ <ref name="BasicBlock"/>
1552
+ </zeroOrMore>
1553
+ </element>
1554
+ </optional>
1555
+ <optional>
1556
+ <element name="newcontent">
1557
+ <zeroOrMore>
1558
+ <ref name="BasicBlock"/>
1559
+ </zeroOrMore>
1560
+ </element>
1561
+ </optional>
1562
+ <optional>
1563
+ <element name="description">
1564
+ <zeroOrMore>
1565
+ <ref name="BasicBlock"/>
1566
+ </zeroOrMore>
1567
+ </element>
1568
+ </optional>
1569
+ </element>
1570
+ </define>
1571
+ <define name="autonumber">
1572
+ <element name="autonumber">
1573
+ <attribute name="type">
1574
+ <choice>
1575
+ <value>requirement</value>
1576
+ <value>recommendation</value>
1577
+ <value>permission</value>
1578
+ <value>table</value>
1579
+ <value>figure</value>
1580
+ <value>admonition</value>
1581
+ <value>formula</value>
1582
+ <value>sourcecode</value>
1583
+ <value>example</value>
1584
+ <value>note</value>
1585
+ </choice>
1586
+ </attribute>
1587
+ <text/>
1588
+ </element>
1589
+ </define>
1510
1590
  </grammar>