relaton-gb 1.16.3 → 1.17.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 +4 -4
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_gb/document_type.rb +16 -0
- data/lib/relaton_gb/gb_bibliographic_item.rb +2 -2
- data/lib/relaton_gb/hash_converter.rb +30 -27
- data/lib/relaton_gb/scrapper.rb +1 -1
- data/lib/relaton_gb/version.rb +1 -1
- data/lib/relaton_gb.rb +1 -0
- data/relaton_gb.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53cd256c857a13c478b3d76fed719c5aab7a1ab716efafec164013da692d0c6e
|
|
4
|
+
data.tar.gz: b6d73b1296ac658de87cda32b776f11d69bb28b3b0e665843089c8e719113c80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 207fd52a45bcaaa959d951639fb0a16dcdace2be5db19e50c6f56bad479a7c9b3f2755dd125daaac67731907caa2a93da0878b0421b9556da50d32cb762f75c6
|
|
7
|
+
data.tar.gz: ee2a7ab80c231ad97382670840d78d14768c11a92dc53aa43fcf6b056a3d9e7d8dd3de48d37c31685304725a035f23bd100338fb614a88c96c9befd188c44c16
|
data/grammars/basicdoc.rng
CHANGED
|
@@ -346,6 +346,8 @@
|
|
|
346
346
|
<ref name="keyword"/>
|
|
347
347
|
<ref name="xref"/>
|
|
348
348
|
<ref name="hyperlink"/>
|
|
349
|
+
<ref name="index"/>
|
|
350
|
+
<ref name="index-xref"/>
|
|
349
351
|
</choice>
|
|
350
352
|
</oneOrMore>
|
|
351
353
|
</element>
|
|
@@ -623,6 +625,8 @@
|
|
|
623
625
|
<ref name="eref"/>
|
|
624
626
|
<ref name="xref"/>
|
|
625
627
|
<ref name="hyperlink"/>
|
|
628
|
+
<ref name="index"/>
|
|
629
|
+
<ref name="index-xref"/>
|
|
626
630
|
</choice>
|
|
627
631
|
</zeroOrMore>
|
|
628
632
|
</element>
|
|
@@ -636,6 +640,8 @@
|
|
|
636
640
|
<ref name="eref"/>
|
|
637
641
|
<ref name="xref"/>
|
|
638
642
|
<ref name="hyperlink"/>
|
|
643
|
+
<ref name="index"/>
|
|
644
|
+
<ref name="index-xref"/>
|
|
639
645
|
</choice>
|
|
640
646
|
</zeroOrMore>
|
|
641
647
|
</element>
|
|
@@ -648,6 +654,8 @@
|
|
|
648
654
|
<ref name="eref"/>
|
|
649
655
|
<ref name="xref"/>
|
|
650
656
|
<ref name="hyperlink"/>
|
|
657
|
+
<ref name="index"/>
|
|
658
|
+
<ref name="index-xref"/>
|
|
651
659
|
</choice>
|
|
652
660
|
</zeroOrMore>
|
|
653
661
|
</element>
|
|
@@ -655,7 +663,11 @@
|
|
|
655
663
|
<define name="keyword">
|
|
656
664
|
<element name="keyword">
|
|
657
665
|
<zeroOrMore>
|
|
658
|
-
<
|
|
666
|
+
<choice>
|
|
667
|
+
<ref name="PureTextElement"/>
|
|
668
|
+
<ref name="index"/>
|
|
669
|
+
<ref name="index-xref"/>
|
|
670
|
+
</choice>
|
|
659
671
|
</zeroOrMore>
|
|
660
672
|
</element>
|
|
661
673
|
</define>
|
|
@@ -676,7 +688,11 @@
|
|
|
676
688
|
<define name="strike">
|
|
677
689
|
<element name="strike">
|
|
678
690
|
<zeroOrMore>
|
|
679
|
-
<
|
|
691
|
+
<choice>
|
|
692
|
+
<ref name="PureTextElement"/>
|
|
693
|
+
<ref name="index"/>
|
|
694
|
+
<ref name="index-xref"/>
|
|
695
|
+
</choice>
|
|
680
696
|
</zeroOrMore>
|
|
681
697
|
</element>
|
|
682
698
|
</define>
|
data/grammars/biblio.rng
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module RelatonGb
|
|
2
|
+
class DocumentType < RelatonBib::DocumentType
|
|
3
|
+
DOCTYPES = %w[standard reccomendation].freeze
|
|
4
|
+
|
|
5
|
+
def initialize(type:, abbreviation: nil)
|
|
6
|
+
check_type type
|
|
7
|
+
super
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def check_type(type)
|
|
11
|
+
unless DOCTYPES.include? type
|
|
12
|
+
Util.warn "WARNING: invalid doctype: `#{type}`"
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -9,7 +9,7 @@ require "relaton_gb/ccs"
|
|
|
9
9
|
module RelatonGb
|
|
10
10
|
# GB bibliographic item class.
|
|
11
11
|
class GbBibliographicItem < RelatonIsoBib::IsoBibliographicItem
|
|
12
|
-
|
|
12
|
+
SUBDOCTYPES = %w[specification method-of-test vocabulary code-of-practice].freeze
|
|
13
13
|
|
|
14
14
|
# @return [RelatonGb::GbTechnicalCommittee]
|
|
15
15
|
attr_reader :committee
|
|
@@ -59,7 +59,7 @@ module RelatonGb
|
|
|
59
59
|
super(**opts) do |b|
|
|
60
60
|
if opts[:bibdata] && has_ext_attrs?
|
|
61
61
|
ext = b.ext do
|
|
62
|
-
|
|
62
|
+
doctype&.to_xml b
|
|
63
63
|
b.horizontal horizontal unless horizontal.nil?
|
|
64
64
|
# b.docsubtype docsubtype if docsubtype
|
|
65
65
|
committee&.to_xml b
|
|
@@ -1,36 +1,39 @@
|
|
|
1
|
-
require "yaml"
|
|
2
|
-
|
|
3
1
|
module RelatonGb
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
# @param args [Hash]
|
|
8
|
-
# @param nested [TrueClass, FalseClass]
|
|
9
|
-
# @return [Hash]
|
|
10
|
-
def hash_to_bib(args)
|
|
11
|
-
ret = super
|
|
12
|
-
return if ret.nil?
|
|
2
|
+
module HashConverter
|
|
3
|
+
include RelatonIsoBib::HashConverter
|
|
4
|
+
extend self
|
|
13
5
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
# @override RelatonBib::HashConverter.hash_to_bib
|
|
7
|
+
# @param args [Hash]
|
|
8
|
+
# @param nested [TrueClass, FalseClass]
|
|
9
|
+
# @return [Hash]
|
|
10
|
+
def hash_to_bib(args)
|
|
11
|
+
ret = super
|
|
12
|
+
return if ret.nil?
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
ccs_hash_to_bib(ret)
|
|
15
|
+
ret
|
|
16
|
+
end
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
# Ovverides superclass's method
|
|
22
|
-
#
|
|
23
|
-
# @param item [Hash]
|
|
24
|
-
# @retirn [RelatonGb::GbBibliographicItem]
|
|
25
|
-
def bib_item(item)
|
|
26
|
-
GbBibliographicItem.new(item)
|
|
27
|
-
end
|
|
18
|
+
private
|
|
28
19
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
#
|
|
21
|
+
# Ovverides superclass's method
|
|
22
|
+
#
|
|
23
|
+
# @param item [Hash]
|
|
24
|
+
# @retirn [RelatonGb::GbBibliographicItem]
|
|
25
|
+
def bib_item(item)
|
|
26
|
+
GbBibliographicItem.new(item)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def ccs_hash_to_bib(ret)
|
|
30
|
+
ret[:ccs] = RelatonBib.array(ret[:ccs]).map do |ccs|
|
|
31
|
+
(ccs[:code] && Cnccs.fetch(ccs[:code])) || Cnccs.fetch(ccs)
|
|
33
32
|
end
|
|
34
33
|
end
|
|
34
|
+
|
|
35
|
+
def create_doctype(**args)
|
|
36
|
+
DocumentType.new(**args)
|
|
37
|
+
end
|
|
35
38
|
end
|
|
36
39
|
end
|
data/lib/relaton_gb/scrapper.rb
CHANGED
data/lib/relaton_gb/version.rb
CHANGED
data/lib/relaton_gb.rb
CHANGED
data/relaton_gb.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-gb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.17.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: 2023-11-
|
|
11
|
+
date: 2023-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cnccs
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 1.
|
|
47
|
+
version: 1.17.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 1.
|
|
54
|
+
version: 1.17.0
|
|
55
55
|
description: 'RelatonGb: retrieve Chinese GB Standards for bibliographic use using
|
|
56
56
|
the BibliographicItem model.'
|
|
57
57
|
email:
|
|
@@ -81,6 +81,7 @@ files:
|
|
|
81
81
|
- lib/relaton_gb.rb
|
|
82
82
|
- lib/relaton_gb/ccs.rb
|
|
83
83
|
- lib/relaton_gb/config.rb
|
|
84
|
+
- lib/relaton_gb/document_type.rb
|
|
84
85
|
- lib/relaton_gb/gb_bibliographic_item.rb
|
|
85
86
|
- lib/relaton_gb/gb_bibliography.rb
|
|
86
87
|
- lib/relaton_gb/gb_scrapper.rb
|