metanorma-plugin-glossarist 0.5.2 → 0.5.3.pre.alpha.1

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: db0124df506956c04fd99381c614e2d921ead65cf5918a1bb8f49b80cde8c2c9
4
- data.tar.gz: e60bf164cd7becbc5a096a774d5d8f6b494478e6cf1558f6b9c6ca2703a5025a
3
+ metadata.gz: cf34441379e0de9b9ba6a8a680cac2bd971750b0700c72ee80758a9d892ed07c
4
+ data.tar.gz: 9e006a7bc8f570bf9c3c79fdba330492ea9a57e6e73eb31461d7c39bb3a3478f
5
5
  SHA512:
6
- metadata.gz: fc7a8c4118818585c2c80b818cb4679be59123a2b8474318d37f9026769b110c0c5b466d78db01ff114d0d45f9e7bf70a5c017af9fe4f0c3a167e8cc199ebfd1
7
- data.tar.gz: 8bad06b56f2d363acbf96a85c4dac4ec8a23c31bc12ead57ee3887acb8e4f146ecf7a18b97c2c12bd8bdb13aa52a6db8d4450738ece556e5e8723549329b3908
6
+ metadata.gz: d672c5391726eee43defd3da5af83c3d28898879d2d6a4d28eb255676594cbbc3d94b3975786ba22157570bb996d188394a4ce521292176476927ddaf7f8ea7e
7
+ data.tar.gz: 23de9fd069969746cfe8170209ed7ac18a14f6fee776889a3e398173638bc080ee2dd7e58e4f9bee01fc27c30e8bcd19f8946cf21e2d34ea98d0915c78345d45
@@ -14,9 +14,10 @@ on:
14
14
  repository_dispatch:
15
15
  types: [ do-release ]
16
16
 
17
+ # Least-privilege ceiling for the called rubygems-release.yml: its release job
18
+ # needs contents:write (git tag push) and id-token:write (OIDC Trusted Publishing).
17
19
  permissions:
18
20
  contents: write
19
- packages: write
20
21
  id-token: write
21
22
 
22
23
  jobs:
data/.rubocop.yml CHANGED
@@ -2,18 +2,30 @@
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ # .rubocop_todo.yml MUST be the last entry. inherit_from is last-wins:
6
+ # if listed before oss-guides, the shared config's stricter Metrics/
7
+ # (MethodLength, BlockLength, etc.) rules override the todo's per-file
8
+ # grandfathering, and the todo becomes inert on those cops. Empirically
9
+ # verified on suma 2026-07-06: with todo listed first, 34 Metrics/* offenses
10
+ # remained; moved last, cleared. Every gem in the metanorma-org fleet
11
+ # already ships a `.rubocop_todo.yml` on its live tree (audited 2026-07-06,
12
+ # 54/54 have it), so this reference is safe to emit unconditionally.
5
13
  - .rubocop_todo.yml
6
14
 
7
- inherit_mode:
8
- merge:
9
- - Exclude
10
-
11
- # local repo-specific modifications
12
- # ...
15
+ # Rubocop plugins enabled centrally so every metanorma-org gem picks them up
16
+ # on cimas sync — best practice belongs at the shared-template layer, not
17
+ # per-repo. Per ronaldtse feedback on metanorma/ci#332.
13
18
  plugins:
14
19
  - rubocop-rspec
15
20
  - rubocop-performance
16
21
  - rubocop-rake
17
22
 
23
+ # local repo-specific modifications
24
+ # ...
25
+
18
26
  AllCops:
19
- TargetRubyVersion: 3.0
27
+ # 3.3 matches the org-wide minimum being pushed via #274 (Raise minimum
28
+ # Ruby version to 3.3 due to EOL of 3.2 on 2026-03-31). Was 3.4 before
29
+ # this commit — 3.4 was above the org's stated minimum and would have
30
+ # applied Rubocop rules that fail-close on gems still targeting 3.3.
31
+ TargetRubyVersion: 3.3
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-07-05 06:01:54 UTC using RuboCop version 1.86.1.
3
+ # on 2026-10-10 14:51:08 UTC using RuboCop version 1.91.0.
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
@@ -11,7 +11,7 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'metanorma-plugin-glossarist.gemspec'
13
13
 
14
- # Offense count: 37
14
+ # Offense count: 39
15
15
  # This cop supports safe autocorrection (--autocorrect).
16
16
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
17
  # URISchemes: http, https
@@ -26,6 +26,12 @@ Lint/ConstantDefinitionInBlock:
26
26
  - 'lib/metanorma/plugin/glossarist/field_filter.rb'
27
27
  - 'spec/metanorma/plugin/glossarist/field_filter_spec.rb'
28
28
 
29
+ # Offense count: 1
30
+ # This cop supports safe autocorrection (--autocorrect).
31
+ Lint/RedundantRequireStatement:
32
+ Exclude:
33
+ - 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb'
34
+
29
35
  # Offense count: 1
30
36
  Lint/StructNewOverride:
31
37
  Exclude:
@@ -45,7 +51,7 @@ Metrics/AbcSize:
45
51
  - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
46
52
  - 'lib/metanorma/plugin/glossarist/template_renderer.rb'
47
53
 
48
- # Offense count: 5
54
+ # Offense count: 6
49
55
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
50
56
  Metrics/CyclomaticComplexity:
51
57
  Exclude:
@@ -53,6 +59,7 @@ Metrics/CyclomaticComplexity:
53
59
  - 'lib/metanorma/plugin/glossarist/concept_filter.rb'
54
60
  - 'lib/metanorma/plugin/glossarist/concept_path_resolver.rb'
55
61
  - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
62
+ - 'lib/metanorma/plugin/glossarist/template_renderer.rb'
56
63
 
57
64
  # Offense count: 15
58
65
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
@@ -67,6 +74,14 @@ Metrics/PerceivedComplexity:
67
74
  - 'lib/metanorma/plugin/glossarist/concept_filter.rb'
68
75
  - 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb'
69
76
 
77
+ # Offense count: 2
78
+ # This cop supports safe autocorrection (--autocorrect).
79
+ # Configuration parameters: EnforcedStyle, BlockForwardingName.
80
+ # SupportedStyles: anonymous, explicit
81
+ Naming/BlockForwarding:
82
+ Exclude:
83
+ - 'lib/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop.rb'
84
+
70
85
  # Offense count: 25
71
86
  # Configuration parameters: Prefixes, AllowedPatterns.
72
87
  # Prefixes: when, with, without
@@ -78,9 +93,14 @@ RSpec/ContextWording:
78
93
  # Configuration parameters: IgnoredMetadata.
79
94
  RSpec/DescribeClass:
80
95
  Exclude:
96
+ - '**/spec/features/**/*'
97
+ - '**/spec/requests/**/*'
98
+ - '**/spec/routing/**/*'
99
+ - '**/spec/system/**/*'
100
+ - '**/spec/views/**/*'
81
101
  - 'spec/metanorma/plugin/glossarist/bibliography_scope_spec.rb'
82
102
 
83
- # Offense count: 45
103
+ # Offense count: 49
84
104
  # Configuration parameters: CountAsOne.
85
105
  RSpec/ExampleLength:
86
106
  Max: 35
@@ -90,7 +110,7 @@ RSpec/LeakyConstantDeclaration:
90
110
  Exclude:
91
111
  - 'spec/metanorma/plugin/glossarist/field_filter_spec.rb'
92
112
 
93
- # Offense count: 66
113
+ # Offense count: 68
94
114
  RSpec/MultipleExpectations:
95
115
  Max: 4
96
116
 
@@ -116,12 +136,23 @@ RSpec/RepeatedExample:
116
136
  # SupportedInflectors: default, active_support
117
137
  RSpec/SpecFilePathFormat:
118
138
  Exclude:
139
+ - '**/spec/routing/**/*'
119
140
  - 'spec/metanorma/plugin/glossarist/liquid/custom_filters_spec.rb'
120
141
  - 'spec/metanorma/plugin/glossarist/liquid/drop_bracket_access_spec.rb'
121
142
  - 'spec/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop_spec.rb'
122
143
  - 'spec/metanorma/plugin/glossarist/liquid/drops/managed_concept_data_drop_spec.rb'
123
144
  - 'spec/metanorma/plugin/glossarist/liquid/drops/managed_concept_drop_spec.rb'
124
145
 
146
+ # Offense count: 2
147
+ # This cop supports safe autocorrection (--autocorrect).
148
+ # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
149
+ # RedundantRestArgumentNames: args, arguments
150
+ # RedundantKeywordRestArgumentNames: kwargs, options, opts
151
+ # RedundantBlockArgumentNames: blk, block, proc
152
+ Style/ArgumentsForwarding:
153
+ Exclude:
154
+ - 'lib/metanorma/plugin/glossarist/liquid/drops/localization_collection_drop.rb'
155
+
125
156
  # Offense count: 1
126
157
  # Configuration parameters: Max.
127
158
  Style/SafeNavigationChainLength:
data/CLAUDE.md ADDED
@@ -0,0 +1,49 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ Metanorma Asciidoctor plugin for Glossarist terminology datasets. It loads concept datasets (V2 and V3 Glossarist schemas), renders concepts, bibliographies, and non-verbal entities (figures/tables/formulas) into Metanorma AsciiDoc, using Liquid templates.
8
+
9
+ ## Commands
10
+
11
+ - Run all specs: `bundle exec rspec` (or `bundle exec rake`)
12
+ - Run one spec file: `bundle exec rspec spec/metanorma/plugin/glossarist/mention_extractor_spec.rb`
13
+ - Run one example: append `:LINE` to the spec file path
14
+ - Lint: `bundle exec rubocop`
15
+ - Console: `bin/console`
16
+
17
+ `metanorma-standoc` is in the Gemfile `:test` group only — specs render through the `:standoc` backend, but the released gem does not depend on it. Keep any new test-only dependencies in that group; the release workflow bundles with `--without test`.
18
+
19
+ ## Architecture
20
+
21
+ `lib/metanorma-plugin-glossarist.rb` is the entry point: it defines all autoloads (no `require_relative` for internal code — new classes get an autoload entry there) and `TEMPLATES_DIR`, and registers the Liquid extensions at load time (indexed-access polyfill, `WithGlossaristContext` block, custom filters).
22
+
23
+ Processing pipeline (AsciiDoc in → AsciiDoc out):
24
+
25
+ 1. **`DatasetPreprocessor`** — Asciidoctor preprocessor that dispatches all directives:
26
+ - `[glossarist,path,filter=...,template=...,context]` block with a Liquid body
27
+ - `glossarist::import[ds]`, `glossarist::import_sections[ds]`, `glossarist::render[ds,term]`
28
+ - `glossarist::render_bibliography[ds]`, `glossarist::render_bibliography_entry[ds,term]`
29
+ - `glossarist::render_figures|tables|formulas[ds]`
30
+ - `:glossarist-dataset:` document attribute pre-loads datasets globally (`name:path;name:path`)
31
+ 2. **`DatasetRegistry`** — loads and caches datasets per document, `find_concept` lookup, registers sections from `register.yaml`, exposes per-context collections (concepts, sections, bibliography, non-verbal kinds).
32
+ 3. **Filters** — `ConceptFilter` (collection filters: `sort_by`, `lang`, `tag`, `domain`/`group`), `FieldFilter` (`path=value`, `path.start_with(v)`), `SectionFilter`; all resolve paths via `ConceptPathResolver`, which navigates dot/bracket notation (`data.localizations['eng'].data.terms[0].designation`) through the Glossarist object graph.
33
+ 4. **Renderers** — `TemplateRenderer` / `SectionRenderer` (Liquid; builds parent-child trees from broader/narrower refs, auto-detects section depth), `NonVerbalRenderer` + `NonVerbalFormatters::{Figure,Table,Formula}`, `BibliographyRenderer`, `MentionExtractor` (collects xref/cite anchors used to scope bibliographies).
34
+ 5. **Liquid layer** (`Liquid` submodule) — drops (`ManagedConceptDrop`, `ManagedConceptDataDrop`, `LocalizationCollectionDrop`), custom filters (`sanitize_references`, `format_ref`), `WithGlossaristContext` block, `MultiplyLocalFileSystem` for template lookup. `Sanitize` converts URN-style refs into Metanorma-safe anchor ids.
35
+
36
+ ### Glossarist gem interop
37
+
38
+ - This plugin's namespace is `Metanorma::Plugin::Glossarist`. Inside it, Ruby resolves `Glossarist::` to this namespace first — always reference gem classes with the `::Glossarist::` prefix.
39
+ - Dataset layouts: V2 (UUID-named concept/localized_concept files), V3 (identifier-based files, `register.yaml` with sections, `figures/tables/formulas/` subdirectories). Fixtures: `spec/fixtures/dataset-glossarist-v2`, `-v3`, and `invalid_dataset` for error paths. The non-verbal YAML filename stem is irrelevant; the `id:` field inside is the cross-reference target.
40
+
41
+ ### Spec conventions
42
+
43
+ - Load real `Glossarist` collections from the fixtures; never use `double()`. For Asciidoctor document objects, simple `Struct`-based stand-ins are the accepted pattern.
44
+ - Preprocessor specs drive `Asciidoctor::Reader` with inline template strings; rendering specs compare against the `:standoc` backend using `canon` XML matching (configured in `spec/spec_helper.rb`).
45
+
46
+ ## CI and release
47
+
48
+ - `rake.yml` calls `metanorma/ci/.github/workflows/generic-rake.yml@v1` (tests Ruby 3.3/3.4/4.0 on linux/macOS/windows).
49
+ - `release.yml` calls `metanorma/ci/.github/workflows/rubygems-release.yml@main`, gated: a `workflow_dispatch` bumps the version and pushes a tag, but publishing only happens after CI on the tag passes and dispatches `do-release` back. Publishing steps showing "skipped" in the first run is expected. Version numbers are the owner's decision — never pick or dispatch one unprompted.
@@ -3,7 +3,7 @@
3
3
  module Metanorma
4
4
  module Plugin
5
5
  module Glossarist
6
- VERSION = "0.5.2"
6
+ VERSION = "0.5.3.pre.alpha.1"
7
7
  end
8
8
  end
9
9
  end
@@ -23,11 +23,11 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.required_ruby_version = ">= 3.1.0"
26
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
27
27
 
28
28
  spec.add_dependency "asciidoctor"
29
29
  spec.add_dependency "glossarist", "~> 2.8", ">= 2.11.1"
30
- spec.add_dependency "liquid"
30
+ spec.add_dependency "liquid", "~> 5"
31
31
  spec.add_dependency "metanorma-utils"
32
32
  spec.metadata["rubygems_mfa_required"] = "true"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plugin-glossarist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-29 00:00:00.000000000 Z
11
+ date: 2026-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -48,16 +48,16 @@ dependencies:
48
48
  name: liquid
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '5'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '5'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: metanorma-utils
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +85,7 @@ files:
85
85
  - ".rspec"
86
86
  - ".rubocop.yml"
87
87
  - ".rubocop_todo.yml"
88
+ - CLAUDE.md
88
89
  - CODE_OF_CONDUCT.md
89
90
  - Gemfile
90
91
  - LICENSE.txt
@@ -138,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
139
  requirements:
139
140
  - - ">="
140
141
  - !ruby/object:Gem::Version
141
- version: 3.1.0
142
+ version: 3.3.0
142
143
  required_rubygems_version: !ruby/object:Gem::Requirement
143
144
  requirements:
144
145
  - - ">="