relaton-nist 1.2.1 → 1.5.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -0
- data/.rubocop.yml +2 -2
- data/README.adoc +9 -11
- data/grammars/isodoc.rng +130 -21
- data/grammars/nist.rng +19 -1
- data/lib/relaton_nist/comment_period.rb +11 -0
- data/lib/relaton_nist/hit_collection.rb +15 -12
- data/lib/relaton_nist/nist_bibliographic_item.rb +15 -4
- data/lib/relaton_nist/nist_bibliography.rb +1 -1
- data/lib/relaton_nist/scrapper.rb +5 -4
- data/lib/relaton_nist/version.rb +1 -1
- data/lib/relaton_nist/xml_parser.rb +16 -13
- data/relaton_nist.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27f46f4290ada7c96ae0d01052f04586cd82a6c8800c42b151c2f70b31ebc700
|
4
|
+
data.tar.gz: 6927543ec8f9f8e2dbf8f3d981952d1e7dbd92c53f27be8823abbc4fc6481930
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3104efb08ff4e56ee69b584d27d2b8353956107eeacc2d14fcdf11e285a37d9d8629f6e9f31f0ed383bb644ca4b9b4fdc56bf1f5f4d4b2dc889af15ec2726c81
|
7
|
+
data.tar.gz: 02d479127243b75eaea466a6d7ec531d1f1aa22ee9c1d039898a39e18fda57be92d9b290a954e8c424d926e4f1a5b4500d5395a46277b5c0937a99b702553093
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -39,11 +39,10 @@ Or install it yourself as:
|
|
39
39
|
require 'relaton_nist'
|
40
40
|
|
41
41
|
hit_collection = RelatonNist::NistBibliography.search("8200")
|
42
|
-
=>
|
43
|
-
<RelatonNist::Hit:0x007f82b9b2a1e0 @text="8200" @fetched="false" @fullIdentifier="" @title="8200">]
|
42
|
+
=> <RelatonNist::HitCollection:0x007fc069d19da0 @ref=8200 @fetched=false>
|
44
43
|
|
45
44
|
item = hit_collection[1].fetch
|
46
|
-
|
45
|
+
=> #<RelatonNist::NistBibliographicItem:0x007fc049aa6778
|
47
46
|
...
|
48
47
|
----
|
49
48
|
|
@@ -71,9 +70,6 @@ item.to_xml bibdata: true
|
|
71
70
|
...
|
72
71
|
<ext>
|
73
72
|
<doctype>stadard</doctype>
|
74
|
-
<keyword>cybersecurity</keyword>
|
75
|
-
<keyword>cybersecurity objectives</keyword>
|
76
|
-
...
|
77
73
|
<commentperiod>
|
78
74
|
<from>2018-02-01</from>
|
79
75
|
<to>2018-04-18</to>
|
@@ -86,8 +82,9 @@ item.to_xml bibdata: true
|
|
86
82
|
[source,ruby]
|
87
83
|
----
|
88
84
|
RelatonNist::NistBibliography.get("8200", "2018", {})
|
89
|
-
|
90
|
-
|
85
|
+
[relaton-nist] ("8200") fetching...
|
86
|
+
[relaton-nist] ("8200") found NISTIR 8200
|
87
|
+
=> #<RelatonNist::NistBibliographicItem:0x007fc06aa2b480
|
91
88
|
...
|
92
89
|
----
|
93
90
|
|
@@ -110,9 +107,10 @@ NIST FIPS {docnumber}
|
|
110
107
|
----
|
111
108
|
[source,ruby]
|
112
109
|
----
|
113
|
-
RelatonNist::NistBibliography.get("
|
114
|
-
fetching
|
115
|
-
|
110
|
+
RelatonNist::NistBibliography.get("SP 800-205 (February 2019) (PD)")
|
111
|
+
[relaton-nist] ("SP 800-205") fetching...
|
112
|
+
[relaton-nist] ("SP 800-205") found SP 800-205 (Draft)
|
113
|
+
=> #<RelatonNist::NistBibliographicItem:0x007fc059934768
|
116
114
|
...
|
117
115
|
----
|
118
116
|
|
data/grammars/isodoc.rng
CHANGED
@@ -42,8 +42,11 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
+
<!-- attribute target { xsd:IDREF }, -->
|
45
46
|
<attribute name="target">
|
46
|
-
<data type="
|
47
|
+
<data type="string">
|
48
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
49
|
+
</data>
|
47
50
|
</attribute>
|
48
51
|
<optional>
|
49
52
|
<attribute name="type">
|
@@ -61,6 +64,11 @@
|
|
61
64
|
</choice>
|
62
65
|
</attribute>
|
63
66
|
</optional>
|
67
|
+
<optional>
|
68
|
+
<attribute name="droploc">
|
69
|
+
<data type="boolean"/>
|
70
|
+
</attribute>
|
71
|
+
</optional>
|
64
72
|
<text/>
|
65
73
|
</element>
|
66
74
|
</define>
|
@@ -578,6 +586,8 @@
|
|
578
586
|
<ref name="ol"/>
|
579
587
|
<ref name="dl"/>
|
580
588
|
<ref name="formula"/>
|
589
|
+
<ref name="quote"/>
|
590
|
+
<ref name="sourcecode"/>
|
581
591
|
</choice>
|
582
592
|
</oneOrMore>
|
583
593
|
</element>
|
@@ -661,6 +671,16 @@
|
|
661
671
|
</choice>
|
662
672
|
</attribute>
|
663
673
|
</optional>
|
674
|
+
<optional>
|
675
|
+
<attribute name="valign">
|
676
|
+
<choice>
|
677
|
+
<value>top</value>
|
678
|
+
<value>middle</value>
|
679
|
+
<value>bottom</value>
|
680
|
+
<value>baseline</value>
|
681
|
+
</choice>
|
682
|
+
</attribute>
|
683
|
+
</optional>
|
664
684
|
<choice>
|
665
685
|
<zeroOrMore>
|
666
686
|
<choice>
|
@@ -697,6 +717,16 @@
|
|
697
717
|
</choice>
|
698
718
|
</attribute>
|
699
719
|
</optional>
|
720
|
+
<optional>
|
721
|
+
<attribute name="valign">
|
722
|
+
<choice>
|
723
|
+
<value>top</value>
|
724
|
+
<value>middle</value>
|
725
|
+
<value>bottom</value>
|
726
|
+
<value>baseline</value>
|
727
|
+
</choice>
|
728
|
+
</attribute>
|
729
|
+
</optional>
|
700
730
|
<choice>
|
701
731
|
<zeroOrMore>
|
702
732
|
<choice>
|
@@ -855,7 +885,7 @@
|
|
855
885
|
<oneOrMore>
|
856
886
|
<choice>
|
857
887
|
<ref name="content"/>
|
858
|
-
<ref name="
|
888
|
+
<ref name="abstract"/>
|
859
889
|
<ref name="foreword"/>
|
860
890
|
<ref name="introduction"/>
|
861
891
|
<ref name="acknowledgements"/>
|
@@ -922,6 +952,9 @@
|
|
922
952
|
<optional>
|
923
953
|
<attribute name="script"/>
|
924
954
|
</optional>
|
955
|
+
<optional>
|
956
|
+
<attribute name="type"/>
|
957
|
+
</optional>
|
925
958
|
<optional>
|
926
959
|
<attribute name="obligation">
|
927
960
|
<choice>
|
@@ -961,9 +994,6 @@
|
|
961
994
|
</define>
|
962
995
|
<define name="content-subsection">
|
963
996
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
997
|
<ref name="Content-Section"/>
|
968
998
|
</element>
|
969
999
|
</define>
|
@@ -992,6 +1022,9 @@
|
|
992
1022
|
</choice>
|
993
1023
|
</attribute>
|
994
1024
|
</optional>
|
1025
|
+
<optional>
|
1026
|
+
<attribute name="type"/>
|
1027
|
+
</optional>
|
995
1028
|
<optional>
|
996
1029
|
<ref name="section-title"/>
|
997
1030
|
</optional>
|
@@ -1011,9 +1044,6 @@
|
|
1011
1044
|
</define>
|
1012
1045
|
<define name="clause">
|
1013
1046
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1047
|
<ref name="Clause-Section"/>
|
1018
1048
|
</element>
|
1019
1049
|
</define>
|
@@ -1042,18 +1072,24 @@
|
|
1042
1072
|
</choice>
|
1043
1073
|
</attribute>
|
1044
1074
|
</optional>
|
1075
|
+
<optional>
|
1076
|
+
<attribute name="type"/>
|
1077
|
+
</optional>
|
1045
1078
|
<optional>
|
1046
1079
|
<ref name="section-title"/>
|
1047
1080
|
</optional>
|
1048
1081
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1082
|
+
<choice>
|
1083
|
+
<group>
|
1084
|
+
<zeroOrMore>
|
1085
|
+
<ref name="BasicBlock"/>
|
1086
|
+
</zeroOrMore>
|
1087
|
+
<zeroOrMore>
|
1088
|
+
<ref name="note"/>
|
1089
|
+
</zeroOrMore>
|
1090
|
+
</group>
|
1091
|
+
<ref name="amend"/>
|
1092
|
+
</choice>
|
1057
1093
|
<zeroOrMore>
|
1058
1094
|
<choice>
|
1059
1095
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1216,9 @@
|
|
1180
1216
|
<optional>
|
1181
1217
|
<attribute name="script"/>
|
1182
1218
|
</optional>
|
1219
|
+
<optional>
|
1220
|
+
<attribute name="type"/>
|
1221
|
+
</optional>
|
1183
1222
|
<optional>
|
1184
1223
|
<attribute name="obligation">
|
1185
1224
|
<choice>
|
@@ -1447,11 +1486,6 @@
|
|
1447
1486
|
</optional>
|
1448
1487
|
</element>
|
1449
1488
|
</define>
|
1450
|
-
<define name="preface_abstract">
|
1451
|
-
<element name="abstract">
|
1452
|
-
<ref name="Basic-Section"/>
|
1453
|
-
</element>
|
1454
|
-
</define>
|
1455
1489
|
<define name="term-clause">
|
1456
1490
|
<element name="clause">
|
1457
1491
|
<optional>
|
@@ -1501,4 +1535,79 @@
|
|
1501
1535
|
<ref name="CitationType"/>
|
1502
1536
|
</element>
|
1503
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1504
1613
|
</grammar>
|
data/grammars/nist.rng
CHANGED
@@ -9,6 +9,24 @@
|
|
9
9
|
<start>
|
10
10
|
<ref name="nist-standard"/>
|
11
11
|
</start>
|
12
|
+
<define name="ol">
|
13
|
+
<element name="ol">
|
14
|
+
<attribute name="id">
|
15
|
+
<data type="ID"/>
|
16
|
+
</attribute>
|
17
|
+
<optional>
|
18
|
+
<attribute name="class">
|
19
|
+
<value>steps</value>
|
20
|
+
</attribute>
|
21
|
+
</optional>
|
22
|
+
<oneOrMore>
|
23
|
+
<ref name="li"/>
|
24
|
+
</oneOrMore>
|
25
|
+
<zeroOrMore>
|
26
|
+
<ref name="note"/>
|
27
|
+
</zeroOrMore>
|
28
|
+
</element>
|
29
|
+
</define>
|
12
30
|
<define name="DocumentType">
|
13
31
|
<value>standard</value>
|
14
32
|
</define>
|
@@ -16,7 +34,7 @@
|
|
16
34
|
<define name="preface">
|
17
35
|
<element name="preface">
|
18
36
|
<optional>
|
19
|
-
<ref name="
|
37
|
+
<ref name="abstract"/>
|
20
38
|
</optional>
|
21
39
|
<optional>
|
22
40
|
<ref name="foreword"/>
|
@@ -34,5 +34,16 @@ module RelatonNist
|
|
34
34
|
hash["extended"] = extended.to_s if extended
|
35
35
|
hash
|
36
36
|
end
|
37
|
+
|
38
|
+
# @param prefix [String]
|
39
|
+
# @return [String]
|
40
|
+
def to_asciibib(prefix)
|
41
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
42
|
+
pref += "commentperiod"
|
43
|
+
out = "#{pref}.from:: #{from}\n"
|
44
|
+
out += "#{pref}.to:: #{to}\n" if to
|
45
|
+
out += "#{pref}.extended:: #{extended}\n" if extended
|
46
|
+
out
|
47
|
+
end
|
37
48
|
end
|
38
49
|
end
|
@@ -17,10 +17,10 @@ module RelatonNist
|
|
17
17
|
# @param year [String]
|
18
18
|
# @param opts [Hash]
|
19
19
|
# @option opts [String] :stage
|
20
|
-
def initialize(ref_nbr, year = nil, opts = {})
|
20
|
+
def initialize(ref_nbr, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize
|
21
21
|
super ref_nbr, year
|
22
22
|
|
23
|
-
/(?<docid>(SP|FIPS)\s[0-9-]
|
23
|
+
/(?<docid>(SP|FIPS)\s[0-9-]+\w?)/ =~ text
|
24
24
|
@array = docid ? from_json(docid, **opts) : from_csrc(**opts)
|
25
25
|
|
26
26
|
@array.sort! do |a, b|
|
@@ -45,28 +45,28 @@ module RelatonNist
|
|
45
45
|
from = d.strftime "%m/%d/%Y"
|
46
46
|
to = d.next_year.prev_day.strftime "%m/%d/%Y"
|
47
47
|
end
|
48
|
-
url
|
48
|
+
url = "#{DOMAIN}/publications/search?keywords-lg=#{text}"
|
49
49
|
url += "&dateFrom-lg=#{from}" if from
|
50
50
|
url += "&dateTo-lg=#{to}" if to
|
51
|
-
url += if /PD
|
51
|
+
url += if /PD/.match? opts[:stage]
|
52
52
|
"&status-lg=Draft,Retired Draft,Withdrawn"
|
53
53
|
else
|
54
54
|
"&status-lg=Final,Withdrawn"
|
55
55
|
end
|
56
56
|
|
57
|
-
doc
|
57
|
+
doc = Nokogiri::HTML OpenURI.open_uri(::Addressable::URI.parse(url).normalize)
|
58
58
|
doc.css("table.publications-table > tbody > tr").map do |h|
|
59
59
|
link = h.at("td/div/strong/a")
|
60
60
|
serie = h.at("td[1]").text.strip
|
61
61
|
code = h.at("td[2]").text.strip
|
62
62
|
title = link.text
|
63
|
-
doc_url
|
63
|
+
doc_url = DOMAIN + link[:href]
|
64
64
|
status = h.at("td[4]").text.strip.downcase
|
65
65
|
release_date = Date.strptime h.at("td[5]").text.strip, "%m/%d/%Y"
|
66
66
|
Hit.new(
|
67
67
|
{
|
68
|
-
code: code, serie: serie, title: title, url: doc_url,
|
69
|
-
release_date: release_date
|
68
|
+
code: code, serie: serie, title: title, url: doc_url,
|
69
|
+
status: status, release_date: release_date
|
70
70
|
}, self
|
71
71
|
)
|
72
72
|
end
|
@@ -91,17 +91,18 @@ module RelatonNist
|
|
91
91
|
# @param docid [String]
|
92
92
|
# @param stage [String]
|
93
93
|
# @return [Array<Hach>]
|
94
|
-
def select_data(docid, **opts)
|
94
|
+
def select_data(docid, **opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength,Metrics/PerceivedComplexity
|
95
95
|
d = Date.strptime year, "%Y" if year
|
96
|
+
didrx = Regexp.new(docid)
|
96
97
|
data.select do |doc|
|
97
98
|
next unless match_year?(doc, d)
|
98
99
|
|
99
|
-
if /PD
|
100
|
+
if /PD/.match? opts[:stage]
|
100
101
|
next unless %w[draft-public draft-prelim].include? doc["status"]
|
101
102
|
else
|
102
103
|
next unless doc["status"] == "final"
|
103
104
|
end
|
104
|
-
doc["docidentifier"] =~
|
105
|
+
doc["docidentifier"] =~ didrx
|
105
106
|
end
|
106
107
|
end
|
107
108
|
|
@@ -129,7 +130,9 @@ module RelatonNist
|
|
129
130
|
#
|
130
131
|
# @prarm ctime [Time, NilClass]
|
131
132
|
def fetch_data(ctime)
|
132
|
-
resp = OpenURI.open_uri(
|
133
|
+
resp = OpenURI.open_uri(
|
134
|
+
"https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.meta"
|
135
|
+
)
|
133
136
|
if !ctime || ctime < resp.last_modified
|
134
137
|
@data = nil
|
135
138
|
zip = OpenURI.open_uri "https://csrc.nist.gov/CSRC/media/feeds/metanorma/pubs-export.zip"
|
@@ -63,13 +63,16 @@ module RelatonNist
|
|
63
63
|
super
|
64
64
|
end
|
65
65
|
|
66
|
-
# @param
|
67
|
-
|
68
|
-
|
66
|
+
# @param opts [Hash]
|
67
|
+
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
68
|
+
# @option opts [Boolean] :bibdata
|
69
|
+
# @option opts [String] :lang language
|
70
|
+
# @return [String] XML
|
71
|
+
def to_xml(**opts)
|
72
|
+
super date_format: :short, **opts do |b|
|
69
73
|
if opts[:bibdata]
|
70
74
|
b.ext do
|
71
75
|
b.doctype doctype if doctype
|
72
|
-
# keyword.each { |kw| b.keyword { kw.to_xml b } }
|
73
76
|
commentperiod&.to_xml b
|
74
77
|
end
|
75
78
|
end
|
@@ -83,5 +86,13 @@ module RelatonNist
|
|
83
86
|
hash["commentperiod"] = commentperiod.to_hash if commentperiod
|
84
87
|
hash
|
85
88
|
end
|
89
|
+
|
90
|
+
# @param prefix [String]
|
91
|
+
# @return [String]
|
92
|
+
def to_asciibib(prefix = "")
|
93
|
+
out = super
|
94
|
+
out += commentperiod.to_asciibib prefix if commentperiod
|
95
|
+
out
|
96
|
+
end
|
86
97
|
end
|
87
98
|
end
|
@@ -121,7 +121,7 @@ module RelatonNist
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def nistbib_search_filter(code, year, opts)
|
124
|
-
idregex = %r{[0-9-]{3,}}
|
124
|
+
idregex = %r{[0-9-]{3,}\w?}
|
125
125
|
docid = code.match(idregex).to_s
|
126
126
|
serie = code.match(%r{(FISP|SP|NISTIR)(?=\s)})
|
127
127
|
warn "[relaton-nist] (\"#{code}\") fetching..."
|
@@ -18,10 +18,10 @@ module RelatonNist
|
|
18
18
|
end
|
19
19
|
# doctype = "standard"
|
20
20
|
titles = fetch_titles(hit_data)
|
21
|
-
unless /^(SP|NISTIR|FIPS)
|
21
|
+
unless /^(SP|NISTIR|FIPS) /.match? item_data[:docid][0].id
|
22
22
|
# doctype = id_cleanup(item_data[:docid][0].id)
|
23
23
|
item_data[:docid][0] = RelatonBib::DocumentIdentifier.new(
|
24
|
-
id: titles[0][:content].upcase, type: "NIST"
|
24
|
+
id: titles[0][:content].upcase, type: "NIST"
|
25
25
|
)
|
26
26
|
end
|
27
27
|
item_data[:fetched] = Date.today.to_s
|
@@ -172,14 +172,15 @@ module RelatonNist
|
|
172
172
|
# @param hit_data [Hash]
|
173
173
|
# @return [Array<Hash>]
|
174
174
|
def fetch_titles(hit_data)
|
175
|
-
[{ content: hit_data[:title], language: "en", script: "Latn",
|
175
|
+
[{ content: hit_data[:title], language: "en", script: "Latn",
|
176
|
+
format: "text/plain" }]
|
176
177
|
end
|
177
178
|
|
178
179
|
# Fetch dates
|
179
180
|
# @param doc [Nokogiri::HTML::Document]
|
180
181
|
# @param release_date [Date]
|
181
182
|
# @return [Array<Hash>]
|
182
|
-
def fetch_dates(doc, release_date)
|
183
|
+
def fetch_dates(doc, release_date) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
183
184
|
dates = [{ type: "published", on: release_date.to_s }]
|
184
185
|
|
185
186
|
if doc.is_a? Hash
|
data/lib/relaton_nist/version.rb
CHANGED
@@ -1,28 +1,25 @@
|
|
1
1
|
module RelatonNist
|
2
2
|
class XMLParser < RelatonBib::XMLParser
|
3
3
|
class << self
|
4
|
-
def from_xml(xml)
|
5
|
-
doc = Nokogiri::XML xml
|
6
|
-
doc.remove_namespaces!
|
7
|
-
nistitem = doc.at("/bibitem|/bibdata")
|
8
|
-
if nistitem
|
9
|
-
NistBibliographicItem.new(item_data(nistitem))
|
10
|
-
elsif
|
11
|
-
warn "[relaton-nist] can't find bibitem or bibdata element in the XML"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
4
|
private
|
16
5
|
|
17
|
-
|
6
|
+
# @param intem [Nokogiri::XML::Document]
|
7
|
+
# @return [Hash]
|
8
|
+
def item_data(item)
|
18
9
|
data = super
|
19
|
-
ext =
|
10
|
+
ext = item.at "./ext"
|
20
11
|
return data unless ext
|
21
12
|
|
22
13
|
data[:commentperiod] = fetch_commentperiod(ext)
|
23
14
|
data
|
24
15
|
end
|
25
16
|
|
17
|
+
# @param item_hash [Hash]
|
18
|
+
# @return [RelatonNist::NistBibliographicItem]
|
19
|
+
def bib_item(item_hash)
|
20
|
+
NistBibliographicItem.new item_hash
|
21
|
+
end
|
22
|
+
|
26
23
|
def fetch_status(item)
|
27
24
|
status = item.at "./status"
|
28
25
|
return unless status
|
@@ -43,6 +40,12 @@ module RelatonNist
|
|
43
40
|
extended: cp.at("extended")&.text
|
44
41
|
)
|
45
42
|
end
|
43
|
+
|
44
|
+
# @param item [Nokogiri::XML::Element]
|
45
|
+
# @return [Array<RelatonBib::DocumentRelation>]
|
46
|
+
def fetch_relations(item)
|
47
|
+
super item, DocumentRelation
|
48
|
+
end
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
data/relaton_nist.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.pre
|
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-
|
11
|
+
date: 2020-10-07 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.
|
159
|
+
version: 1.5.pre
|
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.
|
166
|
+
version: 1.5.pre
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: rubyzip
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +220,7 @@ homepage: https://github.com/metanorma/relaton-nist
|
|
220
220
|
licenses:
|
221
221
|
- MIT
|
222
222
|
metadata: {}
|
223
|
-
post_install_message:
|
223
|
+
post_install_message:
|
224
224
|
rdoc_options: []
|
225
225
|
require_paths:
|
226
226
|
- lib
|
@@ -231,12 +231,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
231
|
version: 2.4.0
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- - "
|
234
|
+
- - ">"
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
236
|
+
version: 1.3.1
|
237
237
|
requirements: []
|
238
238
|
rubygems_version: 3.0.6
|
239
|
-
signing_key:
|
239
|
+
signing_key:
|
240
240
|
specification_version: 4
|
241
241
|
summary: 'RelatonNist: retrive NIST standards.'
|
242
242
|
test_files: []
|