relaton-jis 1.16.1 → 1.16.3

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: c2ee66af10fcc5b78823a228bc7ac31263f8cd52f9e8fbbfdfb47ac500eb9c4a
4
- data.tar.gz: 68ddb0faf39ad33cd96edd29f072e41787b7c9fa262c5647768f12a481f5e2a7
3
+ metadata.gz: 1b3a731d5e0f676963ec89f4899c2d1bb8284373d42926fa99b62d6175ffde3d
4
+ data.tar.gz: fd4571456406d7175da4c2b4e613a9c1ddac3cda715a54914bfd0d4b39d1bba9
5
5
  SHA512:
6
- metadata.gz: b8c365ed292ca2405923fc74b5f9f3682bf7c95aef6cf2caa4a54e7d479203b617a530a19bf17c5ff9efb9365781f5c4b603ae7d1ec51fd467ff235eb4eed230
7
- data.tar.gz: 74d12f5337f22272db21fb76264a18b8d2be376d96f116ae6235f712388e4eb074d8c6a7806a24860be3ac560ff4d983899a043cf02d3b2183a03a0b2c39ce3f
6
+ metadata.gz: 6f304a961b00a79400f0b372122e24e136dd165b5d364c91d5a7221f1eabad76b4289c358b8da1a061f3d0dab7be5ddb27cf21d4e2a39d849cb83f369c4f38ad
7
+ data.tar.gz: 79d9d7aac0fcb3b7e5686ac1c9c5cc367d958f60becca732fb3c0c945a9286698664004ce9b8f7e97fd1d6bce4717aa59f262c0e1abfb2ff450d69875579f911
data/README.adoc CHANGED
@@ -22,13 +22,24 @@ If bundler is not being used to manage dependencies, install the gem by executin
22
22
 
23
23
  == Usage
24
24
 
25
- === Search for standards using keywords
25
+ === Configuration
26
+
27
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonJis.configure` block.
26
28
 
27
29
  [source,ruby]
28
30
  ----
29
31
  require 'relaton_jis'
30
32
  => true
31
33
 
34
+ RelatonJis.configure do |config|
35
+ config.logger.level = Logger::DEBUG
36
+ end
37
+ ----
38
+
39
+ === Search for standards using keywords
40
+
41
+ [source,ruby]
42
+ ----
32
43
  hit_collection = RelatonJis::Bibliography.search("JIS X 0208")
33
44
  => <RelatonJis::HitCollection:0x00000000018858 @ref=JIS X 0208 @fetched=false>
34
45
 
@@ -54,14 +65,14 @@ item.docidentifier
54
65
  [source,ruby]
55
66
  ----
56
67
  item = RelatonJis::Bibliography.get "JIS X 0208:1997"
57
- [relaton-jis] ("JIS X 0208:1997") fetching...
58
- [relaton-jis] ("JIS X 0208:1997") found JIS X 0208:1997
68
+ [relaton-jis] (JIS X 0208:1997) Fetching from webdesk.jsa.or.jp ...
69
+ [relaton-jis] (JIS X 0208:1997) Found: `JIS X 0208:1997`
59
70
  => #<RelatonJis::BibliographicItem:0x00007fe4478ecc08
60
71
  ...
61
72
 
62
73
  item = RelatonJis::Bibliography.get "JIS X 0208", "1997"
63
- [relaton-jis] ("JIS X 0208") fetching...
64
- [relaton-jis] ("JIS X 0208") found JIS X 0208:1997
74
+ [relaton-jis] (JIS X 0208) Fetching from webdesk.jsa.or.jp ...
75
+ [relaton-jis] (JIS X 0208) Found: `JIS X 0208:1997`
65
76
  => #<RelatonJis::BibliographicItem:0x00007fe436b49d90
66
77
  ...
67
78
 
@@ -78,7 +89,7 @@ Possible options:
78
89
  [source,ruby]
79
90
  ----
80
91
  item.to_xml
81
- => "<bibitem id="JISX0208-1997" type="standard" schema-version="v1.2.4">
92
+ => "<bibitem id="JISX0208-1997" type="standard" schema-version="v1.2.5">
82
93
  <fetched>2023-03-18</fetched>
83
94
  <title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
84
95
  <title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
@@ -86,12 +97,12 @@ item.to_xml
86
97
  </bibitem>"
87
98
 
88
99
  item.to_xml bibdata: true
89
- => "<bibdata type="standard" schema-version="v1.2.4">
100
+ => "<bibdata type="standard" schema-version="v1.2.5">
90
101
  <fetched>2023-03-18</fetched>
91
102
  <title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
92
103
  <title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
93
104
  ...
94
- <ext schema-version="">
105
+ <ext schema-version="v0.0.1">
95
106
  <doctype>standard</doctype>
96
107
  <editorialgroup>
97
108
  <technical-committee>一般財団法人 日本規格協会</technical-committee>
@@ -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>
@@ -36,7 +36,7 @@ module RelatonJis
36
36
  def get(ref, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
37
37
  code = ref.sub(/\s\((all parts|規格群)\)/, "")
38
38
  opts[:all_parts] ||= !$1.nil?
39
- Util.warn "(#{ref}) fetching..."
39
+ Util.warn "(#{ref}) Fetching from webdesk.jsa.or.jp ..."
40
40
  hits = search(code, year)
41
41
  unless hits
42
42
  hint [], ref, year
@@ -44,7 +44,7 @@ module RelatonJis
44
44
  end
45
45
  result = opts[:all_parts] ? hits.find_all_parts : hits.find
46
46
  if result.is_a? RelatonJis::BibliographicItem
47
- Util.warn "(#{ref}) found `#{result.docidentifier[0].id}`"
47
+ Util.warn "(#{ref}) Found: `#{result.docidentifier[0].id}`"
48
48
  return result
49
49
  end
50
50
  hint result, ref, year
@@ -58,8 +58,7 @@ module RelatonJis
58
58
  # @param [String, nil] year year to search
59
59
  #
60
60
  def hint(result, ref, year)
61
- Util.warn "(#{ref}) not found. The identifier must be " \
62
- "exactly as shown on the webdesk.jsa.or.jp website."
61
+ Util.warn "(#{ref}) Not found."
63
62
  if result.any?
64
63
  Util.warn "(#{ref}) TIP: No match for edition year `#{year}`, " \
65
64
  "but matches exist for `#{result.uniq.join('`, `')}`."
@@ -38,6 +38,8 @@ module RelatonJis
38
38
 
39
39
  def find_all_years # rubocop:disable Metrics/AbcSize
40
40
  hits = @array.select { |hit| hit.eq? ref_parts }
41
+ return [] if hits.empty?
42
+
41
43
  item = hits.max_by { |i| i.id_parts[:year].to_i }.fetch
42
44
  item_id = item.docidentifier.first.id
43
45
  parent = item.to_most_recent_reference
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonJis
4
- VERSION = "1.16.1"
4
+ VERSION = "1.16.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-jis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.16.3
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-09-21 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize