metanorma-plugin-glossarist 0.3.3 → 0.3.6
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/.gitignore +6 -6
- data/.rubocop_todo.yml +55 -246
- data/Gemfile +6 -5
- data/README.adoc +11 -1
- data/lib/metanorma/plugin/glossarist/bibliography_renderer.rb +54 -12
- data/lib/metanorma/plugin/glossarist/concept_filter.rb +22 -40
- data/lib/metanorma/plugin/glossarist/concept_path_resolver.rb +100 -0
- data/lib/metanorma/plugin/glossarist/dataset_preprocessor.rb +55 -84
- data/lib/metanorma/plugin/glossarist/dataset_registry.rb +98 -0
- data/lib/metanorma/plugin/glossarist/document.rb +8 -20
- data/lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb +47 -61
- data/lib/metanorma/plugin/glossarist/liquid/custom_filters/filters.rb +10 -4
- data/lib/metanorma/plugin/glossarist/liquid/custom_filters.rb +14 -0
- data/lib/metanorma/plugin/glossarist/liquid/drop_bracket_access.rb +36 -0
- data/lib/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop.rb +47 -0
- data/lib/metanorma/plugin/glossarist/liquid/drops/managed_concept_data_drop.rb +29 -0
- data/lib/metanorma/plugin/glossarist/liquid/drops/managed_concept_drop.rb +45 -0
- data/lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb +1 -1
- data/lib/metanorma/plugin/glossarist/liquid.rb +26 -0
- data/lib/metanorma/plugin/glossarist/liquid_rendering.rb +26 -0
- data/lib/metanorma/plugin/glossarist/liquid_templates/_concept.liquid +51 -0
- data/lib/metanorma/plugin/glossarist/sanitize.rb +6 -4
- data/lib/metanorma/plugin/glossarist/template_renderer.rb +113 -0
- data/lib/metanorma/plugin/glossarist/version.rb +1 -1
- data/lib/metanorma-plugin-glossarist.rb +26 -8
- data/metanorma-plugin-glossarist.gemspec +1 -1
- metadata +17 -9
- data/lib/metanorma/plugin/glossarist/citation_helper.rb +0 -13
- data/lib/metanorma/plugin/glossarist/concept_renderer.rb +0 -93
- data/lib/metanorma/plugin/glossarist/concept_serializer.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d98a873073dcda160a7b6f3ee5e61c994c50c418007e0dd2861c231c16ac65d
|
|
4
|
+
data.tar.gz: 2d3c3cc14fcaed9644f72fe7626e7aa8ebfd65d7b88ce4144c697b5cb3e123b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9b86a8598407a6172693189fb1e89e7faa2d49673035a74f895ec0bb43886d3205fbd77cf620090f4ed157a4c4512367ca3479fc598f5e7259f724f1c9db53e
|
|
7
|
+
data.tar.gz: 49cb457f4154355f6c9484754704e0063c70df33e396600c5ac8ad2b2705bc8994fdbe38ed4463683c3e7f7668873eceb1f4f837d999115e34dc1f54fac70e9c
|
data/.gitignore
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
# rspec failure tracking
|
|
3
|
+
*.log.txt
|
|
4
|
+
.rspec_status
|
|
5
|
+
.rubocop-https--*
|
|
1
6
|
/.bundle/
|
|
2
7
|
/.yardoc
|
|
3
8
|
/_yardoc/
|
|
@@ -6,10 +11,5 @@
|
|
|
6
11
|
/pkg/
|
|
7
12
|
/spec/reports/
|
|
8
13
|
/tmp/
|
|
9
|
-
|
|
10
|
-
# rspec failure tracking
|
|
11
|
-
.rspec_status
|
|
12
|
-
|
|
13
|
-
.rubocop-https--*
|
|
14
|
-
*.log.txt
|
|
15
14
|
Gemfile.lock
|
|
15
|
+
TODO*
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,326 +1,135 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2026-
|
|
3
|
+
# on 2026-06-09 09:31:05 UTC using RuboCop version 1.86.1.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count: 7
|
|
10
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
-
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
|
|
12
|
-
Bundler/OrderedGems:
|
|
13
|
-
Exclude:
|
|
14
|
-
- 'Gemfile'
|
|
15
|
-
|
|
16
|
-
# Offense count: 1
|
|
17
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
18
|
-
Gemspec/RequireMFA:
|
|
19
|
-
Exclude:
|
|
20
|
-
- 'metanorma-plugin-glossarist.gemspec'
|
|
21
|
-
|
|
22
9
|
# Offense count: 1
|
|
23
10
|
Gemspec/RequiredRubyVersion:
|
|
24
11
|
Exclude:
|
|
25
12
|
- 'metanorma-plugin-glossarist.gemspec'
|
|
26
13
|
|
|
27
|
-
# Offense count:
|
|
28
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
29
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
30
|
-
# SupportedStyles: with_first_argument, with_fixed_indentation
|
|
31
|
-
Layout/ArgumentAlignment:
|
|
32
|
-
Exclude:
|
|
33
|
-
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
34
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
35
|
-
- 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
|
|
36
|
-
|
|
37
|
-
# Offense count: 1
|
|
38
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
39
|
-
# Configuration parameters: IndentationWidth.
|
|
40
|
-
Layout/AssignmentIndentation:
|
|
41
|
-
Exclude:
|
|
42
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
43
|
-
|
|
44
|
-
# Offense count: 20
|
|
45
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
46
|
-
# Configuration parameters: EnforcedStyleAlignWith.
|
|
47
|
-
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
|
48
|
-
Layout/BlockAlignment:
|
|
49
|
-
Exclude:
|
|
50
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
51
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
52
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
53
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
54
|
-
|
|
55
|
-
# Offense count: 14
|
|
56
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
57
|
-
Layout/BlockEndNewline:
|
|
58
|
-
Exclude:
|
|
59
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
60
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
61
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
62
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
63
|
-
|
|
64
|
-
# Offense count: 1
|
|
65
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
66
|
-
Layout/ClosingParenthesisIndentation:
|
|
67
|
-
Exclude:
|
|
68
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
69
|
-
|
|
70
|
-
# Offense count: 1
|
|
71
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
72
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
73
|
-
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
|
74
|
-
Layout/FirstArgumentIndentation:
|
|
75
|
-
Exclude:
|
|
76
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
77
|
-
|
|
78
|
-
# Offense count: 4
|
|
79
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
80
|
-
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
81
|
-
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
82
|
-
Layout/FirstHashElementIndentation:
|
|
83
|
-
Exclude:
|
|
84
|
-
- 'spec/metanorma/plugin/glossarist/concept_filter_spec.rb'
|
|
85
|
-
|
|
86
|
-
# Offense count: 4
|
|
87
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
88
|
-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
89
|
-
# SupportedHashRocketStyles: key, separator, table
|
|
90
|
-
# SupportedColonStyles: key, separator, table
|
|
91
|
-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
92
|
-
Layout/HashAlignment:
|
|
93
|
-
Exclude:
|
|
94
|
-
- 'Gemfile'
|
|
95
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
96
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
97
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
98
|
-
|
|
99
|
-
# Offense count: 1
|
|
100
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
101
|
-
# Configuration parameters: EnforcedStyle.
|
|
102
|
-
# SupportedStyles: normal, indented_internal_methods
|
|
103
|
-
Layout/IndentationConsistency:
|
|
104
|
-
Exclude:
|
|
105
|
-
- 'metanorma-plugin-glossarist.gemspec'
|
|
106
|
-
|
|
107
|
-
# Offense count: 22
|
|
108
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
109
|
-
# Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
|
|
110
|
-
# SupportedStylesAlignWith: start_of_line, relative_to_receiver
|
|
111
|
-
Layout/IndentationWidth:
|
|
112
|
-
Exclude:
|
|
113
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
114
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
115
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
116
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
117
|
-
|
|
118
|
-
# Offense count: 1
|
|
119
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
120
|
-
# Configuration parameters: EnforcedStyle.
|
|
121
|
-
# SupportedStyles: leading, trailing
|
|
122
|
-
Layout/LineContinuationLeadingSpace:
|
|
123
|
-
Exclude:
|
|
124
|
-
- 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
|
|
125
|
-
|
|
126
|
-
# Offense count: 32
|
|
14
|
+
# Offense count: 25
|
|
127
15
|
# This cop supports safe autocorrection (--autocorrect).
|
|
128
16
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
|
|
129
17
|
# URISchemes: http, https
|
|
130
18
|
Layout/LineLength:
|
|
131
19
|
Exclude:
|
|
132
|
-
- '
|
|
133
|
-
- 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
|
|
134
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
20
|
+
- 'lib/metanorma/plugin/glossarist/concept_path_resolver.rb'
|
|
135
21
|
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
22
|
+
- 'lib/metanorma/plugin/glossarist/liquid.rb'
|
|
136
23
|
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
137
|
-
- 'lib/metanorma/plugin/glossarist/liquid/
|
|
24
|
+
- 'lib/metanorma/plugin/glossarist/liquid/drop_bracket_access.rb'
|
|
25
|
+
- 'lib/metanorma/plugin/glossarist/liquid/drops/managed_concept_data_drop.rb'
|
|
138
26
|
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
27
|
+
- 'spec/metanorma/plugin/glossarist/bibliography_scope_spec.rb'
|
|
139
28
|
- 'spec/metanorma/plugin/glossarist/concept_filter_spec.rb'
|
|
140
|
-
- 'spec/metanorma/plugin/glossarist/
|
|
141
|
-
- 'spec/metanorma/plugin/glossarist/
|
|
142
|
-
|
|
143
|
-
# Offense count: 6
|
|
144
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
145
|
-
Layout/MultilineBlockLayout:
|
|
146
|
-
Exclude:
|
|
147
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
148
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
149
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
29
|
+
- 'spec/metanorma/plugin/glossarist/concept_path_resolver_spec.rb'
|
|
30
|
+
- 'spec/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop_spec.rb'
|
|
31
|
+
- 'spec/metanorma/plugin/glossarist/liquid/with_glossarist_context_spec.rb'
|
|
150
32
|
|
|
151
33
|
# Offense count: 1
|
|
152
|
-
|
|
153
|
-
# Configuration parameters: EnforcedStyle.
|
|
154
|
-
# SupportedStyles: symmetrical, new_line, same_line
|
|
155
|
-
Layout/MultilineMethodCallBraceLayout:
|
|
34
|
+
Lint/UselessConstantScoping:
|
|
156
35
|
Exclude:
|
|
157
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
158
|
-
|
|
159
|
-
# Offense count: 14
|
|
160
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
161
|
-
# Configuration parameters: AllowInHeredoc.
|
|
162
|
-
Layout/TrailingWhitespace:
|
|
163
|
-
Exclude:
|
|
164
|
-
- 'Gemfile'
|
|
165
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
166
36
|
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
167
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
168
|
-
- 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
|
|
169
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
170
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
171
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
172
37
|
|
|
173
|
-
# Offense count:
|
|
174
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
175
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
176
|
-
Lint/AmbiguousBlockAssociation:
|
|
177
|
-
Exclude:
|
|
178
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
179
|
-
|
|
180
|
-
# Offense count: 6
|
|
38
|
+
# Offense count: 8
|
|
181
39
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
|
182
40
|
Metrics/AbcSize:
|
|
183
41
|
Exclude:
|
|
184
42
|
- 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
|
|
185
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
186
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
43
|
+
- 'lib/metanorma/plugin/glossarist/concept_filter.rb'
|
|
187
44
|
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
45
|
+
- 'lib/metanorma/plugin/glossarist/template_renderer.rb'
|
|
188
46
|
|
|
189
|
-
# Offense count:
|
|
47
|
+
# Offense count: 5
|
|
190
48
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
191
49
|
Metrics/CyclomaticComplexity:
|
|
192
50
|
Exclude:
|
|
193
51
|
- 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
|
|
194
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
195
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
52
|
+
- 'lib/metanorma/plugin/glossarist/concept_filter.rb'
|
|
53
|
+
- 'lib/metanorma/plugin/glossarist/concept_path_resolver.rb'
|
|
196
54
|
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
197
55
|
|
|
198
|
-
# Offense count:
|
|
56
|
+
# Offense count: 13
|
|
199
57
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
200
58
|
Metrics/MethodLength:
|
|
201
|
-
Max:
|
|
59
|
+
Max: 22
|
|
202
60
|
|
|
203
61
|
# Offense count: 4
|
|
204
62
|
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
|
|
205
63
|
Metrics/PerceivedComplexity:
|
|
206
64
|
Exclude:
|
|
207
65
|
- 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
|
|
208
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
209
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
210
|
-
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
211
|
-
|
|
212
|
-
# Offense count: 1
|
|
213
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
214
|
-
Performance/MapCompact:
|
|
215
|
-
Exclude:
|
|
66
|
+
- 'lib/metanorma/plugin/glossarist/concept_filter.rb'
|
|
216
67
|
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
217
68
|
|
|
218
69
|
# Offense count: 1
|
|
219
|
-
#
|
|
220
|
-
|
|
221
|
-
# SupportedStyles: be, be_nil
|
|
222
|
-
RSpec/BeNil:
|
|
70
|
+
# Configuration parameters: MinSize.
|
|
71
|
+
Performance/CollectionLiteralInLoop:
|
|
223
72
|
Exclude:
|
|
224
|
-
- '
|
|
73
|
+
- 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
|
|
225
74
|
|
|
226
|
-
# Offense count:
|
|
75
|
+
# Offense count: 17
|
|
227
76
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
228
77
|
# Prefixes: when, with, without
|
|
229
78
|
RSpec/ContextWording:
|
|
230
79
|
Exclude:
|
|
231
80
|
- 'spec/metanorma/plugin/glossarist/dataset_preprocessor_spec.rb'
|
|
232
81
|
|
|
233
|
-
# Offense count:
|
|
82
|
+
# Offense count: 1
|
|
83
|
+
# Configuration parameters: IgnoredMetadata.
|
|
84
|
+
RSpec/DescribeClass:
|
|
85
|
+
Exclude:
|
|
86
|
+
- 'spec/metanorma/plugin/glossarist/bibliography_scope_spec.rb'
|
|
87
|
+
|
|
88
|
+
# Offense count: 19
|
|
234
89
|
# Configuration parameters: CountAsOne.
|
|
235
90
|
RSpec/ExampleLength:
|
|
236
91
|
Max: 35
|
|
237
92
|
|
|
238
|
-
# Offense count:
|
|
239
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
240
|
-
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
|
|
241
|
-
# DisallowedExamples: works
|
|
242
|
-
RSpec/ExampleWording:
|
|
243
|
-
Exclude:
|
|
244
|
-
- 'spec/metanorma/plugin/glossarist/dataset_preprocessor_spec.rb'
|
|
245
|
-
|
|
246
|
-
# Offense count: 12
|
|
93
|
+
# Offense count: 22
|
|
247
94
|
RSpec/MultipleExpectations:
|
|
248
|
-
Max:
|
|
95
|
+
Max: 3
|
|
249
96
|
|
|
250
|
-
# Offense count:
|
|
97
|
+
# Offense count: 25
|
|
251
98
|
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
|
|
252
99
|
# SupportedStyles: always, named_only
|
|
253
100
|
RSpec/NamedSubject:
|
|
254
101
|
Exclude:
|
|
255
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
256
102
|
- 'spec/metanorma/plugin/glossarist/dataset_preprocessor_spec.rb'
|
|
257
103
|
|
|
258
|
-
# Offense count:
|
|
104
|
+
# Offense count: 28
|
|
259
105
|
# Configuration parameters: AllowedGroups.
|
|
260
106
|
RSpec/NestedGroups:
|
|
261
107
|
Max: 6
|
|
262
108
|
|
|
263
|
-
# Offense count:
|
|
264
|
-
|
|
265
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
|
266
|
-
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
|
267
|
-
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
|
268
|
-
# FunctionalMethods: let, let!, subject, watch
|
|
269
|
-
# AllowedMethods: lambda, proc, it
|
|
270
|
-
Style/BlockDelimiters:
|
|
109
|
+
# Offense count: 2
|
|
110
|
+
RSpec/RepeatedExample:
|
|
271
111
|
Exclude:
|
|
272
|
-
- '
|
|
273
|
-
- 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
|
|
274
|
-
- 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
|
|
275
|
-
- 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
|
|
276
|
-
|
|
277
|
-
# Offense count: 4
|
|
278
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
279
|
-
Style/MultilineIfModifier:
|
|
280
|
-
Exclude:
|
|
281
|
-
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
282
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
283
|
-
- 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
|
|
112
|
+
- 'spec/metanorma/plugin/glossarist/concept_path_resolver_spec.rb'
|
|
284
113
|
|
|
285
|
-
# Offense count:
|
|
286
|
-
#
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
290
|
-
|
|
291
|
-
# Offense count: 120
|
|
292
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
293
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
|
294
|
-
# SupportedStyles: single_quotes, double_quotes
|
|
295
|
-
Style/StringLiterals:
|
|
114
|
+
# Offense count: 3
|
|
115
|
+
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
|
|
116
|
+
# SupportedInflectors: default, active_support
|
|
117
|
+
RSpec/SpecFilePathFormat:
|
|
296
118
|
Exclude:
|
|
297
|
-
- '
|
|
298
|
-
- '
|
|
299
|
-
- '
|
|
300
|
-
- 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
|
|
301
|
-
- 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
|
|
302
|
-
- 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
|
|
303
|
-
- 'lib/metanorma/plugin/glossarist/document.rb'
|
|
304
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
|
|
305
|
-
- 'lib/metanorma/plugin/glossarist/liquid/custom_filters/filters.rb'
|
|
306
|
-
- 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
|
|
307
|
-
- 'lib/metanorma/plugin/glossarist/sanitize.rb'
|
|
308
|
-
- 'lib/metanorma/plugin/glossarist/version.rb'
|
|
309
|
-
- 'metanorma-plugin-glossarist.gemspec'
|
|
119
|
+
- 'spec/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop_spec.rb'
|
|
120
|
+
- 'spec/metanorma/plugin/glossarist/liquid/drops/managed_concept_data_drop_spec.rb'
|
|
121
|
+
- 'spec/metanorma/plugin/glossarist/liquid/drops/managed_concept_drop_spec.rb'
|
|
310
122
|
|
|
311
|
-
# Offense count:
|
|
312
|
-
#
|
|
313
|
-
|
|
314
|
-
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
|
|
315
|
-
Style/TrailingCommaInArguments:
|
|
123
|
+
# Offense count: 2
|
|
124
|
+
# Configuration parameters: Max.
|
|
125
|
+
Style/SafeNavigationChainLength:
|
|
316
126
|
Exclude:
|
|
317
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
318
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
127
|
+
- 'lib/metanorma/plugin/glossarist/dataset_registry.rb'
|
|
128
|
+
- 'lib/metanorma/plugin/glossarist/template_renderer.rb'
|
|
319
129
|
|
|
320
|
-
# Offense count:
|
|
321
|
-
# This cop supports
|
|
322
|
-
# Configuration parameters:
|
|
323
|
-
|
|
324
|
-
Style/TrailingCommaInHashLiteral:
|
|
130
|
+
# Offense count: 1
|
|
131
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
132
|
+
# Configuration parameters: Mode.
|
|
133
|
+
Style/StringConcatenation:
|
|
325
134
|
Exclude:
|
|
326
|
-
- 'lib/metanorma/plugin/glossarist/
|
|
135
|
+
- 'lib/metanorma/plugin/glossarist/template_renderer.rb'
|
data/Gemfile
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
|
-
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
5
4
|
|
|
6
|
-
gem "metanorma", github: "metanorma/metanorma", branch: "main"
|
|
7
|
-
gem "metanorma-plugin-lutaml", github: "metanorma/metanorma-plugin-lutaml",
|
|
8
|
-
branch: "main"
|
|
9
|
-
gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
|
|
10
5
|
gem "ogc-gml", "~> 1.1"
|
|
11
6
|
gem "rake"
|
|
12
7
|
gem "rspec"
|
|
@@ -16,3 +11,9 @@ gem "rubocop-rake"
|
|
|
16
11
|
gem "rubocop-rspec"
|
|
17
12
|
|
|
18
13
|
gemspec
|
|
14
|
+
|
|
15
|
+
group :test do
|
|
16
|
+
gem "metanorma"
|
|
17
|
+
gem "metanorma-plugin-lutaml"
|
|
18
|
+
gem "metanorma-standoc"
|
|
19
|
+
end
|
data/README.adoc
CHANGED
|
@@ -311,9 +311,19 @@ alphabetically by the English designation.
|
|
|
311
311
|
[example]
|
|
312
312
|
`lang=ara` loads all localized concepts of Arabic for all concepts.
|
|
313
313
|
|
|
314
|
+
`tag=<tag name>`::: Loads concepts that carry the specified organizational tag.
|
|
315
|
+
Tags are plain strings on `ManagedConceptData.tags`, used for grouping and
|
|
316
|
+
filtering concepts by section or category (e.g. `tag=general`,
|
|
317
|
+
`tag=time-scale-units`). Unlike `domain=`, tags are not rendered as
|
|
318
|
+
terminological domain annotations.
|
|
319
|
+
+
|
|
320
|
+
[example]
|
|
321
|
+
`tag=general` will only load concepts whose `tags` array includes `"general"`.
|
|
322
|
+
|
|
314
323
|
`domain=<domain name>`::: Loads concepts that belong to the specified domain.
|
|
315
324
|
Domains are `ConceptReference` objects (with `concept_id` and `ref_type: "domain"`)
|
|
316
|
-
that categorize concepts into subject areas
|
|
325
|
+
that categorize concepts into subject areas, and are rendered as `<domain>`
|
|
326
|
+
elements in the output.
|
|
317
327
|
+
|
|
318
328
|
[example]
|
|
319
329
|
`domain=foo` will only load concepts that have a domain with `concept_id` "foo".
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "set"
|
|
4
|
+
|
|
3
5
|
module Metanorma
|
|
4
6
|
module Plugin
|
|
5
7
|
module Glossarist
|
|
6
8
|
class BibliographyRenderer
|
|
7
|
-
|
|
9
|
+
IEV_ENTRY = "* [[[ievtermbank,IEV]]], _IEV: Electropedia_"
|
|
10
|
+
IEV_ANCHOR = "ievtermbank"
|
|
8
11
|
|
|
9
|
-
def initialize
|
|
12
|
+
def initialize(existing_anchors: [], bibliography_data: {})
|
|
10
13
|
@rendered = {}
|
|
14
|
+
@existing_anchors = Set.new(existing_anchors)
|
|
15
|
+
@bibliography_data = bibliography_data
|
|
11
16
|
end
|
|
12
17
|
|
|
13
18
|
def render_entry(concept, lang: "eng")
|
|
@@ -15,13 +20,28 @@ module Metanorma
|
|
|
15
20
|
return nil unless l10n
|
|
16
21
|
|
|
17
22
|
entries = source_entries(l10n)
|
|
18
|
-
|
|
23
|
+
entries.concat(xref_entries(l10n))
|
|
19
24
|
entries.empty? ? nil : entries.sort.join("\n")
|
|
20
25
|
end
|
|
21
26
|
|
|
22
27
|
def render_all(concepts, lang: "eng")
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
all_entries = concepts.filter_map do |concept|
|
|
29
|
+
l10n = concept.localization(lang)
|
|
30
|
+
next unless l10n
|
|
31
|
+
|
|
32
|
+
source_entries(l10n)
|
|
33
|
+
end.flatten
|
|
34
|
+
|
|
35
|
+
xref_entries = concepts.filter_map do |concept|
|
|
36
|
+
l10n = concept.localization(lang)
|
|
37
|
+
next unless l10n
|
|
38
|
+
|
|
39
|
+
xref_entries(l10n)
|
|
40
|
+
end.flatten
|
|
41
|
+
|
|
42
|
+
all_entries.concat(xref_entries)
|
|
43
|
+
|
|
44
|
+
all_entries.sort.join("\n")
|
|
25
45
|
end
|
|
26
46
|
|
|
27
47
|
private
|
|
@@ -31,28 +51,50 @@ module Metanorma
|
|
|
31
51
|
return [] if sources.nil? || sources.empty?
|
|
32
52
|
|
|
33
53
|
sources.filter_map do |source|
|
|
34
|
-
ref =
|
|
54
|
+
ref = source.origin&.text
|
|
35
55
|
next if ref.nil? || ref.empty?
|
|
36
56
|
next if @rendered.key?(ref)
|
|
37
57
|
|
|
38
58
|
anchor = ref.gsub(%r{[ /:]}, "_")
|
|
59
|
+
next if @existing_anchors.include?(anchor)
|
|
60
|
+
|
|
39
61
|
@rendered[ref] = anchor
|
|
40
|
-
|
|
62
|
+
|
|
63
|
+
if anchor == IEV_ANCHOR
|
|
64
|
+
IEV_ENTRY
|
|
65
|
+
else
|
|
66
|
+
format_entry(anchor, ref)
|
|
67
|
+
end
|
|
41
68
|
end
|
|
42
69
|
end
|
|
43
70
|
|
|
44
|
-
def
|
|
71
|
+
def xref_entries(l10n)
|
|
45
72
|
xref_ids = extract_content_xrefs(l10n)
|
|
46
|
-
return if xref_ids.empty?
|
|
73
|
+
return [] if xref_ids.empty?
|
|
47
74
|
|
|
48
|
-
xref_ids.
|
|
75
|
+
xref_ids.filter_map do |ref_id|
|
|
49
76
|
next if @rendered.value?(ref_id)
|
|
77
|
+
next if @existing_anchors.include?(ref_id)
|
|
78
|
+
next unless @bibliography_data.key?(ref_id)
|
|
79
|
+
|
|
80
|
+
anchor = ref_id
|
|
81
|
+
@rendered[ref_id] = anchor
|
|
50
82
|
|
|
51
|
-
|
|
52
|
-
"<<#{ref_id}>> — not defined as a source in the dataset"
|
|
83
|
+
format_entry(anchor, ref_id)
|
|
53
84
|
end
|
|
54
85
|
end
|
|
55
86
|
|
|
87
|
+
def format_entry(anchor, ref)
|
|
88
|
+
bib = @bibliography_data[ref]
|
|
89
|
+
return "* [[[#{anchor},#{ref}]]]" unless bib
|
|
90
|
+
|
|
91
|
+
display_ref = bib["reference"] || ref
|
|
92
|
+
parts = ["* [[[#{anchor},#{display_ref}]]]"]
|
|
93
|
+
parts << ", _#{bib['title']}_" if bib["title"]
|
|
94
|
+
parts << ". Available at: #{bib['link']} " if bib["link"]
|
|
95
|
+
parts.join
|
|
96
|
+
end
|
|
97
|
+
|
|
56
98
|
def extract_content_xrefs(l10n)
|
|
57
99
|
parts = []
|
|
58
100
|
l10n.definition&.each { |d| parts << d.content.to_s }
|