relaton-ietf 1.11.4 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -24
- data/README.adoc +15 -13
- data/grammars/biblio.rng +172 -48
- data/grammars/isodoc.rng +77 -0
- data/lib/relaton_ietf/data_fetcher.rb +12 -7
- data/lib/relaton_ietf/hash_converter.rb +10 -0
- data/lib/relaton_ietf/processor.rb +1 -1
- data/lib/relaton_ietf/rfc_entry.rb +2 -1
- data/lib/relaton_ietf/rfc_index_entry.rb +54 -12
- data/lib/relaton_ietf/scrapper.rb +17 -14
- data/lib/relaton_ietf/version.rb +1 -1
- data/lib/relaton_ietf/xml_parser.rb +15 -0
- data/relaton_ietf.gemspec +1 -2
- 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: ee8439e302cb63b932839983b8beb248eeb760bf9ec797ad4b3ae6b66a6c5650
|
4
|
+
data.tar.gz: 7f34f291e1af77dbdcedf4c3895b87568f7bab8ec037cc83ff53590bfe29b9e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c026795d5a04d9ca8ba1fbc6ebff3acc86010703ee596eeb052b0dc4cf1aff20046dafbe7acecf9160713641119b7a7604bc6ded4b5de23415d974992d2b8d7
|
7
|
+
data.tar.gz: c51489f7fbb18b9834c16231995b1409996b20c3e1922f38b90de7a7ae7928b139042cb7049ad8567b58f845b722ed63a343d7238bbe4fd0a088bc5b39653478
|
data/.github/workflows/rake.yml
CHANGED
@@ -10,27 +10,4 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
rake:
|
13
|
-
|
14
|
-
runs-on: ${{ matrix.os }}
|
15
|
-
continue-on-error: ${{ matrix.experimental }}
|
16
|
-
strategy:
|
17
|
-
fail-fast: false
|
18
|
-
matrix:
|
19
|
-
ruby: ['3.0', '2.7', '2.6', '2.5' ]
|
20
|
-
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
-
experimental: [ false ]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
with:
|
25
|
-
submodules: true
|
26
|
-
|
27
|
-
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
28
|
-
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
29
|
-
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
30
|
-
|
31
|
-
- uses: ruby/setup-ruby@v1
|
32
|
-
with:
|
33
|
-
ruby-version: ${{ matrix.ruby }}
|
34
|
-
bundler-cache: true
|
35
|
-
|
36
|
-
- run: bundle exec rake
|
13
|
+
uses: relaton/support/.github/workflows/rake.yml@master
|
data/README.adoc
CHANGED
@@ -47,10 +47,10 @@ item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
|
|
47
47
|
...
|
48
48
|
|
49
49
|
# Fetch Internet-Draft document
|
50
|
-
RelatonIetf::IetfBibliography.get 'IETF I-D.abarth-cake-
|
51
|
-
[relaton-ietf] ("IETF I-D.abarth-cake-
|
52
|
-
[relaton-ietf] ("IETF I-D.abarth-cake-
|
53
|
-
=> #<RelatonIetf::IetfBibliographicItem:
|
50
|
+
RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
|
51
|
+
[relaton-ietf] ("IETF I-D.draft-abarth-cake-01") fetching...
|
52
|
+
[relaton-ietf] ("IETF I-D.draft-abarth-cake-01") found draft-abarth-cake-01
|
53
|
+
=> #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
|
54
54
|
...
|
55
55
|
|
56
56
|
# Return nil if document doesn't exist.
|
@@ -65,12 +65,12 @@ RelatonIetf::IetfBibliography.get 'IETF 1111'
|
|
65
65
|
[source,ruby]
|
66
66
|
----
|
67
67
|
item.to_xml
|
68
|
-
=>"<bibitem id="RFC8341">
|
69
|
-
<fetched>
|
70
|
-
<title format="text/plain"
|
68
|
+
=>"<bibitem id="RFC8341" type="standard">
|
69
|
+
<fetched>2022-06-10</fetched>
|
70
|
+
<title type="main" format="text/plain">Network Configuration Access Control Model</title>
|
71
71
|
<uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
|
72
|
-
<docidentifier type="IETF">RFC 8341</docidentifier>
|
73
|
-
<docidentifier type
|
72
|
+
<docidentifier type="IETF" primary="true">RFC 8341</docidentifier>
|
73
|
+
<docidentifier type="IETF" scope="anchor">RFC8341</docidentifier>
|
74
74
|
<docidentifier type="DOI">10.17487/RFC8341</docidentifier>
|
75
75
|
....
|
76
76
|
</bibitem>"
|
@@ -79,13 +79,15 @@ With `bibdata: true` option XML output wrapped with `bibdata` element and `ext`
|
|
79
79
|
[source,ruby]
|
80
80
|
----
|
81
81
|
item.to_xml bibdata: true
|
82
|
-
=>"<bibdata>
|
83
|
-
<fetched>
|
84
|
-
<title format="text/plain"
|
82
|
+
=>"<bibdata type="standard">
|
83
|
+
<fetched>2022-06-10</fetched>
|
84
|
+
<title type="main" format="text/plain">Network Configuration Access Control Model</title>
|
85
85
|
<uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
|
86
86
|
...
|
87
87
|
<ext>
|
88
|
-
<
|
88
|
+
<editorialgroup>
|
89
|
+
<committee>netconf</committee>
|
90
|
+
</editorialgroup>
|
89
91
|
</ext>
|
90
92
|
</bibdata>"
|
91
93
|
----
|
data/grammars/biblio.rng
CHANGED
@@ -527,7 +527,7 @@
|
|
527
527
|
</define>
|
528
528
|
<define name="LocalityType">
|
529
529
|
<data type="string">
|
530
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
530
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
531
531
|
</data>
|
532
532
|
</define>
|
533
533
|
<define name="referenceFrom">
|
@@ -614,12 +614,103 @@
|
|
614
614
|
<optional>
|
615
615
|
<ref name="fetched"/>
|
616
616
|
</optional>
|
617
|
-
<
|
618
|
-
<oneOrMore>
|
619
|
-
<ref name="btitle"/>
|
620
|
-
</oneOrMore>
|
617
|
+
<optional>
|
621
618
|
<ref name="formattedref"/>
|
622
|
-
</
|
619
|
+
</optional>
|
620
|
+
<oneOrMore>
|
621
|
+
<ref name="btitle"/>
|
622
|
+
</oneOrMore>
|
623
|
+
<zeroOrMore>
|
624
|
+
<ref name="bsource"/>
|
625
|
+
</zeroOrMore>
|
626
|
+
<oneOrMore>
|
627
|
+
<ref name="docidentifier"/>
|
628
|
+
</oneOrMore>
|
629
|
+
<optional>
|
630
|
+
<ref name="docnumber"/>
|
631
|
+
</optional>
|
632
|
+
<zeroOrMore>
|
633
|
+
<ref name="bdate"/>
|
634
|
+
</zeroOrMore>
|
635
|
+
<zeroOrMore>
|
636
|
+
<ref name="contributor"/>
|
637
|
+
</zeroOrMore>
|
638
|
+
<optional>
|
639
|
+
<ref name="edition"/>
|
640
|
+
</optional>
|
641
|
+
<zeroOrMore>
|
642
|
+
<ref name="version"/>
|
643
|
+
</zeroOrMore>
|
644
|
+
<zeroOrMore>
|
645
|
+
<ref name="biblionote"/>
|
646
|
+
</zeroOrMore>
|
647
|
+
<zeroOrMore>
|
648
|
+
<ref name="language"/>
|
649
|
+
</zeroOrMore>
|
650
|
+
<zeroOrMore>
|
651
|
+
<ref name="script"/>
|
652
|
+
</zeroOrMore>
|
653
|
+
<zeroOrMore>
|
654
|
+
<ref name="bibabstract"/>
|
655
|
+
</zeroOrMore>
|
656
|
+
<optional>
|
657
|
+
<ref name="status"/>
|
658
|
+
</optional>
|
659
|
+
<zeroOrMore>
|
660
|
+
<ref name="copyright"/>
|
661
|
+
</zeroOrMore>
|
662
|
+
<zeroOrMore>
|
663
|
+
<ref name="docrelation"/>
|
664
|
+
</zeroOrMore>
|
665
|
+
<zeroOrMore>
|
666
|
+
<ref name="series"/>
|
667
|
+
</zeroOrMore>
|
668
|
+
<optional>
|
669
|
+
<ref name="medium"/>
|
670
|
+
</optional>
|
671
|
+
<zeroOrMore>
|
672
|
+
<ref name="bplace"/>
|
673
|
+
</zeroOrMore>
|
674
|
+
<zeroOrMore>
|
675
|
+
<ref name="bprice"/>
|
676
|
+
</zeroOrMore>
|
677
|
+
<zeroOrMore>
|
678
|
+
<ref name="extent"/>
|
679
|
+
</zeroOrMore>
|
680
|
+
<optional>
|
681
|
+
<ref name="bibliographic_size"/>
|
682
|
+
</optional>
|
683
|
+
<zeroOrMore>
|
684
|
+
<ref name="accesslocation"/>
|
685
|
+
</zeroOrMore>
|
686
|
+
<zeroOrMore>
|
687
|
+
<ref name="license"/>
|
688
|
+
</zeroOrMore>
|
689
|
+
<zeroOrMore>
|
690
|
+
<ref name="bclassification"/>
|
691
|
+
</zeroOrMore>
|
692
|
+
<zeroOrMore>
|
693
|
+
<ref name="bkeyword"/>
|
694
|
+
</zeroOrMore>
|
695
|
+
<optional>
|
696
|
+
<ref name="validity"/>
|
697
|
+
</optional>
|
698
|
+
</define>
|
699
|
+
<define name="ReducedBibliographicItem">
|
700
|
+
<optional>
|
701
|
+
<attribute name="type">
|
702
|
+
<ref name="BibItemType"/>
|
703
|
+
</attribute>
|
704
|
+
</optional>
|
705
|
+
<optional>
|
706
|
+
<ref name="fetched"/>
|
707
|
+
</optional>
|
708
|
+
<optional>
|
709
|
+
<ref name="formattedref"/>
|
710
|
+
</optional>
|
711
|
+
<zeroOrMore>
|
712
|
+
<ref name="btitle"/>
|
713
|
+
</zeroOrMore>
|
623
714
|
<zeroOrMore>
|
624
715
|
<ref name="bsource"/>
|
625
716
|
</zeroOrMore>
|
@@ -638,9 +729,9 @@
|
|
638
729
|
<optional>
|
639
730
|
<ref name="edition"/>
|
640
731
|
</optional>
|
641
|
-
<
|
732
|
+
<zeroOrMore>
|
642
733
|
<ref name="version"/>
|
643
|
-
</
|
734
|
+
</zeroOrMore>
|
644
735
|
<zeroOrMore>
|
645
736
|
<ref name="biblionote"/>
|
646
737
|
</zeroOrMore>
|
@@ -833,6 +924,12 @@
|
|
833
924
|
<data type="boolean"/>
|
834
925
|
</attribute>
|
835
926
|
</optional>
|
927
|
+
<optional>
|
928
|
+
<attribute name="language"/>
|
929
|
+
</optional>
|
930
|
+
<optional>
|
931
|
+
<attribute name="script"/>
|
932
|
+
</optional>
|
836
933
|
<text/>
|
837
934
|
</element>
|
838
935
|
</define>
|
@@ -851,17 +948,46 @@
|
|
851
948
|
</define>
|
852
949
|
<define name="bplace">
|
853
950
|
<element name="place">
|
854
|
-
<
|
855
|
-
<
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
951
|
+
<choice>
|
952
|
+
<text/>
|
953
|
+
<group>
|
954
|
+
<ref name="bibliocity"/>
|
955
|
+
<zeroOrMore>
|
956
|
+
<ref name="biblioregion"/>
|
957
|
+
</zeroOrMore>
|
958
|
+
<zeroOrMore>
|
959
|
+
<ref name="bibliocountry"/>
|
960
|
+
</zeroOrMore>
|
961
|
+
</group>
|
962
|
+
</choice>
|
963
|
+
</element>
|
964
|
+
</define>
|
965
|
+
<define name="bibliocity">
|
966
|
+
<element name="city">
|
862
967
|
<text/>
|
863
968
|
</element>
|
864
969
|
</define>
|
970
|
+
<define name="biblioregion">
|
971
|
+
<element name="region">
|
972
|
+
<ref name="RegionType"/>
|
973
|
+
</element>
|
974
|
+
</define>
|
975
|
+
<define name="bibliocountry">
|
976
|
+
<element name="country">
|
977
|
+
<ref name="RegionType"/>
|
978
|
+
</element>
|
979
|
+
</define>
|
980
|
+
<define name="RegionType">
|
981
|
+
<optional>
|
982
|
+
<attribute name="iso"/>
|
983
|
+
</optional>
|
984
|
+
<optional>
|
985
|
+
<attribute name="recommended">
|
986
|
+
<data type="boolean"/>
|
987
|
+
</attribute>
|
988
|
+
</optional>
|
989
|
+
<text/>
|
990
|
+
</define>
|
865
991
|
<define name="bprice">
|
866
992
|
<element name="price">
|
867
993
|
<attribute name="currency"/>
|
@@ -957,36 +1083,34 @@
|
|
957
1083
|
<ref name="SeriesType"/>
|
958
1084
|
</attribute>
|
959
1085
|
</optional>
|
960
|
-
<
|
1086
|
+
<optional>
|
961
1087
|
<ref name="formattedref"/>
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
</group>
|
989
|
-
</choice>
|
1088
|
+
</optional>
|
1089
|
+
<ref name="btitle"/>
|
1090
|
+
<optional>
|
1091
|
+
<ref name="bplace"/>
|
1092
|
+
</optional>
|
1093
|
+
<optional>
|
1094
|
+
<ref name="seriesorganization"/>
|
1095
|
+
</optional>
|
1096
|
+
<optional>
|
1097
|
+
<ref name="abbreviation"/>
|
1098
|
+
</optional>
|
1099
|
+
<optional>
|
1100
|
+
<ref name="seriesfrom"/>
|
1101
|
+
</optional>
|
1102
|
+
<optional>
|
1103
|
+
<ref name="seriesto"/>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<ref name="seriesnumber"/>
|
1107
|
+
</optional>
|
1108
|
+
<optional>
|
1109
|
+
<ref name="seriespartnumber"/>
|
1110
|
+
</optional>
|
1111
|
+
<optional>
|
1112
|
+
<ref name="seriesrun"/>
|
1113
|
+
</optional>
|
990
1114
|
</element>
|
991
1115
|
</define>
|
992
1116
|
<define name="SeriesType">
|
@@ -1145,7 +1269,7 @@
|
|
1145
1269
|
</element>
|
1146
1270
|
</optional>
|
1147
1271
|
<element name="bibitem">
|
1148
|
-
<ref name="
|
1272
|
+
<ref name="ReducedBibliographicItem"/>
|
1149
1273
|
</element>
|
1150
1274
|
<choice>
|
1151
1275
|
<zeroOrMore>
|
@@ -1170,9 +1294,9 @@
|
|
1170
1294
|
<optional>
|
1171
1295
|
<ref name="revision-date"/>
|
1172
1296
|
</optional>
|
1173
|
-
<
|
1297
|
+
<optional>
|
1174
1298
|
<ref name="draft"/>
|
1175
|
-
</
|
1299
|
+
</optional>
|
1176
1300
|
</element>
|
1177
1301
|
</define>
|
1178
1302
|
<define name="vedition">
|
data/grammars/isodoc.rng
CHANGED
@@ -32,6 +32,43 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="admonition">
|
36
|
+
<element name="admonition">
|
37
|
+
<attribute name="type">
|
38
|
+
<ref name="AdmonitionType"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="class"/>
|
42
|
+
</optional>
|
43
|
+
<attribute name="id">
|
44
|
+
<data type="ID"/>
|
45
|
+
</attribute>
|
46
|
+
<optional>
|
47
|
+
<attribute name="uri">
|
48
|
+
<data type="anyURI"/>
|
49
|
+
</attribute>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<attribute name="coverpage">
|
53
|
+
<data type="boolean"/>
|
54
|
+
</attribute>
|
55
|
+
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="notag">
|
58
|
+
<data type="boolean"/>
|
59
|
+
</attribute>
|
60
|
+
</optional>
|
61
|
+
<optional>
|
62
|
+
<ref name="tname"/>
|
63
|
+
</optional>
|
64
|
+
<zeroOrMore>
|
65
|
+
<ref name="paragraph-with-footnote"/>
|
66
|
+
</zeroOrMore>
|
67
|
+
<zeroOrMore>
|
68
|
+
<ref name="note"/>
|
69
|
+
</zeroOrMore>
|
70
|
+
</element>
|
71
|
+
</define>
|
35
72
|
<define name="index">
|
36
73
|
<element name="index">
|
37
74
|
<optional>
|
@@ -79,6 +116,11 @@
|
|
79
116
|
<data type="boolean"/>
|
80
117
|
</attribute>
|
81
118
|
</optional>
|
119
|
+
<optional>
|
120
|
+
<attribute name="suppress_identifier">
|
121
|
+
<data type="boolean"/>
|
122
|
+
</attribute>
|
123
|
+
</optional>
|
82
124
|
<ref name="BibliographicItem"/>
|
83
125
|
</element>
|
84
126
|
</define>
|
@@ -245,6 +287,9 @@
|
|
245
287
|
<ref name="MultilingualRenderingType"/>
|
246
288
|
</attribute>
|
247
289
|
</optional>
|
290
|
+
<optional>
|
291
|
+
<ref name="tname"/>
|
292
|
+
</optional>
|
248
293
|
<oneOrMore>
|
249
294
|
<ref name="ul_li"/>
|
250
295
|
</oneOrMore>
|
@@ -287,6 +332,9 @@
|
|
287
332
|
</choice>
|
288
333
|
</attribute>
|
289
334
|
</optional>
|
335
|
+
<optional>
|
336
|
+
<ref name="tname"/>
|
337
|
+
</optional>
|
290
338
|
<oneOrMore>
|
291
339
|
<ref name="li"/>
|
292
340
|
</oneOrMore>
|
@@ -323,6 +371,9 @@
|
|
323
371
|
<ref name="MultilingualRenderingType"/>
|
324
372
|
</attribute>
|
325
373
|
</optional>
|
374
|
+
<optional>
|
375
|
+
<ref name="tname"/>
|
376
|
+
</optional>
|
326
377
|
<oneOrMore>
|
327
378
|
<ref name="dt"/>
|
328
379
|
<ref name="dd"/>
|
@@ -657,6 +708,9 @@
|
|
657
708
|
<optional>
|
658
709
|
<attribute name="tag"/>
|
659
710
|
</optional>
|
711
|
+
<optional>
|
712
|
+
<attribute name="type"/>
|
713
|
+
</optional>
|
660
714
|
<optional>
|
661
715
|
<attribute name="multilingual-rendering">
|
662
716
|
<ref name="MultilingualRenderingType"/>
|
@@ -692,6 +746,9 @@
|
|
692
746
|
<optional>
|
693
747
|
<attribute name="tag"/>
|
694
748
|
</optional>
|
749
|
+
<optional>
|
750
|
+
<attribute name="type"/>
|
751
|
+
</optional>
|
695
752
|
<optional>
|
696
753
|
<attribute name="multilingual-rendering">
|
697
754
|
<ref name="MultilingualRenderingType"/>
|
@@ -851,6 +908,16 @@
|
|
851
908
|
<ref name="MultilingualRenderingType"/>
|
852
909
|
</attribute>
|
853
910
|
</optional>
|
911
|
+
<optional>
|
912
|
+
<attribute name="coverpage">
|
913
|
+
<data type="boolean"/>
|
914
|
+
</attribute>
|
915
|
+
</optional>
|
916
|
+
<optional>
|
917
|
+
<attribute name="notag">
|
918
|
+
<data type="boolean"/>
|
919
|
+
</attribute>
|
920
|
+
</optional>
|
854
921
|
<oneOrMore>
|
855
922
|
<choice>
|
856
923
|
<ref name="paragraph"/>
|
@@ -1178,6 +1245,7 @@
|
|
1178
1245
|
<ref name="concept"/>
|
1179
1246
|
<ref name="add"/>
|
1180
1247
|
<ref name="del"/>
|
1248
|
+
<ref name="span"/>
|
1181
1249
|
</choice>
|
1182
1250
|
</define>
|
1183
1251
|
<define name="add">
|
@@ -1204,6 +1272,14 @@
|
|
1204
1272
|
</choice>
|
1205
1273
|
</element>
|
1206
1274
|
</define>
|
1275
|
+
<define name="span">
|
1276
|
+
<element name="span">
|
1277
|
+
<attribute name="class"/>
|
1278
|
+
<oneOrMore>
|
1279
|
+
<ref name="TextElement"/>
|
1280
|
+
</oneOrMore>
|
1281
|
+
</element>
|
1282
|
+
</define>
|
1207
1283
|
<define name="concept">
|
1208
1284
|
<element name="concept">
|
1209
1285
|
<optional>
|
@@ -1994,6 +2070,7 @@
|
|
1994
2070
|
<value>compare</value>
|
1995
2071
|
<value>contrast</value>
|
1996
2072
|
<value>see</value>
|
2073
|
+
<value>seealso</value>
|
1997
2074
|
</choice>
|
1998
2075
|
</define>
|
1999
2076
|
<define name="deprecates">
|
@@ -94,6 +94,7 @@ module RelatonIetf
|
|
94
94
|
if series != match[:series]
|
95
95
|
bib_versions = versions.select { |ref| ref.include? match[:series] }
|
96
96
|
create_series match[:series], bib_versions
|
97
|
+
series = match[:series]
|
97
98
|
end
|
98
99
|
lv = bib_versions.select { |ref| ref.match(/\d+$/).to_s.to_i < match[:ver].to_i }
|
99
100
|
hv = bib_versions.select { |ref| ref.match(/\d+$/).to_s.to_i > match[:ver].to_i }
|
@@ -103,7 +104,6 @@ module RelatonIetf
|
|
103
104
|
bib.relation << version_relation(hv.first, "updatedBy") if hv.any?
|
104
105
|
save_doc bib, check_duplicate: false
|
105
106
|
end
|
106
|
-
series = match[:series]
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -114,14 +114,18 @@ module RelatonIetf
|
|
114
114
|
# @param [String] ref reference
|
115
115
|
# @param [Array<String>] versions list of versions
|
116
116
|
#
|
117
|
-
def create_series(ref, versions)
|
117
|
+
def create_series(ref, versions) # rubocop:disable Metrics/AbcSize
|
118
118
|
return if versions.size < 2
|
119
119
|
|
120
|
+
vs = versions.sort_by { |v| v.match(/\d+$/).to_s.to_i }
|
120
121
|
fref = RelatonBib::FormattedRef.new content: ref
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
docid = RelatonBib::DocumentIdentifier.new type: "Internet-Draft", id: ref, primary: true
|
123
|
+
rel = vs.map { |v| version_relation v, "includes" }
|
124
|
+
last_v = HashConverter.hash_to_bib YAML.load_file("#{@output}/#{vs.last}.#{@ext}")
|
125
|
+
bib = IetfBibliographicItem.new(
|
126
|
+
title: last_v[:title], abstract: last_v[:abstract], formattedref: fref, docid: [docid], relation: rel,
|
127
|
+
)
|
128
|
+
save_doc bib
|
125
129
|
end
|
126
130
|
|
127
131
|
#
|
@@ -134,7 +138,8 @@ module RelatonIetf
|
|
134
138
|
#
|
135
139
|
def version_relation(ref, type)
|
136
140
|
fref = RelatonBib::FormattedRef.new content: ref
|
137
|
-
|
141
|
+
docid = RelatonBib::DocumentIdentifier.new type: "Internet-Draft", id: ref, primary: true
|
142
|
+
bibitem = IetfBibliographicItem.new formattedref: fref, docid: [docid]
|
138
143
|
RelatonBib::DocumentRelation.new(type: type, bibitem: bibitem)
|
139
144
|
end
|
140
145
|
|
@@ -9,6 +9,16 @@ module RelatonIetf
|
|
9
9
|
def bib_item(item)
|
10
10
|
IetfBibliographicItem.new(**item)
|
11
11
|
end
|
12
|
+
|
13
|
+
# @param ret [Hash]
|
14
|
+
def editorialgroup_hash_to_bib(ret)
|
15
|
+
return unless ret[:editorialgroup]
|
16
|
+
|
17
|
+
technical_committee = array(ret[:editorialgroup]).map do |wg|
|
18
|
+
Committee.new RelatonBib::WorkGroup.new(**wg)
|
19
|
+
end
|
20
|
+
ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
@@ -6,7 +6,7 @@ module RelatonIetf
|
|
6
6
|
def initialize # rubocop:disable Lint/MissingSuper
|
7
7
|
@short = :relaton_ietf
|
8
8
|
@prefix = "IETF"
|
9
|
-
@defaultprefix = /^(IETF|RFC|BCP)\s/
|
9
|
+
@defaultprefix = /^(IETF|RFC|BCP|FYI|STD)\s/
|
10
10
|
@idtype = "IETF"
|
11
11
|
@datasets = %w[ietf-rfcsubseries ietf-internet-drafts ietf-rfc-entries]
|
12
12
|
end
|
@@ -243,7 +243,8 @@ module RelatonIetf
|
|
243
243
|
types = { "updates" => "updates", "obsoleted-by" => "obsoletedBy"}
|
244
244
|
@doc.xpath("./xmlns:updates/xmlns:doc-id|./xmlns:obsoleted-by/xmlns:doc-id").map do |r|
|
245
245
|
fref = RelatonBib::FormattedRef.new(content: r.text)
|
246
|
-
|
246
|
+
docid = RelatonBib::DocumentIdentifier.new type: "IETF", id: r.text, primary: true
|
247
|
+
bib = IetfBibliographicItem.new(formattedref: fref, docid: [docid])
|
247
248
|
RelatonBib::DocumentRelation.new(type: types[r.parent.name], bibitem: bib)
|
248
249
|
end
|
249
250
|
end
|
@@ -30,8 +30,15 @@ module RelatonIetf
|
|
30
30
|
new(doc, doc_id.text, is_also).parse
|
31
31
|
end
|
32
32
|
|
33
|
-
|
33
|
+
#
|
34
|
+
# Parse document
|
35
|
+
#
|
36
|
+
# @return [RelatonIetf::IetfBibliographicItem] bib item
|
37
|
+
#
|
38
|
+
def parse # rubocop:disable Metrics/MethodLength
|
34
39
|
IetfBibliographicItem.new(
|
40
|
+
fetched: Date.today.to_s,
|
41
|
+
title: make_title,
|
35
42
|
docnumber: docnumber,
|
36
43
|
type: "standard",
|
37
44
|
docid: parse_docid,
|
@@ -43,15 +50,29 @@ module RelatonIetf
|
|
43
50
|
)
|
44
51
|
end
|
45
52
|
|
53
|
+
def make_title
|
54
|
+
t = case @name
|
55
|
+
when "bcp" then "Best Current Practice #{@shortnum}"
|
56
|
+
when "fyi" then "For Your Information #{@shortnum}"
|
57
|
+
when "std" then "Internet Standard technical specification #{@shortnum}"
|
58
|
+
end
|
59
|
+
[RelatonBib::TypedTitleString.new(content: t, language: "en", script: "Latn")]
|
60
|
+
end
|
61
|
+
|
46
62
|
#
|
47
|
-
# Document
|
63
|
+
# Document number
|
48
64
|
#
|
49
|
-
# @return [Strinng] document
|
65
|
+
# @return [Strinng] document number
|
50
66
|
#
|
51
67
|
def docnumber
|
52
68
|
@doc_id
|
53
69
|
end
|
54
70
|
|
71
|
+
#
|
72
|
+
# Create docidentifiers
|
73
|
+
#
|
74
|
+
# @return [Array<RelatonBib::DocumentIdentifier>] docidentifiers
|
75
|
+
#
|
55
76
|
def parse_docid
|
56
77
|
[
|
57
78
|
RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id, primary: true),
|
@@ -59,34 +80,55 @@ module RelatonIetf
|
|
59
80
|
]
|
60
81
|
end
|
61
82
|
|
83
|
+
#
|
84
|
+
# Create pub_id
|
85
|
+
#
|
86
|
+
# @return [String] pub_id
|
87
|
+
#
|
62
88
|
def pub_id
|
63
89
|
"#{@name.upcase} #{@shortnum}"
|
64
90
|
end
|
65
91
|
|
92
|
+
#
|
93
|
+
# Create anchor
|
94
|
+
#
|
95
|
+
# @return [String] anchor
|
96
|
+
#
|
66
97
|
def anchor
|
67
98
|
"#{@name.upcase}#{@shortnum}"
|
68
99
|
end
|
69
100
|
|
101
|
+
#
|
102
|
+
# Create link
|
103
|
+
#
|
104
|
+
# @return [Array<RelatonBib::TypedUri>]
|
105
|
+
#
|
70
106
|
def parse_link
|
71
107
|
[RelatonBib::TypedUri.new(type: "src", content: "https://www.rfc-editor.org/info/#{@name}#{@shortnum}")]
|
72
108
|
end
|
73
109
|
|
110
|
+
#
|
111
|
+
# Create formatted reference
|
112
|
+
#
|
113
|
+
# @return [RelatonBib::FormattedRef]
|
114
|
+
#
|
74
115
|
def formattedref
|
75
116
|
RelatonBib::FormattedRef.new(
|
76
117
|
content: anchor, language: "en", script: "Latn",
|
77
118
|
)
|
78
119
|
end
|
79
120
|
|
121
|
+
#
|
122
|
+
# Create relations
|
123
|
+
#
|
124
|
+
# @return [Array<Hash>] relations
|
125
|
+
#
|
80
126
|
def parse_relation
|
81
|
-
@is_also.
|
82
|
-
|
83
|
-
|
84
|
-
bib =
|
85
|
-
|
86
|
-
fref = RelatonBib::FormattedRef.new content: ref
|
87
|
-
IetfBibliographicItem.new formattedref: fref
|
88
|
-
end
|
89
|
-
a << { type: "includes", bibitem: bib } if bib
|
127
|
+
@is_also.map do |ref|
|
128
|
+
fref = RelatonBib::FormattedRef.new content: ref
|
129
|
+
docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: ref, primary: true)
|
130
|
+
bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
|
131
|
+
{ type: "includes", bibitem: bib }
|
90
132
|
end
|
91
133
|
end
|
92
134
|
end
|
@@ -5,7 +5,9 @@ module RelatonIetf
|
|
5
5
|
module Scrapper
|
6
6
|
extend Scrapper
|
7
7
|
|
8
|
-
|
8
|
+
IDS = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-ids/main/data/"
|
9
|
+
RFC = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-rfcs/main/data/"
|
10
|
+
RSS = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-rfcsubseries/main/data/"
|
9
11
|
|
10
12
|
# @param text [String]
|
11
13
|
# @param is_relation [TrueClass, FalseClass]
|
@@ -13,8 +15,7 @@ module RelatonIetf
|
|
13
15
|
def scrape_page(text, is_relation: false)
|
14
16
|
# Remove initial "IETF " string if specified
|
15
17
|
ref = text.gsub(/^IETF /, "")
|
16
|
-
|
17
|
-
ref.sub!(/(?<=^(?:RFC|BCP|FYI|STD)\s)(\d+)/, num.rjust(4, "0")) if num
|
18
|
+
ref.sub!(/(?<=^(?:RFC|BCP|FYI|STD))\s(\d+)/) { $1.rjust 4, "0" }
|
18
19
|
rfc_item ref, is_relation
|
19
20
|
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
20
21
|
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
@@ -28,17 +29,19 @@ module RelatonIetf
|
|
28
29
|
# @param is_relation [Boolen, nil]
|
29
30
|
# @return [RelatonIetf::IetfBibliographicItem]
|
30
31
|
def rfc_item(ref, is_relation)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
|
32
|
+
ghurl = case ref
|
33
|
+
when /^RFC/ then RFC
|
34
|
+
when /^(?:BCP|FYI|STD)/ then RSS
|
35
|
+
when /^I-D/
|
36
|
+
ref.sub!(/^I-D\./, "")
|
37
|
+
IDS
|
38
|
+
else return
|
39
|
+
end
|
40
|
+
|
41
|
+
uri = "#{ghurl}#{ref.sub(/\s|\u00a0/, '.')}.yaml"
|
42
|
+
# BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
|
43
|
+
resp = get_page uri
|
44
|
+
IetfBibliographicItem.from_hash YAML.safe_load(resp) if resp
|
42
45
|
end
|
43
46
|
|
44
47
|
# @param uri [String]
|
data/lib/relaton_ietf/version.rb
CHANGED
@@ -11,6 +11,21 @@ module RelatonIetf
|
|
11
11
|
def bib_item(item_hash)
|
12
12
|
IetfBibliographicItem.new(**item_hash)
|
13
13
|
end
|
14
|
+
|
15
|
+
# @param ext [Nokogiri::XML::Element]
|
16
|
+
# @return [RelatonBib::EditorialGroup, nil]
|
17
|
+
def fetch_editorialgroup(ext)
|
18
|
+
return unless ext && (eg = ext.at "editorialgroup")
|
19
|
+
|
20
|
+
eg = eg.xpath("committee").map do |tc|
|
21
|
+
wg = RelatonBib::WorkGroup.new(
|
22
|
+
name: tc.text, number: tc[:number]&.to_i, type: tc[:type],
|
23
|
+
identifier: tc[:identifier], prefix: tc[:prefix]
|
24
|
+
)
|
25
|
+
Committee.new wg
|
26
|
+
end
|
27
|
+
RelatonBib::EditorialGroup.new eg if eg.any?
|
28
|
+
end
|
14
29
|
end
|
15
30
|
end
|
16
31
|
end
|
data/relaton_ietf.gemspec
CHANGED
@@ -38,6 +38,5 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency "vcr"
|
39
39
|
spec.add_development_dependency "webmock"
|
40
40
|
|
41
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
42
|
-
# spec.add_dependency "zlib", "~> 1.1.0"
|
41
|
+
spec.add_dependency "relaton-bib", "~> 1.12.0"
|
43
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.12.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.12.0
|
139
139
|
description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
|
140
140
|
BibliographicItem model.\n\nFormerly known as rfcbib.\n"
|
141
141
|
email:
|