relaton-jis 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +12 -0
- data/Gemfile +20 -0
- data/LICENSE.txt +21 -0
- data/README.adoc +141 -0
- data/Rakefile +12 -0
- data/grammars/basicdoc.rng +1125 -0
- data/grammars/biblio-standoc.rng +164 -0
- data/grammars/biblio.rng +1461 -0
- data/grammars/relaton-jis-compile.rng +11 -0
- data/grammars/relaton-jis.rng +231 -0
- data/lib/relaton_jis/bibliographic_item.rb +12 -0
- data/lib/relaton_jis/bibliography.rb +58 -0
- data/lib/relaton_jis/hash_converter.rb +9 -0
- data/lib/relaton_jis/hit.rb +48 -0
- data/lib/relaton_jis/hit_collection.rb +58 -0
- data/lib/relaton_jis/processor.rb +41 -0
- data/lib/relaton_jis/scraper.rb +132 -0
- data/lib/relaton_jis/version.rb +5 -0
- data/lib/relaton_jis/xml_parser.rb +9 -0
- data/lib/relaton_jis.rb +25 -0
- data/relaton_jis.gemspec +42 -0
- data/sig/relaton_jis.rbs +4 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 30edf630d85d2e1abafa0c0c03c7b5b22be3b5eebe8c18a7b9df955d8588e22b
|
4
|
+
data.tar.gz: 79ce45cba39f96353038c95c608c38b893ddbad335a671ade2361384ab8e3a3c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b0a58bb07a4b7b6f00b8b18014e3b6500ec5403f0c26cca6fac3286aa97ff0736a604d4d1e7a61c3e4379f5625409720c1119229a9c0dc4642173da46498b170
|
7
|
+
data.tar.gz: 6ba60be774e61bbfbcff9d10fe4dc031e4e07026c52fb64bbd56b9e6ccb59a2999f46c7c29475afcc8801effcc7fccf5f7076d64cb27744612abb291d1ad8219
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This project follows the Ribose OSS style guide.
|
2
|
+
# https://github.com/riboseinc/oss-guides
|
3
|
+
# All project-specific additions and overrides should be specified in this file.
|
4
|
+
|
5
|
+
require: rubocop-rails
|
6
|
+
|
7
|
+
inherit_from:
|
8
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
9
|
+
AllCops:
|
10
|
+
TargetRubyVersion: 2.7
|
11
|
+
Rails:
|
12
|
+
Enabled: false
|
data/Gemfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in relaton_jis.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.48"
|
13
|
+
gem "rubocop-performance", "~> 1.11"
|
14
|
+
gem "rubocop-rails", "~> 2.12"
|
15
|
+
|
16
|
+
gem "equivalent-xml", "~> 0.6"
|
17
|
+
gem "ruby-jing"
|
18
|
+
gem "simplecov", "~> 0.21"
|
19
|
+
gem "vcr", "~> 6.0"
|
20
|
+
gem "webmock", "~> 3.0"
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Ribose Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.adoc
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
= RelatonJis: retrieve JIS Standards for bibliographic use using the BibliographicItem model
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/relaton-jis.svg["Gem Version", link="https://rubygems.org/gems/relaton-jis"]
|
4
|
+
image:https://github.com/relaton/relaton-jis/workflows/macos/badge.svg["Build Status, link="https://github.com/relaton/relaton-jis/actions?workflow=rake"]
|
5
|
+
image:https://codeclimate.com/github/relaton/relaton-jis/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-jis"]
|
6
|
+
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-jis.svg["Pull Requests", link="https://github.com/relaton/relaton-jis/pulls"]
|
7
|
+
image:https://img.shields.io/github/commits-since/relaton/relaton-jis/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-jis/releases"]
|
8
|
+
|
9
|
+
RelatonJis is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
|
10
|
+
|
11
|
+
You can use it to retrieve metadata of JIS Standards from https://webdesk.jsa.or.jp, and access such metadata through the `RelatonJis::BibliographicItem` object.
|
12
|
+
|
13
|
+
== Installation
|
14
|
+
|
15
|
+
Install the gem and add to the application's Gemfile by executing:
|
16
|
+
|
17
|
+
$ bundle add relaton-jis
|
18
|
+
|
19
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
20
|
+
|
21
|
+
$ gem install relaton-jis
|
22
|
+
|
23
|
+
== Usage
|
24
|
+
|
25
|
+
=== Search for standards using keywords
|
26
|
+
|
27
|
+
[source,ruby]
|
28
|
+
----
|
29
|
+
require 'relaton_jis'
|
30
|
+
=> true
|
31
|
+
|
32
|
+
hit_collection = RelatonJis::Bibliography.search("JIS X 0208")
|
33
|
+
=> <RelatonJis::HitCollection:0x00000000018858 @ref=JIS X 0208 @fetched=false>
|
34
|
+
|
35
|
+
hit_collection.first
|
36
|
+
=> <RelatonJis::Hit:0x00000000018880 @text="JIS X 0208" @fetched="false" @fullIdentifier="" @title="">
|
37
|
+
|
38
|
+
item = hit_collection[2].fetch
|
39
|
+
=> #<RelatonJis::BibliographicItem:0x00007fe4564a7580
|
40
|
+
...
|
41
|
+
|
42
|
+
item.docidentifier
|
43
|
+
=> [#<RelatonBib::DocumentIdentifier:0x00007fe46625c518
|
44
|
+
@id="JIS X 0208:1997/AMENDMENT 1:2012",
|
45
|
+
@language=nil,
|
46
|
+
@primary=true,
|
47
|
+
@scope=nil,
|
48
|
+
@script=nil,
|
49
|
+
@type="JIS">]
|
50
|
+
----
|
51
|
+
|
52
|
+
=== Fetch document by reference and year
|
53
|
+
|
54
|
+
[source,ruby]
|
55
|
+
----
|
56
|
+
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
|
59
|
+
=> #<RelatonJis::BibliographicItem:0x00007fe4478ecc08
|
60
|
+
...
|
61
|
+
|
62
|
+
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
|
65
|
+
=> #<RelatonJis::BibliographicItem:0x00007fe436b49d90
|
66
|
+
...
|
67
|
+
|
68
|
+
item.docidentifier[0].id
|
69
|
+
=> "JIS X 0208:1997"
|
70
|
+
----
|
71
|
+
|
72
|
+
=== XML serialization
|
73
|
+
|
74
|
+
Possible options:
|
75
|
+
|
76
|
+
- *bibdata* - If true then wrapp item with _bibdata_ element and add _ext_ element.
|
77
|
+
|
78
|
+
[source,ruby]
|
79
|
+
----
|
80
|
+
item.to_xml
|
81
|
+
=> "<bibitem id="JISX0208-1997" type="standard" schema-version="v1.2.3">
|
82
|
+
<fetched>2023-03-18</fetched>
|
83
|
+
<title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
|
84
|
+
<title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
|
85
|
+
...
|
86
|
+
</bibitem>"
|
87
|
+
|
88
|
+
item.to_xml bibdata: true
|
89
|
+
=> "<bibdata type="standard" schema-version="v1.2.3">
|
90
|
+
<fetched>2023-03-18</fetched>
|
91
|
+
<title format="text/plain" language="ja" script="Jpan">7ビット及び8ビットの2バイト情報交換用符号化漢字集合</title>
|
92
|
+
<title format="text/plain" language="en" script="Lant">7-bit and 8-bit double byte coded KANJI sets for information interchange</title>
|
93
|
+
...
|
94
|
+
<ext schema-version="">
|
95
|
+
<doctype>standard</doctype>
|
96
|
+
<editorialgroup>
|
97
|
+
<technical-committee>一般財団法人 日本規格協会</technical-committee>
|
98
|
+
</editorialgroup>
|
99
|
+
<ics>
|
100
|
+
<code>35.040</code>
|
101
|
+
<text>Information coding</text>
|
102
|
+
</ics>
|
103
|
+
<structuredidentifier type="JIS">
|
104
|
+
<project-number>X0208</project-number>
|
105
|
+
</structuredidentifier>
|
106
|
+
</ext>
|
107
|
+
</bibdata>"
|
108
|
+
----
|
109
|
+
|
110
|
+
=== Typed links
|
111
|
+
|
112
|
+
Each JIS document has `src` type link and optional `pdf`.
|
113
|
+
|
114
|
+
[source,ruby]
|
115
|
+
----
|
116
|
+
item.link
|
117
|
+
=> [#<RelatonBib::TypedUri:0x00007fe436a626c0
|
118
|
+
@content=#<Addressable::URI:0xc620 URI:https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+X+0208%3A1997>,
|
119
|
+
@language=nil,
|
120
|
+
@script=nil,
|
121
|
+
@type="src">,
|
122
|
+
#<RelatonBib::TypedUri:0x00007fe436a60ed8
|
123
|
+
@content=#<Addressable::URI:0xc634 URI:https://webdesk.jsa.or.jp/preview/pre_jis_x_00208_000_000_1997_j_pr11_i4.pdf>,
|
124
|
+
@language=nil,
|
125
|
+
@script=nil,
|
126
|
+
@type="pdf">]
|
127
|
+
----
|
128
|
+
|
129
|
+
== Development
|
130
|
+
|
131
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
132
|
+
|
133
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
134
|
+
|
135
|
+
== Contributing
|
136
|
+
|
137
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-jis.
|
138
|
+
|
139
|
+
== License
|
140
|
+
|
141
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|