html2doc 1.9.0 → 1.9.2

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: a78b87b6a657f39c29e047bd6eddebefb3fad81ef91a863207bc4c10ff4c9670
4
+ data.tar.gz: 0ebf87be9c727d47d82f80d24d3ad2464d6fb2f63d148cad8bf4ae35774c6d86
5
5
  SHA512:
6
- metadata.gz: a1d1308b98007926b078afb54e43906f613366236997f563141a56b9a7852d6d98a682fe920e5d9855c46233a04e71123cee8e7e5a6b46820cc22de5d2cd9859
7
- data.tar.gz: e494f012eb58a10268227e3a445bc0ae2d592f023f2eb0d9fb57133d444bb507b8b5ec428018a8f7e01020e06b547593b1f41b208e8146ba136963e7fee99b03
6
+ metadata.gz: d069eacfc9454730817db1f5e3e81b197917f2a1a3d093892e2ae2142b9b530f60a70d0b283a109c7f403da4232bdbbd9fc238a34abb8b996888f712f10b0c63
7
+ data.tar.gz: e4a83b5cf61a6270d849356f5c54b72381963b51671bea6f14d11348acee83536854e01d3d3a1a0841bde2d23eb6793826d1cfbd7215fa50986330fe9e9db817
data/html2doc.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_dependency "thread_safe"
38
38
  spec.add_dependency "uuidtools"
39
39
  spec.add_dependency "unitsml"
40
- spec.add_dependency "vectory", "~> 0.7"
40
+ spec.add_dependency "vectory", "~> 0.8"
41
41
 
42
42
  spec.add_development_dependency "debug"
43
43
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
data/lib/html2doc/base.rb CHANGED
@@ -137,8 +137,8 @@ class Html2Doc
137
137
  def bookmarks(docxml)
138
138
  docxml.xpath("//*[@id][not(@name)][not(@style = 'mso-element:footnote')]")
139
139
  .each do |x|
140
- (x["id"].empty? ||
141
- %w(v:shapetype v:shape v:rect v:line v:group).include?(x.name)) and next
140
+ (x["id"].empty? || x.namespace&.prefix == "v" &&
141
+ %w(shapetype shape rect line group).include?(x.name)) and next
142
142
  if x.children.empty? then x.add_child("<a name='#{x['id']}'></a>")
143
143
  else x.children.first.previous = "<a name='#{x['id']}'></a>"
144
144
  end
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.2".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.2
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-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '0.7'
173
+ version: '0.8'
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '0.7'
180
+ version: '0.8'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: debug
183
183
  requirement: !ruby/object:Gem::Requirement