metanorma 1.5.2 → 1.5.3

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: 2dd771e6d08104e0da071e1a9326ebdd909565d6e53b5393b4375dde3507e157
4
- data.tar.gz: ff4931bf6d1fd1bbed2ffb47b4dbf6dbda95027caff1d24f388f881e4827da65
3
+ metadata.gz: 504b901a50469dec68785b7c3cb207e287757a7b2a86394843210dd90b8703ed
4
+ data.tar.gz: '097ecbfebaa22181ecbb33330d4d5a8b609a24bf56d3df882a4a50504324ba17'
5
5
  SHA512:
6
- metadata.gz: 55f9e339d45f4cd40e6666660fdd2ad2c52b85332c07b64b66f59208cabd703e79ac38dda55070c99cd79a45b09199fb487b7aa5701553e1599d8239f8a50959
7
- data.tar.gz: ba2ccbb163a0bad558a56680a8bf66d112ca3cc0f72fb87772b678b029d3c8ac3e27152f28442c5cade32149ab86a09e1ebebe19786e1a770c53f85036f3723e
6
+ metadata.gz: dc055a69f2d0ab1e130ea9692e438df7e8547529191b601581ae7547b410c03e2cd35b54fb1f574dfad9795c4e3113f2e60dea924a16be4537a30c6dd6d13cd1
7
+ data.tar.gz: 609f4b00335d2ded1b480edf5839518c3b2ee7d857a063a1b5dab8dc0a0d5a2b2232b6ae5502b92593c51bbb5cb53d3c969f86edfac804dc6e6aff24aa4cc1e1
@@ -60,7 +60,7 @@ module Metanorma
60
60
  %w(htmlstylesheet htmlcoverpage htmlintropage scripts
61
61
  scripts-override scripts-pdf wordstylesheet i18nyaml
62
62
  standardstylesheet header wordcoverpage wordintropage
63
- ulstyle olstyle htmlstylesheet-override bare
63
+ ulstyle olstyle htmlstylesheet-override bare toclevels
64
64
  htmltoclevels doctoclevels sectionsplit base-asset-path
65
65
  body-font header-font monospace-font title-font
66
66
  align-cross-elements wordstylesheet-override ieee-dtd
@@ -68,39 +68,50 @@ module Metanorma
68
68
  pdf-owner-password pdf-allow-copy-content pdf-allow-edit-content
69
69
  pdf-allow-assemble-document pdf-allow-edit-annotations
70
70
  pdf-allow-print pdf-allow-print-hq pdf-allow-fill-in-forms
71
- toc-figures toc-tables toc-recommendations fonts
72
- font-license-agreement pdf-allow-access-content
71
+ fonts font-license-agreement pdf-allow-access-content
73
72
  pdf-encrypt-metadata iso-word-template document-scheme
74
73
  localize-number iso-word-bg-strip-color
75
74
  modspec-identifier-base).freeze
76
75
 
76
+ EMPTY_ADOC_OPTIONS_DEFAULT_TRUE =
77
+ %w(data-uri-image suppress-asciimath-dup use-xinclude).freeze
78
+
79
+ EMPTY_ADOC_OPTIONS_DEFAULT_FALSE =
80
+ %w(hierarchical-assets break-up-urls-in-tables toc-figures
81
+ toc-tables toc-recommendations).freeze
82
+
83
+ def attr_name_normalise(name)
84
+ name.gsub(/-/, "").sub(/override$/, "_override").sub(/pdf$/, "_pdf")
85
+ .to_sym
86
+ end
87
+
77
88
  def extract_options(file)
78
89
  header = file.sub(/\n\n.*$/m, "\n")
79
90
  ret = ADOC_OPTIONS.each_with_object({}) do |w, acc|
80
91
  m = /\n:#{w}: ([^\n]+)\n/.match(header) or next
81
- acc[w.gsub(/-/, "").sub(/override$/, "_override")
82
- .sub(/pdf$/, "_pdf").to_sym] = m[1]
92
+ acc[attr_name_normalise(w)] = m[1]
83
93
  end
84
- /\n:data-uri-image: (?<datauriimage>[^\n]+)\n/ =~ header
85
- /\n:(?<hier_assets>hierarchical-assets:[^\n]*)\n/ =~ header
86
- /\n:(?<use_xinclude>use-xinclude:[^\n]*)\n/ =~ header
87
- /\n:(?<break_up>break-up-urls-in-tables:[^\n]*)\n/ =~ header
88
- /\n:suppress-asciimath-dup: (?<suppress_asciimath_dup>[^\n]+)\n/ =~ header
89
-
90
- defined?(hier_assets) and
91
- hier_assets = empty_attr(hier_assets, "hierarchical-assets")
92
- defined?(use_xinclude) and
93
- use_xinclude = empty_attr(use_xinclude, "use-xinclude")
94
- defined?(break_up) and
95
- break_up = empty_attr(break_up, "break-up-urls-in-tables")
96
- ret.merge(
97
- datauriimage: defined?(datauriimage) ? datauriimage != "false" : true,
98
- suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
99
- hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
100
- use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
101
- break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
102
- ).compact
94
+ ret2 = EMPTY_ADOC_OPTIONS_DEFAULT_TRUE.each_with_object({}) do |w, acc|
95
+ m = /\n:#{w}:([^\n]*)\n/.match(header) || [nil, "true"]
96
+ #require "debug" binding.b if w == "break-up-urls-in-tables"
97
+ acc[attr_name_normalise(w)] = (m[1].strip != "false")
98
+ end
99
+ ret3 = EMPTY_ADOC_OPTIONS_DEFAULT_FALSE.each_with_object({}) do |w, acc|
100
+ m = /\n:#{w}:([^\n]*)\n/.match(header) || [nil, "false"]
101
+ #require "debug" binding.b if w == "break-up-urls-in-tables"
102
+ acc[attr_name_normalise(w)] = !["false"].include?(m[1].strip)
103
+ end
104
+ ret.merge(ret2).merge(ret3).compact
103
105
  end
106
+
107
+ # ret.merge(
108
+ # datauriimage: defined?(datauriimage) ? datauriimage != "false" : true,
109
+ # suppressasciimathdup: defined?(suppress_asciimath_dup) ? suppress_asciimath_dup != "false" : nil,
110
+ # hierarchical_assets: defined?(hier_assets) ? hier_assets : nil,
111
+ # use_xinclude: defined?(use_xinclude) ? use_xinclude : nil,
112
+ # break_up_urls_in_tables: defined?(break_up) ? break_up : nil,
113
+ # ).compact
114
+ # end
104
115
  end
105
116
  end
106
117
  end
@@ -1,3 +1,3 @@
1
1
  module Metanorma
2
- VERSION = "1.5.2".freeze
2
+ VERSION = "1.5.3".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: 1.5.2
4
+ version: 1.5.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: 2022-11-07 00:00:00.000000000 Z
11
+ date: 2022-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor