metanorma-ietf 2.0.7 → 2.0.12
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 +4 -4
- data/.github/workflows/macos.yml +9 -1
- data/.github/workflows/ubuntu.yml +9 -2
- data/.github/workflows/windows.yml +10 -2
- data/Gemfile +1 -1
- data/lib/asciidoctor/ietf/biblio.rng +142 -37
- data/lib/asciidoctor/ietf/converter.rb +5 -0
- data/lib/asciidoctor/ietf/front.rb +4 -3
- data/lib/asciidoctor/ietf/isodoc.rng +48 -2
- data/lib/isodoc/ietf/front.rb +0 -1
- data/lib/isodoc/ietf/inline.rb +27 -3
- data/lib/isodoc/ietf/metadata.rb +10 -18
- data/lib/isodoc/ietf/references.rb +26 -7
- data/lib/isodoc/ietf/rfc_convert.rb +12 -1
- data/lib/isodoc/ietf/section.rb +3 -5
- data/lib/metanorma/ietf/processor.rb +13 -1
- data/lib/metanorma/ietf/version.rb +1 -1
- data/metanorma-ietf.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c4621a18fe484fb098aab72221f43765c0ae8e4d91ffd1d0319e8d894acd7aa
|
4
|
+
data.tar.gz: 2ff2fd68a116943e119e190267372a1e243cf20253ec6fde2a9a6ea6d91d35f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 755749c0a269c0b018b93a02c2c502efde5781aa799ab07f2031ece79d88c87845d512801df2f1f4ae45b46e0fa0909107eaf52a74a11b69853d9e6eb6619bb4
|
7
|
+
data.tar.gz: 880c92cd6b26b25a9fc40e5f2c991fd18100bd0fff7e9c10ac7ca99a0dbc1fcb6fa6fc3543863d3c0739e3c2affe4488703c0c741d6bf34b1a5f88fffa09533a
|
data/.github/workflows/macos.yml
CHANGED
@@ -6,15 +6,23 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/ubuntu.yml
|
11
|
+
- .github/workflows/windows.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-macos:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} macOS
|
13
16
|
runs-on: macos-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Cache xml2rfc
|
@@ -36,7 +44,7 @@ jobs:
|
|
36
44
|
- name: Use Python
|
37
45
|
uses: actions/setup-python@v1
|
38
46
|
with:
|
39
|
-
python-version: '
|
47
|
+
python-version: '3.6'
|
40
48
|
architecture: 'x64'
|
41
49
|
- name: Install xml2rfc
|
42
50
|
run: |
|
@@ -6,15 +6,22 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
-
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/windows.yml
|
10
12
|
jobs:
|
11
13
|
test-linux:
|
12
14
|
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
13
15
|
runs-on: ubuntu-latest
|
16
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
17
|
strategy:
|
15
18
|
fail-fast: false
|
16
19
|
matrix:
|
17
20
|
ruby: [ '2.6', '2.5', '2.4' ]
|
21
|
+
experimental: [false]
|
22
|
+
include:
|
23
|
+
- ruby: '2.7'
|
24
|
+
experimental: true
|
18
25
|
steps:
|
19
26
|
- uses: actions/checkout@master
|
20
27
|
- name: Cache xml2rfc
|
@@ -36,7 +43,7 @@ jobs:
|
|
36
43
|
- name: Use Python
|
37
44
|
uses: actions/setup-python@v1
|
38
45
|
with:
|
39
|
-
python-version: '
|
46
|
+
python-version: '3.6'
|
40
47
|
architecture: 'x64'
|
41
48
|
- name: Install xml2rfc
|
42
49
|
run: |
|
@@ -6,15 +6,23 @@ on:
|
|
6
6
|
push:
|
7
7
|
branches: [ master ]
|
8
8
|
pull_request:
|
9
|
+
paths-ignore:
|
10
|
+
- .github/workflows/macos.yml
|
11
|
+
- .github/workflows/ubuntu.yml
|
9
12
|
|
10
13
|
jobs:
|
11
14
|
test-windows:
|
12
15
|
name: Test on Ruby ${{ matrix.ruby }} Windows
|
13
16
|
runs-on: windows-latest
|
17
|
+
continue-on-error: ${{ matrix.experimental }}
|
14
18
|
strategy:
|
15
19
|
fail-fast: false
|
16
20
|
matrix:
|
17
21
|
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
+
experimental: [false]
|
23
|
+
include:
|
24
|
+
- ruby: '2.7'
|
25
|
+
experimental: true
|
18
26
|
steps:
|
19
27
|
- uses: actions/checkout@master
|
20
28
|
- name: Cache xml2rfc
|
@@ -37,11 +45,11 @@ jobs:
|
|
37
45
|
- name: Use Python
|
38
46
|
uses: actions/setup-python@v1
|
39
47
|
with:
|
40
|
-
ruby-version: '
|
48
|
+
ruby-version: '3.6'
|
41
49
|
architecture: 'x64'
|
42
50
|
- name: Install xml2rfc
|
43
51
|
run: |
|
44
52
|
pip install xml2rfc
|
45
53
|
- name: Run specs
|
46
54
|
run: |
|
47
|
-
bundle exec rake
|
55
|
+
bundle exec rake
|
data/Gemfile
CHANGED
@@ -49,11 +49,17 @@
|
|
49
49
|
</define>
|
50
50
|
<define name="stage">
|
51
51
|
<element name="stage">
|
52
|
+
<optional>
|
53
|
+
<attribute name="abbreviation"/>
|
54
|
+
</optional>
|
52
55
|
<text/>
|
53
56
|
</element>
|
54
57
|
</define>
|
55
58
|
<define name="substage">
|
56
59
|
<element name="substage">
|
60
|
+
<optional>
|
61
|
+
<attribute name="abbreviation"/>
|
62
|
+
</optional>
|
57
63
|
<text/>
|
58
64
|
</element>
|
59
65
|
</define>
|
@@ -82,7 +88,7 @@
|
|
82
88
|
<text/>
|
83
89
|
</element>
|
84
90
|
</define>
|
85
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
86
92
|
<optional>
|
87
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
88
94
|
<attribute name="language"/>
|
@@ -92,6 +98,16 @@
|
|
92
98
|
</optional>
|
93
99
|
<text/>
|
94
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
95
111
|
<!--
|
96
112
|
Unlike UML, change type to format: type is overloaded
|
97
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -115,7 +131,7 @@
|
|
115
131
|
</optional>
|
116
132
|
<ref name="LocalizedStringOrXsAny"/>
|
117
133
|
</define>
|
118
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
119
135
|
<optional>
|
120
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
121
137
|
<attribute name="language"/>
|
@@ -130,6 +146,16 @@
|
|
130
146
|
</choice>
|
131
147
|
</oneOrMore>
|
132
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
133
159
|
<define name="contributor">
|
134
160
|
<element name="contributor">
|
135
161
|
<zeroOrMore>
|
@@ -452,9 +478,14 @@
|
|
452
478
|
<attribute name="bibitemid">
|
453
479
|
<data type="IDREF"/>
|
454
480
|
</attribute>
|
455
|
-
<
|
456
|
-
<
|
457
|
-
|
481
|
+
<choice>
|
482
|
+
<zeroOrMore>
|
483
|
+
<ref name="locality"/>
|
484
|
+
</zeroOrMore>
|
485
|
+
<zeroOrMore>
|
486
|
+
<ref name="localityStack"/>
|
487
|
+
</zeroOrMore>
|
488
|
+
</choice>
|
458
489
|
<optional>
|
459
490
|
<ref name="date"/>
|
460
491
|
</optional>
|
@@ -469,6 +500,25 @@
|
|
469
500
|
<ref name="BibItemLocality"/>
|
470
501
|
</element>
|
471
502
|
</define>
|
503
|
+
<define name="localityStack">
|
504
|
+
<element name="localityStack">
|
505
|
+
<zeroOrMore>
|
506
|
+
<ref name="locality"/>
|
507
|
+
</zeroOrMore>
|
508
|
+
</element>
|
509
|
+
</define>
|
510
|
+
<define name="sourceLocality">
|
511
|
+
<element name="sourceLocality">
|
512
|
+
<ref name="BibItemLocality"/>
|
513
|
+
</element>
|
514
|
+
</define>
|
515
|
+
<define name="sourceLocalityStack">
|
516
|
+
<element name="sourceLocalityStack">
|
517
|
+
<zeroOrMore>
|
518
|
+
<ref name="sourceLocality"/>
|
519
|
+
</zeroOrMore>
|
520
|
+
</element>
|
521
|
+
</define>
|
472
522
|
<define name="BibItemLocality">
|
473
523
|
<attribute name="type">
|
474
524
|
<ref name="LocalityType"/>
|
@@ -611,9 +661,9 @@
|
|
611
661
|
<optional>
|
612
662
|
<ref name="status"/>
|
613
663
|
</optional>
|
614
|
-
<
|
664
|
+
<zeroOrMore>
|
615
665
|
<ref name="copyright"/>
|
616
|
-
</
|
666
|
+
</zeroOrMore>
|
617
667
|
<zeroOrMore>
|
618
668
|
<ref name="docrelation"/>
|
619
669
|
</zeroOrMore>
|
@@ -737,6 +787,8 @@
|
|
737
787
|
<value>unchanged</value>
|
738
788
|
<value>circulated</value>
|
739
789
|
<value>adapted</value>
|
790
|
+
<value>vote-started</value>
|
791
|
+
<value>vote-ended</value>
|
740
792
|
</choice>
|
741
793
|
</define>
|
742
794
|
<define name="bdate">
|
@@ -969,7 +1021,17 @@
|
|
969
1021
|
<optional>
|
970
1022
|
<ref name="to"/>
|
971
1023
|
</optional>
|
972
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
973
1035
|
</element>
|
974
1036
|
</define>
|
975
1037
|
<define name="from">
|
@@ -989,38 +1051,63 @@
|
|
989
1051
|
</define>
|
990
1052
|
<define name="DocRelationType">
|
991
1053
|
<choice>
|
992
|
-
<value>obsoletes</value>
|
993
|
-
<value>obsoletedBy</value>
|
994
|
-
<value>supersedes</value>
|
995
|
-
<value>supersededBy</value>
|
996
|
-
<value>updates</value>
|
997
|
-
<value>updatedBy</value>
|
998
|
-
<value>complements</value>
|
999
|
-
<value>derivedFrom</value>
|
1000
|
-
<value>translatedFrom</value>
|
1001
|
-
<value>hasTranslation</value>
|
1002
|
-
<value>adoptedFrom</value>
|
1003
|
-
<value>equivalent</value>
|
1004
|
-
<value>identical</value>
|
1005
|
-
<value>nonequivalent</value>
|
1006
|
-
<value>includedIn</value>
|
1007
1054
|
<value>includes</value>
|
1008
|
-
<value>
|
1009
|
-
<value>instanceOf</value>
|
1010
|
-
<value>partOf</value>
|
1055
|
+
<value>includedIn</value>
|
1011
1056
|
<value>hasPart</value>
|
1012
|
-
<value>
|
1013
|
-
<value>draftOf</value>
|
1057
|
+
<value>partOf</value>
|
1014
1058
|
<value>merges</value>
|
1059
|
+
<value>mergedInto</value>
|
1015
1060
|
<value>splits</value>
|
1016
|
-
<value>
|
1017
|
-
<value>
|
1018
|
-
<value>
|
1019
|
-
<value>
|
1020
|
-
<value>
|
1021
|
-
<value>
|
1061
|
+
<value>splitInto</value>
|
1062
|
+
<value>instance</value>
|
1063
|
+
<value>hasInstance</value>
|
1064
|
+
<value>exemplarOf</value>
|
1065
|
+
<value>hasExemplar</value>
|
1066
|
+
<value>manifestationOf</value>
|
1067
|
+
<value>hasManifestation</value>
|
1068
|
+
<value>reproductionOf</value>
|
1069
|
+
<value>hasReproduction</value>
|
1070
|
+
<value>reprintOf</value>
|
1071
|
+
<value>hasReprint</value>
|
1072
|
+
<value>expressionOf</value>
|
1073
|
+
<value>hasExpression</value>
|
1074
|
+
<value>translatedFrom</value>
|
1075
|
+
<value>hasTranslation</value>
|
1076
|
+
<value>arrangementOf</value>
|
1077
|
+
<value>hasArrangement</value>
|
1078
|
+
<value>abridgementOf</value>
|
1079
|
+
<value>hasAbridgement</value>
|
1080
|
+
<value>annotationOf</value>
|
1081
|
+
<value>hasAnnotation</value>
|
1082
|
+
<value>draftOf</value>
|
1083
|
+
<value>hasDraft</value>
|
1084
|
+
<value>editionOf</value>
|
1085
|
+
<value>hasEdition</value>
|
1086
|
+
<value>updates</value>
|
1087
|
+
<value>updatedBy</value>
|
1088
|
+
<value>derivedFrom</value>
|
1089
|
+
<value>derives</value>
|
1022
1090
|
<value>describes</value>
|
1023
1091
|
<value>describedBy</value>
|
1092
|
+
<value>catalogues</value>
|
1093
|
+
<value>cataloguedBy</value>
|
1094
|
+
<value>hasSuccessor</value>
|
1095
|
+
<value>successorOf</value>
|
1096
|
+
<value>adaptedFrom</value>
|
1097
|
+
<value>hasAdaptation</value>
|
1098
|
+
<value>adoptedFrom</value>
|
1099
|
+
<value>adoptedAs</value>
|
1100
|
+
<value>reviewOf</value>
|
1101
|
+
<value>hasReview</value>
|
1102
|
+
<value>commentaryOf</value>
|
1103
|
+
<value>hasCommentary</value>
|
1104
|
+
<value>related</value>
|
1105
|
+
<value>complements</value>
|
1106
|
+
<value>complementOf</value>
|
1107
|
+
<value>obsoletes</value>
|
1108
|
+
<value>obsoletedBy</value>
|
1109
|
+
<value>cited</value>
|
1110
|
+
<value>isCitedIn</value>
|
1024
1111
|
</choice>
|
1025
1112
|
</define>
|
1026
1113
|
<define name="docrelation">
|
@@ -1028,12 +1115,30 @@
|
|
1028
1115
|
<attribute name="type">
|
1029
1116
|
<ref name="DocRelationType"/>
|
1030
1117
|
</attribute>
|
1118
|
+
<optional>
|
1119
|
+
<element name="description">
|
1120
|
+
<ref name="FormattedString"/>
|
1121
|
+
</element>
|
1122
|
+
</optional>
|
1031
1123
|
<element name="bibitem">
|
1032
1124
|
<ref name="BibliographicItem"/>
|
1033
1125
|
</element>
|
1034
|
-
<
|
1035
|
-
<
|
1036
|
-
|
1126
|
+
<choice>
|
1127
|
+
<zeroOrMore>
|
1128
|
+
<ref name="locality"/>
|
1129
|
+
</zeroOrMore>
|
1130
|
+
<zeroOrMore>
|
1131
|
+
<ref name="localityStack"/>
|
1132
|
+
</zeroOrMore>
|
1133
|
+
</choice>
|
1134
|
+
<choice>
|
1135
|
+
<zeroOrMore>
|
1136
|
+
<ref name="sourceLocality"/>
|
1137
|
+
</zeroOrMore>
|
1138
|
+
<zeroOrMore>
|
1139
|
+
<ref name="sourceLocalityStack"/>
|
1140
|
+
</zeroOrMore>
|
1141
|
+
</choice>
|
1037
1142
|
</element>
|
1038
1143
|
</define>
|
1039
1144
|
<define name="version">
|
@@ -22,6 +22,7 @@ module Asciidoctor
|
|
22
22
|
@draft = node.attributes.has_key?("draft")
|
23
23
|
@workgroups = cache_workgroup(node)
|
24
24
|
@bcp_bold = !node.attr?("no-rfc-bold-bcp14")
|
25
|
+
@xinclude = node.attr?("use-xinclude")
|
25
26
|
super
|
26
27
|
end
|
27
28
|
|
@@ -198,6 +199,10 @@ module Asciidoctor
|
|
198
199
|
end
|
199
200
|
end
|
200
201
|
|
202
|
+
def html_extract_attributes(node)
|
203
|
+
super.merge(use_xinclude: node.attr("use-xinclude"))
|
204
|
+
end
|
205
|
+
|
201
206
|
def rfc_converter(node)
|
202
207
|
IsoDoc::Ietf::RfcConvert.new(html_extract_attributes(node))
|
203
208
|
end
|
@@ -2,7 +2,7 @@ module Asciidoctor
|
|
2
2
|
module Ietf
|
3
3
|
class Converter < ::Asciidoctor::Standoc::Converter
|
4
4
|
def relaton_relations
|
5
|
-
%w(included-in described-by derived-from
|
5
|
+
%w(included-in described-by derived-from instance obsoletes updates)
|
6
6
|
end
|
7
7
|
|
8
8
|
def metadata_author(node, xml)
|
@@ -57,8 +57,9 @@ module Asciidoctor
|
|
57
57
|
["en"].each do |lang|
|
58
58
|
at = { language: lang, format: "text/plain" }
|
59
59
|
xml.title **attr_code(at.merge(type: "main")) do |t|
|
60
|
-
t << ::Asciidoctor::Standoc::Utils::asciidoc_sub(
|
61
|
-
|
60
|
+
t << (::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title")) ||
|
61
|
+
::Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-en")) ||
|
62
|
+
node.title)
|
62
63
|
end
|
63
64
|
a = node.attr("abbrev") and
|
64
65
|
xml.title a, **attr_code(at.merge(type: "abbrev"))
|
@@ -53,6 +53,14 @@
|
|
53
53
|
<optional>
|
54
54
|
<attribute name="alt"/>
|
55
55
|
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="case">
|
58
|
+
<choice>
|
59
|
+
<value>capital</value>
|
60
|
+
<value>lowercase</value>
|
61
|
+
</choice>
|
62
|
+
</attribute>
|
63
|
+
</optional>
|
56
64
|
<text/>
|
57
65
|
</element>
|
58
66
|
</define>
|
@@ -129,6 +137,9 @@
|
|
129
137
|
</choice>
|
130
138
|
</attribute>
|
131
139
|
</optional>
|
140
|
+
<attribute name="normative">
|
141
|
+
<data type="boolean"/>
|
142
|
+
</attribute>
|
132
143
|
<optional>
|
133
144
|
<ref name="section-title"/>
|
134
145
|
</optional>
|
@@ -305,6 +316,21 @@
|
|
305
316
|
</define>
|
306
317
|
</include>
|
307
318
|
<!-- end overrides -->
|
319
|
+
<define name="TextElement" combine="choice">
|
320
|
+
<ref name="concept"/>
|
321
|
+
</define>
|
322
|
+
<define name="concept">
|
323
|
+
<element name="concept">
|
324
|
+
<optional>
|
325
|
+
<attribute name="term"/>
|
326
|
+
</optional>
|
327
|
+
<choice>
|
328
|
+
<ref name="eref"/>
|
329
|
+
<ref name="xref"/>
|
330
|
+
<ref name="termref"/>
|
331
|
+
</choice>
|
332
|
+
</element>
|
333
|
+
</define>
|
308
334
|
<define name="BasicBlock" combine="choice">
|
309
335
|
<choice>
|
310
336
|
<ref name="requirement"/>
|
@@ -884,7 +910,15 @@
|
|
884
910
|
<attribute name="id">
|
885
911
|
<data type="ID"/>
|
886
912
|
</attribute>
|
887
|
-
<
|
913
|
+
<oneOrMore>
|
914
|
+
<choice>
|
915
|
+
<ref name="paragraph"/>
|
916
|
+
<ref name="ul"/>
|
917
|
+
<ref name="ol"/>
|
918
|
+
<ref name="dl"/>
|
919
|
+
<ref name="formula"/>
|
920
|
+
</choice>
|
921
|
+
</oneOrMore>
|
888
922
|
</element>
|
889
923
|
</define>
|
890
924
|
<define name="termexample">
|
@@ -911,7 +945,10 @@
|
|
911
945
|
</define>
|
912
946
|
<define name="origin">
|
913
947
|
<element name="origin">
|
914
|
-
<
|
948
|
+
<choice>
|
949
|
+
<ref name="erefType"/>
|
950
|
+
<ref name="termref"/>
|
951
|
+
</choice>
|
915
952
|
</element>
|
916
953
|
</define>
|
917
954
|
<define name="modification">
|
@@ -919,6 +956,15 @@
|
|
919
956
|
<ref name="paragraph"/>
|
920
957
|
</element>
|
921
958
|
</define>
|
959
|
+
<define name="termref">
|
960
|
+
<element name="termref">
|
961
|
+
<attribute name="base"/>
|
962
|
+
<attribute name="target"/>
|
963
|
+
<optional>
|
964
|
+
<text/>
|
965
|
+
</optional>
|
966
|
+
</element>
|
967
|
+
</define>
|
922
968
|
<define name="structuredidentifier">
|
923
969
|
<element name="structuredidentifier">
|
924
970
|
<optional>
|
data/lib/isodoc/ietf/front.rb
CHANGED
data/lib/isodoc/ietf/inline.rb
CHANGED
@@ -110,9 +110,17 @@ module IsoDoc::Ietf
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
def get_linkend(node)
|
114
|
+
contents = node.children.select { |c| !%w{locality localityStack}.include? c.name }.
|
115
|
+
select { |c| !c.text? || /\S/.match(c) }
|
116
|
+
!contents.empty? and
|
117
|
+
return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
|
118
|
+
""
|
119
|
+
end
|
120
|
+
|
113
121
|
def eref_parse(node, out)
|
114
|
-
linkend = node.children.
|
115
|
-
section = eref_clause(node.xpath(ns("./locality")), nil) || ""
|
122
|
+
linkend = node.children.reject { |c| %w{locality localityStack}.include? c.name }
|
123
|
+
section = eref_clause(node.xpath(ns("./locality | ./localityStack")), nil) || ""
|
116
124
|
out.relref **attr_code(target: node["bibitemid"], section: section,
|
117
125
|
displayFormat: node["displayFormat"]) do |l|
|
118
126
|
linkend.each { |n| parse(n, l) }
|
@@ -120,11 +128,27 @@ module IsoDoc::Ietf
|
|
120
128
|
end
|
121
129
|
|
122
130
|
def eref_clause(refs, target)
|
131
|
+
ret = []
|
132
|
+
ret1 = ""
|
133
|
+
refs.each do |l|
|
134
|
+
if l.name == "localityStack"
|
135
|
+
ret << ret1
|
136
|
+
ret1 = ""
|
137
|
+
ret << eref_clause1(l.elements, target)
|
138
|
+
else
|
139
|
+
ret1 += eref_clause1([l], target)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
ret << ret1
|
143
|
+
ret.reject { |c| c.nil? || c.empty? }.join("; ")
|
144
|
+
end
|
145
|
+
|
146
|
+
def eref_clause1(refs, target)
|
123
147
|
refs.each do |l|
|
124
148
|
next unless %w(clause section).include? l["type"]
|
125
149
|
return l&.at(ns("./referenceFrom"))&.text
|
126
150
|
end
|
127
|
-
return
|
151
|
+
return ""
|
128
152
|
end
|
129
153
|
|
130
154
|
def index_parse(node, out)
|
data/lib/isodoc/ietf/metadata.rb
CHANGED
@@ -15,18 +15,10 @@ module IsoDoc
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def relaton_relations
|
18
|
-
%w(included-in described-by derived-from
|
18
|
+
%w(included-in described-by derived-from instance)
|
19
19
|
# = item describedby convertedfrom alternate
|
20
20
|
end
|
21
21
|
|
22
|
-
def keywords(isoxml, _out)
|
23
|
-
ret = []
|
24
|
-
isoxml.xpath(ns("//bibdata/keyword")).each do |kw|
|
25
|
-
ret << kw.text
|
26
|
-
end
|
27
|
-
set(:keywords, ret)
|
28
|
-
end
|
29
|
-
|
30
22
|
def areas(isoxml, _out)
|
31
23
|
ret = []
|
32
24
|
isoxml.xpath(ns("//bibdata/ext/area")).each do |kw|
|
@@ -45,18 +37,18 @@ module IsoDoc
|
|
45
37
|
wg(xml)
|
46
38
|
end
|
47
39
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
def wg(xml)
|
41
|
+
workgroups = []
|
42
|
+
xml.xpath(ns("//bibdata/ext/editorialgroup/workgroup")).each do |wg|
|
43
|
+
workgroups << wg.text
|
52
44
|
end
|
53
|
-
|
45
|
+
set(:wg, workgroups)
|
54
46
|
end
|
55
47
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
def doctype(isoxml, _out)
|
49
|
+
super
|
50
|
+
set(:doctype, "Rfc") if get[:doctype].nil?
|
51
|
+
end
|
60
52
|
end
|
61
53
|
end
|
62
54
|
end
|
@@ -31,7 +31,13 @@ module IsoDoc::Ietf
|
|
31
31
|
|
32
32
|
def nonstd_bibitem(list, b, ordinal, bibliography)
|
33
33
|
uris = b.xpath(ns("./uri"))
|
34
|
-
|
34
|
+
target = nil
|
35
|
+
uris&.each do |u|
|
36
|
+
if u["type"] == "src" then
|
37
|
+
target = u.text
|
38
|
+
end
|
39
|
+
end
|
40
|
+
list.reference **attr_code(target: target,
|
35
41
|
anchor: b["id"]) do |r|
|
36
42
|
r.front do |f|
|
37
43
|
relaton_to_title(b, f)
|
@@ -40,25 +46,31 @@ module IsoDoc::Ietf
|
|
40
46
|
relaton_to_keyword(b, f)
|
41
47
|
relaton_to_abstract(b, f)
|
42
48
|
end
|
43
|
-
uris
|
49
|
+
uris&.each do |u|
|
44
50
|
r.format nil, **attr_code(target: u.text, type: u["type"])
|
45
51
|
end
|
52
|
+
docidentifiers = b.xpath(ns("./docidentifier"))
|
53
|
+
id = render_identifier(bibitem_ref_code(b))
|
54
|
+
!id[1].nil? and id[1] != "(NO ID)" and
|
55
|
+
r.refcontent id[1]
|
56
|
+
docidentifiers&.each do |u|
|
57
|
+
if %w(DOI IETF).include? u["type"]
|
58
|
+
r.seriesInfo nil, **attr_code(value: u.text, name: u["type"])
|
59
|
+
end
|
60
|
+
end
|
46
61
|
end
|
47
62
|
end
|
48
63
|
|
49
64
|
def relaton_to_title(b, f)
|
50
|
-
id = bibitem_ref_code(b)
|
51
|
-
identifier = render_identifier(id)
|
52
65
|
title = b&.at(ns("./title")) || b&.at(ns("./formattedref")) or return
|
53
66
|
f.title do |t|
|
54
|
-
t << "#{identifier}, "
|
55
67
|
title.children.each { |n| parse(n, t) }
|
56
68
|
end
|
57
69
|
end
|
58
70
|
|
59
71
|
def relaton_to_author(b, f)
|
60
72
|
auths = b.xpath(ns("./contributor[xmlns:role/@type = 'author' or "\
|
61
|
-
|
73
|
+
"xmlns:role/@type = 'editor']"))
|
62
74
|
auths.empty? and auths = b.xpath(ns("./contributor[xmlns:role/@type = "\
|
63
75
|
"'publisher']"))
|
64
76
|
auths.each do |a|
|
@@ -111,7 +123,13 @@ module IsoDoc::Ietf
|
|
111
123
|
def relaton_to_abstract(b, f)
|
112
124
|
b.xpath(ns("./abstract")).each do |k|
|
113
125
|
f.abstract do |abstract|
|
114
|
-
k.
|
126
|
+
if k.at(ns("./p"))
|
127
|
+
k.children.each { |n| parse(n, abstract) }
|
128
|
+
else
|
129
|
+
abstract.t do |t|
|
130
|
+
k.children.each { |n| parse(n, t) }
|
131
|
+
end
|
132
|
+
end
|
115
133
|
end
|
116
134
|
end
|
117
135
|
end
|
@@ -122,6 +140,7 @@ module IsoDoc::Ietf
|
|
122
140
|
end
|
123
141
|
|
124
142
|
def is_ietf(b)
|
143
|
+
return false if !@xinclude
|
125
144
|
url = b.at(ns("./uri[@type = 'xml']")) or return false
|
126
145
|
/xml2rfc\.tools\.ietf\.org/.match(url)
|
127
146
|
end
|
@@ -50,8 +50,13 @@ module IsoDoc::Ietf
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
def textcleanup(docxml)
|
54
|
+
passthrough_cleanup(docxml)
|
55
|
+
end
|
56
|
+
|
53
57
|
def postprocess(result, filename, dir)
|
54
|
-
result = from_xhtml(cleanup(to_xhtml(result)))
|
58
|
+
result = from_xhtml(cleanup(to_xhtml(textcleanup(result)))).
|
59
|
+
sub(/<!DOCTYPE[^>]+>\n/, "").
|
55
60
|
sub(/(<rfc[^<]+? )lang="[^"]+"/, "\\1")
|
56
61
|
File.open("#{filename}.rfc.xml", "w:UTF-8") { |f| f.write(result) }
|
57
62
|
@files_to_delete.each { |f| FileUtils.rm_rf f }
|
@@ -61,5 +66,11 @@ module IsoDoc::Ietf
|
|
61
66
|
filename = filename.sub(/\.rfc\.xml$/, ".rfc")
|
62
67
|
super
|
63
68
|
end
|
69
|
+
|
70
|
+
def initialize(options)
|
71
|
+
super
|
72
|
+
@xinclude = options[:use_xinclude] == "true"
|
73
|
+
@format = :rfc
|
74
|
+
end
|
64
75
|
end
|
65
76
|
end
|
data/lib/isodoc/ietf/section.rb
CHANGED
@@ -75,8 +75,6 @@ module IsoDoc::Ietf
|
|
75
75
|
'xml:lang': docxml&.at(ns("//bibdata/language"))&.text,
|
76
76
|
version: "3",
|
77
77
|
'xmlns:xi': "http://www.w3.org/2001/XInclude",
|
78
|
-
prepTime: sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
|
79
|
-
t.year, t.month, t.day, t.hour, t.min, t.sec),
|
80
78
|
}
|
81
79
|
end
|
82
80
|
|
@@ -88,7 +86,7 @@ module IsoDoc::Ietf
|
|
88
86
|
def make_link(out, isoxml)
|
89
87
|
links = isoxml.xpath(ns(
|
90
88
|
"//bibdata/relation[@type = 'includedIn' or @type = 'describedBy' or "\
|
91
|
-
"@type = 'derivedFrom' or @type = '
|
89
|
+
"@type = 'derivedFrom' or @type = 'instance']")) || return
|
92
90
|
links.each do |l|
|
93
91
|
out.link **{ href: l&.at(ns("./bibitem/docidentifier"))&.text,
|
94
92
|
rel: rel2iana(l["type"]) }
|
@@ -100,7 +98,7 @@ module IsoDoc::Ietf
|
|
100
98
|
when "includedIn" then "item"
|
101
99
|
when "describedBy" then "describedby"
|
102
100
|
when "derivedFrom" then "convertedfrom"
|
103
|
-
when "
|
101
|
+
when "instance" then "alternate"
|
104
102
|
else
|
105
103
|
"alternate"
|
106
104
|
end
|
@@ -114,8 +112,8 @@ module IsoDoc::Ietf
|
|
114
112
|
|
115
113
|
def make_back(out, isoxml)
|
116
114
|
out.back do |back|
|
117
|
-
annex isoxml, back
|
118
115
|
bibliography isoxml, back
|
116
|
+
annex isoxml, back
|
119
117
|
end
|
120
118
|
end
|
121
119
|
|
@@ -17,7 +17,8 @@ module Metanorma
|
|
17
17
|
xml: "xml",
|
18
18
|
rfc: "rfc.xml",
|
19
19
|
html: "html",
|
20
|
-
txt: "txt"
|
20
|
+
txt: "txt",
|
21
|
+
pdf: "pdf"
|
21
22
|
}
|
22
23
|
end
|
23
24
|
|
@@ -68,6 +69,17 @@ module Metanorma
|
|
68
69
|
|
69
70
|
system("xml2rfc --text #{rfcname} -o #{outname}")
|
70
71
|
|
72
|
+
when :pdf
|
73
|
+
unless xml2rfc_present?
|
74
|
+
warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
|
75
|
+
return
|
76
|
+
end
|
77
|
+
|
78
|
+
rfcname = outname.sub(/\.pdf$/, ".rfc.xml")
|
79
|
+
output(isodoc_node, outname, :rfc, options) unless @done_rfc
|
80
|
+
|
81
|
+
system("xml2rfc --pdf #{rfcname} -o #{outname}")
|
82
|
+
|
71
83
|
when :html
|
72
84
|
unless xml2rfc_present?
|
73
85
|
warn "[metanorma-ietf] Error: unable to generate #{format}, the command `xml2rfc` is not found in path."
|
data/metanorma-ietf.gemspec
CHANGED
@@ -35,7 +35,7 @@ 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.
|
38
|
+
spec.add_dependency "metanorma-standoc", "~> 1.4.0"
|
39
39
|
spec.add_dependency "isodoc", "~> 1.0.0"
|
40
40
|
spec.add_dependency "mathml2asciimath"
|
41
41
|
|
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.0.
|
4
|
+
version: 2.0.12
|
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-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-standoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.4.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.
|
26
|
+
version: 1.4.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: isodoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|