metanorma-plugin-glossarist 0.3.0 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c276825ef7619a1c30187bd49bd9fb158359dbead0916ed5fef2fe72b5017345
4
- data.tar.gz: 54246f81ee9ade95db6b00335826e0f6656d44728dbc55750356562da6ae70f8
3
+ metadata.gz: 55d315bc6cddf69dfc612fa0f19f6b7fb2161333f765a525befffb6e83000185
4
+ data.tar.gz: db3d207cb5be69640cd4e137c79853ee5d008537743f6d24763ae687f464923c
5
5
  SHA512:
6
- metadata.gz: 61118e98032cabbbbd4e570f0b9212557f614b22f521a68e2dbf43884dab308e2e466fe497af0b144b9b4c3e6452c1a47f580cbf8f2ecfa631653b16d66d8f41
7
- data.tar.gz: e61d92462837e204ada664428241d989fc82a7dcf2452702cff47f33321e020fd913e18cdf31fe203d12a4e6dbcad8beb1239e65f5189bdd6871ff2460b96909
6
+ metadata.gz: 164ee3cb6feb6b609cc4bb28541f539e9fd2c7354a05dded59863b9d81405ae0f42bc68a618f5b5fecb02b503bf628a6101c9ab0a3ffae0c54c502ecd0db9e63
7
+ data.tar.gz: b014dcaa771d6e67dac030f6ffaf0b662cfc9e5f2471ec8a482c38006ff2dcdd321c568a3c8f3fa3026170dd19c497dcbff0c21c8e25c7f19fd373e5af463792
@@ -8,6 +8,9 @@ on:
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
11
+ permissions:
12
+ contents: write
13
+
11
14
  jobs:
12
15
  rake:
13
16
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
@@ -7,12 +7,18 @@ on:
7
7
  inputs:
8
8
  next_version:
9
9
  description: |
10
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
10
+ Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
11
+ Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
11
12
  required: true
12
13
  default: 'skip'
13
14
  repository_dispatch:
14
15
  types: [ do-release ]
15
16
 
17
+ permissions:
18
+ contents: write
19
+ packages: write
20
+ id-token: write
21
+
16
22
  jobs:
17
23
  release:
18
24
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
data/.gitignore CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
- Gemfile.lock
13
12
 
14
13
  .rubocop-https--*
14
+ *.log.txt
15
+ Gemfile.lock
data/.rubocop.yml CHANGED
@@ -1,10 +1,19 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
6
+
7
+ inherit_mode:
8
+ merge:
9
+ - Exclude
5
10
 
6
11
  # local repo-specific modifications
7
12
  # ...
13
+ plugins:
14
+ - rubocop-rspec
15
+ - rubocop-performance
16
+ - rubocop-rake
8
17
 
9
18
  AllCops:
10
- TargetRubyVersion: 2.5
19
+ TargetRubyVersion: 3.0
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,326 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-05-11 09:00:54 UTC using RuboCop version 1.86.1.
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: 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
+ # Offense count: 1
23
+ Gemspec/RequiredRubyVersion:
24
+ Exclude:
25
+ - 'metanorma-plugin-glossarist.gemspec'
26
+
27
+ # Offense count: 3
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
127
+ # This cop supports safe autocorrection (--autocorrect).
128
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
129
+ # URISchemes: http, https
130
+ Layout/LineLength:
131
+ Exclude:
132
+ - 'Gemfile'
133
+ - 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
134
+ - 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
135
+ - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
136
+ - 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
137
+ - 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
138
+ - 'spec/metanorma/plugin/glossarist/bibliography_renderer_spec.rb'
139
+ - 'spec/metanorma/plugin/glossarist/concept_filter_spec.rb'
140
+ - 'spec/metanorma/plugin/glossarist/concept_renderer_spec.rb'
141
+ - 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
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'
150
+
151
+ # Offense count: 1
152
+ # This cop supports safe autocorrection (--autocorrect).
153
+ # Configuration parameters: EnforcedStyle.
154
+ # SupportedStyles: symmetrical, new_line, same_line
155
+ Layout/MultilineMethodCallBraceLayout:
156
+ 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
+ - '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
+
173
+ # Offense count: 1
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
181
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
182
+ Metrics/AbcSize:
183
+ Exclude:
184
+ - 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
185
+ - 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
186
+ - 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
187
+ - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
188
+
189
+ # Offense count: 4
190
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
191
+ Metrics/CyclomaticComplexity:
192
+ Exclude:
193
+ - 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
194
+ - 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
195
+ - 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
196
+ - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
197
+
198
+ # Offense count: 8
199
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
200
+ Metrics/MethodLength:
201
+ Max: 19
202
+
203
+ # Offense count: 4
204
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
205
+ Metrics/PerceivedComplexity:
206
+ Exclude:
207
+ - 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
208
+ - 'lib/metanorma/plugin/glossarist/concept_renderer.rb'
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:
216
+ - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
217
+
218
+ # Offense count: 1
219
+ # This cop supports safe autocorrection (--autocorrect).
220
+ # Configuration parameters: EnforcedStyle.
221
+ # SupportedStyles: be, be_nil
222
+ RSpec/BeNil:
223
+ Exclude:
224
+ - 'spec/metanorma/plugin/glossarist_spec.rb'
225
+
226
+ # Offense count: 14
227
+ # Configuration parameters: Prefixes, AllowedPatterns.
228
+ # Prefixes: when, with, without
229
+ RSpec/ContextWording:
230
+ Exclude:
231
+ - 'spec/metanorma/plugin/glossarist/dataset_preprocessor_spec.rb'
232
+
233
+ # Offense count: 7
234
+ # Configuration parameters: CountAsOne.
235
+ RSpec/ExampleLength:
236
+ Max: 35
237
+
238
+ # Offense count: 18
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
247
+ RSpec/MultipleExpectations:
248
+ Max: 7
249
+
250
+ # Offense count: 28
251
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
252
+ # SupportedStyles: always, named_only
253
+ RSpec/NamedSubject:
254
+ Exclude:
255
+ - 'spec/metanorma/plugin/glossarist/concept_serializer_spec.rb'
256
+ - 'spec/metanorma/plugin/glossarist/dataset_preprocessor_spec.rb'
257
+
258
+ # Offense count: 22
259
+ # Configuration parameters: AllowedGroups.
260
+ RSpec/NestedGroups:
261
+ Max: 6
262
+
263
+ # Offense count: 19
264
+ # This cop supports safe autocorrection (--autocorrect).
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:
271
+ Exclude:
272
+ - 'lib/metanorma/plugin/glossarist/liquid/custom_blocks/with_glossarist_context.rb'
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'
284
+
285
+ # Offense count: 1
286
+ # This cop supports unsafe autocorrection (--autocorrect-all).
287
+ Style/ReduceToHash:
288
+ Exclude:
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:
296
+ Exclude:
297
+ - 'lib/metanorma-plugin-glossarist.rb'
298
+ - 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
299
+ - 'lib/metanorma/plugin/glossarist/concept_filter.rb'
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'
310
+
311
+ # Offense count: 3
312
+ # This cop supports safe autocorrection (--autocorrect).
313
+ # Configuration parameters: EnforcedStyleForMultiline.
314
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
315
+ Style/TrailingCommaInArguments:
316
+ Exclude:
317
+ - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
318
+ - 'lib/metanorma/plugin/glossarist/liquid/multiply_local_file_system.rb'
319
+
320
+ # Offense count: 6
321
+ # This cop supports safe autocorrection (--autocorrect).
322
+ # Configuration parameters: EnforcedStyleForMultiline.
323
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
324
+ Style/TrailingCommaInHashLiteral:
325
+ Exclude:
326
+ - 'lib/metanorma/plugin/glossarist/concept_serializer.rb'
data/Gemfile CHANGED
@@ -1,21 +1,18 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
1
+ # frozen_string_literal: true
3
2
 
4
3
  source "https://rubygems.org"
5
4
  git_source(:github) { |repo| "https://github.com/#{repo}" }
6
5
 
7
- gem "metanorma-standoc", github: "metanorma/metanorma-standoc"
8
- gem "isodoc", github: "metanorma/isodoc"
9
- gem "metanorma", github: "metanorma/metanorma"
10
-
11
- gem "pry"
12
- gem "rake", "~> 13.0"
13
- gem "rspec", "~> 3.6"
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
+ gem "ogc-gml", "~> 1.1"
11
+ gem "rake"
12
+ gem "rspec"
13
+ gem "rubocop"
14
+ gem "rubocop-performance"
15
+ gem "rubocop-rake"
16
+ gem "rubocop-rspec"
14
17
 
15
18
  gemspec
16
-
17
- begin
18
- eval_gemfile("Gemfile.devel")
19
- rescue StandardError
20
- nil
21
- end
data/README.adoc CHANGED
@@ -271,7 +271,7 @@ Multiple filters can be applied by separating them with a semicolon `;`.
271
271
  ====
272
272
  [source,adoc]
273
273
  ------
274
- [glossarist,dataset,filter='group=foo;sort_by=term',concepts]
274
+ [glossarist,dataset,filter='domain=foo;sort_by=term',concepts]
275
275
  ----
276
276
  ...
277
277
  ----
@@ -286,22 +286,43 @@ which concepts are loaded into the block.
286
286
 
287
287
  `sort_by=<field name>`::: Sorts the dataset in ascending order of the given
288
288
  field values. The field `term` is a special case, where it sorts according to
289
- the `default_designation` of the term.
289
+ the `default_designation` of the term. Nested attribute paths are supported
290
+ using dot notation (e.g., `data.identifier`) and bracket notation for hash/array access
291
+ (e.g., `data.localizations['eng'].data.terms[0].designation`).
292
+ Nested path sorts use natural ordering so that version-like identifiers
293
+ (e.g., `3.1.1.10`) sort correctly after `3.1.1.2`. Concepts missing the
294
+ specified path are sorted last.
290
295
  +
296
+ --
291
297
  [example]
292
298
  `sort_by=term` will sort concepts in ascending order based on the
293
299
  default term (which is the first English designation, at `data.localizations['eng'].data.terms[0].designation`).
294
300
 
301
+ [example]
302
+ `sort_by=data.identifier` will sort concepts by their identifier.
303
+
304
+ [example]
305
+ `sort_by=data.localizations['eng'].data.terms[0].designation` will sort concepts
306
+ alphabetically by the English designation.
307
+ --
308
+
295
309
  `lang=<language code>`::: Loads concepts in the specified language.
296
310
  +
297
311
  [example]
298
312
  `lang=ara` loads all localized concepts of Arabic for all concepts.
299
313
 
300
- `group=<group name>`::: Loads concepts that belong to the specified group. Group is a dataset-specific
301
- field that can be used to categorize concepts.
314
+ `domain=<domain name>`::: Loads concepts that belong to the specified domain.
315
+ Domains are `ConceptReference` objects (with `concept_id` and `ref_type: "domain"`)
316
+ that categorize concepts into subject areas.
317
+ +
318
+ [example]
319
+ `domain=foo` will only load concepts that have a domain with `concept_id` "foo".
320
+
321
+ `group=<group name>`::: Legacy alias for `domain`. Loads concepts that belong to
322
+ the specified domain. Provided for backward compatibility with existing documents.
302
323
  +
303
324
  [example]
304
- `group=foo` will only load concepts that have a group named `foo`.
325
+ `group=foo` will only load concepts that have a domain with `concept_id` "foo".
305
326
 
306
327
  Field filters:: These filters are applied to individual fields of the concepts
307
328
  and affect which concepts are included in the block based on the values of those
@@ -710,14 +731,14 @@ System for identifying position in the real world
710
731
  ====
711
732
 
712
733
  [example]
713
- .Applying sorting and filtering by group
734
+ .Applying sorting and filtering by domain
714
735
  ====
715
- Using the same dataset as above, but with sorting and filtering by the "terminology" group:
736
+ Using the same dataset as above, but with sorting and filtering by the "terminology" domain:
716
737
 
717
738
  [source,asciidoc]
718
739
  ------
719
740
  === Terms and definitions
720
- [glossarist, /path/to/glossarist-dataset, filter='group=terminology;sort_by=term', dataset]
741
+ [glossarist, /path/to/glossarist-dataset, filter='domain=terminology;sort_by=term', dataset]
721
742
  ----
722
743
  {%- for concept in dataset -%}
723
744
  ==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
@@ -747,7 +768,7 @@ Using the same dataset, but filtering for terms related to addressing:
747
768
  [source,asciidoc]
748
769
  ------
749
770
  === Terms and definitions
750
- [glossarist, /path/to/glossarist-dataset, filter='group=addressing', dataset]
771
+ [glossarist, /path/to/glossarist-dataset, filter='domain=addressing', dataset]
751
772
  ----
752
773
  {%- for concept in dataset -%}
753
774
  ==== {{ concept.data.localizations['eng'].data.terms[0].designation }}
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metanorma
4
+ module Plugin
5
+ module Glossarist
6
+ class BibliographyRenderer
7
+ def initialize
8
+ @rendered = {}
9
+ end
10
+
11
+ def render_entry(concept, lang: "eng")
12
+ l10n = concept.localization(lang)
13
+ return nil unless l10n
14
+
15
+ entries = source_entries(l10n)
16
+ warn_unresolved_xrefs(l10n)
17
+ entries.empty? ? nil : entries.sort.join("\n")
18
+ end
19
+
20
+ def render_all(concepts, lang: "eng")
21
+ entries = concepts.filter_map { |c| render_entry(c, lang: lang) }
22
+ entries.sort.join("\n")
23
+ end
24
+
25
+ private
26
+
27
+ def source_entries(l10n)
28
+ sources = l10n.sources
29
+ return [] if sources.nil? || sources.empty?
30
+
31
+ sources.filter_map do |source|
32
+ ref = source.origin&.text
33
+ next if ref.nil? || ref.empty?
34
+ next if @rendered.key?(ref)
35
+
36
+ anchor = ref.gsub(%r{[ /:]}, "_")
37
+ @rendered[ref] = anchor
38
+ "* [[[#{anchor},#{ref}]]]"
39
+ end
40
+ end
41
+
42
+ def warn_unresolved_xrefs(l10n)
43
+ xref_ids = extract_content_xrefs(l10n)
44
+ return if xref_ids.empty?
45
+
46
+ xref_ids.each do |ref_id|
47
+ next if @rendered.value?(ref_id)
48
+
49
+ warn "[glossarist] unresolved bibliography reference: " \
50
+ "<<#{ref_id}>> — not defined as a source in the dataset"
51
+ end
52
+ end
53
+
54
+ def extract_content_xrefs(l10n)
55
+ parts = []
56
+ l10n.definition&.each { |d| parts << d.content.to_s }
57
+ l10n.notes&.each { |n| parts << n.content.to_s }
58
+ l10n.examples&.each { |e| parts << e.content.to_s }
59
+ return [] if parts.empty?
60
+
61
+ Sanitize.extract_xrefs(parts.join(" "))
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end