metanorma-ietf 2.2.4 → 2.2.9

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: f06324c3b9c916155d7de089ca675e524498efdcd6c07ff824f94b57ab6964c6
4
- data.tar.gz: 51bfdd81d038f103e94bc9d5be4f6954d6bc6fbc691972f4b7f3001cd7ca9a2d
3
+ metadata.gz: ef8df6cb58dabbcabed03ba7d877da277111d4899c18d37ab8cc4dc4946cfffa
4
+ data.tar.gz: 6b7ad838b66278077b12c5665989f29d928dcbe5a3db01744b6382cbfc33cb0f
5
5
  SHA512:
6
- metadata.gz: 45fc197eeaeb201677a069bd7ce3037a8d0bb28aacb49678a723bf7628cde25792aca668ddcff291f5932194f906e4bcbe12af342891da9ec5e36963c0cde2e6
7
- data.tar.gz: a1752e87e7185ef20c56f58b1d1f568617bfecab5c7295a48e67b22d27afd5eb9b9de470edb0b712423991803887a714a834111af0ba03f1fabc62a6219e8c7c
6
+ metadata.gz: 2753190188ffb6db38d5c9b82f005288306b2ec8e9b2fc3c913b59f6e233387997b8d2669ea3e30caf6f2c1c17705a47ce77b5fac74bcff404c040a169040e1c
7
+ data.tar.gz: 2e8bb3135c7b65585822c02c3c0fd57ba26630ded8d73b0af1c9b43f620214a457061eb5769e269a0cf791fea1e5788c0e6ed63669addfaf5e5fbe65d43ed806
@@ -4,7 +4,8 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -31,26 +32,25 @@ jobs:
31
32
 
32
33
  steps:
33
34
  - uses: actions/checkout@master
34
- - name: Cache xml2rfc
35
- id: cache-xml2rfc
36
- uses: actions/cache@v1
37
- with:
38
- path: ~/.cache/xml2rfc
39
- key: xml2rfc
40
- restore-key: xml2rfc
41
35
 
42
- - name: Use Ruby
43
- uses: ruby/setup-ruby@v1
36
+ - uses: ruby/setup-ruby@v1
44
37
  with:
45
38
  ruby-version: ${{ matrix.ruby }}
46
- bundler-cache: true
47
39
 
48
- - name: Update gems
49
- run: |
50
- bundle install --jobs 4 --retry 3
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
51
52
 
52
- - name: Use Python
53
- uses: actions/setup-python@v1
53
+ - uses: actions/setup-python@v1
54
54
  with:
55
55
  python-version: '3.6'
56
56
  architecture: 'x64'
@@ -58,6 +58,7 @@ jobs:
58
58
  - name: set PIP_DOWNLOAD_CACHE
59
59
  shell: python
60
60
  run: |
61
+ import os
61
62
  import platform
62
63
  from os.path import expanduser
63
64
 
@@ -65,10 +66,10 @@ jobs:
65
66
  cache_path = {
66
67
  "Linux": f"{home}/.cache/pip",
67
68
  "Darwin": f"{home}Library/Caches/pip",
68
- "Windows": f"{home}/AppData/Local/pip/Cache"
69
- }
69
+ "Windows": f"{home}\\AppData\\Local\\pip\\Cache"
70
+ }[platform.system()]
70
71
 
71
- print(f"::set-env name=PIP_DOWNLOAD_CACHE::{cache_path[platform.system()]}")
72
+ os.system(f"echo PIP_DOWNLOAD_CACHE={cache_path} >> {os.environ['GITHUB_ENV']}")
72
73
 
73
74
  - uses: actions/cache@v2
74
75
  with:
@@ -76,17 +77,32 @@ jobs:
76
77
  key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
77
78
  restore-keys: ${{ runner.os }}-pip-
78
79
 
79
- - name: Install xml2rfc's deps macOS
80
- if: matrix.os == 'macos-latest'
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'
81
87
  run: brew install libmagic
82
88
 
83
- - name: Install xml2rfc's deps Windows
84
- if: matrix.os == 'windows-latest'
89
+ - if: matrix.os == 'windows-latest'
85
90
  run: pip install python-magic-bin
86
91
 
87
- - name: Install xml2rfc
88
- run: pip install xml2rfc
92
+ - run: pip install xml2rfc
89
93
 
90
- - name: Run specs
91
- run: |
92
- bundle exec rake
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 }}
data/README.adoc CHANGED
@@ -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
@@ -204,6 +204,22 @@ module Asciidoctor
204
204
  end
205
205
  end
206
206
 
207
+ def inline_indexterm(node)
208
+ noko do |xml|
209
+ node.type == :visible and xml << node.text.sub(/^primary:(?=\S)/, "")
210
+ terms = (node.attr("terms") || [node.text]).map { |x| xml_encode(x) }
211
+ if /^primary:\S/.match(terms[0])
212
+ terms[0].sub!(/^primary:/, "")
213
+ has_primary = true
214
+ end
215
+ xml.index **attr_code(primary: has_primary) do |i|
216
+ i.primary { |x| x << terms[0] }
217
+ a = terms.dig(1) and i.secondary { |x| x << a }
218
+ a = terms.dig(2) and i.tertiary { |x| x << a }
219
+ end
220
+ end.join
221
+ end
222
+
207
223
  def html_extract_attributes(node)
208
224
  super.merge(use_xinclude: node.attr("use-xinclude"))
209
225
  end
@@ -211,6 +227,13 @@ module Asciidoctor
211
227
  def rfc_converter(node)
212
228
  IsoDoc::Ietf::RfcConvert.new(html_extract_attributes(node))
213
229
  end
230
+
231
+ def isodoc(lang, script, i18nyaml = nil)
232
+ conv = rfc_converter(EmptyAttr.new)
233
+ i18n = conv.i18n_init(lang, script, i18nyaml)
234
+ conv.metadata_init(lang, script, i18n)
235
+ conv
236
+ end
214
237
  end
215
238
  end
216
239
  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
@@ -564,6 +564,39 @@
564
564
  </zeroOrMore>
565
565
  </element>
566
566
  </define>
567
+ <define name="index">
568
+ <element name="index">
569
+ <optional>
570
+ <attribute name="to">
571
+ <data type="IDREF"/>
572
+ </attribute>
573
+ </optional>
574
+ <optional>
575
+ <attribute name="primary">
576
+ <data type="boolean"/>
577
+ </attribute>
578
+ </optional>
579
+ <element name="primary">
580
+ <oneOrMore>
581
+ <ref name="PureTextElement"/>
582
+ </oneOrMore>
583
+ </element>
584
+ <optional>
585
+ <element name="secondary">
586
+ <oneOrMore>
587
+ <ref name="PureTextElement"/>
588
+ </oneOrMore>
589
+ </element>
590
+ </optional>
591
+ <optional>
592
+ <element name="tertiary">
593
+ <oneOrMore>
594
+ <ref name="PureTextElement"/>
595
+ </oneOrMore>
596
+ </element>
597
+ </optional>
598
+ </element>
599
+ </define>
567
600
  </include>
568
601
  <define name="TextElement" combine="choice">
569
602
  <ref name="bcp14"/>
@@ -879,6 +912,9 @@
879
912
  <zeroOrMore>
880
913
  <ref name="termdocsource"/>
881
914
  </zeroOrMore>
915
+ <optional>
916
+ <ref name="misccontainer"/>
917
+ </optional>
882
918
  <optional>
883
919
  <ref name="boilerplate"/>
884
920
  </optional>
@@ -890,6 +926,9 @@
890
926
  <ref name="annex"/>
891
927
  </zeroOrMore>
892
928
  <ref name="bibliography"/>
929
+ <zeroOrMore>
930
+ <ref name="indexsect"/>
931
+ </zeroOrMore>
893
932
  </element>
894
933
  </define>
895
934
  </grammar>
@@ -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">
@@ -47,6 +55,13 @@
47
55
  <param name="pattern">\i\c*|\c+#\c+</param>
48
56
  </data>
49
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>
50
65
  <optional>
51
66
  <attribute name="type">
52
67
  <ref name="ReferenceFormat"/>
@@ -141,6 +156,11 @@
141
156
  <data type="boolean"/>
142
157
  </attribute>
143
158
  </optional>
159
+ <optional>
160
+ <attribute name="key">
161
+ <data type="boolean"/>
162
+ </attribute>
163
+ </optional>
144
164
  <oneOrMore>
145
165
  <ref name="dt"/>
146
166
  <ref name="dd"/>
@@ -233,6 +253,12 @@
233
253
  <data type="boolean"/>
234
254
  </attribute>
235
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
236
262
  <optional>
237
263
  <ref name="tname"/>
238
264
  </optional>
@@ -751,6 +777,21 @@
751
777
  </define>
752
778
  </include>
753
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>
754
795
  <define name="TextElement" combine="choice">
755
796
  <ref name="concept"/>
756
797
  </define>
@@ -771,6 +812,8 @@
771
812
  <ref name="requirement"/>
772
813
  <ref name="recommendation"/>
773
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
774
817
  </choice>
775
818
  </define>
776
819
  <define name="bibliography">
@@ -801,6 +844,9 @@
801
844
  <data type="boolean"/>
802
845
  </attribute>
803
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
804
850
  <optional>
805
851
  <attribute name="obligation">
806
852
  <choice>
@@ -856,9 +902,11 @@
856
902
  <element name="code">
857
903
  <text/>
858
904
  </element>
859
- <element name="text">
860
- <text/>
861
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
862
910
  </element>
863
911
  </define>
864
912
  <define name="standard-document">
@@ -871,6 +919,9 @@
871
919
  </choice>
872
920
  </attribute>
873
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
874
925
  <optional>
875
926
  <ref name="boilerplate"/>
876
927
  </optional>
@@ -881,11 +932,21 @@
881
932
  <zeroOrMore>
882
933
  <ref name="annex"/>
883
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
884
938
  <zeroOrMore>
885
- <ref name="references"/>
939
+ <ref name="indexsect"/>
886
940
  </zeroOrMore>
887
941
  </element>
888
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
889
950
  <define name="preface">
890
951
  <element name="preface">
891
952
  <oneOrMore>
@@ -909,6 +970,11 @@
909
970
  <ref name="Content-Section"/>
910
971
  </element>
911
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
912
978
  <define name="boilerplate">
913
979
  <element name="boilerplate">
914
980
  <optional>
@@ -1028,6 +1094,9 @@
1028
1094
  </choice>
1029
1095
  </attribute>
1030
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1031
1100
  <optional>
1032
1101
  <attribute name="type"/>
1033
1102
  </optional>
@@ -1081,6 +1150,9 @@
1081
1150
  <optional>
1082
1151
  <attribute name="type"/>
1083
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1084
1156
  <optional>
1085
1157
  <ref name="section-title"/>
1086
1158
  </optional>
@@ -1183,6 +1255,9 @@
1183
1255
  <optional>
1184
1256
  <attribute name="type"/>
1185
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1186
1261
  <optional>
1187
1262
  <attribute name="obligation">
1188
1263
  <choice>
@@ -1511,6 +1586,7 @@
1511
1586
  <value>add</value>
1512
1587
  <value>modify</value>
1513
1588
  <value>delete</value>
1589
+ <value>replace</value>
1514
1590
  </choice>
1515
1591
  </attribute>
1516
1592
  <optional>
@@ -1541,6 +1617,11 @@
1541
1617
  </optional>
1542
1618
  <optional>
1543
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1544
1625
  <zeroOrMore>
1545
1626
  <ref name="BasicBlock"/>
1546
1627
  </zeroOrMore>
@@ -1574,4 +1655,65 @@
1574
1655
  <text/>
1575
1656
  </element>
1576
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1577
1719
  </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, primary: node["primary"],
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
@@ -25,7 +26,7 @@ module IsoDoc::Ietf
25
26
  make_back(html, docxml)
26
27
  end
27
28
  end.join("\n").sub(/<!DOCTYPE[^>]+>\n/, "")
28
- set_pis(docxml, Nokogiri::XML(xml))
29
+ set_pis(docxml, Nokogiri::XML(xml))
29
30
  end
30
31
 
31
32
  def metadata_init(lang, script, i18n)
@@ -33,8 +34,8 @@ module IsoDoc::Ietf
33
34
  end
34
35
 
35
36
  def xref_init(lang, script, klass, i18n, options)
36
- @xrefs = Xref.new(lang, script, klass, i18n, options)
37
- end
37
+ @xrefs = Xref.new(lang, script, klass, i18n, options)
38
+ end
38
39
 
39
40
  def extract_delims(text)
40
41
  @openmathdelim = "$$"
@@ -56,9 +57,14 @@ module IsoDoc::Ietf
56
57
  end
57
58
  end
58
59
 
59
- def textcleanup(docxml)
60
+ def omit_docid_prefix(prefix)
61
+ return true if prefix == "IETF"
62
+ super
63
+ end
64
+
65
+ def textcleanup(docxml)
60
66
  passthrough_cleanup(docxml)
61
- end
67
+ end
62
68
 
63
69
  def postprocess(result, filename, _dir)
64
70
  result = from_xhtml(cleanup(to_xhtml(textcleanup(result)))).
@@ -81,5 +87,7 @@ module IsoDoc::Ietf
81
87
  @format = :rfc
82
88
  @suffix = "rfc.xml"
83
89
  end
90
+
91
+ include ::IsoDoc::Ietf::Init
84
92
  end
85
93
  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
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.2.4".freeze
3
+ VERSION = "2.2.9".freeze
4
4
  end
5
5
  end
@@ -35,9 +35,10 @@ 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
+ spec.add_dependency "nokogiri", "~> 1.10.4"
41
42
 
42
43
  spec.add_development_dependency "byebug"
43
44
  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.2.4
4
+ version: 2.2.9
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-10-25 00:00:00.000000000 Z
11
+ date: 2021-02-22 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
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.10.4
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.10.4
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: byebug
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -260,6 +274,9 @@ files:
260
274
  - lib/isodoc/ietf/cleanup.rb
261
275
  - lib/isodoc/ietf/footnotes.rb
262
276
  - lib/isodoc/ietf/front.rb
277
+ - lib/isodoc/ietf/i18n-en.yaml
278
+ - lib/isodoc/ietf/i18n.rb
279
+ - lib/isodoc/ietf/init.rb
263
280
  - lib/isodoc/ietf/inline.rb
264
281
  - lib/isodoc/ietf/metadata.rb
265
282
  - lib/isodoc/ietf/references.rb
@@ -298,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
315
  - !ruby/object:Gem::Version
299
316
  version: '0'
300
317
  requirements: []
301
- rubygems_version: 3.0.3
318
+ rubygems_version: 3.1.4
302
319
  signing_key:
303
320
  specification_version: 4
304
321
  summary: metanorma-ietf lets you write IETF documents, such as Internet-Drafts and