relaton-gb 1.16.3 → 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbe2626219dda70b56d1c186f9220eb521eb124a89d328f7f7743a0ca971e87b
4
- data.tar.gz: a57f4fb37c2edd1451d2b29b3896d636648be8f0486dfc0dba385759cd9f73ed
3
+ metadata.gz: 53cd256c857a13c478b3d76fed719c5aab7a1ab716efafec164013da692d0c6e
4
+ data.tar.gz: b6d73b1296ac658de87cda32b776f11d69bb28b3b0e665843089c8e719113c80
5
5
  SHA512:
6
- metadata.gz: c68e56282a8ddf5e0da3bdac5ce9e8a26bb5af07eb227750a0060b5c48a075c991e418f878283557327b8bbc332f9da1926763ad08e0cc57d74ee2c4b4260f21
7
- data.tar.gz: e263b6a66f9054ec3872fca035a0a19877acc8bc2655e7b7f400fd7d14ccdac84e14ff9be25d8506d2976bebf5a05ddc7ce719fe6b76017ff221f64aee72c888
6
+ metadata.gz: 207fd52a45bcaaa959d951639fb0a16dcdace2be5db19e50c6f56bad479a7c9b3f2755dd125daaac67731907caa2a93da0878b0421b9556da50d32cb762f75c6
7
+ data.tar.gz: ee2a7ab80c231ad97382670840d78d14768c11a92dc53aa43fcf6b056a3d9e7d8dd3de48d37c31685304725a035f23bd100338fb614a88c96c9befd188c44c16
@@ -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
- <ref name="PureTextElement"/>
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
- <ref name="PureTextElement"/>
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
@@ -942,6 +942,7 @@
942
942
  <value>obsoleted</value>
943
943
  <value>confirmed</value>
944
944
  <value>updated</value>
945
+ <value>corrected</value>
945
946
  <value>issued</value>
946
947
  <value>transmitted</value>
947
948
  <value>copied</value>
@@ -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
- DOCTYPES = %w[standard reccomendation].freeze
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
- b.doctype doctype if doctype
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
- class HashConverter < RelatonIsoBib::HashConverter
5
- class << self
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?
2
+ module HashConverter
3
+ include RelatonIsoBib::HashConverter
4
+ extend self
13
5
 
14
- ccs_hash_to_bib(ret)
15
- ret
16
- end
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
- private
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
- 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)
32
- end
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
@@ -92,7 +92,7 @@ module RelatonGb
92
92
  end
93
93
 
94
94
  def get_type
95
- "standard"
95
+ DocumentType.new type: "standard"
96
96
  end
97
97
 
98
98
  # @param doc [Nokogiri::HTML::Document]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonGb
4
- VERSION = "1.16.3"
4
+ VERSION = "1.17.0"
5
5
  end
data/lib/relaton_gb.rb CHANGED
@@ -4,6 +4,7 @@ require "cnccs"
4
4
  require "relaton_gb/version"
5
5
  require "relaton_gb/config"
6
6
  require "relaton_gb/util"
7
+ require "relaton_gb/document_type"
7
8
  require "relaton_gb/gb_bibliography"
8
9
 
9
10
  # if defined? Relaton
data/relaton_gb.gemspec CHANGED
@@ -26,5 +26,5 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "cnccs", "~> 0.1.1"
28
28
  spec.add_dependency "gb-agencies", "~> 0.0.1"
29
- spec.add_dependency "relaton-iso-bib", "~> 1.16.0"
29
+ spec.add_dependency "relaton-iso-bib", "~> 1.17.0"
30
30
  end
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.16.3
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-01 00:00:00.000000000 Z
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.16.0
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.16.0
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