glossarist 2.3.5 → 2.3.7
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 +37 -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 +10 -7
- 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: c0af35cdd40da6ea573d2dd4424a70c97016427ae9027b959f4235b322f8fcb5
|
4
|
+
data.tar.gz: b0e28310c983727e41ca6f35ddb1099a58dddead5fa30aa0a204851d0b8dc85f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac19ff4ea8fdb5a81b4acaabade8b77879a0be14edef108af43cce863a9caa00dc8df4574634e3f58e697b6fd7ec7b05af001ccdbfbc37b01f9e05dff5b40927
|
7
|
+
data.tar.gz: fbd2b877dd317ed884c694917e1828886a8d6939fa887c86a410027c155f3baca5bfa2497921c0cf2decd66527da544c52a0ee1ce3426cf4919962d605de2c10
|
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,35 @@ 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
|
+
locality.type = value["type"] || "clause"
|
122
|
+
locality.reference_from = value["reference_from"] || value
|
123
|
+
locality.reference_to = value["reference_to"] if value["reference_to"]
|
124
|
+
locality.validate!
|
125
|
+
|
126
|
+
model.locality = locality
|
127
|
+
end
|
128
|
+
|
129
|
+
def clause_to_yaml(model, doc) # rubocop:disable Metrics/AbcSize
|
130
|
+
if model.locality
|
131
|
+
doc["locality"] = {}
|
132
|
+
doc["locality"]["type"] = model.locality.type
|
133
|
+
|
134
|
+
if model.locality.reference_from
|
135
|
+
doc["locality"]["reference_from"] = model.locality.reference_from
|
136
|
+
end
|
137
|
+
|
138
|
+
if model.locality.reference_to
|
139
|
+
doc["locality"]["reference_to"] = model.locality.reference_to
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
111
144
|
def plain?
|
112
145
|
(source && id && version).nil?
|
113
146
|
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,11 +85,11 @@ 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)
|
92
|
-
|
92
|
+
data.localized_concepts = stringify_keys(localized_concepts_collection)
|
93
93
|
else
|
94
94
|
localized_concepts_collection.each do |localized_concept_hash|
|
95
95
|
lang = localized_concept_hash.dig("data", "language_code").to_s
|
@@ -98,21 +98,24 @@ module Glossarist
|
|
98
98
|
Config.class_for(:localized_concept).of_yaml(localized_concept_hash),
|
99
99
|
)
|
100
100
|
|
101
|
-
|
101
|
+
data.localized_concepts[lang] = localization(lang).uuid
|
102
102
|
|
103
103
|
localized_concept
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
|
+
def localized_concepts
|
109
|
+
data.localized_concepts
|
110
|
+
end
|
108
111
|
|
109
112
|
# Adds concept localization.
|
110
113
|
# @param localized_concept [LocalizedConcept]
|
111
114
|
def add_localization(localized_concept)
|
112
115
|
lang = localized_concept.language_code
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
+
data.localized_concepts ||= {}
|
117
|
+
data.localized_concepts[lang] =
|
118
|
+
data.localized_concepts[lang] || localized_concept.uuid
|
116
119
|
localizations.store(lang, localized_concept)
|
117
120
|
end
|
118
121
|
alias :add_l10n :add_localization
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03
|
11
|
+
date: 2025-07-03 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
|