pubid-plateau 1.15.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 +7 -0
- data/LICENSE.txt +25 -0
- data/README.adoc +42 -0
- data/lib/pubid/plateau/errors.rb +5 -0
- data/lib/pubid/plateau/identifier/base.rb +43 -0
- data/lib/pubid/plateau/identifier/handbook.rb +15 -0
- data/lib/pubid/plateau/identifier/technical_report.rb +15 -0
- data/lib/pubid/plateau/identifier.rb +12 -0
- data/lib/pubid/plateau/parser.rb +30 -0
- data/lib/pubid/plateau/renderer/base.rb +21 -0
- data/lib/pubid/plateau/renderer/handbook.rb +5 -0
- data/lib/pubid/plateau/renderer/technical_report.rb +5 -0
- data/lib/pubid/plateau/version.rb +5 -0
- data/lib/pubid/plateau.rb +29 -0
- data/lib/pubid-plateau.rb +3 -0
- data/update_codes.yaml +6 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 249d895ac2ce20122cd153efa3cf6dee4e23ff1c057a3b80963d410f63a31ee2
|
4
|
+
data.tar.gz: b484768bf5fde435042cc49cdec3091e037a53bfd081a49ddf8edb7d80afb1fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3f195da3a5c6cb5c051ffc13ef7eeef7fd2b1780163c94e70e9315b2993f034c25326bff0cd4f91e123c0dc7a1d51cc7ffe47a7bbb4d2248b944ba7af5802d7
|
7
|
+
data.tar.gz: d3d981fe9277ad89765e16d5ec53ef9ffa041c693e479906077a0a0562fd8a2a8f71c06f5a11ed762ecfb1612f4669159a73e376cda148ba137049c1cc13af3b
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
BSD 2-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2018, Ribose
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.adoc
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
= PLATEAU publication identifiers ("Plateau PubID")
|
2
|
+
|
3
|
+
== Purpose
|
4
|
+
|
5
|
+
This gem implements a mechanism to parse and utilize Plateau publication identifiers.
|
6
|
+
|
7
|
+
== Use cases to support
|
8
|
+
|
9
|
+
. generate updated PubID
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
=== Identifier creation
|
14
|
+
|
15
|
+
Basic usage of the pubid-plateau gem starts with the `Identifier#create` method.
|
16
|
+
|
17
|
+
[source,ruby]
|
18
|
+
----
|
19
|
+
require "pubid-plateau"
|
20
|
+
|
21
|
+
pubid = Pubid::Plateau::Identifier.create(type: :handbook, number: 1, annex: 1, edition: 1.2)
|
22
|
+
pubid.to_s
|
23
|
+
|
24
|
+
=> "PLATEAU Handbook #01-1 第1.2版"
|
25
|
+
----
|
26
|
+
|
27
|
+
== Handbook 11 update
|
28
|
+
|
29
|
+
Handbook 11 has 2 parts for editions 1 to 3:
|
30
|
+
|
31
|
+
* (民間活用編) used to be Handbook 06 editions 1 to 3
|
32
|
+
* (公共活用編) used to be Handbook 04 editions 1 to 3
|
33
|
+
|
34
|
+
Only from edition 4 they are combined into Handbook 11.
|
35
|
+
|
36
|
+
In case when provided Handbook 11 editions 1 to 3, we convert it to Handbook 04 or 06.
|
37
|
+
|
38
|
+
[example]
|
39
|
+
====
|
40
|
+
`PLATEAU Handbook #11 第1.0版(民間活用編)` =>
|
41
|
+
`PLATEAU Handbook #06 第1.0版`
|
42
|
+
====
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module Pubid::Plateau
|
4
|
+
module Identifier
|
5
|
+
class Base < Pubid::Core::Identifier::Base
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
attr_accessor :annex, :type
|
9
|
+
|
10
|
+
def self.type
|
11
|
+
{ key: :plateau }
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(number:, publisher: "PLATEAU", annex: nil, edition: nil, **opts)
|
15
|
+
@annex = annex if annex
|
16
|
+
@edition = edition if edition
|
17
|
+
super(**opts.merge(publisher: publisher, number: number.to_i))
|
18
|
+
end
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def transform(params)
|
22
|
+
identifier_params = params.map do |k, v|
|
23
|
+
get_transformer_class.new.apply(k => v).to_a.first
|
24
|
+
end.to_h
|
25
|
+
|
26
|
+
Identifier.create(**identifier_params)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_parser_class
|
30
|
+
Parser
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_renderer_class
|
34
|
+
Renderer::Base
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_update_codes
|
38
|
+
UPDATE_CODES
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pubid::Plateau
|
2
|
+
module Identifier
|
3
|
+
class Handbook < Base
|
4
|
+
def_delegators 'Pubid::Plateau::Identifier::Handbook', :type
|
5
|
+
|
6
|
+
def self.get_renderer_class
|
7
|
+
Renderer::Handbook
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.type
|
11
|
+
{ key: :handbook, title: "Handbook" }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Pubid::Plateau
|
2
|
+
module Identifier
|
3
|
+
class TechnicalReport < Base
|
4
|
+
def_delegators 'Pubid::Plateau::Identifier::TechnicalReport', :type
|
5
|
+
|
6
|
+
def self.get_renderer_class
|
7
|
+
Renderer::TechnicalReport
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.type
|
11
|
+
{ key: :tr, title: "Technical Report", values: ["Technical Report"] }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Pubid::Plateau
|
2
|
+
class Parser < Pubid::Core::Parser
|
3
|
+
rule(:annex) do
|
4
|
+
(dash | str("_")) >> digits.as(:annex)
|
5
|
+
end
|
6
|
+
|
7
|
+
rule(:edition) do
|
8
|
+
space >> str("第") >> (digits >> str(".") >> digits).as(:edition) >> str("版")
|
9
|
+
end
|
10
|
+
|
11
|
+
rule(:type) do
|
12
|
+
(str("Handbook") | str("Technical Report")).as(:type)
|
13
|
+
end
|
14
|
+
|
15
|
+
# PLATEAU Handbook #00 第1.0版
|
16
|
+
rule(:number) do
|
17
|
+
str("#") >> digits.as(:number)
|
18
|
+
end
|
19
|
+
|
20
|
+
# ETSI ETR 299-1 ed.1 (1996-09)
|
21
|
+
# ETSI ETR 298 ed.1 (1996-09)
|
22
|
+
#
|
23
|
+
rule(:identifier) do
|
24
|
+
str("PLATEAU") >> space >> type >> space >>
|
25
|
+
number >> annex.maybe >> edition.maybe
|
26
|
+
end
|
27
|
+
|
28
|
+
rule(:root) { identifier }
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Pubid::Plateau::Renderer
|
2
|
+
class Base < Pubid::Core::Renderer::Base
|
3
|
+
TYPE = "".freeze
|
4
|
+
|
5
|
+
def render_identifier(params)
|
6
|
+
"%{publisher} #{self::class::TYPE} #%{number}%{annex}%{edition}" % params
|
7
|
+
end
|
8
|
+
|
9
|
+
def render_number(number, _opts, _params)
|
10
|
+
"%02d" % number.to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_annex(annex, _opts, _params)
|
14
|
+
"-#{annex}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def render_edition(edition, _opts, _params)
|
18
|
+
" 第#{edition}版"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "parslet"
|
4
|
+
require "yaml"
|
5
|
+
|
6
|
+
module Pubid
|
7
|
+
module Plateau
|
8
|
+
UPDATE_CODES = YAML.load_file(File.join(File.dirname(__FILE__), "../../update_codes.yaml"))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require "pubid-core"
|
13
|
+
|
14
|
+
require_relative "plateau/identifier"
|
15
|
+
require_relative "plateau/identifier/base"
|
16
|
+
require_relative "plateau/identifier/handbook"
|
17
|
+
require_relative "plateau/identifier/technical_report"
|
18
|
+
require_relative "plateau/renderer/base"
|
19
|
+
require_relative "plateau/renderer/handbook"
|
20
|
+
require_relative "plateau/renderer/technical_report"
|
21
|
+
|
22
|
+
config = Pubid::Core::Configuration.new
|
23
|
+
config.default_type = Pubid::Plateau::Identifier::Base
|
24
|
+
config.types = [Pubid::Plateau::Identifier::Handbook,
|
25
|
+
Pubid::Plateau::Identifier::TechnicalReport]
|
26
|
+
|
27
|
+
Pubid::Plateau::Identifier.set_config(config)
|
28
|
+
|
29
|
+
require_relative "plateau/parser"
|
data/update_codes.yaml
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
"PLATEAU Handbook #11 第1.0版(民間活用編)": "PLATEAU Handbook #06 第1.0版"
|
2
|
+
"PLATEAU Handbook #11 第1.0版(公共活用編)": "PLATEAU Handbook #04 第1.0版"
|
3
|
+
"PLATEAU Handbook #11 第2.0版(民間活用編)": "PLATEAU Handbook #06 第2.0版"
|
4
|
+
"PLATEAU Handbook #11 第2.0版(公共活用編)": "PLATEAU Handbook #04 第2.0版"
|
5
|
+
"PLATEAU Handbook #11 第3.0版(民間活用編)": "PLATEAU Handbook #06 第3.0版"
|
6
|
+
"PLATEAU Handbook #11 第3.0版(公共活用編)": "PLATEAU Handbook #04 第3.0版"
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pubid-plateau
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.15.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ribose Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-06-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parslet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pubid-core
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.15.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.15.0
|
41
|
+
description: Library to generate, parse and manipulate PLATEAU PubID.
|
42
|
+
email:
|
43
|
+
- open.source@ribose.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files:
|
47
|
+
- README.adoc
|
48
|
+
- LICENSE.txt
|
49
|
+
files:
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.adoc
|
52
|
+
- lib/pubid-plateau.rb
|
53
|
+
- lib/pubid/plateau.rb
|
54
|
+
- lib/pubid/plateau/errors.rb
|
55
|
+
- lib/pubid/plateau/identifier.rb
|
56
|
+
- lib/pubid/plateau/identifier/base.rb
|
57
|
+
- lib/pubid/plateau/identifier/handbook.rb
|
58
|
+
- lib/pubid/plateau/identifier/technical_report.rb
|
59
|
+
- lib/pubid/plateau/parser.rb
|
60
|
+
- lib/pubid/plateau/renderer/base.rb
|
61
|
+
- lib/pubid/plateau/renderer/handbook.rb
|
62
|
+
- lib/pubid/plateau/renderer/technical_report.rb
|
63
|
+
- lib/pubid/plateau/version.rb
|
64
|
+
- update_codes.yaml
|
65
|
+
homepage: https://github.com/metanorma/pubid-plateau
|
66
|
+
licenses:
|
67
|
+
- BSD-2-Clause
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.5.0
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.5.22
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Library to generate, parse and manipulate PLATEAU PubID.
|
88
|
+
test_files: []
|