relaton-omg 1.11.0 → 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/grammars/biblio.rng +172 -48
- data/lib/relaton_omg/scrapper.rb +7 -7
- data/lib/relaton_omg/version.rb +1 -1
- data/relaton_omg.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2aa9901dcb622d08d582b25f4b7bfc79aa4b44c652b178d1540ab654bfd1efbc
|
4
|
+
data.tar.gz: 36b0d964595013a38200343bdfa76a289c4a2f81db79b9933d3ac475794b0502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 541b688c6e07fe10014996f535b582faa1114075bc7a0b8ad2f6a7093e09222e0cd515d40acffcab83d9df86f9adaf5912abf9bee119924eabd2af69d2708d65
|
7
|
+
data.tar.gz: 5d800ace325c49bab2e3604425a8048c604320718767974ffd3b27626d24d0dd432365ecf89933d111d5b5ceb41520dfcea151da9421a56d8d811bec08e0ab90
|
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/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/lib/relaton_omg/scrapper.rb
CHANGED
@@ -2,18 +2,18 @@ require "nokogiri"
|
|
2
2
|
|
3
3
|
module RelatonOmg
|
4
4
|
module Scrapper
|
5
|
-
URL_PATTERN = "https://www.omg.org/spec/"
|
5
|
+
URL_PATTERN = "https://www.omg.org/spec/".freeze
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def scrape_page(ref)
|
8
|
+
def scrape_page(ref) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
9
9
|
%r{OMG (?<acronym>[^\s]+)\s?(?<version>.*)} =~ ref
|
10
10
|
return unless acronym
|
11
11
|
|
12
12
|
url = URL_PATTERN + acronym
|
13
|
-
url += "
|
14
|
-
doc = Nokogiri::HTML OpenURI.open_uri(
|
13
|
+
url += "/#{version}" if version
|
14
|
+
doc = Nokogiri::HTML OpenURI.open_uri(url, open_timeout: 10)
|
15
15
|
OmgBibliographicItem.new(**item(doc, acronym))
|
16
|
-
rescue OpenURI::HTTPError, URI::InvalidURIError => e
|
16
|
+
rescue OpenURI::HTTPError, URI::InvalidURIError, Net::OpenTimeout => e
|
17
17
|
if e.is_a?(URI::InvalidURIError) || e.io.status[0] == "404"
|
18
18
|
warn %{[relaton-omg] no document found for "#{ref}" reference.}
|
19
19
|
return
|
@@ -65,7 +65,7 @@ module RelatonOmg
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def fetch_version(doc)
|
68
|
-
RelatonBib::BibliographicItem::Version.new
|
68
|
+
[RelatonBib::BibliographicItem::Version.new(pub_date(doc), version(doc))]
|
69
69
|
end
|
70
70
|
|
71
71
|
def version(doc)
|
@@ -116,7 +116,7 @@ module RelatonOmg
|
|
116
116
|
|
117
117
|
def fetch_license(doc)
|
118
118
|
doc.xpath(
|
119
|
-
'//dt/span/a[contains(., "IPR Mode")]/../../following-sibling::dd/span'
|
119
|
+
'//dt/span/a[contains(., "IPR Mode")]/../../following-sibling::dd/span',
|
120
120
|
).map { |l| l.text.match(/[\w\s-]+/).to_s.strip }
|
121
121
|
end
|
122
122
|
end
|
data/lib/relaton_omg/version.rb
CHANGED
data/relaton_omg.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-omg
|
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: byebug
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.12.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.12.0
|
125
125
|
description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
|
126
126
|
model'
|
127
127
|
email:
|