metanorma-taste 0.0.2 → 0.0.3

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: 40130f7061043b85b1764af26102db83804e934b656f6af7e83ee0b582e65346
4
- data.tar.gz: 0bb630519b80b9f726847b7ca2ba38ce63ce7379f325a61929bddc49b7324a3b
3
+ metadata.gz: ff69cbef2464ea0306112994b8618c729e32c8aec02b5cd2a76defe8f7d01cad
4
+ data.tar.gz: 76cd6f232661a10abf2910cf551b4f6588b080f4df755eac9d85d39089809b65
5
5
  SHA512:
6
- metadata.gz: bf149523ea974279e19331aca8220c2c51c08634981513501811698422da5b3e0ad37b7272d79d0b172f86c8fa86f1716a9e43f57a4e2494cca94de001b5349d
7
- data.tar.gz: 57570e155e0f800820488a4974aa5f57fa07c2b85784faa62a64a1c5c17c8478dbfb531fb06248d47576a527947a4e13bcd17a66da0d604392886849ce5b1b13
6
+ metadata.gz: 444fb2139d64a5dc94e03629b79c6b2a44eac37e255b98177ecdfb1d5f83b68cbcab209d4b5e4a31993a9b367b357362ed231fa9a1dedb6c556ddc5db2596d5f
7
+ data.tar.gz: b1ee9539951eaf26be6553960d049f1d13cbfd3afbc0d7568fcf6ffd37894f008472ecb08b5e540f574d10a83fad9ea45a0a48681ecbaaa9bc92822eb8f52675
data/README.adoc CHANGED
@@ -146,6 +146,11 @@ currently available:
146
146
  |`iso`
147
147
  |ICC specifications and standards with ICC branding and copyright
148
148
 
149
+ |`elf`
150
+ |Express Language Foundation
151
+ |`iso`
152
+ |ELF specifications and standards with ELF branding and copyright
153
+
149
154
  |===
150
155
 
151
156
 
@@ -205,6 +210,10 @@ base-override: # Hash of document attributes to override from base f
205
210
  publisher: string # Publisher name override
206
211
  publisher_abbr: string # Publisher abbreviation
207
212
  presentation-metadata-*: # Template style attributes for presentation
213
+ doctypes: # Array of doctypes built over base flavour doctypes
214
+ - taste: # taste-specific machine-readable doctype name
215
+ base: # Base Metanorma flavor corresponding machine-readable doctype name
216
+ override-attributes: # Hash of document attributes to override from base flavor for this doctype
208
217
  ----
209
218
 
210
219
  .Taste configuration example from ICC
@@ -222,6 +231,11 @@ base-override:
222
231
  publisher_abbr: ICC
223
232
  presentation-metadata-color-secondary: '#376795'
224
233
  presentation-metadata-backcover-text: color.org
234
+ doctypes:
235
+ - taste: specification # Specification # The name goes into i18n.yaml
236
+ base: international-standard
237
+ override-attributes:
238
+ - presentation-metadata-color-secondary: '#376795'
225
239
  ----
226
240
  ====
227
241
 
@@ -236,13 +250,16 @@ doctype_dict: # Document type translations
236
250
  # Add more document type mappings as needed
237
251
  ----
238
252
 
253
+ Note that any taste-specific doctypes need to have a renderable corresponding entry under
254
+ `doctype_dict`. The same is the case for the native doctypes in the base flavor's i18n.yaml files.
255
+
239
256
  .i18n.yaml example from ICC
240
257
  [example]
241
258
  ====
242
259
  [source,yaml]
243
260
  ----
244
261
  doctype_dict:
245
- international-standard: Specification
262
+ specification: Specification
246
263
  ----
247
264
  ====
248
265
 
data/data/elf/config.yaml CHANGED
@@ -9,3 +9,8 @@ base-override:
9
9
  publisher_abbr: ELF
10
10
  presentation-metadata-color-secondary: '#3f65a2'
11
11
  presentation-metadata-backcover-text: expresslang.org
12
+ doctypes:
13
+ - taste: standard
14
+ base: international-standard
15
+ - taste: guide
16
+ base: guide
data/data/elf/i18n.yaml CHANGED
@@ -1,2 +1,3 @@
1
1
  doctype_dict:
2
- international-standard: Standard
2
+ standard: Standard
3
+ guide: Guide
data/data/icc/config.yaml CHANGED
@@ -9,3 +9,20 @@ base-override:
9
9
  publisher_abbr: ICC
10
10
  presentation-metadata-color-secondary: '#376795'
11
11
  presentation-metadata-backcover-text: color.org
12
+ doctypes:
13
+ - taste: specification # Specification # The name goes into i18n.yaml
14
+ base: international-standard
15
+ override-attributes:
16
+ - presentation-metadata-color-secondary: '#376795'
17
+ - taste: ics # Interoperability Conformance Specification
18
+ base: international-standard
19
+ override-attributes:
20
+ - presentation-metadata-color-secondary: '#376795'
21
+ - taste: white-paper # White Paper
22
+ base: international-standard
23
+ - taste: proposal # Proposal
24
+ base: international-standard
25
+ - taste: votable-proposal # Votable Proposal
26
+ base: international-standard
27
+ - taste: technical-note # Technical Note
28
+ base: international-standard
data/data/icc/i18n.yaml CHANGED
@@ -1,2 +1,7 @@
1
1
  doctype_dict:
2
- international-standard: Specification
2
+ specification: Specification
3
+ ics: Interoperability Conformance Specification
4
+ white-paper: White Paper
5
+ proposal: Proposal
6
+ votable-proposal: Votable Proposal
7
+ technical-note: Technical Note
@@ -18,7 +18,7 @@ module Metanorma
18
18
  # If attrs has fewer than 2 elements, this will handle it appropriately
19
19
  insertion_index = [attrs.length, 2].min
20
20
 
21
- new_attrs = build_attribute_overrides
21
+ attrs, new_attrs = build_attribute_overrides(attrs)
22
22
  attrs.insert(insertion_index, *new_attrs) unless new_attrs.empty?
23
23
 
24
24
  # Set boilerplate authority if copyright notice exists
@@ -32,45 +32,67 @@ module Metanorma
32
32
 
33
33
  private
34
34
 
35
- def build_attribute_overrides
35
+ def build_attribute_overrides(attrs)
36
36
  overrides = []
37
+ build_attribute_copyright_overrides(overrides)
38
+ build_attribute_i18n_overrides(overrides)
39
+ # Add base-override attributes
40
+ @taste_info[:base_override].each do |key, value|
41
+ overrides << ":#{key}: #{value}"
42
+ end
43
+ build_attribute_doctype_overrides(attrs, overrides)
44
+ [attrs, overrides]
45
+ end
37
46
 
38
- # Add copyright notice if available
47
+ # Add copyright notice if available
48
+ def build_attribute_copyright_overrides(overrides)
39
49
  copyright_file = copyright_notice_path
40
50
  if copyright_file && File.exist?(copyright_file)
41
51
  overrides << ":boilerplate-authority: #{copyright_file}"
42
52
  end
53
+ end
43
54
 
44
- # Add i18n dictionary if available
55
+ # Add i18n dictionary if availablee
56
+ def build_attribute_i18n_overrides(overrides)
45
57
  i18n_file = i18n_dictionary_path
46
58
  if i18n_file && File.exist?(i18n_file)
47
59
  overrides << ":i18nyaml: #{i18n_file}"
48
60
  end
61
+ end
49
62
 
50
- # Add base-override attributes
51
- @taste_info[:base_override].each do |key, value|
63
+ def build_attribute_doctype_overrides(attrs, overrides)
64
+ doctype_idx, dt = build_attribute_doctype_overrides_prep(attrs)
65
+ dt.nil? and return
66
+ overrides << ":presentation-metadata-doctype-alias: #{dt['taste']}"
67
+ attrs[doctype_idx] = ":doctype: #{dt['base']}"
68
+ dt["override_attributes"]&.each do |key, value|
52
69
  overrides << ":#{key}: #{value}"
53
70
  end
71
+ end
54
72
 
55
- overrides
73
+ def build_attribute_doctype_overrides_prep(attrs)
74
+ doctype_idx = attrs.index { |e| /^:doctype:/.match?(e) } or
75
+ return [nil, nil, nil]
76
+ old_doctype = attrs[doctype_idx].sub(/^:doctype:/, "").strip
77
+ dt = @taste_info[:doctypes].detect do |e|
78
+ e["taste"] == old_doctype
79
+ end or return [nil, nil, nil]
80
+ [doctype_idx, dt]
56
81
  end
57
82
 
58
83
  def copyright_notice_path
59
- return nil unless @taste_info[:copyright_notice]
60
-
84
+ @taste_info[:copyright_notice] or return nil
61
85
  File.join(@taste_info[:directory], @taste_info[:copyright_notice])
62
86
  end
63
87
 
64
88
  def i18n_dictionary_path
65
- return nil unless @taste_info[:i18n_dictionary]
66
-
89
+ @taste_info[:i18n_dictionary] or return nil
67
90
  File.join(@taste_info[:directory], @taste_info[:i18n_dictionary])
68
91
  end
69
92
 
70
93
  def load_i18n_dictionary
71
94
  i18n_file = i18n_dictionary_path
72
- return {} unless i18n_file && File.exist?(i18n_file)
73
-
95
+ i18n_file && File.exist?(i18n_file) or return {}
74
96
  YAML.load_file(i18n_file)
75
97
  rescue StandardError
76
98
  {}
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Metanorma
4
4
  module Taste
5
- VERSION = "0.0.2"
5
+ VERSION = "0.0.3"
6
6
  end
7
7
  end
@@ -77,6 +77,7 @@ module Metanorma
77
77
  copyright_notice: config["copyright-notice"],
78
78
  i18n_dictionary: config["i18n-dictionary"],
79
79
  base_override: config["base-override"] || {},
80
+ doctypes: config["doctypes"] || {}
80
81
  }
81
82
  end
82
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-taste
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-04 00:00:00.000000000 Z
11
+ date: 2025-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debug