relaton-ietf 1.2.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b582d89c8f44fb110d82a47cd477f50be19667cd4482de9753280d9b6ba8a84
4
- data.tar.gz: 3da49d99a2b3fa8880b603b252eea0d551e3f1457c8b8486d0256df957f227a1
3
+ metadata.gz: e833387c3a25a940b436ab64dd8ed498c5418240fe02a371a97ffd49a62de1c7
4
+ data.tar.gz: e7470c46a46172373d273c08243d9831ac6eb57efb5007ed3d1c0896d8b645df
5
5
  SHA512:
6
- metadata.gz: ea84e7f6f05e5b95aaaf1668cd9502b6e781409b9f899efafcb757bce60056e5f292e5147f5564c49662a016286300f198de9504427beec1e4677d9ca1eb7f24
7
- data.tar.gz: 0c5fcefc0c2e17233f874f252d2b66e488867dd6b0af77f5043a90e2f547a2237a0ba2302bbcd4d723b3330cba8976c1bf272062ea12f948fc3c12b5b9d08316
6
+ metadata.gz: 10ba8e35c6ddf329ce0aebeade61c8ed71973f8c86b7665b3bdf8aa5b7164e9bb76f3669d6da8258265fb86d3e47d0bacff749fb5b1fdc0549a521d0a071a4d6
7
+ data.tar.gz: 43a839c670c248d1293c978b9bdfa9f06a2cf1b0cbe287e2b3a115b7144ec7779b689eecaec783e27a1f3b1a3810bf2bf6781a9754f943ba9894206e6bf4cfb2
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -45,7 +45,7 @@ item = RelatonIetf::IetfBibliography.search 'RFC 8341'
45
45
 
46
46
  # Return nil if document doesn't exist.
47
47
  RelatonIetf::IetfBibliography.search '1111'
48
- 1111.xml: not recognised for RFC
48
+ RelatonBib::RequestError: 1111: not recognised for RFC
49
49
  => nil
50
50
  ----
51
51
 
@@ -59,48 +59,9 @@ item.to_xml
59
59
  <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
60
60
  <uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
61
61
  <docidentifier type="IETF">RFC 8341</docidentifier>
62
+ <docidentifier type=\"rfc-anchor\">RFC8341</docidentifier>
62
63
  <docidentifier type="DOI">10.17487/RFC8341</docidentifier>
63
- <date type="published">
64
- <on>2018-03</on>
65
- </date>
66
- <contributor>
67
- <role type="author"/>
68
- <person>
69
- <name>
70
- <completename language="en">A. Bierman</completename>
71
- </name>
72
- <affiliation>
73
- <organization>
74
- <name>IETF</name>
75
- <abbreviation>IETF</abbreviation>
76
- </organization>
77
- </affiliation>
78
- </person>
79
- </contributor>
80
- <contributor>
81
- <role type="author"/>
82
- <person>
83
- <name>
84
- <completename language="en">M. Bjorklund</completename>
85
- </name>
86
- <affiliation>
87
- <organization>
88
- <name>IETF</name>
89
- <abbreviation>IETF</abbreviation>
90
- </organization>
91
- </affiliation>
92
- </person>
93
- </contributor>
94
- <language>en</language>
95
- <script>Latn</script>
96
- <series type="main">
97
- <title format="text/plain" language="en" script="Latn">STD</title>
98
- <number>91</number>
99
- </series>
100
- <series type="main">
101
- <title format="text/plain" language="en" script="Latn">RFC</title>
102
- <number>8341</number>
103
- </series>
64
+ ....
104
65
  </bibitem>"
105
66
  ----
106
67
  With `bibdata: true` option XML output wrapped with `bibdata` element and `ext` element added.
@@ -122,13 +83,16 @@ item.to_xml bibdata: true
122
83
 
123
84
  [source,ruby]
124
85
  ----
125
- item = Relaton::Provider::Ietf.from_rfcxml File.read("rfc.xml")
86
+ item = Relaton::Provider::Ietf.from_rfcxml File.read("spec/examples/rfc.xml")
126
87
  => #<RelatonIetf::IetfBibliographicItem:0x007fa8cda79ab8
127
88
  ...
128
89
 
129
90
  item.to_xml bibdata: true
130
91
  =>"<bibdata>
131
- ...
92
+ <fetched>2020-09-15</fetched>
93
+ <title format="text/plain" language="en" script="Latn">ACVP Secure Hash Algorithm (SHA) JSON Specification</title>
94
+ ...
95
+ </bibdata>"
132
96
  ----
133
97
 
134
98
  === Create bibliographic item form YAML
@@ -868,6 +868,13 @@
868
868
  </define>
869
869
  <define name="ietf-standard">
870
870
  <element name="ietf-standard">
871
+ <attribute name="version"/>
872
+ <attribute name="type">
873
+ <choice>
874
+ <value>semantic</value>
875
+ <value>presentation</value>
876
+ </choice>
877
+ </attribute>
871
878
  <ref name="bibdata"/>
872
879
  <zeroOrMore>
873
880
  <ref name="termdocsource"/>
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,6 +63,11 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -922,6 +958,9 @@
922
958
  <optional>
923
959
  <attribute name="script"/>
924
960
  </optional>
961
+ <optional>
962
+ <attribute name="type"/>
963
+ </optional>
925
964
  <optional>
926
965
  <attribute name="obligation">
927
966
  <choice>
@@ -961,9 +1000,6 @@
961
1000
  </define>
962
1001
  <define name="content-subsection">
963
1002
  <element name="clause">
964
- <optional>
965
- <attribute name="type"/>
966
- </optional>
967
1003
  <ref name="Content-Section"/>
968
1004
  </element>
969
1005
  </define>
@@ -992,6 +1028,9 @@
992
1028
  </choice>
993
1029
  </attribute>
994
1030
  </optional>
1031
+ <optional>
1032
+ <attribute name="type"/>
1033
+ </optional>
995
1034
  <optional>
996
1035
  <ref name="section-title"/>
997
1036
  </optional>
@@ -1011,9 +1050,6 @@
1011
1050
  </define>
1012
1051
  <define name="clause">
1013
1052
  <element name="clause">
1014
- <optional>
1015
- <attribute name="type"/>
1016
- </optional>
1017
1053
  <ref name="Clause-Section"/>
1018
1054
  </element>
1019
1055
  </define>
@@ -1042,18 +1078,24 @@
1042
1078
  </choice>
1043
1079
  </attribute>
1044
1080
  </optional>
1081
+ <optional>
1082
+ <attribute name="type"/>
1083
+ </optional>
1045
1084
  <optional>
1046
1085
  <ref name="section-title"/>
1047
1086
  </optional>
1048
1087
  <group>
1049
- <group>
1050
- <zeroOrMore>
1051
- <ref name="BasicBlock"/>
1052
- </zeroOrMore>
1053
- <zeroOrMore>
1054
- <ref name="note"/>
1055
- </zeroOrMore>
1056
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
1057
1099
  <zeroOrMore>
1058
1100
  <choice>
1059
1101
  <ref name="clause-subsection"/>
@@ -1180,6 +1222,9 @@
1180
1222
  <optional>
1181
1223
  <attribute name="script"/>
1182
1224
  </optional>
1225
+ <optional>
1226
+ <attribute name="type"/>
1227
+ </optional>
1183
1228
  <optional>
1184
1229
  <attribute name="obligation">
1185
1230
  <choice>
@@ -1447,11 +1492,6 @@
1447
1492
  </optional>
1448
1493
  </element>
1449
1494
  </define>
1450
- <define name="preface_abstract">
1451
- <element name="abstract">
1452
- <ref name="Basic-Section"/>
1453
- </element>
1454
- </define>
1455
1495
  <define name="term-clause">
1456
1496
  <element name="clause">
1457
1497
  <optional>
@@ -1501,4 +1541,79 @@
1501
1541
  <ref name="CitationType"/>
1502
1542
  </element>
1503
1543
  </define>
1544
+ <define name="amend">
1545
+ <element name="amend">
1546
+ <optional>
1547
+ <attribute name="id">
1548
+ <data type="ID"/>
1549
+ </attribute>
1550
+ </optional>
1551
+ <attribute name="change">
1552
+ <choice>
1553
+ <value>add</value>
1554
+ <value>modify</value>
1555
+ <value>delete</value>
1556
+ </choice>
1557
+ </attribute>
1558
+ <optional>
1559
+ <attribute name="path"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <attribute name="path_end"/>
1563
+ </optional>
1564
+ <optional>
1565
+ <attribute name="title"/>
1566
+ </optional>
1567
+ <optional>
1568
+ <element name="location">
1569
+ <zeroOrMore>
1570
+ <ref name="locality"/>
1571
+ </zeroOrMore>
1572
+ </element>
1573
+ </optional>
1574
+ <zeroOrMore>
1575
+ <ref name="autonumber"/>
1576
+ </zeroOrMore>
1577
+ <optional>
1578
+ <element name="description">
1579
+ <zeroOrMore>
1580
+ <ref name="BasicBlock"/>
1581
+ </zeroOrMore>
1582
+ </element>
1583
+ </optional>
1584
+ <optional>
1585
+ <element name="newcontent">
1586
+ <zeroOrMore>
1587
+ <ref name="BasicBlock"/>
1588
+ </zeroOrMore>
1589
+ </element>
1590
+ </optional>
1591
+ <optional>
1592
+ <element name="description">
1593
+ <zeroOrMore>
1594
+ <ref name="BasicBlock"/>
1595
+ </zeroOrMore>
1596
+ </element>
1597
+ </optional>
1598
+ </element>
1599
+ </define>
1600
+ <define name="autonumber">
1601
+ <element name="autonumber">
1602
+ <attribute name="type">
1603
+ <choice>
1604
+ <value>requirement</value>
1605
+ <value>recommendation</value>
1606
+ <value>permission</value>
1607
+ <value>table</value>
1608
+ <value>figure</value>
1609
+ <value>admonition</value>
1610
+ <value>formula</value>
1611
+ <value>sourcecode</value>
1612
+ <value>example</value>
1613
+ <value>note</value>
1614
+ </choice>
1615
+ </attribute>
1616
+ <text/>
1617
+ </element>
1618
+ </define>
1504
1619
  </grammar>
@@ -15,29 +15,17 @@ module RelatonIetf
15
15
  warn "[relaton-ietf] WARNING: invalid doctype #{args[:doctype]}"
16
16
  end
17
17
  super
18
- # @doctype = args[:doctype]
19
18
  end
20
19
 
21
- # @param builder
22
20
  # @param opts [Hash]
21
+ # @option opts [Nokogiri::XML::Builder] :builder XML builder
22
+ # @option opts [Boolean] :bibdata
23
23
  # @option opts [Symbol, NilClass] :date_format (:short), :full
24
- def to_xml(builder = nil, **opts)
24
+ # @option opts [String, Symbol] :lang language
25
+ # @return [String] XML
26
+ def to_xml(**opts)
25
27
  opts[:date_format] ||= :short
26
- super builder, **opts do |b|
27
- if opts[:bibdata] && doctype
28
- b.ext do
29
- b.doctype doctype if doctype
30
- end
31
- end
32
- end
33
- end
34
-
35
- # @return [Hash]
36
- def to_hash
37
- hash = super
38
- hash["doctype"] = doctype if doctype
39
- # hash["keyword"] = single_element_array(keyword) if keyword&.any?
40
- hash
28
+ super **opts
41
29
  end
42
30
  end
43
31
  end
@@ -111,7 +111,10 @@ module RelatonIetf
111
111
  error = nil
112
112
  uri_nums.each do |n|
113
113
  /(?<=-)(?<ver>\d{2})$/ =~ ref
114
- ref.sub! /-\d{2}/, "" if ver && n == "3"
114
+ if n == "3"
115
+ ref.sub! /-\d{2}/, "" if ver
116
+ ref.sub! /(?<=I-D\.)draft-/, ""
117
+ end
115
118
 
116
119
  uri = "#{RFC_URI_PATTERN}#{n}/reference.#{ref.sub(/\s|\u00a0/, ".")}.xml"
117
120
  begin
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
@@ -3,17 +3,6 @@ require "nokogiri"
3
3
  module RelatonIetf
4
4
  class XMLParser < RelatonBib::XMLParser
5
5
  class << self
6
- # def from_xml(xml)
7
- # doc = Nokogiri::XML(xml)
8
- # doc.remove_namespaces!
9
- # ietfitem = doc.at("/bibitem|/bibdata")
10
- # if ietfitem
11
- # RelatonIetf::IetfBibliographicItem.new(item_data(ietfitem))
12
- # elsif
13
- # warn "[relato-ietf] can't find bibitem or bibdata element in the XML"
14
- # end
15
- # end
16
-
17
6
  private
18
7
 
19
8
  # override RelatonBib::BibliographicItem.bib_item method
@@ -22,15 +11,6 @@ module RelatonIetf
22
11
  def bib_item(item_hash)
23
12
  IetfBibliographicItem.new item_hash
24
13
  end
25
-
26
- def item_data(ietfitem)
27
- data = super
28
- ext = ietfitem.at "./ext"
29
- return data unless ext
30
-
31
- data[:doctype] = ext.at("./doctype")&.text
32
- data
33
- end
34
14
  end
35
15
  end
36
16
  end
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "vcr"
41
41
  spec.add_development_dependency "webmock"
42
42
 
43
- spec.add_dependency "relaton-bib", "~> 1.2.0"
43
+ spec.add_dependency "relaton-bib", "~> 1.5.0"
44
44
  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.2.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-26 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.2.0
159
+ version: 1.5.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.2.0
166
+ version: 1.5.0
167
167
  description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
168
168
  BibliographicItem model.\n\nFormerly known as rfcbib.\n"
169
169
  email:
@@ -205,7 +205,7 @@ homepage: https://github.com/metanorma/relaton-ietf
205
205
  licenses:
206
206
  - BSD-2-Clause
207
207
  metadata: {}
208
- post_install_message:
208
+ post_install_message:
209
209
  rdoc_options: []
210
210
  require_paths:
211
211
  - lib
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubygems_version: 3.0.6
224
- signing_key:
224
+ signing_key:
225
225
  specification_version: 4
226
226
  summary: 'RelatonIetf: retrieve IETF Standards for bibliographic use using the BibliographicItem
227
227
  model'