html2doc 1.5.5 → 1.6.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: 46856bf56ad5dd95f8f5781dc11049bb4600060c28c49715a262837ece8028bf
4
- data.tar.gz: 866ba19867f233b45aeee436df719679623d671902b30476b61952f7a6357e1f
3
+ metadata.gz: 47535bf46876ee49a732b6c136f78b58a9ac009f880b95c5a73c8770293f3735
4
+ data.tar.gz: a052e0c3ba3ee27ca208b2624d7a832cba67bcc959f1ec5da36f9a7049c26c35
5
5
  SHA512:
6
- metadata.gz: b949f47c356437ce418f65ce7fd1c497648d0d0e960fe1e05d7318d280ddf6de23ddad8e5ab94a18f447b3eaba948b2a4db69ca2d00f0dcfebd692933a64c1da
7
- data.tar.gz: 953999bd39aa1c1b6a0e1a34c939dcbdba01242c898f5a587eab546b4c9a4578e8051c9c68b49900390fcb3ab5d2de4ad6f0f1bce1af5a8ee6e7bd4daf300966
6
+ metadata.gz: '096dc5a7fe4b35e5afdec632f37b28f9980fcbcba4222e1ec1eb81fe4653a62cc00c5d9b90ed38ae54d4320ea8bf7e0fd0698625045504d371bcb90fb6247a54'
7
+ data.tar.gz: 7aeebef3892dc2273bc4ab9899624fc113b1989c3af097204b4f73eb250a7d52e8b3cfe62439e84fb179c1e9bbc96563af669d87f56b15dd82b4fc99953a2227
data/lib/html2doc/base.rb CHANGED
@@ -53,7 +53,7 @@ class Html2Doc
53
53
  end
54
54
 
55
55
  def process_html(result)
56
- docxml = to_xhtml(asciimath_to_mathml(result, @asciimathdelims))
56
+ docxml = to_xhtml(result)
57
57
  define_head(cleanup(docxml))
58
58
  msword_fix(from_xhtml(docxml))
59
59
  end
data/lib/html2doc/math.rb CHANGED
@@ -5,29 +5,6 @@ require "nokogiri"
5
5
  require "plane1converter"
6
6
 
7
7
  class Html2Doc
8
- def asciimath_to_mathml1(expr, retain_asciimath)
9
- ret = Plurimath::Math.parse(HTMLEntities.new.decode(expr), "asciimath").to_mathml
10
- .gsub(/<math>/, "<math xmlns='http://www.w3.org/1998/Math/MathML'>").strip
11
- retain_asciimath and
12
- ret += "<asciimath>#{@c.encode(@c.decode(expr), :basic)}</asciimath>"
13
- ret
14
- rescue StandardError => e
15
- puts "parsing: #{expr}"
16
- puts e.message
17
- raise e
18
- end
19
-
20
- def asciimath_to_mathml(doc, delims, retain_asciimath: false)
21
- return doc if delims.nil? || delims.size < 2
22
-
23
- m = doc.split(/(#{Regexp.escape(delims[0])}|#{Regexp.escape(delims[1])})/)
24
- m.each_slice(4).map.with_index do |(*a), i|
25
- progress_conv(i, 500, (m.size / 4).floor, 1000, "AsciiMath")
26
- a[2].nil? or a[2] = asciimath_to_mathml1(a[2], retain_asciimath)
27
- a.size > 1 ? a[0] + a[2] : a[0]
28
- end.join
29
- end
30
-
31
8
  def progress_conv(idx, step, total, threshold, msg)
32
9
  return unless (idx % step).zero? && total > threshold && idx.positive?
33
10
 
@@ -1,3 +1,3 @@
1
1
  class Html2Doc
2
- VERSION = "1.5.5".freeze
2
+ VERSION = "1.6.0".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.5.5
4
+ version: 1.6.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: 2023-06-29 00:00:00.000000000 Z
11
+ date: 2023-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities