kaleidl 0.1.6 → 0.1.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/README.adoc +40 -15
- data/lib/kaleidl/sequences/registry.rb +9 -3
- data/lib/kaleidl/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a10e1941f546a23a076f1912f429f2efbe5d78262cf4194bac1fdd83ef543b6e
|
|
4
|
+
data.tar.gz: 4ebeb2e2f2be060fb185aee56c6259dccecee98c9b569fa753a2256bfdfec0c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f71aa88bee7b41387b404deadcfd840de9c847cb1829a6643c6d9a02dd9c4423a0b1663637f317e46772e99ad79184407699fe16ed1893622a04eed9ac1af8f6
|
|
7
|
+
data.tar.gz: 573271195010ab071ecda6d686ba2df573bc9092ee5feed027eeb51da21b01b54079cc152bc1787f3d21093e9d463766226f55fdc9386215270444c4c2055b65
|
data/README.adoc
CHANGED
|
@@ -26,35 +26,38 @@ the specification is kept as the conformance fixture
|
|
|
26
26
|
----
|
|
27
27
|
require "kaleidl"
|
|
28
28
|
|
|
29
|
-
profile = Kaleidl.
|
|
29
|
+
profile = Kaleidl.load_profile("spec/fixtures/iso_iec_label_style.lml")
|
|
30
30
|
tree = Kaleidl::ContentElement.new(id: "doc", type: "document",
|
|
31
|
+
label_context: "DocumentContext",
|
|
31
32
|
children: [
|
|
32
33
|
Kaleidl::ContentElement.new(id: "c1", type: "clause"),
|
|
33
|
-
Kaleidl::ContentElement.new(id: "ax1", type: "annex",
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
Kaleidl::ContentElement.new(id: "ax1", type: "annex",
|
|
35
|
+
label_context: "AnnexContext",
|
|
36
|
+
children: [
|
|
37
|
+
Kaleidl::ContentElement.new(id: "ax1s1", type: "clause"),
|
|
38
|
+
]),
|
|
36
39
|
])
|
|
37
40
|
|
|
38
41
|
result = Kaleidl::Runtime::Engine.new(profile).label(tree)
|
|
39
|
-
result.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
by = result.labels_by_element_id
|
|
43
|
+
by["c1"].value # => "Clause 1"
|
|
44
|
+
by["ax1"].value # => "Annex A"
|
|
45
|
+
by["ax1s1"].value # => "A.1"
|
|
42
46
|
----
|
|
43
47
|
|
|
44
|
-
Load a custom profile written in the MN 112 `.lml` instance syntax
|
|
48
|
+
Load a custom profile written in the MN 112 `.lml` instance syntax (or
|
|
49
|
+
its YAML realization):
|
|
45
50
|
|
|
46
51
|
[source,ruby]
|
|
47
52
|
----
|
|
48
53
|
profile = Kaleidl.load_profile("my_flavor.lml")
|
|
49
54
|
----
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
result = Kaleidl::Runtime::Engine.new(profile).label(content)
|
|
57
|
-
----
|
|
56
|
+
The host declares where each labeling scope begins: an element carrying
|
|
57
|
+
`label_context` associates its subtree with a profile context, and
|
|
58
|
+
descendants inherit the nearest declaration. The same element type
|
|
59
|
+
labels differently under different contexts — the clause inside the
|
|
60
|
+
annex above is A.1, not Clause 2.
|
|
58
61
|
|
|
59
62
|
== Architecture
|
|
60
63
|
|
|
@@ -279,6 +282,28 @@ every default sequence, the core models, the resolver, the renderer,
|
|
|
279
282
|
the engine algorithm (counter scoping, `%pn` resolution, conditional
|
|
280
283
|
templates) and the metanorma-document adapter.
|
|
281
284
|
|
|
285
|
+
== Testsuite
|
|
286
|
+
|
|
287
|
+
The cross-runtime conformance vectors for the kaleidl fleet are
|
|
288
|
+
published as the [kaleidl/kaleidl-testsuite](https://github.com/kaleidl/kaleidl-testsuite)
|
|
289
|
+
repository; the runtime ports (kaleidl-py, kaleidl-rs, kaleidl-ts)
|
|
290
|
+
vendor the vectors at a pinned tag of that repository and their CI
|
|
291
|
+
diffs the vendored copy against it. This monorepo stays the generating
|
|
292
|
+
reference: it keeps its own working fixtures (the MN 112-A conformance
|
|
293
|
+
fixture at `spec/fixtures/iso_iec_label_style.lml` is the SSOT source
|
|
294
|
+
of the testsuite's `mn112a-label-style` profile), and the published
|
|
295
|
+
snapshot is refreshed from here.
|
|
296
|
+
|
|
297
|
+
bundle exec sh tools/sync_testsuite.sh <testsuite-checkout>
|
|
298
|
+
|
|
299
|
+
The sync script copies the SSOT fixture into the checkout, verifies
|
|
300
|
+
every LML/YAML profile pair derives identical instance data
|
|
301
|
+
(`tools/check_realization.rb` from the testsuite), and regenerates the
|
|
302
|
+
expected labels maps from this reference (`tools/gen_vectors.rb`). Any
|
|
303
|
+
diff left in the checkout afterwards is the snapshot delta to commit
|
|
304
|
+
and publish as the next tagged version; a clean run proves the
|
|
305
|
+
published snapshot still matches this reference byte-for-byte.
|
|
306
|
+
|
|
282
307
|
== License
|
|
283
308
|
|
|
284
309
|
The gem is available as open source under the terms of the MIT license.
|
|
@@ -15,8 +15,13 @@ module Kaleidl
|
|
|
15
15
|
|
|
16
16
|
module_function
|
|
17
17
|
|
|
18
|
-
# Default sequences by instance name,
|
|
19
|
-
#
|
|
18
|
+
# Default sequences by instance name, memoized. The sequence
|
|
19
|
+
# objects are pure position→string formatters (value_for_position
|
|
20
|
+
# carries no internal counter), so sharing them across labellers
|
|
21
|
+
# is safe; the hash is frozen to protect the registry map.
|
|
22
|
+
# Rebuilding all fifteen per lookup cost ~89% of Engine#label
|
|
23
|
+
# wall time (bench 2026-11-30: 130.9ms -> 14.6ms on the
|
|
24
|
+
# 455-element tree).
|
|
20
25
|
def defaults
|
|
21
26
|
numeric = lambda do |format|
|
|
22
27
|
Kaleidl::NumericSequence.new(initial_value: 1, increment: 1, format: format)
|
|
@@ -54,7 +59,8 @@ module Kaleidl
|
|
|
54
59
|
|
|
55
60
|
# Looks up a sequence by instance name in the default registry.
|
|
56
61
|
def lookup(name)
|
|
57
|
-
defaults
|
|
62
|
+
@defaults ||= defaults.freeze
|
|
63
|
+
@defaults[name]
|
|
58
64
|
end
|
|
59
65
|
end
|
|
60
66
|
end
|
data/lib/kaleidl/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kaleidl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ronald Tse
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-11-30 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rhoella
|
|
@@ -116,6 +117,7 @@ metadata:
|
|
|
116
117
|
source_code_uri: https://github.com/kaleidl/kaleidl
|
|
117
118
|
changelog_uri: https://github.com/kaleidl/kaleidl/releases
|
|
118
119
|
rubygems_mfa_required: 'true'
|
|
120
|
+
post_install_message:
|
|
119
121
|
rdoc_options: []
|
|
120
122
|
require_paths:
|
|
121
123
|
- lib
|
|
@@ -130,7 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
130
132
|
- !ruby/object:Gem::Version
|
|
131
133
|
version: '0'
|
|
132
134
|
requirements: []
|
|
133
|
-
rubygems_version:
|
|
135
|
+
rubygems_version: 3.5.22
|
|
136
|
+
signing_key:
|
|
134
137
|
specification_version: 4
|
|
135
138
|
summary: Label Auto-assignment Definition Language (LADL) engine
|
|
136
139
|
test_files: []
|