suma 0.5.46 → 0.5.47

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: 85a9c26d83622207b34e74ff9079c36a8111cf87afb0e571b732a8f83b852f8d
4
- data.tar.gz: 2cdffdf12e5e539ea0c96d8608ee0affe428bd03a4046f5ec1bfd11d3d3182bf
3
+ metadata.gz: c8fb1adc0379739d78560e605a1bba605ef3f66cf672e6605fd533b6b845a83f
4
+ data.tar.gz: 588f8e95bc39f7d45c0dbf654441b2a4c61f3514223fc73bfe420466e833896f
5
5
  SHA512:
6
- metadata.gz: 98ce215e152ba83d93c686bfb6d239b485e0d49832894d73fcff70f73580840d23d084f488cb0579bb4ccd98e956a971578e3e544f510dc59ca44423252735cb
7
- data.tar.gz: b3e7d4d2e7961d5a09a2b137505191a5d4797eaf5bf377bba25b8cd1a4fc14ac6382a1ff1c325fa2aecc03827b576a4113fd7d037e35f12f0a7f816e0032b02a
6
+ metadata.gz: 76b38361530284dee7dad395fd7e96e63c10f05a0703eb1e5c43cf5a6edb4f58c77d7022878e7ede42866566b3254aa1ff905fc2775f8363dc37f189cea8d7ce
7
+ data.tar.gz: d6ae1b368bf9f5ac3e09b7fcc69c1cd28c35042c520ca5a9254cbcd8981a8b466b1dc12601476fee38ea85052b7cfeabafd057efe6bc1dfe81f9fa0e9b94b294
data/Gemfile CHANGED
@@ -20,7 +20,9 @@ gem "canon"
20
20
  # metanorma-standoc "Standoc::Document" split, so pin that from main too.
21
21
  # Flip both to released gems once metanorma-iso releases the migration.
22
22
  gem "metanorma-iso", github: "metanorma/metanorma-iso", branch: "main"
23
- gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
23
+ # released 3.5.22+ accepts moxml ~> 0.6 (metanorma-document >= 0.5.11
24
+ # needs it); the git main still pins moxml ~> 0.5.84
25
+ gem "metanorma-standoc", ">= 3.5.22"
24
26
  # metanorma#607 (drop localized <edition> variants before the relaton
25
27
  # parse; metanorma-iso main emits them) landed on main, where the
26
28
  # collection document parser lives at
@@ -28,7 +30,10 @@ gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
28
30
  gem "metanorma", github: "metanorma/metanorma", branch: "main"
29
31
  # iso/standoc main also use unreleased metanorma-document 0.5.x model
30
32
  # classes (e.g. Components::Inline::TermrefElement).
31
- gem "metanorma-document", github: "metanorma/metanorma-document", branch: "main"
33
+ # released >= 0.5.11 declares relaton ~> 3.1.1 (the git main still
34
+ # requires the 3.0.0.pre.alpha family, conflicting with the relaton
35
+ # floor below)
36
+ gem "metanorma-document", ">= 0.5.11"
32
37
  # Collection/Compile implementation gem the main-line metanorma stack
33
38
  # resolves against (standoc main needs ~> 0.2.3).
34
39
  gem "metanorma-core", github: "metanorma/metanorma-core", branch: "main"
@@ -38,7 +43,11 @@ gem "metanorma-core", github: "metanorma/metanorma-core", branch: "main"
38
43
  # prerelease); the released 3.7.3 still pins relaton-render ~> 1.3.0
39
44
  # and crashes collection renders. Revert to the released gem once an
40
45
  # isodoc release carries the allowance.
41
- gem "isodoc", github: "metanorma/isodoc", branch: "main"
46
+ # released isodoc pins relaton-render ~> 1.3.0 and crashed collection
47
+ # renders (see the comment above) — main carried the allowance; the
48
+ # consolidated relaton ~> 3.1.1 absorbed relaton-render, so the
49
+ # release works again with the floor below
50
+ gem "isodoc", ">= 3.7.17"
42
51
  # relaton floor: isodoc main (post-relaton#462 consolidation) requires
43
52
  # relaton ~> 3.1.1 -- the consolidated relaton gem absorbed
44
53
  # relaton-cli/relaton-render, whose standalone lines stop being the
@@ -47,7 +56,10 @@ gem "relaton", "~> 3.1.1"
47
56
  # gem "metanorma-plugin-lutaml", github: "metanorma/metanorma-plugin-lutaml", branch: "main"
48
57
  # gem "metanorma-standoc", github: "metanorma/metanorma-standoc", branch: "main"
49
58
  # gem "expressir", github: "lutaml/expressir", branch: "main"
50
- gem "expressir", "2.4.35"
59
+ # 2.4.75: the keep_untagged_remarks formatter option to_plain needs
60
+ # (the plain-schema face, suma#217); supersedes the 2.4.35 windows fix
61
+ # and the 2.4.56 parse regression, both fixed upstream since.
62
+ gem "expressir", "2.4.75"
51
63
  gem "nokogiri"
52
64
  gem "openssl", "~> 3.0"
53
65
  gem "rake"
@@ -241,7 +241,12 @@ module Suma
241
241
  end
242
242
  next unless schema
243
243
 
244
- [File.basename(exp, ".exp"), schema.remarks]
244
+ # Expressir 2.4.70+ keeps tagged remarks in #remarks and the
245
+ # source's untagged comments in #untagged_remarks; the page
246
+ # publishes both channels (description blocks and the listing).
247
+ remarks = Array(schema.remarks) +
248
+ Array(schema.untagged_remarks).map(&:text)
249
+ [File.basename(exp, ".exp"), remarks]
245
250
  end.compact.to_h
246
251
  end
247
252
 
@@ -52,7 +52,9 @@ module Suma
52
52
  end
53
53
 
54
54
  def to_plain
55
- parsed.to_s
55
+ "#{header_from_source}#{parsed.format(
56
+ no_remarks: true, keep_untagged_remarks: true,
57
+ )}"
56
58
  end
57
59
 
58
60
  def filename_plain
@@ -84,8 +86,35 @@ module Suma
84
86
  File.write(filename_plain, content)
85
87
  end
86
88
 
89
+ # expressir drops the pre-SCHEMA header comment at parse time
90
+ # (lutaml/expressir#696); the plain face keeps it verbatim from the
91
+ # source. The scan skips comment bodies, so a "SCHEMA" line inside a
92
+ # header comment (ap243_open_jt mim's draft notes) is not mistaken
93
+ # for the statement; a file with no SCHEMA statement (express-g
94
+ # diagram stubs) is all commentary and is kept whole.
95
+ PRE_SCHEMA_TOKEN = /
96
+ \(\*.*?\*\) # block comment (EXPRESS comments do not nest)
97
+ | --[^\n]* # line comment
98
+ | ^[ \t]*SCHEMA\b # the statement keyword
99
+ /mx
100
+
87
101
  private
88
102
 
103
+ def header_from_source
104
+ source = File.read(@path.to_s, encoding: "UTF-8")
105
+ pos = 0
106
+ while (match = PRE_SCHEMA_TOKEN.match(source, pos))
107
+ return source[0, match.begin(0)] if schema_keyword?(match.to_s)
108
+
109
+ pos = match.end(0)
110
+ end
111
+ source
112
+ end
113
+
114
+ def schema_keyword?(token)
115
+ token.lstrip.upcase.start_with?("SCHEMA")
116
+ end
117
+
89
118
  def parse_and_cache(source)
90
119
  repository = Expressir::Express::Parser.from_file(@path.to_s)
91
120
  @cache&.store_parsed(source, repository)
@@ -144,7 +144,7 @@ module Suma
144
144
  output_path_docs: "schema_docs",
145
145
  output_path_schemas: "plain_schemas",
146
146
  options: {
147
- annotations: true,
147
+ annotations: false,
148
148
  incremental: @incremental,
149
149
  state_file: @state_file,
150
150
  jobs: @jobs,
@@ -28,17 +28,27 @@ module Suma
28
28
 
29
29
  # @return [Array<String>] source files determining the rendered site
30
30
  def source_files
31
- @source_files ||= begin
32
- files = @extra_inputs.select { |file| File.file?(file) }
33
- (files + tree_files).uniq.sort
34
- end
31
+ @source_files ||= scan_sources
32
+ end
33
+
34
+ # The freshness key's inputs: the source scan minus the files the
35
+ # previous build emitted into the source tree (render-extracted images
36
+ # beside their documents). The render runs after the freshness scan
37
+ # memoized in source_files, so those files appear mid-build; recorded
38
+ # on the state, they stay outputs of the previous build and never
39
+ # inputs of the next.
40
+ def key_files
41
+ emitted = Array(read_state&.fetch("emitted_files", nil))
42
+ return source_files if emitted.empty?
43
+
44
+ source_files.reject { |file| emitted.include?(relative(file)) }
35
45
  end
36
46
 
37
47
  # @return [String] digest of every source file and the render toolchain
38
48
  def key
39
49
  @key ||= begin
40
50
  digest = Digest::SHA256.new
41
- source_files.each do |file|
51
+ key_files.each do |file|
42
52
  digest << relative(file) << "\0"
43
53
  digest << Digest::SHA256.file(file).hexdigest << "\0"
44
54
  end
@@ -60,7 +70,8 @@ module Suma
60
70
 
61
71
  # Persist the key and the produced files for the next build.
62
72
  def record
63
- write_state("key" => key, "outputs" => output_files)
73
+ write_state("key" => key, "outputs" => output_files,
74
+ "emitted_files" => emitted_files)
64
75
  self
65
76
  end
66
77
 
@@ -70,6 +81,17 @@ module Suma
70
81
 
71
82
  private
72
83
 
84
+ def scan_sources
85
+ files = @extra_inputs.select { |file| File.file?(file) }
86
+ (files + tree_files).uniq.sort
87
+ end
88
+
89
+ # Files present after the build that the starting scan did not see:
90
+ # what the render wrote into the source tree.
91
+ def emitted_files
92
+ (scan_sources - source_files).map { |file| relative(file) }
93
+ end
94
+
73
95
  def tree_files
74
96
  excluded = excluded_paths
75
97
  Dir.glob(File.join(@root, "**", "*")).select do |file|
data/lib/suma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.5.46"
4
+ VERSION = "0.5.47"
5
5
  end
data/suma.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
35
35
 
36
36
  # Bundled gem required directly by lib code: base64 in jsdai/figure_image.rb (metanorma/metanorma#669)
37
37
  spec.add_dependency "base64"
38
- spec.add_dependency "expressir"
38
+ spec.add_dependency "expressir", ">= 2.4.75"
39
39
  spec.add_dependency "glossarist", "~> 2.8", ">= 2.8.7"
40
40
  spec.add_dependency "leptris"
41
41
  spec.add_dependency "lutaml-model", "~> 0.8.0"
@@ -55,4 +55,3 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
55
55
 
56
56
  spec.metadata["rubygems_mfa_required"] = "true"
57
57
  end
58
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.46
4
+ version: 0.5.47
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-11-20 00:00:00.000000000 Z
11
+ date: 2026-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 2.4.75
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 2.4.75
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: glossarist
43
43
  requirement: !ruby/object:Gem::Requirement