glossarist 2.3.0 → 2.3.2
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/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +65 -0
- data/README.adoc +2 -2
- data/config.yml +1 -1
- data/exe/glossarist +5 -3
- data/glossarist.gemspec +1 -0
- data/lib/glossarist/asset.rb +4 -9
- data/lib/glossarist/citation.rb +73 -41
- data/lib/glossarist/collection.rb +2 -11
- data/lib/glossarist/collections/asset_collection.rb +0 -3
- data/lib/glossarist/collections/bibliography_collection.rb +1 -1
- data/lib/glossarist/concept.rb +66 -206
- data/lib/glossarist/concept_data.rb +66 -0
- data/lib/glossarist/concept_date.rb +7 -11
- data/lib/glossarist/concept_manager.rb +19 -29
- data/lib/glossarist/concept_set.rb +6 -4
- data/lib/glossarist/concept_source.rb +15 -58
- data/lib/glossarist/config.rb +4 -4
- data/lib/glossarist/designation/abbreviation.rb +15 -16
- data/lib/glossarist/designation/base.rb +16 -15
- data/lib/glossarist/designation/expression.rb +18 -26
- data/lib/glossarist/designation/grammar_info.rb +27 -45
- data/lib/glossarist/designation/graphical_symbol.rb +12 -8
- data/lib/glossarist/designation/letter_symbol.rb +13 -11
- data/lib/glossarist/designation/symbol.rb +11 -13
- data/lib/glossarist/designation.rb +3 -3
- data/lib/glossarist/detailed_definition.rb +6 -24
- data/lib/glossarist/error.rb +4 -4
- data/lib/glossarist/glossary_definition.rb +6 -3
- data/lib/glossarist/localized_concept.rb +17 -62
- data/lib/glossarist/managed_concept.rb +73 -146
- data/lib/glossarist/managed_concept_collection.rb +15 -24
- data/lib/glossarist/managed_concept_data.rb +47 -0
- data/lib/glossarist/non_verb_rep.rb +10 -13
- data/lib/glossarist/related_concept.rb +14 -21
- data/lib/glossarist/utilities/uuid.rb +10 -5
- data/lib/glossarist/utilities.rb +0 -2
- data/lib/glossarist/version.rb +1 -1
- data/lib/glossarist.rb +10 -9
- metadata +23 -13
- data/lib/glossarist/model.rb +0 -40
- data/lib/glossarist/utilities/boolean_attributes.rb +0 -35
- data/lib/glossarist/utilities/enum/class_methods.rb +0 -99
- data/lib/glossarist/utilities/enum/enum_collection.rb +0 -45
- data/lib/glossarist/utilities/enum/instance_methods.rb +0 -55
- data/lib/glossarist/utilities/enum.rb +0 -21
- data/lib/glossarist/v1_reader.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0667bd53eab8d4a86ef3376ddb095b7dafe5ce903b5df39683f279ef51c01a7e
|
4
|
+
data.tar.gz: 66a281d1f6132de430a6c24706eeb564c98c10f97cfac4751811c33dae2fdcc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb5758d7c7528f8cf8759924e9b2e6e5872ea58ef4c63b86365265f884f99ac4899caf62003bd01b2cb9ff8f32d914775df95820f21907c8f5cb80c306009a4
|
7
|
+
data.tar.gz: 43b9635c121ca5e910611a46109a3353c2290ef8e901bec2b1a55e37e03d707e28cfb927ed6a20c9e6e85df9bc708801552bab821d20f63dff71bce832055e14
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2025-01-16 08:32:21 UTC using RuboCop version 1.70.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'glossarist.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 64
|
17
|
+
# This cop supports safe autocorrection (--autocorrect).
|
18
|
+
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
19
|
+
# URISchemes: http, https
|
20
|
+
Layout/LineLength:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Offense count: 1
|
24
|
+
# Configuration parameters: AllowedMethods.
|
25
|
+
# AllowedMethods: enums
|
26
|
+
Lint/ConstantDefinitionInBlock:
|
27
|
+
Exclude:
|
28
|
+
- 'spec/unit/utilities/common_functions_spec.rb'
|
29
|
+
|
30
|
+
# Offense count: 2
|
31
|
+
Lint/DuplicateMethods:
|
32
|
+
Exclude:
|
33
|
+
- 'lib/glossarist/managed_concept.rb'
|
34
|
+
|
35
|
+
# Offense count: 3
|
36
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
37
|
+
Metrics/AbcSize:
|
38
|
+
Exclude:
|
39
|
+
- 'lib/glossarist/concept_manager.rb'
|
40
|
+
- 'lib/glossarist/utilities/uuid.rb'
|
41
|
+
|
42
|
+
# Offense count: 2
|
43
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
44
|
+
Metrics/CyclomaticComplexity:
|
45
|
+
Exclude:
|
46
|
+
- 'lib/glossarist/designation/expression.rb'
|
47
|
+
- 'lib/glossarist/managed_concept.rb'
|
48
|
+
|
49
|
+
# Offense count: 6
|
50
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
51
|
+
Metrics/MethodLength:
|
52
|
+
Max: 20
|
53
|
+
|
54
|
+
# Offense count: 1
|
55
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
56
|
+
Metrics/PerceivedComplexity:
|
57
|
+
Exclude:
|
58
|
+
- 'lib/glossarist/designation/expression.rb'
|
59
|
+
|
60
|
+
# Offense count: 6
|
61
|
+
# This cop supports safe autocorrection (--autocorrect).
|
62
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
63
|
+
# SupportedStyles: annotated, template, unannotated
|
64
|
+
Style/FormatStringToken:
|
65
|
+
EnforcedStyle: unannotated
|
data/README.adoc
CHANGED
@@ -210,7 +210,7 @@ There are two ways to initialize and populate a concept date
|
|
210
210
|
[,ruby]
|
211
211
|
----
|
212
212
|
concept_date = Glossarist::ConceptDate.new({
|
213
|
-
date: "2010-11-01T00:00:00
|
213
|
+
date: "2010-11-01T00:00:00+00:00",
|
214
214
|
type: :accepted,
|
215
215
|
})
|
216
216
|
----
|
@@ -221,7 +221,7 @@ concept_date = Glossarist::ConceptDate.new({
|
|
221
221
|
----
|
222
222
|
concept_date = Glossarist::ConceptDate.new
|
223
223
|
concept_date.type = :accepted
|
224
|
-
concept_date.date = "2010-11-01T00:00:00
|
224
|
+
concept_date.date = "2010-11-01T00:00:00+00:00"
|
225
225
|
----
|
226
226
|
|
227
227
|
[[id,detailed-definition]]
|
data/config.yml
CHANGED
data/exe/glossarist
CHANGED
@@ -21,12 +21,14 @@ class GlossaristCommand < Thor
|
|
21
21
|
|
22
22
|
concept_set = Glossarist::ConceptSet.new(options[:concepts_path], assets)
|
23
23
|
latex_str = concept_set.to_latex(latex_concepts_file)
|
24
|
+
output_latex(latex_str)
|
25
|
+
end
|
24
26
|
|
27
|
+
def output_latex(latex_str)
|
25
28
|
output_file_path = options[:output_file]
|
29
|
+
|
26
30
|
if output_file_path
|
27
|
-
File.open(output_file_path, "w")
|
28
|
-
file.puts latex_str
|
29
|
-
end
|
31
|
+
File.open(output_file_path, "w") { |file| file.puts latex_str }
|
30
32
|
else
|
31
33
|
puts latex_str
|
32
34
|
end
|
data/glossarist.gemspec
CHANGED
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
|
+
spec.add_dependency "lutaml-model", "~> 0.6"
|
33
34
|
spec.add_dependency "relaton", "~> 1.19"
|
34
35
|
spec.add_dependency "thor"
|
35
36
|
end
|
data/lib/glossarist/asset.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# (c) Copyright 2021 Ribose Inc.
|
4
|
-
#
|
5
|
-
|
6
1
|
module Glossarist
|
7
|
-
class Asset
|
8
|
-
|
2
|
+
class Asset < Lutaml::Model::Serializable
|
3
|
+
attribute :path, :string
|
9
4
|
|
10
|
-
|
11
|
-
|
5
|
+
yaml do
|
6
|
+
map :path, to: :path
|
12
7
|
end
|
13
8
|
|
14
9
|
def eql?(asset)
|
data/lib/glossarist/citation.rb
CHANGED
@@ -1,69 +1,101 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# (c) Copyright 2021 Ribose Inc.
|
4
|
-
#
|
5
|
-
|
6
1
|
module Glossarist
|
7
|
-
class Citation < Model
|
2
|
+
class Citation < Lutaml::Model::Serializable
|
8
3
|
# Unstructured (plain text) reference.
|
9
4
|
# @return [String]
|
10
|
-
|
5
|
+
attribute :text, :string
|
11
6
|
|
12
7
|
# Source in structured reference.
|
13
8
|
# @return [String]
|
14
|
-
|
9
|
+
attribute :source, :string
|
15
10
|
|
16
11
|
# Document ID in structured reference.
|
17
12
|
# @return [String]
|
18
|
-
|
13
|
+
attribute :id, :string
|
19
14
|
|
20
15
|
# Document version in structured reference.
|
21
16
|
# @return [String]
|
22
|
-
|
17
|
+
attribute :version, :string
|
23
18
|
|
24
19
|
# @return [String]
|
25
20
|
# Referred clause of the document.
|
26
|
-
|
21
|
+
attribute :clause, :string
|
27
22
|
|
28
23
|
# Link to document.
|
29
24
|
# @return [String]
|
30
|
-
|
25
|
+
attribute :link, :string
|
31
26
|
|
32
27
|
# Original ref text before parsing.
|
33
28
|
# @return [String]
|
34
29
|
# @note This attribute is likely to be removed or reworked in future.
|
35
30
|
# It is arguably not relevant to Glossarist itself.
|
36
|
-
|
31
|
+
attribute :original, :string
|
32
|
+
|
33
|
+
attribute :ref, :string
|
34
|
+
|
35
|
+
yaml do
|
36
|
+
map :id, to: :id, with: { from: :id_from_yaml, to: :id_to_yaml }
|
37
|
+
map :text, to: :text, with: { from: :text_from_yaml, to: :text_to_yaml }
|
38
|
+
map :source, to: :source,
|
39
|
+
with: { from: :source_from_yaml, to: :source_to_yaml }
|
40
|
+
map :version, to: :version,
|
41
|
+
with: { from: :version_from_yaml, to: :version_to_yaml }
|
42
|
+
map :ref, to: :ref, with: { from: :ref_from_yaml, to: :ref_to_yaml }
|
43
|
+
|
44
|
+
map :clause, to: :clause
|
45
|
+
map :link, to: :link
|
46
|
+
map :original, to: :original
|
47
|
+
end
|
37
48
|
|
38
|
-
|
39
|
-
|
40
|
-
def plain?
|
41
|
-
(source && id && version).nil?
|
49
|
+
def ref_from_yaml(model, value)
|
50
|
+
model.ref = value
|
42
51
|
end
|
43
52
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
53
|
+
def ref_to_yaml(model, doc)
|
54
|
+
doc["ref"] = if model.structured?
|
55
|
+
ref_hash(model)
|
56
|
+
else
|
57
|
+
model.text
|
58
|
+
end
|
48
59
|
end
|
49
60
|
|
50
|
-
def
|
51
|
-
|
52
|
-
"ref" => ref_to_h,
|
53
|
-
"clause" => clause,
|
54
|
-
"link" => link,
|
55
|
-
"original" => original,
|
56
|
-
}.compact
|
61
|
+
def id_from_yaml(model, value)
|
62
|
+
model.id = value
|
57
63
|
end
|
58
64
|
|
59
|
-
def
|
60
|
-
|
65
|
+
def id_to_yaml(_model, _doc)
|
66
|
+
# skip, will be handled in ref
|
67
|
+
end
|
61
68
|
|
62
|
-
|
63
|
-
|
64
|
-
|
69
|
+
def text_from_yaml(model, value)
|
70
|
+
model.text = value
|
71
|
+
end
|
72
|
+
|
73
|
+
def text_to_yaml(_model, _doc)
|
74
|
+
# skip, will be handled in ref
|
75
|
+
end
|
76
|
+
|
77
|
+
def source_from_yaml(model, value)
|
78
|
+
model.source = value
|
79
|
+
end
|
65
80
|
|
66
|
-
|
81
|
+
def source_to_yaml(_model, _doc)
|
82
|
+
# skip, will be handled in ref
|
83
|
+
end
|
84
|
+
|
85
|
+
def version_from_yaml(model, value)
|
86
|
+
model.version = value
|
87
|
+
end
|
88
|
+
|
89
|
+
def version_to_yaml(_model, _doc)
|
90
|
+
# skip, will be handled in ref
|
91
|
+
end
|
92
|
+
|
93
|
+
def ref_hash(model = self)
|
94
|
+
{
|
95
|
+
"source" => model.source,
|
96
|
+
"id" => model.id,
|
97
|
+
"version" => model.version,
|
98
|
+
}.compact
|
67
99
|
end
|
68
100
|
|
69
101
|
def ref=(ref)
|
@@ -76,14 +108,14 @@ module Glossarist
|
|
76
108
|
end
|
77
109
|
end
|
78
110
|
|
79
|
-
|
111
|
+
def plain?
|
112
|
+
(source && id && version).nil?
|
113
|
+
end
|
80
114
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
text
|
86
|
-
end
|
115
|
+
# Whether it is a structured ref.
|
116
|
+
# @return [Boolean]
|
117
|
+
def structured?
|
118
|
+
!plain?
|
87
119
|
end
|
88
120
|
end
|
89
121
|
end
|
@@ -1,8 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# (c) Copyright 2021 Ribose Inc.
|
4
|
-
#
|
5
|
-
|
6
1
|
module Glossarist
|
7
2
|
# @todo Add support for lazy concept loading.
|
8
3
|
# @todo Consider extracting persistence backend to a separate class.
|
@@ -33,7 +28,6 @@ module Glossarist
|
|
33
28
|
def fetch(id)
|
34
29
|
@index[id]
|
35
30
|
end
|
36
|
-
|
37
31
|
alias :[] :fetch
|
38
32
|
|
39
33
|
# If concept with given ID is present in this collection, returns that
|
@@ -44,7 +38,7 @@ module Glossarist
|
|
44
38
|
# Concept ID
|
45
39
|
# @return [Concept]
|
46
40
|
def fetch_or_initialize(id)
|
47
|
-
fetch(id) or store(Concept.
|
41
|
+
fetch(id) or store(Concept.of_yaml({ id: id }))
|
48
42
|
end
|
49
43
|
|
50
44
|
# Adds concept to the collection. If collection contains a concept with
|
@@ -55,7 +49,6 @@ module Glossarist
|
|
55
49
|
def store(concept)
|
56
50
|
@index[concept.id] = concept
|
57
51
|
end
|
58
|
-
|
59
52
|
alias :<< :store
|
60
53
|
|
61
54
|
# Reads all concepts from files.
|
@@ -70,10 +63,8 @@ module Glossarist
|
|
70
63
|
@index.each_value &method(:save_concept_to_file)
|
71
64
|
end
|
72
65
|
|
73
|
-
private
|
74
|
-
|
75
66
|
def load_concept_from_file(filename)
|
76
|
-
Concept.
|
67
|
+
Concept.from_yaml(File.read(filename))
|
77
68
|
rescue Psych::SyntaxError => e
|
78
69
|
raise Glossarist::ParseError.new(filename: filename, line: e.line)
|
79
70
|
end
|