html2doc 1.9.0 → 1.9.1

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: bd9aa0c3f133e294fecba1a04b8b3fb817029f5caef8449e00544e6b5f1e78f9
4
- data.tar.gz: 7cca11025865ec7ed9e4cfd40223df969e2edbeae16809559ed10a9fae678056
3
+ metadata.gz: abee9d2b61164e6a1ca6a93832d2f0883fd7f759287590e0a3995287f1711964
4
+ data.tar.gz: efaee47d719f40b076dbc851299e7fd59594a77b3af1654fe3827ba1cce28e6a
5
5
  SHA512:
6
- metadata.gz: a1d1308b98007926b078afb54e43906f613366236997f563141a56b9a7852d6d98a682fe920e5d9855c46233a04e71123cee8e7e5a6b46820cc22de5d2cd9859
7
- data.tar.gz: e494f012eb58a10268227e3a445bc0ae2d592f023f2eb0d9fb57133d444bb507b8b5ec428018a8f7e01020e06b547593b1f41b208e8146ba136963e7fee99b03
6
+ metadata.gz: 7898834a57a94b995beea51a93270efa90b19f247f8d3bb4d8ee95d9216e9c3828ff8991432a7ac561fe7257fe5ae43760733f035d5562e4f6fc2953c5a9f597
7
+ data.tar.gz: 78ac742fe5ca906728541c21973739ea6b22256762fc361a9fc7264e3f966fd14f0f29e8f30e2f5a77b8c739201089decf88f3b4c8361f01ecea0413b1c3f464
data/lib/html2doc/math.rb CHANGED
@@ -167,7 +167,8 @@ class Html2Doc
167
167
  doc.root = ooxml_cleanup(xml, docnamespaces)
168
168
  # d = xml.parent["block"] != "false" # display_style
169
169
  ooxml = Nokogiri::XML(Plurimath::Math
170
- .parse(doc.root.to_xml(indent: 0), :mathml).to_omml(split_on_linebreak: true))
170
+ .parse(doc.root.to_xml(indent: 0), :mathml)
171
+ .to_omml(split_on_linebreak: true))
171
172
  ooxml = unitalic(accent_tr(ooxml))
172
173
  ooxml = ooml_clean(uncenter(xml, ooxml))
173
174
  xml.swap(ooxml)
@@ -217,15 +218,20 @@ class Html2Doc
217
218
  alignnode = math.xpath(STYLE_BEARING_NODE).last
218
219
  ooxml.document? and ooxml = ooxml.root
219
220
  ret = uncenter_unneeded(math, ooxml, alignnode) and return ret
220
- dir = "left"
221
- alignnode["style"]&.include?("text-align:right") and dir = "right"
222
- ooxml.name == "oMathPara" or
223
- ooxml.wrap("<m:oMathPara></m:oMathPara>")
221
+ dir = ooxml_alignment(alignnode)
222
+ ooxml.name == "oMathPara" or ooxml.wrap("<m:oMathPara></m:oMathPara>")
224
223
  ooxml.elements.first.previous =
225
224
  "<m:oMathParaPr><m:jc m:val='#{dir}'/></m:oMathParaPr>"
226
225
  ooxml
227
226
  end
228
227
 
228
+ def ooxml_alignment(alignnode)
229
+ dir = "left"
230
+ /text-align:\s*right/.match?(alignnode["style"]) and dir = "right"
231
+ /text-align:\s*center/.match?(alignnode["style"]) and dir = "center"
232
+ dir
233
+ end
234
+
229
235
  def uncenter_unneeded(math, ooxml, alignnode)
230
236
  (math_block?(ooxml, math) || !alignnode) and return ooxml
231
237
  math_only_para?(alignnode) and return nil
@@ -1,3 +1,3 @@
1
1
  class Html2Doc
2
- VERSION = "1.9.0".freeze
2
+ VERSION = "1.9.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
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-03-31 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64