metanorma 2.2.9 → 2.3.0

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: f949939db63522ce80839447f7a4a2c860f2b6c1a8a8bef299bb12e5a375f23c
4
- data.tar.gz: cd92ed471004f16de40d4c0e02bc457a7a2492a4b0a92729a1b36d312eef2672
3
+ metadata.gz: f0b38bef2506229ec98ad17d482c5b1fff15bf21d159833393a54dc19842a501
4
+ data.tar.gz: 8e6b6a5f689f5b37379bf80d2d987ac2d2cfe28d2b5a678069b90fbf79628ff2
5
5
  SHA512:
6
- metadata.gz: f85234d7dea81dda16e4c66d1f883666bd1f9b7382ab6bd20770e75f3dc04ad940d78a54a49c2df7dfc25859f1434f5559233ce8c2eb585761397b7fcb0d22af
7
- data.tar.gz: 4bddae518329cebca7cf762666c0d769243524a40c595f3ea7e94db33fad26fc3daaf26598c73a85b3ab12d13cd974a5a89ce7a1548ef679bec00156de8e6608
6
+ metadata.gz: e98a37c21f6741a3d59c765947a6f589938b44e11120a066ebac4fa1919aa00fb32fdb4f812a6bed66a1db88207df673c2361ac4b32889bd0ca25d106b0904e4
7
+ data.tar.gz: ee81239a3a28c45650b5a2770609a029e31be0f36cba332b9e5d2cacd5845149a8fa986e2aee8d8461e8d61e5f4ce2aec50b4715dae1fab23ef989128e49d40d
@@ -160,6 +160,7 @@ module Metanorma
160
160
  b.attachment Vectory::Utils::datauri(doc.file)
161
161
  else
162
162
  doc.to_xml b
163
+ b.parent.children.first["flavor"] = flavor
163
164
  end
164
165
  end
165
166
  end
@@ -49,7 +49,7 @@ module Metanorma
49
49
  private
50
50
 
51
51
  def mn2relaton_parser(tag)
52
- case tag.sub(/-standard/, "")
52
+ case tag
53
53
  when "bipm" then ::RelatonBipm::XMLParser
54
54
  when "bsi" then ::RelatonBsi::XMLParser
55
55
  when "ietf" then ::RelatonIetf::XMLParser
@@ -67,7 +67,7 @@ module Metanorma
67
67
  # @return [RelatonBib::BibliographicItem,RelatonIso::IsoBibliographicItem]
68
68
  def from_xml(xml)
69
69
  b = xml.at("//xmlns:bibitem|//xmlns:bibdata")
70
- r = mn2relaton_parser(xml.root.name)
70
+ r = mn2relaton_parser(xml.root["flavor"])
71
71
  # Relaton doesn't understand Pres XML tags
72
72
  b.xpath("//xmlns:fmt-identifier").each(&:remove)
73
73
  r.from_xml(b.to_xml)
@@ -127,7 +127,7 @@ module Metanorma
127
127
  if @raw
128
128
  builder.parent.add_child(@bibitem.root)
129
129
  else
130
- builder.send("#{type}-standard") do |b|
130
+ builder.send("metanorma") do |b|
131
131
  b << @bibitem.to_xml(bibdata: true)
132
132
  end
133
133
  end
@@ -200,11 +200,11 @@ module Metanorma
200
200
  # need to update options, for any content added;
201
201
  # e.g. new attributes from Metanorma taste
202
202
  def update_options_after_preprocessing(file, options)
203
- new_options = {}
203
+ new_options = { extension_keys: options[:extension_keys] }
204
204
  Tempfile.open(["tmp", ".adoc"], encoding: "UTF-8") do |f|
205
205
  f.write(file)
206
206
  f.close
207
- new_options = extract_options(f, {})
207
+ new_options = extract_options(f, new_options)
208
208
  end
209
209
  new_options.compact!
210
210
  new_options.delete(:filename)
@@ -21,8 +21,7 @@ module Metanorma
21
21
  o = options_in_file(filename)
22
22
  extract_flavor_options(options, o)
23
23
  extract_dir_options(options, o, filename)
24
- options[:extension_keys] ||= o[:extensions]&.split(/, */)&.map(&:to_sym)
25
- options[:extension_keys] = nil if options[:extension_keys] == [:all]
24
+ extract_extension_options(options, o)
26
25
  options[:format] ||= :asciidoc
27
26
  options[:filename] = filename
28
27
  options[:fontlicenseagreement] ||= "no-install-fonts"
@@ -30,6 +29,15 @@ module Metanorma
30
29
  options
31
30
  end
32
31
 
32
+ def extract_extension_options(opt, doc_opt)
33
+ opt[:extension_keys] == [:all] and opt[:extension_keys] = []
34
+ ext = opt[:extension_keys] || []
35
+ doc_opt[:extensions] == "all" and doc_opt[:extensions] = ""
36
+ ext1 = (doc_opt[:extensions] || "").split(/, */).map(&:to_sym)
37
+ !ext1.empty? && ext.empty? and opt[:extension_keys] = ext1
38
+ opt[:extension_keys]&.empty? and opt[:extension_keys] = nil
39
+ end
40
+
33
41
  def options_in_file(filename)
34
42
  content = read_file(filename)
35
43
  Metanorma::Input::Asciidoc.new.extract_metanorma_options(content)
@@ -93,7 +101,7 @@ module Metanorma
93
101
 
94
102
  def get_isodoc_options(file, options, ext)
95
103
  ret = @processor.extract_options(file)
96
- get_isodoc_i18nyaml(options, ret)
104
+ get_isodoc_fileparams(options, ret)
97
105
  copy_isodoc_options_attrs(options, ret)
98
106
  font_manifest_mn2pdf(options, ret, ext)
99
107
  ret[:output_formats]&.select! do |k, _|
@@ -103,11 +111,13 @@ module Metanorma
103
111
  ret
104
112
  end
105
113
 
106
- def get_isodoc_i18nyaml(options, ret)
107
- dir = File.dirname(options[:filename])
108
- ret[:i18nyaml] or return
109
- (Pathname.new ret[:i18nyaml]).absolute? or
110
- ret[:i18nyaml] = File.join(dir, ret[:i18nyaml])
114
+ def get_isodoc_fileparams(options, ret)
115
+ %i(i18nyaml relatonrenderconfig).each do |k|
116
+ dir = File.dirname(options[:filename])
117
+ ret[k] or next
118
+ (Pathname.new ret[k]).absolute? or
119
+ ret[k] = File.join(dir, ret[k])
120
+ end
111
121
  end
112
122
 
113
123
  def copy_isodoc_options_attrs(options, ret)
@@ -124,7 +134,8 @@ module Metanorma
124
134
 
125
135
  ext == :pdf && custom_fonts and
126
136
  ret[:mn2pdf] = {
127
- font_manifest: Util::FontistHelper.location_manifest(@processor, ret),
137
+ font_manifest: Util::FontistHelper
138
+ .location_manifest(@processor, ret),
128
139
  }
129
140
  end
130
141
  end
@@ -55,7 +55,7 @@ module Metanorma
55
55
  pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
56
56
  pdf-allow-assemble-document pdf-allow-edit-annotations
57
57
  pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
58
- pdf-stylesheet pdf-stylesheet-override
58
+ pdf-stylesheet pdf-stylesheet-override relaton-render-config
59
59
  fonts font-license-agreement pdf-allow-access-content
60
60
  pdf-encrypt-metadata iso-word-template document-scheme
61
61
  localize-number iso-word-bg-strip-color modspec-identifier-base)
@@ -41,14 +41,13 @@ module Metanorma
41
41
  end
42
42
 
43
43
  def fontist_install(manifest, agree, no_progress)
44
- if agree
45
- no_license_log
44
+ if agree then no_license_log
46
45
  else
47
- Fontist.log_level = :info
46
+ # Fontist.log_level = :info
47
+ # Shutting up Fontist 2.0's verbose logging of installation locations
48
+ Fontist.log_level = :fatal
48
49
  end
49
-
50
- instance = Fontist::Manifest.from_hash(manifest)
51
- instance.install(
50
+ Fontist::Manifest.from_hash(manifest).install(
52
51
  confirmation: agree ? "yes" : "no",
53
52
  no_progress: no_progress,
54
53
  ).to_hash
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "2.2.9".freeze
2
+ VERSION = "2.3.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.9
4
+ version: 2.3.0
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-11-17 00:00:00.000000000 Z
11
+ date: 2025-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor