pubid-core 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1dac8a83909259a5aec69feedb3883fdc064047647334c08235aef1e66b74efb
4
+ data.tar.gz: 579ef254a5a1740a29d4f8e13ec725668627c8b98b7c928ef90848f9dd1a1f14
5
+ SHA512:
6
+ metadata.gz: 8e43b94b80a8e7b7d4ac838b11ad9dde07ac87f5a83221d95fcb766e3dea0dd1cad277a61516b407aad128c7217371ac74b5163f26c9114775e763f33e104d77
7
+ data.tar.gz: c63eb1bdc208613a82922a4640c0741182d8706d051b4646e2af83f70dd963f75a62fe3105b6daea31a19d27dd012dca3ac41625f2e4b961fe91854de24ba1df
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,2 @@
1
+ = Publication identifiers parsing library
2
+
@@ -0,0 +1,41 @@
1
+ module Pubid::Core
2
+ class Parser < Parslet::Parser
3
+ rule(:space) { str(" ") }
4
+ rule(:space?) { space.maybe }
5
+
6
+ rule(:digits) do
7
+ match('\d').repeat(1)
8
+ end
9
+
10
+ rule(:year) do
11
+ match('\d').repeat(4, 4).as(:year)
12
+ end
13
+
14
+ rule(:comma) { str(", ") }
15
+ rule(:comma?) { comma.maybe }
16
+ rule(:comma_space) { comma | space }
17
+ rule(:dash) { str("-") }
18
+ rule(:dot) { str(".") }
19
+ rule(:words_digits) { match('[\dA-Za-z]').repeat(1) }
20
+ rule(:words) { match("[A-Za-z]").repeat(1) }
21
+ rule(:words?) { words.maybe }
22
+ rule(:year_digits) { (str("19") | str("20")) >> match('\d').repeat(2, 2) }
23
+
24
+ rule(:month_digits) do
25
+ match('\d').repeat(2, 2)
26
+ end
27
+
28
+ rule(:day_digits) do
29
+ match('\d').repeat(2, 2)
30
+ end
31
+
32
+ rule(:originator) do
33
+ organization.as(:publisher) >>
34
+ (space? >> str("/") >> organization.as(:copublisher)).repeat
35
+ end
36
+
37
+ rule(:comma_month_year) do
38
+ comma >> words.as(:month) >> space >> year_digits.as(:year)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module Pubid
2
+ module Core
3
+ VERSION = "0.1.3".freeze
4
+ end
5
+ end
data/lib/pubid/core.rb ADDED
@@ -0,0 +1,3 @@
1
+ require "parslet"
2
+
3
+ require_relative "core/parser"
data/lib/pubid-core.rb ADDED
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "pubid/core"
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pubid-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: parslet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Library to generate, parse and manipulate PubID.
56
+ email:
57
+ - open.source@ribose.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files:
61
+ - README.adoc
62
+ - LICENSE.txt
63
+ files:
64
+ - LICENSE.txt
65
+ - README.adoc
66
+ - lib/pubid-core.rb
67
+ - lib/pubid/core.rb
68
+ - lib/pubid/core/parser.rb
69
+ - lib/pubid/core/version.rb
70
+ homepage: https://github.com/metanorma/pubid-core
71
+ licenses:
72
+ - BSD-2-Clause
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.5.0
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 3.0.3.1
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: Library to generate, parse and manipulate PubID.
93
+ test_files: []