isodoc 1.4.2 → 1.5.0

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: f3c777ea5977413526f9c0178d0460978e495a4292335201d871c1150b0f48ac
4
- data.tar.gz: d5a5cbf4385dbdaa4ab65be04bc902853a236d470247d093f35eb3c12fe3cbc4
3
+ metadata.gz: 46206b47756f66c1927ca1810020fbe63141a27f6ad000e95b7938f5b2f8cdcc
4
+ data.tar.gz: bbce350ccfa6c97bff0c45cccdc15febde0a2c17b1e415fb8132f205ba202d85
5
5
  SHA512:
6
- metadata.gz: 554df5885f22823b5aaec3453da4695fce9c0c32ee90de6830a4159f8029b070385f2124c9fae5a7082b63688df596f8ea2b39d58297e64f20304b0e40e030cb
7
- data.tar.gz: f8adad1944d3062b2ce674c7fb0201f81e6ad4ff43bdd4f43f08429b6cc808f5ab40aa1905473365e3b59d66a6a413a064fdbc20f755c986ed3a763b017fe5b3
6
+ metadata.gz: 7679fe14d35c348ffc9fcda332f27bf39e898337ae5c0cd7a8638e74f1d26a77ca528cad7d210b82f546336b80e0115c4131c49d9cec1ae82a8174d34002ead3
7
+ data.tar.gz: 20ca1c4d733511fa7f5dc5fe28295c754803b20167e3ae8d39209b1c2d3f63fc064308668a7c23cf834a6a1d93e46ec486931d2c189c0e47210507b32c0291a2
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "thread_safe"
35
35
  spec.add_dependency "uuidtools"
36
36
  spec.add_dependency "html2doc", "~> 1.0.0"
37
- spec.add_dependency "liquid"
37
+ spec.add_dependency "liquid", "~> 4"
38
38
  spec.add_dependency "twitter_cldr"
39
39
  spec.add_dependency "roman-numerals"
40
40
  spec.add_dependency "metanorma", "~> 1.2.0"
@@ -9,6 +9,7 @@ module IsoDoc
9
9
  class Convert < ::IsoDoc::Common
10
10
  attr_accessor :options
11
11
  attr_accessor :i18n
12
+ attr_accessor :meta
12
13
 
13
14
  # htmlstylesheet: Generic stylesheet for HTML
14
15
  # wordstylesheet: Generic stylesheet for Word
@@ -152,8 +152,8 @@ module IsoDoc::Function
152
152
  def populate_template(docxml, _format = nil)
153
153
  meta = @meta
154
154
  .get
155
- .merge(@labels || {})
156
- .merge(@meta.labels || {})
155
+ .merge(@labels ? {labels: @labels} : {})
156
+ .merge(@meta.labels ? {labels: @meta.labels} : {})
157
157
  .merge(fonts_options || {})
158
158
  template = liquid(docxml)
159
159
  template.render(meta.map { |k, v| [k.to_s, empty2nil(v)] }.to_h)
@@ -211,7 +211,11 @@ module IsoDoc
211
211
  def mathml1(f, locale)
212
212
  localize_maths(f, locale)
213
213
  return unless f.elements.size == 1 && f.elements.first.name == "mn"
214
- f.replace(f.at("./m:mn", MATHML).children)
214
+ if f.parent.name == "stem"
215
+ f.parent.replace(f.at("./m:mn", MATHML).children)
216
+ else
217
+ f.replace(f.at("./m:mn", MATHML).children)
218
+ end
215
219
  end
216
220
 
217
221
  def variant(docxml)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.4.2".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
@@ -96,7 +96,7 @@ module IsoDoc::WordFunction
96
96
  def generate_header(filename, _dir)
97
97
  return nil unless @header
98
98
  template = IsoDoc::Common.liquid(File.read(@header, encoding: "UTF-8"))
99
- meta = @meta.get.merge(@labels || {}).merge(@meta.labels || {})
99
+ meta = @meta.get.merge(@labels ? { labels: @labels } : {}).merge(@meta.labels ? { labels: @meta.labels } : {})
100
100
  meta[:filename] = filename
101
101
  params = meta.map { |k, v| [k.to_s, v] }.to_h
102
102
  Tempfile.open(%w(header html), :encoding => "utf-8") do |f|
@@ -37,7 +37,7 @@ it "localises numbers in MathML" do
37
37
 
38
38
  <preface>
39
39
  <p>
40
- <stem type='MathML'>30,000</stem>
40
+ 30,000
41
41
  <stem type='MathML'>
42
42
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
43
43
  <mi>P</mi>
@@ -248,7 +248,7 @@ end
248
248
 
249
249
  <preface>
250
250
  <p>
251
- <stem type='MathML'>30,000</stem>
251
+ 30,000
252
252
  <stem type='MathML'>
253
253
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
254
254
  <mi>P</mi>
@@ -382,7 +382,7 @@ it "localises numbers in MathML in French" do
382
382
  <language>fr</language>
383
383
  </bibdata>
384
384
  <preface>
385
- <p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
385
+ <p><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math>
386
386
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>1</mn><mo>−</mo><mi>p</mi></mrow></mfenced></mrow><mrow><mrow><mn>1.003</mn><mo>−</mo><mi>j</mi></mrow></mrow></msup></math></stem></p>
387
387
  </preface>
388
388
  </iso-standard>
@@ -395,7 +395,7 @@ it "localises numbers in MathML in French" do
395
395
 
396
396
  <preface>
397
397
  <p>
398
- <stem type='MathML'>30&#x202F;000</stem>
398
+ 30&#x202F;000
399
399
  <stem type='MathML'>
400
400
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
401
401
  <mi>P</mi>
@@ -506,7 +506,7 @@ it "customises localisation of numbers" do
506
506
 
507
507
  <preface>
508
508
  <p>
509
- <stem type='MathML'>30'000</stem>
509
+ 30'000
510
510
  <stem type='MathML'>
511
511
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
512
512
  <mi>P</mi>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.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: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: liquid
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '4'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '4'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: twitter_cldr
113
113
  requirement: !ruby/object:Gem::Requirement