metanorma-ietf 2.4.3 → 2.4.4

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: 8b22c8815c0cc3923b629bedb736f56ff20f06aca37abf875d67ff91a63ac6af
4
- data.tar.gz: 7a2dd5c740d7f2343c07f684f1f7c672b5577f03e5acc48467da7e3d63f6eb2f
3
+ metadata.gz: 68f7c56e995bd19565266c00a76aa97a0e7a02e348d34f53d7d9288b63fb8663
4
+ data.tar.gz: 83866142dd9d484e04f7f34b7df0a2a405d1aee18063d0c5d87612e5b336920c
5
5
  SHA512:
6
- metadata.gz: f602fe12119c1bf21a3d35ef675d67ce68964373a41a34e39c3f6c38ba5233d129cc43e39599a87ac3237c0b1da2ece3773d50e499b8f3b1a36dce35c6d1acd0
7
- data.tar.gz: 03fbcf5cb80118d00fdf3753cc00277f52c16fe60c229b03e360ac47cd9b8df3982a11b35a5226dd36c58c593c2aba6e1a08158ebbc5c4184f7aaaceb95d8959
6
+ metadata.gz: 26bf8e60e859a2875c84c8ca90ad6f33e2100de0b381e51da5fb461a9cce3276e52b8a21d090d9639b9003ad2762aa69a3c5abd0154ecc489c56ab9e5660b240
7
+ data.tar.gz: '0891c85154fc7fdc7b53d66307fe7c9179336f45cabecd1c902f772db770e356b17027ac4d16b17fa2270dace7ff7767460788de5706c45febf7be292a96a1d0'
@@ -624,6 +624,9 @@
624
624
  <choice>
625
625
  <ref name="PureTextElement"/>
626
626
  <ref name="stem"/>
627
+ <ref name="eref"/>
628
+ <ref name="xref"/>
629
+ <ref name="hyperlink"/>
627
630
  </choice>
628
631
  </zeroOrMore>
629
632
  </element>
@@ -634,6 +637,9 @@
634
637
  <choice>
635
638
  <ref name="PureTextElement"/>
636
639
  <ref name="stem"/>
640
+ <ref name="eref"/>
641
+ <ref name="xref"/>
642
+ <ref name="hyperlink"/>
637
643
  </choice>
638
644
  </zeroOrMore>
639
645
  </element>
@@ -641,7 +647,12 @@
641
647
  <define name="tt">
642
648
  <element name="tt">
643
649
  <zeroOrMore>
644
- <ref name="PureTextElement"/>
650
+ <choice>
651
+ <ref name="PureTextElement"/>
652
+ <ref name="eref"/>
653
+ <ref name="xref"/>
654
+ <ref name="hyperlink"/>
655
+ </choice>
645
656
  </zeroOrMore>
646
657
  </element>
647
658
  </define>
@@ -822,7 +833,9 @@
822
833
  <attribute name="alt"/>
823
834
  </optional>
824
835
  <ref name="CitationType"/>
825
- <text/>
836
+ <oneOrMore>
837
+ <ref name="PureTextElement"/>
838
+ </oneOrMore>
826
839
  </define>
827
840
  <define name="hyperlink">
828
841
  <element name="link">
@@ -835,7 +848,9 @@
835
848
  <optional>
836
849
  <attribute name="alt"/>
837
850
  </optional>
838
- <text/>
851
+ <oneOrMore>
852
+ <ref name="PureTextElement"/>
853
+ </oneOrMore>
839
854
  </element>
840
855
  </define>
841
856
  <define name="xref">
@@ -849,7 +864,9 @@
849
864
  <optional>
850
865
  <attribute name="alt"/>
851
866
  </optional>
852
- <text/>
867
+ <oneOrMore>
868
+ <ref name="PureTextElement"/>
869
+ </oneOrMore>
853
870
  </element>
854
871
  </define>
855
872
  <define name="fn">
@@ -65,6 +65,8 @@ module Asciidoctor
65
65
  n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'")
66
66
  .gsub(/\u201c|\u201d|\u201e|\u201f/, '"')
67
67
  .gsub(/[\u2010-\u2015]/, "-")
68
+ .gsub(/\u2026/, "...")
69
+ .gsub(/[\u200b-\u200c]/, "")
68
70
  .gsub(/[\u2000-\u200a]|\u202f|\u205f/, " "),
69
71
  :basic,
70
72
  ))
@@ -459,14 +459,9 @@
459
459
  <ref name="section-title"/>
460
460
  </optional>
461
461
  <group>
462
- <group>
463
- <zeroOrMore>
464
- <ref name="BasicBlock"/>
465
- </zeroOrMore>
466
- <zeroOrMore>
467
- <ref name="note"/>
468
- </zeroOrMore>
469
- </group>
462
+ <zeroOrMore>
463
+ <ref name="BasicBlock"/>
464
+ </zeroOrMore>
470
465
  <zeroOrMore>
471
466
  <choice>
472
467
  <ref name="clause-subsection"/>
@@ -508,14 +503,9 @@
508
503
  <ref name="section-title"/>
509
504
  </optional>
510
505
  <group>
511
- <group>
512
- <zeroOrMore>
513
- <ref name="BasicBlock"/>
514
- </zeroOrMore>
515
- <zeroOrMore>
516
- <ref name="note"/>
517
- </zeroOrMore>
518
- </group>
506
+ <zeroOrMore>
507
+ <ref name="BasicBlock"/>
508
+ </zeroOrMore>
519
509
  <zeroOrMore>
520
510
  <ref name="clause-subsection"/>
521
511
  </zeroOrMore>
@@ -547,14 +537,9 @@
547
537
  <ref name="section-title"/>
548
538
  </optional>
549
539
  <group>
550
- <group>
551
- <zeroOrMore>
552
- <ref name="BasicBlock"/>
553
- </zeroOrMore>
554
- <zeroOrMore>
555
- <ref name="note"/>
556
- </zeroOrMore>
557
- </group>
540
+ <zeroOrMore>
541
+ <ref name="BasicBlock"/>
542
+ </zeroOrMore>
558
543
  <zeroOrMore>
559
544
  <ref name="content-subsection"/>
560
545
  </zeroOrMore>
@@ -62,7 +62,9 @@
62
62
  <data type="boolean"/>
63
63
  </attribute>
64
64
  </optional>
65
- <text/>
65
+ <oneOrMore>
66
+ <ref name="PureTextElement"/>
67
+ </oneOrMore>
66
68
  </element>
67
69
  </define>
68
70
  <define name="xref">
@@ -100,7 +102,9 @@
100
102
  <data type="boolean"/>
101
103
  </attribute>
102
104
  </optional>
103
- <text/>
105
+ <oneOrMore>
106
+ <ref name="PureTextElement"/>
107
+ </oneOrMore>
104
108
  </element>
105
109
  </define>
106
110
  <define name="erefType">
@@ -130,7 +134,9 @@
130
134
  </attribute>
131
135
  </optional>
132
136
  <ref name="CitationType"/>
133
- <text/>
137
+ <oneOrMore>
138
+ <ref name="PureTextElement"/>
139
+ </oneOrMore>
134
140
  </define>
135
141
  <define name="ul">
136
142
  <element name="ul">
@@ -147,6 +153,14 @@
147
153
  <data type="boolean"/>
148
154
  </attribute>
149
155
  </optional>
156
+ <optional>
157
+ <attribute name="tag"/>
158
+ </optional>
159
+ <optional>
160
+ <attribute name="multilingual-rendering">
161
+ <ref name="MultilingualRenderingType"/>
162
+ </attribute>
163
+ </optional>
150
164
  <oneOrMore>
151
165
  <ref name="ul_li"/>
152
166
  </oneOrMore>
@@ -170,6 +184,14 @@
170
184
  <data type="boolean"/>
171
185
  </attribute>
172
186
  </optional>
187
+ <optional>
188
+ <attribute name="tag"/>
189
+ </optional>
190
+ <optional>
191
+ <attribute name="multilingual-rendering">
192
+ <ref name="MultilingualRenderingType"/>
193
+ </attribute>
194
+ </optional>
173
195
  <optional>
174
196
  <attribute name="type">
175
197
  <choice>
@@ -209,6 +231,14 @@
209
231
  <data type="boolean"/>
210
232
  </attribute>
211
233
  </optional>
234
+ <optional>
235
+ <attribute name="tag"/>
236
+ </optional>
237
+ <optional>
238
+ <attribute name="multilingual-rendering">
239
+ <ref name="MultilingualRenderingType"/>
240
+ </attribute>
241
+ </optional>
212
242
  <oneOrMore>
213
243
  <ref name="dt"/>
214
244
  <ref name="dd"/>
@@ -256,6 +286,14 @@
256
286
  <data type="boolean"/>
257
287
  </attribute>
258
288
  </optional>
289
+ <optional>
290
+ <attribute name="tag"/>
291
+ </optional>
292
+ <optional>
293
+ <attribute name="multilingual-rendering">
294
+ <ref name="MultilingualRenderingType"/>
295
+ </attribute>
296
+ </optional>
259
297
  <optional>
260
298
  <ref name="tname"/>
261
299
  </optional>
@@ -316,6 +354,14 @@
316
354
  <optional>
317
355
  <attribute name="width"/>
318
356
  </optional>
357
+ <optional>
358
+ <attribute name="tag"/>
359
+ </optional>
360
+ <optional>
361
+ <attribute name="multilingual-rendering">
362
+ <ref name="MultilingualRenderingType"/>
363
+ </attribute>
364
+ </optional>
319
365
  <optional>
320
366
  <ref name="colgroup"/>
321
367
  </optional>
@@ -366,6 +412,14 @@
366
412
  <optional>
367
413
  <attribute name="class"/>
368
414
  </optional>
415
+ <optional>
416
+ <attribute name="tag"/>
417
+ </optional>
418
+ <optional>
419
+ <attribute name="multilingual-rendering">
420
+ <ref name="MultilingualRenderingType"/>
421
+ </attribute>
422
+ </optional>
369
423
  <optional>
370
424
  <ref name="source"/>
371
425
  </optional>
@@ -424,6 +478,14 @@
424
478
  <optional>
425
479
  <attribute name="lang"/>
426
480
  </optional>
481
+ <optional>
482
+ <attribute name="tag"/>
483
+ </optional>
484
+ <optional>
485
+ <attribute name="multilingual-rendering">
486
+ <ref name="MultilingualRenderingType"/>
487
+ </attribute>
488
+ </optional>
427
489
  <optional>
428
490
  <ref name="tname"/>
429
491
  </optional>
@@ -472,6 +534,14 @@
472
534
  <data type="boolean"/>
473
535
  </attribute>
474
536
  </optional>
537
+ <optional>
538
+ <attribute name="tag"/>
539
+ </optional>
540
+ <optional>
541
+ <attribute name="multilingual-rendering">
542
+ <ref name="MultilingualRenderingType"/>
543
+ </attribute>
544
+ </optional>
475
545
  <ref name="stem"/>
476
546
  <optional>
477
547
  <ref name="dl"/>
@@ -500,6 +570,14 @@
500
570
  <data type="boolean"/>
501
571
  </attribute>
502
572
  </optional>
573
+ <optional>
574
+ <attribute name="tag"/>
575
+ </optional>
576
+ <optional>
577
+ <attribute name="multilingual-rendering">
578
+ <ref name="MultilingualRenderingType"/>
579
+ </attribute>
580
+ </optional>
503
581
  <zeroOrMore>
504
582
  <ref name="TextElement"/>
505
583
  </zeroOrMore>
@@ -527,6 +605,14 @@
527
605
  <data type="boolean"/>
528
606
  </attribute>
529
607
  </optional>
608
+ <optional>
609
+ <attribute name="tag"/>
610
+ </optional>
611
+ <optional>
612
+ <attribute name="multilingual-rendering">
613
+ <ref name="MultilingualRenderingType"/>
614
+ </attribute>
615
+ </optional>
530
616
  <zeroOrMore>
531
617
  <choice>
532
618
  <ref name="TextElement"/>
@@ -558,6 +644,14 @@
558
644
  <data type="boolean"/>
559
645
  </attribute>
560
646
  </optional>
647
+ <optional>
648
+ <attribute name="tag"/>
649
+ </optional>
650
+ <optional>
651
+ <attribute name="multilingual-rendering">
652
+ <ref name="MultilingualRenderingType"/>
653
+ </attribute>
654
+ </optional>
561
655
  <optional>
562
656
  <ref name="quote-source"/>
563
657
  </optional>
@@ -624,9 +718,6 @@
624
718
  <zeroOrMore>
625
719
  <ref name="BasicBlock"/>
626
720
  </zeroOrMore>
627
- <zeroOrMore>
628
- <ref name="note"/>
629
- </zeroOrMore>
630
721
  <zeroOrMore>
631
722
  <ref name="bibitem"/>
632
723
  <zeroOrMore>
@@ -667,6 +758,14 @@
667
758
  <optional>
668
759
  <attribute name="type"/>
669
760
  </optional>
761
+ <optional>
762
+ <attribute name="tag"/>
763
+ </optional>
764
+ <optional>
765
+ <attribute name="multilingual-rendering">
766
+ <ref name="MultilingualRenderingType"/>
767
+ </attribute>
768
+ </optional>
670
769
  <oneOrMore>
671
770
  <choice>
672
771
  <ref name="paragraph"/>
@@ -703,14 +802,9 @@
703
802
  <optional>
704
803
  <ref name="section-title"/>
705
804
  </optional>
706
- <group>
707
- <oneOrMore>
708
- <ref name="BasicBlock"/>
709
- </oneOrMore>
710
- <zeroOrMore>
711
- <ref name="note"/>
712
- </zeroOrMore>
713
- </group>
805
+ <oneOrMore>
806
+ <ref name="BasicBlock"/>
807
+ </oneOrMore>
714
808
  </define>
715
809
  <define name="li">
716
810
  <element name="li">
@@ -845,6 +939,9 @@
845
939
  <ref name="PureTextElement"/>
846
940
  <ref name="stem"/>
847
941
  <ref name="index"/>
942
+ <ref name="eref"/>
943
+ <ref name="xref"/>
944
+ <ref name="hyperlink"/>
848
945
  </choice>
849
946
  </zeroOrMore>
850
947
  </element>
@@ -856,6 +953,9 @@
856
953
  <ref name="PureTextElement"/>
857
954
  <ref name="stem"/>
858
955
  <ref name="index"/>
956
+ <ref name="eref"/>
957
+ <ref name="xref"/>
958
+ <ref name="hyperlink"/>
859
959
  </choice>
860
960
  </zeroOrMore>
861
961
  </element>
@@ -866,6 +966,9 @@
866
966
  <choice>
867
967
  <ref name="PureTextElement"/>
868
968
  <ref name="index"/>
969
+ <ref name="eref"/>
970
+ <ref name="xref"/>
971
+ <ref name="hyperlink"/>
869
972
  </choice>
870
973
  </zeroOrMore>
871
974
  </element>
@@ -924,6 +1027,14 @@
924
1027
  </define>
925
1028
  </include>
926
1029
  <!-- end overrides -->
1030
+ <define name="MultilingualRenderingType">
1031
+ <choice>
1032
+ <value>common</value>
1033
+ <value>all-columns</value>
1034
+ <value>parallel</value>
1035
+ <value>tag</value>
1036
+ </choice>
1037
+ </define>
927
1038
  <define name="docsubtype">
928
1039
  <element name="subdoctype">
929
1040
  <ref name="DocumentSubtype"/>
@@ -1062,6 +1173,14 @@
1062
1173
  <optional>
1063
1174
  <attribute name="class"/>
1064
1175
  </optional>
1176
+ <optional>
1177
+ <attribute name="tag"/>
1178
+ </optional>
1179
+ <optional>
1180
+ <attribute name="multilingual-rendering">
1181
+ <ref name="MultilingualRenderingType"/>
1182
+ </attribute>
1183
+ </optional>
1065
1184
  <zeroOrMore>
1066
1185
  <choice>
1067
1186
  <ref name="TextElement"/>
@@ -1261,9 +1380,6 @@
1261
1380
  <zeroOrMore>
1262
1381
  <ref name="BasicBlock"/>
1263
1382
  </zeroOrMore>
1264
- <zeroOrMore>
1265
- <ref name="note"/>
1266
- </zeroOrMore>
1267
1383
  <choice>
1268
1384
  <oneOrMore>
1269
1385
  <ref name="reference-clause"/>
@@ -1446,9 +1562,6 @@
1446
1562
  <zeroOrMore>
1447
1563
  <ref name="BasicBlock"/>
1448
1564
  </zeroOrMore>
1449
- <zeroOrMore>
1450
- <ref name="note"/>
1451
- </zeroOrMore>
1452
1565
  <ref name="dl"/>
1453
1566
  </oneOrMore>
1454
1567
  </element>
@@ -1508,14 +1621,9 @@
1508
1621
  <ref name="section-title"/>
1509
1622
  </optional>
1510
1623
  <group>
1511
- <group>
1512
- <zeroOrMore>
1513
- <ref name="BasicBlock"/>
1514
- </zeroOrMore>
1515
- <zeroOrMore>
1516
- <ref name="note"/>
1517
- </zeroOrMore>
1518
- </group>
1624
+ <zeroOrMore>
1625
+ <ref name="BasicBlock"/>
1626
+ </zeroOrMore>
1519
1627
  <zeroOrMore>
1520
1628
  <ref name="content-subsection"/>
1521
1629
  </zeroOrMore>
@@ -1562,14 +1670,9 @@
1562
1670
  </optional>
1563
1671
  <choice>
1564
1672
  <choice>
1565
- <group>
1566
- <oneOrMore>
1567
- <ref name="BasicBlock"/>
1568
- </oneOrMore>
1569
- <zeroOrMore>
1570
- <ref name="note"/>
1571
- </zeroOrMore>
1572
- </group>
1673
+ <oneOrMore>
1674
+ <ref name="BasicBlock"/>
1675
+ </oneOrMore>
1573
1676
  <ref name="amend"/>
1574
1677
  </choice>
1575
1678
  <oneOrMore>
@@ -1610,14 +1713,9 @@
1610
1713
  <ref name="section-title"/>
1611
1714
  </optional>
1612
1715
  <group>
1613
- <group>
1614
- <zeroOrMore>
1615
- <ref name="BasicBlock"/>
1616
- </zeroOrMore>
1617
- <zeroOrMore>
1618
- <ref name="note"/>
1619
- </zeroOrMore>
1620
- </group>
1716
+ <zeroOrMore>
1717
+ <ref name="BasicBlock"/>
1718
+ </zeroOrMore>
1621
1719
  <zeroOrMore>
1622
1720
  <choice>
1623
1721
  <ref name="annex-subsection"/>
@@ -1676,9 +1774,6 @@
1676
1774
  <zeroOrMore>
1677
1775
  <ref name="BasicBlock"/>
1678
1776
  </zeroOrMore>
1679
- <zeroOrMore>
1680
- <ref name="note"/>
1681
- </zeroOrMore>
1682
1777
  <choice>
1683
1778
  <oneOrMore>
1684
1779
  <ref name="term"/>
@@ -1824,6 +1919,14 @@
1824
1919
  <data type="boolean"/>
1825
1920
  </attribute>
1826
1921
  </optional>
1922
+ <optional>
1923
+ <attribute name="tag"/>
1924
+ </optional>
1925
+ <optional>
1926
+ <attribute name="multilingual-rendering">
1927
+ <ref name="MultilingualRenderingType"/>
1928
+ </attribute>
1929
+ </optional>
1827
1930
  <oneOrMore>
1828
1931
  <choice>
1829
1932
  <ref name="paragraph"/>
@@ -1840,6 +1943,24 @@
1840
1943
  <attribute name="id">
1841
1944
  <data type="ID"/>
1842
1945
  </attribute>
1946
+ <optional>
1947
+ <attribute name="keep-with-next">
1948
+ <data type="boolean"/>
1949
+ </attribute>
1950
+ </optional>
1951
+ <optional>
1952
+ <attribute name="keep-lines-together">
1953
+ <data type="boolean"/>
1954
+ </attribute>
1955
+ </optional>
1956
+ <optional>
1957
+ <attribute name="tag"/>
1958
+ </optional>
1959
+ <optional>
1960
+ <attribute name="multilingual-rendering">
1961
+ <ref name="MultilingualRenderingType"/>
1962
+ </attribute>
1963
+ </optional>
1843
1964
  <ref name="paragraph"/>
1844
1965
  </element>
1845
1966
  </define>
@@ -1966,9 +2087,6 @@
1966
2087
  <zeroOrMore>
1967
2088
  <ref name="BasicBlock"/>
1968
2089
  </zeroOrMore>
1969
- <zeroOrMore>
1970
- <ref name="note"/>
1971
- </zeroOrMore>
1972
2090
  <zeroOrMore>
1973
2091
  <choice>
1974
2092
  <ref name="term-clause"/>
@@ -2007,6 +2125,14 @@
2007
2125
  <optional>
2008
2126
  <attribute name="title"/>
2009
2127
  </optional>
2128
+ <optional>
2129
+ <attribute name="tag"/>
2130
+ </optional>
2131
+ <optional>
2132
+ <attribute name="multilingual-rendering">
2133
+ <ref name="MultilingualRenderingType"/>
2134
+ </attribute>
2135
+ </optional>
2010
2136
  <optional>
2011
2137
  <element name="location">
2012
2138
  <zeroOrMore>
@@ -2066,6 +2192,14 @@
2066
2192
  </define>
2067
2193
  <define name="imagemap">
2068
2194
  <element name="imagemap">
2195
+ <optional>
2196
+ <attribute name="tag"/>
2197
+ </optional>
2198
+ <optional>
2199
+ <attribute name="multilingual-rendering">
2200
+ <ref name="MultilingualRenderingType"/>
2201
+ </attribute>
2202
+ </optional>
2069
2203
  <ref name="figure"/>
2070
2204
  <zeroOrMore>
2071
2205
  <element name="area">
@@ -2110,6 +2244,14 @@
2110
2244
  </define>
2111
2245
  <define name="svgmap">
2112
2246
  <element name="svgmap">
2247
+ <optional>
2248
+ <attribute name="tag"/>
2249
+ </optional>
2250
+ <optional>
2251
+ <attribute name="multilingual-rendering">
2252
+ <ref name="MultilingualRenderingType"/>
2253
+ </attribute>
2254
+ </optional>
2113
2255
  <ref name="figure"/>
2114
2256
  <zeroOrMore>
2115
2257
  <element name="target">
@@ -58,6 +58,14 @@
58
58
  <optional>
59
59
  <attribute name="type"/>
60
60
  </optional>
61
+ <optional>
62
+ <attribute name="tag"/>
63
+ </optional>
64
+ <optional>
65
+ <attribute name="multilingual-rendering">
66
+ <ref name="MultilingualRenderingType"/>
67
+ </attribute>
68
+ </optional>
61
69
  <optional>
62
70
  <ref name="reqtitle"/>
63
71
  </optional>
@@ -101,7 +109,9 @@
101
109
  </define>
102
110
  <define name="label">
103
111
  <element name="label">
104
- <text/>
112
+ <oneOrMore>
113
+ <ref name="TextElement"/>
114
+ </oneOrMore>
105
115
  </element>
106
116
  </define>
107
117
  <define name="subject">
@@ -175,8 +185,19 @@
175
185
  <data type="boolean"/>
176
186
  </attribute>
177
187
  </optional>
188
+ <optional>
189
+ <attribute name="tag"/>
190
+ </optional>
191
+ <optional>
192
+ <attribute name="multilingual-rendering">
193
+ <ref name="MultilingualRenderingType"/>
194
+ </attribute>
195
+ </optional>
178
196
  <oneOrMore>
179
- <ref name="BasicBlock"/>
197
+ <choice>
198
+ <ref name="BasicBlock"/>
199
+ <ref name="component"/>
200
+ </choice>
180
201
  </oneOrMore>
181
202
  </define>
182
203
  <define name="ObligationType">
@@ -197,8 +197,9 @@ module IsoDoc
197
197
  def review_note_parse(node, out)
198
198
  out.cref **attr_code(anchor: node["id"], display: node["display"],
199
199
  source: node["reviewer"]) do |c|
200
- name = node.at(ns("./name")) and c.name do |div|
201
- name.children.each { |n| parse(n, div) }
200
+ if name = node.at(ns("./name"))
201
+ name.children.each { |n| parse(n, c) }
202
+ c << " "
202
203
  end
203
204
  node.children.each { |n| parse(n, c) unless n.name == "name" }
204
205
  end
@@ -1,254 +1,199 @@
1
- module IsoDoc::Ietf
2
- class RfcConvert < ::IsoDoc::Convert
3
- def cleanup(docxml)
4
- image_cleanup(docxml)
5
- figure_cleanup(docxml)
6
- table_cleanup(docxml)
7
- footnote_cleanup(docxml)
8
- sourcecode_cleanup(docxml)
9
- annotation_cleanup(docxml)
10
- li_cleanup(docxml)
11
- deflist_cleanup(docxml)
12
- bookmark_cleanup(docxml)
13
- aside_cleanup(docxml)
14
- front_cleanup(docxml)
15
- u_cleanup(docxml)
16
- docxml
17
- end
18
-
19
- def u_cleanup(xmldoc)
20
- xmldoc.traverse do |n|
21
- next unless n.text?
22
- next unless %w(t blockquote li dd preamble td th annotation)
23
- .include? n.parent.name
24
-
25
- n.replace(n.text.gsub(/[\u0080-\uffff]/, "<u>\\0</u>"))
26
- end
27
- end
28
-
29
- def li_cleanup(xmldoc)
30
- xmldoc.xpath("//li[t]").each do |li|
31
- next unless li.elements.size == 1
32
-
33
- li.children = li.elements[0].children
1
+ require_relative "cleanup_inline"
2
+
3
+ module IsoDoc
4
+ module Ietf
5
+ class RfcConvert < ::IsoDoc::Convert
6
+ def cleanup(docxml)
7
+ image_cleanup(docxml)
8
+ figure_cleanup(docxml)
9
+ table_cleanup(docxml)
10
+ footnote_cleanup(docxml)
11
+ sourcecode_cleanup(docxml)
12
+ annotation_cleanup(docxml)
13
+ li_cleanup(docxml)
14
+ deflist_cleanup(docxml)
15
+ bookmark_cleanup(docxml)
16
+ cref_cleanup(docxml)
17
+ aside_cleanup(docxml)
18
+ front_cleanup(docxml)
19
+ u_cleanup(docxml)
20
+ docxml
21
+ end
22
+
23
+ def li_cleanup(xmldoc)
24
+ xmldoc.xpath("//li[t]").each do |li|
25
+ next unless li.elements.size == 1
26
+
27
+ li.children = li.elements[0].children
28
+ end
34
29
  end
35
- end
36
30
 
37
- def front_cleanup(xmldoc)
38
- xmldoc.xpath("//title").each { |s| s.children = s.text }
39
- xmldoc.xpath("//reference/front[not(author)]").each do |f|
40
- insert = f.at("./seriesInfo[last()]") || f.at("./title")
41
- insert.next = "<author surname='Unknown'/>"
31
+ def front_cleanup(xmldoc)
32
+ xmldoc.xpath("//title").each { |s| s.children = s.text }
33
+ xmldoc.xpath("//reference/front[not(author)]").each do |f|
34
+ insert = f.at("./seriesInfo[last()]") || f.at("./title")
35
+ insert.next = "<author surname='Unknown'/>"
36
+ end
42
37
  end
43
- end
44
38
 
45
- def table_footnote_cleanup(docxml)
46
- docxml.xpath("//table[descendant::fn]").each do |t|
47
- t.xpath(".//fn").each do |a|
48
- t << "<aside>#{a.remove.children}</aside>"
39
+ def table_footnote_cleanup(docxml)
40
+ docxml.xpath("//table[descendant::fn]").each do |t|
41
+ t.xpath(".//fn").each do |a|
42
+ t << "<aside>#{a.remove.children}</aside>"
43
+ end
49
44
  end
50
45
  end
51
- end
52
46
 
53
- def figure_footnote_cleanup(docxml)
54
- docxml.xpath("//figure[descendant::fn]").each do |t|
55
- t.xpath(".//fn").each do |a|
56
- t << "<aside>#{a.remove.children}</aside>"
47
+ def figure_footnote_cleanup(docxml)
48
+ docxml.xpath("//figure[descendant::fn]").each do |t|
49
+ t.xpath(".//fn").each do |a|
50
+ t << "<aside>#{a.remove.children}</aside>"
51
+ end
57
52
  end
58
53
  end
59
- end
60
-
61
- def table_cleanup(docxml)
62
- table_footnote_cleanup(docxml)
63
- end
64
-
65
- def figure_cleanup(docxml)
66
- figure_postamble(docxml)
67
- figure_unnest(docxml)
68
- figure_footnote_cleanup(docxml)
69
- figure_data_uri(docxml)
70
- end
71
-
72
- def figure_data_uri(docxml)
73
- docxml.xpath("//artwork").each do |a|
74
- next unless %r{^data:image/svg\+xml;base64}.match?(a["src"])
75
54
 
76
- f = Metanorma::Utils::save_dataimage(a["src"])
77
- a.delete("src")
78
- a.children = File.read(f).sub(%r{<\?.+\?>}, "")
55
+ def table_cleanup(docxml)
56
+ table_footnote_cleanup(docxml)
79
57
  end
80
- end
81
58
 
82
- def figure_unnest(docxml)
83
- docxml.xpath("//figure[descendant::figure]").each do |f|
84
- insert = f
85
- f.xpath(".//figure").each do |a|
86
- title = f.at("./name") and a.children.first.previous = title.remove
87
- insert.next = a.remove
88
- insert = insert.next_element
89
- end
90
- f.remove
59
+ def figure_cleanup(docxml)
60
+ figure_postamble(docxml)
61
+ figure_unnest(docxml)
62
+ figure_footnote_cleanup(docxml)
63
+ figure_data_uri(docxml)
91
64
  end
92
- end
93
65
 
94
- def figure_postamble(docxml)
95
- make_postamble(docxml)
96
- move_postamble(docxml)
97
- move_preamble(docxml)
98
- end
66
+ def figure_data_uri(docxml)
67
+ docxml.xpath("//artwork").each do |a|
68
+ next unless %r{^data:image/svg\+xml;base64}.match?(a["src"])
99
69
 
100
- def make_postamble(docxml)
101
- docxml.xpath("//figure").each do |f|
102
- a = f&.at("./artwork | ./sourcecode") || next
103
- name = f&.at("./name")&.remove
104
- b = a&.xpath("./preceding-sibling::*")&.remove
105
- c = a&.xpath("./following-sibling::*")&.remove
106
- a = a.remove
107
- name and f << name
108
- b.empty? or f << "<preamble>#{b.to_xml}</preamble>"
109
- a and f << a
110
- c.empty? or f << "<postamble>#{c.to_xml}</postamble>"
111
- end
112
- end
113
-
114
- def move_postamble(docxml)
115
- docxml.xpath("//postamble").each do |p|
116
- insert = p.parent
117
- p.remove.elements.each do |e|
118
- insert.next = e
119
- insert = insert.next_element
70
+ f = Metanorma::Utils::save_dataimage(a["src"])
71
+ a.delete("src")
72
+ a.children = File.read(f).sub(%r{<\?.+\?>}, "")
120
73
  end
121
74
  end
122
- end
123
75
 
124
- def move_preamble(docxml)
125
- docxml.xpath("//preamble").each do |p|
126
- insert = p.parent
127
- p.remove.elements.each do |e|
128
- insert.previous = e
76
+ def figure_unnest(docxml)
77
+ docxml.xpath("//figure[descendant::figure]").each do |f|
78
+ insert = f
79
+ f.xpath(".//figure").each do |a|
80
+ title = f.at("./name") and a.children.first.previous = title.remove
81
+ insert.next = a.remove
82
+ insert = insert.next_element
83
+ end
84
+ f.remove
129
85
  end
130
86
  end
131
- end
132
87
 
133
- def footnote_cleanup(docxml)
134
- fn = footnote_refs_cleanup(docxml)
135
- endnotes = make_endnotes(docxml)
136
- docxml.xpath("//section[descendant::fn] | "\
137
- "//abstract[descendant::fn]").each do |s|
138
- s.xpath(".//fn").each do |f|
139
- ref = f.at(".//ref") and ref.replace("[#{fn[ref.text]}] ")
140
- endnotes << f.remove.children
141
- end
88
+ def figure_postamble(docxml)
89
+ make_postamble(docxml)
90
+ move_postamble(docxml)
91
+ move_preamble(docxml)
142
92
  end
143
- end
144
93
 
145
- def footnote_refs_cleanup(docxml)
146
- i = 0
147
- fn = {}
148
- docxml.xpath("//fnref").each do |f|
149
- unless fn[f.text]
150
- i = i + 1
151
- fn[f.text] = i.to_s
94
+ def make_postamble(docxml)
95
+ docxml.xpath("//figure").each do |f|
96
+ a = f&.at("./artwork | ./sourcecode") || next
97
+ name = f&.at("./name")&.remove
98
+ b = a&.xpath("./preceding-sibling::*")&.remove
99
+ c = a&.xpath("./following-sibling::*")&.remove
100
+ a = a.remove
101
+ name and f << name
102
+ b.empty? or f << "<preamble>#{b.to_xml}</preamble>"
103
+ a and f << a
104
+ c.empty? or f << "<postamble>#{c.to_xml}</postamble>"
152
105
  end
153
- f.replace(" [#{fn[f.text]}]")
154
106
  end
155
- fn
156
- end
157
-
158
- def make_endnotes(docxml)
159
- return unless docxml.at("//fn")
160
107
 
161
- unless endnotes = docxml.at("//back")
162
- docxml << "<back/>" and endnotes = docxml.at("//back")
108
+ def move_postamble(docxml)
109
+ docxml.xpath("//postamble").each do |p|
110
+ insert = p.parent
111
+ p.remove.elements.each do |e|
112
+ insert.next = e
113
+ insert = insert.next_element
114
+ end
115
+ end
163
116
  end
164
- endnotes << "<section><name>Endnotes</name></section>"
165
- docxml.at("//back/section[last()]")
166
- end
167
117
 
168
- def image_cleanup(docxml)
169
- docxml.xpath("//t[descendant::artwork]").each do |t|
170
- insert = t
171
- t.xpath(".//artwork").each_with_index do |a, i|
172
- insert.next = a.dup
173
- insert = insert.next
174
- a.replace("[IMAGE #{i + 1}]")
118
+ def move_preamble(docxml)
119
+ docxml.xpath("//preamble").each do |p|
120
+ insert = p.parent
121
+ p.remove.elements.each do |e|
122
+ insert.previous = e
123
+ end
175
124
  end
176
125
  end
177
- end
178
126
 
179
- # for markup in pseudocode
180
- def sourcecode_cleanup(docxml)
181
- docxml.xpath("//sourcecode").each do |s|
182
- s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
183
- .gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
184
- sourcecode_remove_markup(s)
185
- s.children = "<![CDATA[#{HTMLEntities.new.decode(s
127
+ # for markup in pseudocode
128
+ def sourcecode_cleanup(docxml)
129
+ docxml.xpath("//sourcecode").each do |s|
130
+ s.children = s.children.to_xml.gsub(%r{<br/>\n}, "\n")
131
+ .gsub(%r{\s+(<t[ >])}, "\\1").gsub(%r{</t>\s+}, "</t>")
132
+ sourcecode_remove_markup(s)
133
+ s.children = "<![CDATA[#{HTMLEntities.new.decode(s
186
134
  .children.to_xml.sub(/\A\n+/, ''))}]]>"
135
+ end
187
136
  end
188
- end
189
137
 
190
- def sourcecode_remove_markup(node)
191
- node.traverse do |n|
192
- next if n.text?
193
- next if %w(name callout annotation note sourcecode).include? n.name
138
+ def sourcecode_remove_markup(node)
139
+ node.traverse do |n|
140
+ next if n.text?
141
+ next if %w(name callout annotation note sourcecode).include? n.name
194
142
 
195
- case n.name
196
- when "br" then n.replace("\n")
197
- when "t" then n.replace("\n\n#{n.children}")
198
- else
199
- n.replace(n.children)
143
+ case n.name
144
+ when "br" then n.replace("\n")
145
+ when "t" then n.replace("\n\n#{n.children}")
146
+ else
147
+ n.replace(n.children)
148
+ end
200
149
  end
201
150
  end
202
- end
203
151
 
204
- def annotation_cleanup(docxml)
205
- docxml.xpath("//reference").each do |r|
206
- next unless r&.next_element&.name == "aside"
152
+ def annotation_cleanup(docxml)
153
+ docxml.xpath("//reference").each do |r|
154
+ next unless r&.next_element&.name == "aside"
207
155
 
208
- aside = r.next_element
209
- aside.name = "annotation"
210
- aside.traverse do |n|
211
- n.name == "t" and n.replace(n.children)
156
+ aside = r.next_element
157
+ aside.name = "annotation"
158
+ aside.traverse do |n|
159
+ n.name == "t" and n.replace(n.children)
160
+ end
161
+ r << aside
212
162
  end
213
- r << aside
163
+ docxml.xpath("//references/aside").each(&:remove)
214
164
  end
215
- docxml.xpath("//references/aside").each(&:remove)
216
- end
217
165
 
218
- def deflist_cleanup(docxml)
219
- dt_cleanup(docxml)
220
- dd_cleanup(docxml)
221
- end
166
+ def deflist_cleanup(docxml)
167
+ dt_cleanup(docxml)
168
+ dd_cleanup(docxml)
169
+ end
222
170
 
223
- def dt_cleanup(docxml)
224
- docxml.xpath("//dt").each do |d|
225
- d&.first_element_child&.name == "bookmark" and
226
- d["anchor"] ||= d.first_element_child["anchor"]
227
- d.xpath(".//t").each do |t|
228
- d["anchor"] ||= t["anchor"]
229
- t.replace(t.children)
171
+ def dt_cleanup(docxml)
172
+ docxml.xpath("//dt").each do |d|
173
+ d&.first_element_child&.name == "bookmark" and
174
+ d["anchor"] ||= d.first_element_child["anchor"]
175
+ d.xpath(".//t").each do |t|
176
+ d["anchor"] ||= t["anchor"]
177
+ t.replace(t.children)
178
+ end
230
179
  end
231
180
  end
232
- end
233
181
 
234
- def dd_cleanup(docxml)
235
- docxml.xpath("//dd").each do |d|
236
- d&.first_element_child&.name == "bookmark" and
237
- d["anchor"] ||= d.first_element_child["anchor"]
182
+ def dd_cleanup(docxml)
183
+ docxml.xpath("//dd").each do |d|
184
+ d&.first_element_child&.name == "bookmark" and
185
+ d["anchor"] ||= d.first_element_child["anchor"]
186
+ end
238
187
  end
239
- end
240
-
241
- def bookmark_cleanup(docxml)
242
- docxml.xpath("//bookmark").each(&:remove)
243
- end
244
188
 
245
- def aside_cleanup(docxml)
246
- docxml.xpath("//t[descendant::aside] | //table[descendant::aside] | "\
247
- "//figure[descendant::aside]").each do |p|
248
- insert = p
249
- p.xpath(".//aside").each do |a|
250
- insert.next = a.remove
251
- insert = insert.next_element
189
+ def aside_cleanup(docxml)
190
+ docxml.xpath("//t[descendant::aside] | //table[descendant::aside] | "\
191
+ "//figure[descendant::aside]").each do |p|
192
+ insert = p
193
+ p.xpath(".//aside").each do |a|
194
+ insert.next = a.remove
195
+ insert = insert.next_element
196
+ end
252
197
  end
253
198
  end
254
199
  end
@@ -0,0 +1,76 @@
1
+ module IsoDoc
2
+ module Ietf
3
+ class RfcConvert < ::IsoDoc::Convert
4
+ def u_cleanup(xmldoc)
5
+ xmldoc.traverse do |n|
6
+ next unless n.text?
7
+ next unless %w(t blockquote li dd preamble td th annotation)
8
+ .include? n.parent.name
9
+
10
+ n.replace(n.text.gsub(/[\u0080-\uffff]/, "<u>\\0</u>"))
11
+ end
12
+ end
13
+
14
+ def footnote_cleanup(docxml)
15
+ fn = footnote_refs_cleanup(docxml)
16
+ endnotes = make_endnotes(docxml)
17
+ docxml.xpath("//section[descendant::fn] | "\
18
+ "//abstract[descendant::fn]").each do |s|
19
+ s.xpath(".//fn").each do |f|
20
+ ref = f.at(".//ref") and ref.replace("[#{fn[ref.text]}] ")
21
+ endnotes << f.remove.children
22
+ end
23
+ end
24
+ end
25
+
26
+ def footnote_refs_cleanup(docxml)
27
+ i = 0
28
+ fn = {}
29
+ docxml.xpath("//fnref").each do |f|
30
+ unless fn[f.text]
31
+ i = i + 1
32
+ fn[f.text] = i.to_s
33
+ end
34
+ f.replace(" [#{fn[f.text]}]")
35
+ end
36
+ fn
37
+ end
38
+
39
+ def make_endnotes(docxml)
40
+ return unless docxml.at("//fn")
41
+
42
+ unless endnotes = docxml.at("//back")
43
+ docxml << "<back/>" and endnotes = docxml.at("//back")
44
+ end
45
+ endnotes << "<section><name>Endnotes</name></section>"
46
+ docxml.at("//back/section[last()]")
47
+ end
48
+
49
+ def image_cleanup(docxml)
50
+ docxml.xpath("//t[descendant::artwork]").each do |t|
51
+ insert = t
52
+ t.xpath(".//artwork").each_with_index do |a, i|
53
+ insert.next = a.dup
54
+ insert = insert.next
55
+ a.replace("[IMAGE #{i + 1}]")
56
+ end
57
+ end
58
+ end
59
+
60
+ def bookmark_cleanup(docxml)
61
+ docxml.xpath("//bookmark").each(&:remove)
62
+ end
63
+
64
+ def cref_cleanup(docxml)
65
+ docxml.xpath("//cref").each do |c|
66
+ c.xpath("./t").each do |t|
67
+ t.replace(t.children)
68
+ end
69
+ next unless %w(section abstract).include? c.parent.name
70
+
71
+ c.wrap("<t></t>")
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "2.4.3".freeze
3
+ VERSION = "2.4.4".freeze
4
4
  end
5
5
  end
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.4.3
4
+ version: 2.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc
@@ -286,6 +286,7 @@ files:
286
286
  - lib/isodoc/ietf/SVG-1.2-RFC.rng
287
287
  - lib/isodoc/ietf/blocks.rb
288
288
  - lib/isodoc/ietf/cleanup.rb
289
+ - lib/isodoc/ietf/cleanup_inline.rb
289
290
  - lib/isodoc/ietf/footnotes.rb
290
291
  - lib/isodoc/ietf/front.rb
291
292
  - lib/isodoc/ietf/i18n-en.yaml