glossarist 2.3.6 → 2.3.8
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 +4 -4
- data/Gemfile +0 -1
- data/lib/glossarist/citation.rb +44 -4
- data/lib/glossarist/collection.rb +3 -1
- data/lib/glossarist/concept_manager.rb +3 -1
- data/lib/glossarist/custom_locality.rb +16 -0
- data/lib/glossarist/locality.rb +22 -0
- data/lib/glossarist/managed_concept.rb +1 -1
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455c768825abe3d31abeb221718eb6d9385478fe1a32645ebaae67b82b7bda14
|
4
|
+
data.tar.gz: 9fe994e3a6f2cc3b306c533e620f5faf432f1f4b48a888f059a4ecbeba5fc323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e205c1940c3aa3eabeef7553b0e334d63d6365e10f4e97e0fd59acc3c37cfc7f7c19d707dac98c61d021b3b689d86074af3bad2f37a19aa95328703557fe19
|
7
|
+
data.tar.gz: ba10c0a69e804726607bed7ca36563ecf20b849a5c100a57bbd9409313b2eea0946ebbbdea048aede5c6596bd7babd72c49c125e58d096ce7c44561afa8eee4c
|
data/Gemfile
CHANGED
data/lib/glossarist/citation.rb
CHANGED
@@ -17,8 +17,8 @@ module Glossarist
|
|
17
17
|
attribute :version, :string
|
18
18
|
|
19
19
|
# @return [String]
|
20
|
-
# Referred
|
21
|
-
attribute :
|
20
|
+
# Referred locality of the document.
|
21
|
+
attribute :locality, Locality
|
22
22
|
|
23
23
|
# Link to document.
|
24
24
|
# @return [String]
|
@@ -32,6 +32,8 @@ module Glossarist
|
|
32
32
|
|
33
33
|
attribute :ref, :string
|
34
34
|
|
35
|
+
attribute :custom_locality, CustomLocality, collection: true
|
36
|
+
|
35
37
|
yaml do
|
36
38
|
map :id, to: :id, with: { from: :id_from_yaml, to: :id_to_yaml }
|
37
39
|
map :text, to: :text, with: { from: :text_from_yaml, to: :text_to_yaml }
|
@@ -40,10 +42,12 @@ module Glossarist
|
|
40
42
|
map :version, to: :version,
|
41
43
|
with: { from: :version_from_yaml, to: :version_to_yaml }
|
42
44
|
map :ref, to: :ref, with: { from: :ref_from_yaml, to: :ref_to_yaml }
|
43
|
-
|
44
|
-
|
45
|
+
map %i[clause locality],
|
46
|
+
to: :locality,
|
47
|
+
with: { from: :clause_from_yaml, to: :clause_to_yaml }
|
45
48
|
map :link, to: :link
|
46
49
|
map :original, to: :original
|
50
|
+
map %i[custom_locality customLocality], to: :custom_locality
|
47
51
|
end
|
48
52
|
|
49
53
|
def ref_from_yaml(model, value)
|
@@ -108,6 +112,42 @@ module Glossarist
|
|
108
112
|
end
|
109
113
|
end
|
110
114
|
|
115
|
+
def clause_from_yaml(model, value)
|
116
|
+
# accepts old format like
|
117
|
+
# clause: "11"
|
118
|
+
# or new format like
|
119
|
+
# locality: { type: "clause", reference_from: "11", reference_to: "12" }
|
120
|
+
locality = Locality.new
|
121
|
+
|
122
|
+
if value.is_a?(Hash)
|
123
|
+
locality.type = value["type"] || "clause"
|
124
|
+
locality.reference_from = value["reference_from"] || value
|
125
|
+
locality.reference_to = value["reference_to"] if value["reference_to"]
|
126
|
+
locality.validate!
|
127
|
+
else
|
128
|
+
locality.type = "clause"
|
129
|
+
locality.reference_from = value
|
130
|
+
locality.validate!
|
131
|
+
end
|
132
|
+
|
133
|
+
model.locality = locality
|
134
|
+
end
|
135
|
+
|
136
|
+
def clause_to_yaml(model, doc) # rubocop:disable Metrics/AbcSize
|
137
|
+
if model.locality
|
138
|
+
doc["locality"] = {}
|
139
|
+
doc["locality"]["type"] = model.locality.type
|
140
|
+
|
141
|
+
if model.locality.reference_from
|
142
|
+
doc["locality"]["reference_from"] = model.locality.reference_from
|
143
|
+
end
|
144
|
+
|
145
|
+
if model.locality.reference_to
|
146
|
+
doc["locality"]["reference_to"] = model.locality.reference_to
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
111
151
|
def plain?
|
112
152
|
(source && id && version).nil?
|
113
153
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Glossarist
|
2
|
+
class CustomLocality < Lutaml::Model::Serializable
|
3
|
+
# The name of the custom locality.
|
4
|
+
# @return [String]
|
5
|
+
attribute :name, :string
|
6
|
+
|
7
|
+
# The value of the custom locality, which can be any string.
|
8
|
+
# @return [String]
|
9
|
+
attribute :value, :string
|
10
|
+
|
11
|
+
yaml do
|
12
|
+
map :name, to: :name
|
13
|
+
map :value, to: :value
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Glossarist
|
2
|
+
class Locality < Lutaml::Model::Serializable
|
3
|
+
# @return [String]
|
4
|
+
attribute :type, :string, pattern: %r{
|
5
|
+
section|clause|part|paragraph|chapter|page|title|line|
|
6
|
+
whole|table|annex|figure|note|list|example|volume|issue|time|anchor|
|
7
|
+
locality:[a-zA-Z0-9_]+
|
8
|
+
}x
|
9
|
+
|
10
|
+
# @return [String]
|
11
|
+
attribute :reference_from, :string
|
12
|
+
|
13
|
+
# @return [String]
|
14
|
+
attribute :reference_to, :string
|
15
|
+
|
16
|
+
yaml do
|
17
|
+
map :type, to: :type
|
18
|
+
map :reference_from, to: :reference_from
|
19
|
+
map :reference_to, to: :reference_to
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -85,7 +85,7 @@ module Glossarist
|
|
85
85
|
model.identifier = value || model.identifier
|
86
86
|
end
|
87
87
|
|
88
|
-
def localized_concepts=(localized_concepts_collection)
|
88
|
+
def localized_concepts=(localized_concepts_collection) # rubocop:disable Metrics/AbcSize
|
89
89
|
return unless localized_concepts_collection
|
90
90
|
|
91
91
|
if localized_concepts_collection.is_a?(Hash)
|
data/lib/glossarist/version.rb
CHANGED
data/lib/glossarist.rb
CHANGED
@@ -13,6 +13,8 @@ require_relative "glossarist/glossary_definition"
|
|
13
13
|
|
14
14
|
require_relative "glossarist/designation"
|
15
15
|
require_relative "glossarist/asset"
|
16
|
+
require_relative "glossarist/locality"
|
17
|
+
require_relative "glossarist/custom_locality"
|
16
18
|
require_relative "glossarist/citation"
|
17
19
|
require_relative "glossarist/collection"
|
18
20
|
require_relative "glossarist/concept_date"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossarist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lutaml-model
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/glossarist/concept_set.rb
|
92
92
|
- lib/glossarist/concept_source.rb
|
93
93
|
- lib/glossarist/config.rb
|
94
|
+
- lib/glossarist/custom_locality.rb
|
94
95
|
- lib/glossarist/designation.rb
|
95
96
|
- lib/glossarist/designation/abbreviation.rb
|
96
97
|
- lib/glossarist/designation/base.rb
|
@@ -105,6 +106,7 @@ files:
|
|
105
106
|
- lib/glossarist/error/invalid_type_error.rb
|
106
107
|
- lib/glossarist/error/parse_error.rb
|
107
108
|
- lib/glossarist/glossary_definition.rb
|
109
|
+
- lib/glossarist/locality.rb
|
108
110
|
- lib/glossarist/localized_concept.rb
|
109
111
|
- lib/glossarist/managed_concept.rb
|
110
112
|
- lib/glossarist/managed_concept_collection.rb
|