metanorma 1.3.8 → 1.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8b82f79d4ce3a18564bd84c137faeca4daf763e2284464f390476fb881a0996
4
- data.tar.gz: f6a33995af907243fd0ae9ebff3676467455f21cd502089da6599783b4ba4e86
3
+ metadata.gz: f054752f3bb51d3e1cfe983beaca06c817275d214d5652503a42325d93403a42
4
+ data.tar.gz: 212a35305289d4286539dcdb008bf799fac028e87a84aab0a33b8137c73d84d5
5
5
  SHA512:
6
- metadata.gz: 484b71a094f6e23f5e512ffcbc8eac5bed0cd6d5b3fc6e952a28ce05e0e9eef3b64bff995692fd43f36b0c7888814b20318559aeeb0d9dee7900baf0847d95b8
7
- data.tar.gz: 508757811e5a63b30b91d4353fdc2a983bfe269da85f39b9be50d0c6a904113965ae53c40052cd43fb38ee740c350b9922d114bfd21833383a525782d278f95c
6
+ metadata.gz: c23014599c6a03a04b0dfa4fe93c6b300b0311ff55e552a5f1bd79a2d55220789c94916a9c6b694a044cd9247dcd95d1ab6dde05e0e7d949a29bcaedb07d8807
7
+ data.tar.gz: 98da695a8d3cd9b93f244161b8e0874b7851bb6426fd686cabcafe493f8088b0af2923a216b2741d34a2532b8f76adc3ac377af1caa8a639fdd27ba4c1866ef7
@@ -49,7 +49,7 @@ module Metanorma
49
49
  end
50
50
 
51
51
  def add_section_split_cover(files, manifest, ident)
52
- cover = section_split_cover(manifest, ident)
52
+ cover = section_split_cover(manifest, dir_name_cleanse(ident))
53
53
  files[ident][:out_path] = cover
54
54
  { attachment: true, index: false, out_path: cover,
55
55
  ref: File.join(File.dirname(manifest.file), cover) }
@@ -33,7 +33,7 @@ module Metanorma
33
33
  # output processor for flavour
34
34
  @isodoc = isodoc
35
35
 
36
- @outdir = options[:output_folder]
36
+ @outdir = dir_name_cleanse(options[:output_folder])
37
37
  @coverpage = options[:coverpage]
38
38
  @format = Util.sort_extensions_execution(options[:format])
39
39
  @compile_options = options[:compile] || {}
@@ -51,6 +51,10 @@ module Metanorma
51
51
  FileUtils.mkdir_p @outdir
52
52
  end
53
53
 
54
+ def dir_name_cleanse(name)
55
+ name.gsub(/[<>:"|?*]/, "_")
56
+ end
57
+
54
58
  # @param col [Metanorma::Collection] XML collection
55
59
  # @param options [Hash]
56
60
  # @option options [String] :coverpage cover page HTML (Liquid template)
@@ -52,7 +52,7 @@ module Metanorma
52
52
  def options_extract(filename, options)
53
53
  content = read_file(filename)
54
54
  o = Metanorma::Input::Asciidoc.new.extract_metanorma_options(content)
55
- o = o.merge(xml_options_extract(content))
55
+ .merge(xml_options_extract(content))
56
56
  options[:type] ||= o[:type]&.to_sym
57
57
  t = @registry.alias(options[:type]) and options[:type] = t
58
58
  dir = filename.sub(%r(/[^/]+$), "/")
@@ -130,9 +130,7 @@ module Metanorma
130
130
 
131
131
  def clean_sourcecode(xml)
132
132
  xml.xpath(".//callout | .//annotation | .//xmlns:callout | "\
133
- ".//xmlns:annotation").each do |x|
134
- x.remove
135
- end
133
+ ".//xmlns:annotation").each(&:remove)
136
134
  xml.xpath(".//br | .//xmlns:br").each { |x| x.replace("\n") }
137
135
  HTMLEntities.new.decode(xml.children.to_xml)
138
136
  end
@@ -177,8 +175,8 @@ module Metanorma
177
175
  end
178
176
 
179
177
  REQUIREMENT_XPATH = "//requirement | //xmlns:requirement | "\
180
- "//recommendation | //xmlns:recommendation | //permission | "\
181
- "//xmlns:permission".freeze
178
+ "//recommendation | //xmlns:recommendation | //permission | "\
179
+ "//xmlns:permission".freeze
182
180
 
183
181
  def requirement_export(xml, dirname)
184
182
  xml.at(REQUIREMENT_XPATH) or return
@@ -218,9 +216,11 @@ module Metanorma
218
216
  else
219
217
  begin
220
218
  if @processor.use_presentation_xml(ext)
221
- @processor.output(nil, presentationxml_name, outfilename, ext, isodoc_options)
219
+ @processor.output(nil, presentationxml_name, outfilename, ext,
220
+ isodoc_options)
222
221
  else
223
- @processor.output(isodoc, xml_name, outfilename, ext, isodoc_options)
222
+ @processor.output(isodoc, xml_name, outfilename, ext,
223
+ isodoc_options)
224
224
  end
225
225
  rescue StandardError => e
226
226
  isodoc_error_process(e)
@@ -245,7 +245,7 @@ module Metanorma
245
245
  isodoc_options = @processor.extract_options(file)
246
246
  isodoc_options[:datauriimage] = true if options[:datauriimage]
247
247
  isodoc_options[:sourcefilename] = options[:filename]
248
- %i(bare sectionsplit no_install_fonts).each do |x|
248
+ %i(bare sectionsplit no_install_fonts baseassetpath).each do |x|
249
249
  isodoc_options[x] ||= options[x]
250
250
  end
251
251
  if ext == :pdf
@@ -60,7 +60,7 @@ module Metanorma
60
60
  scripts-override scripts-pdf wordstylesheet i18nyaml
61
61
  standardstylesheet header wordcoverpage wordintropage
62
62
  ulstyle olstyle htmlstylesheet-override bare
63
- htmltoclevels doctoclevels sectionsplit
63
+ htmltoclevels doctoclevels sectionsplit base-asset-path
64
64
  body-font header-font monospace-font title-font
65
65
  wordstylesheet-override).freeze
66
66
 
@@ -75,6 +75,7 @@ module Metanorma
75
75
  /\n:(?<hier_assets>hierarchical-assets:[^\n]*)\n/ =~ header
76
76
  /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ header
77
77
  /\n:(?<break_up>break-up-urls-in-tables:[^\n]*)\n/ =~ header
78
+ /\n:suppress-asciimath-dup: (?<suppress_asciimath_dup>[^\n]+)\n/ =~ header
78
79
 
79
80
  defined?(hier_assets) and
80
81
  hier_assets = empty_attr(hier_assets, "hierarchical-assets")
@@ -84,6 +85,7 @@ module Metanorma
84
85
  break_up = empty_attr(break_up, "break-up-urls-in-tables")
85
86
  ret.merge(
86
87
  datauriimage: defined?(datauriimage) ? datauriimage != "false" : nil,
88
+ suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
87
89
  hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
88
90
  use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
89
91
  break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
@@ -46,8 +46,7 @@ module Metanorma
46
46
 
47
47
  def coll_cover
48
48
  <<~COVER
49
- <html>
50
- <head/>
49
+ <html><head/>
51
50
  <body>
52
51
  <h1>{{ doctitle }}</h1>
53
52
  <h2>{{ docnumber }}</h2>
@@ -102,17 +101,6 @@ module Metanorma
102
101
  outname
103
102
  end
104
103
 
105
- # def xref_preprocess(xml)
106
- # svg_preprocess(xml)
107
- # key = (0...8).map { rand(65..90).chr }.join # random string
108
- # xml.root["type"] = key # to force recognition of internal refs
109
- # refs = eref_to_internal_eref(xml, key)
110
- # refs += xref_to_internal_eref(xml, key)
111
- # ins = new_hidden_ref(xml)
112
- # copy_repo_items_biblio(ins, xml)
113
- # insert_indirect_biblio(ins, refs, key)
114
- # end
115
-
116
104
  def xref_preprocess(xml)
117
105
  svg_preprocess(xml)
118
106
  key = (0...8).map { rand(65..90).chr }.join # random string
@@ -136,7 +124,7 @@ module Metanorma
136
124
 
137
125
  a["href"] = a["href"].sub(/^#/, "")
138
126
  m << "<target href='#{a['href']}'>"\
139
- "<xref target='#{a['href']}'/></target>"
127
+ "<xref target='#{a['href']}'/></target>"
140
128
  end
141
129
  end
142
130
  end
@@ -224,9 +212,7 @@ module Metanorma
224
212
 
225
213
  def recursive_string_keys(hash)
226
214
  case hash
227
- when Hash then Hash[
228
- hash.map { |k, v| [k.to_s, recursive_string_keys(v)] }
229
- ]
215
+ when Hash then hash.map { |k, v| [k.to_s, recursive_string_keys(v)] }.to_h
230
216
  when Enumerable then hash.map { |v| recursive_string_keys(v) }
231
217
  else
232
218
  hash
@@ -246,9 +232,8 @@ module Metanorma
246
232
  directives: ["presentation-xml", "bare-after-first"],
247
233
  bibdata: {
248
234
  title: {
249
- type: "title-main",
250
- language: @lang,
251
- content: xml.at(ns("//bibdata/title")).text,
235
+ type: "title-main", language: @lang,
236
+ content: xml.at(ns("//bibdata/title")).text
252
237
  },
253
238
  type: "collection",
254
239
  docid: {
@@ -257,11 +242,10 @@ module Metanorma
257
242
  },
258
243
  },
259
244
  manifest: {
260
- level: "collection",
261
- title: "Collection",
245
+ level: "collection", title: "Collection",
262
246
  docref: files.sort_by { |f| f[:order] }.each.map do |f|
263
247
  { fileref: f[:url], identifier: f[:title] }
264
- end,
248
+ end
265
249
  },
266
250
  }
267
251
  recursive_string_keys(ret).to_yaml
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.3.8".freeze
2
+ VERSION = "1.3.11".freeze
3
3
  end
data/metanorma.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.required_ruby_version = ">= 2.5.0"
24
24
 
25
25
  spec.add_runtime_dependency "asciidoctor"
26
- spec.add_runtime_dependency "fontist", "~> 1.9.0"
26
+ spec.add_runtime_dependency "fontist", "~> 1.11"
27
27
  spec.add_runtime_dependency "htmlentities"
28
28
  spec.add_runtime_dependency "metanorma-utils", "~> 1.2.0"
29
29
  spec.add_runtime_dependency "mn2pdf", "~> 1"
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: 1.3.8
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.9.0
33
+ version: '1.11'
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: 1.9.0
40
+ version: '1.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: htmlentities
43
43
  requirement: !ruby/object:Gem::Requirement