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 +4 -4
- data/lib/html2doc/base.rb +1 -1
- data/lib/html2doc/math.rb +0 -23
- data/lib/html2doc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47535bf46876ee49a732b6c136f78b58a9ac009f880b95c5a73c8770293f3735
|
4
|
+
data.tar.gz: a052e0c3ba3ee27ca208b2624d7a832cba67bcc959f1ec5da36f9a7049c26c35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '096dc5a7fe4b35e5afdec632f37b28f9980fcbcba4222e1ec1eb81fe4653a62cc00c5d9b90ed38ae54d4320ea8bf7e0fd0698625045504d371bcb90fb6247a54'
|
7
|
+
data.tar.gz: 7aeebef3892dc2273bc4ab9899624fc113b1989c3af097204b4f73eb250a7d52e8b3cfe62439e84fb179c1e9bbc96563af669d87f56b15dd82b4fc99953a2227
|
data/lib/html2doc/base.rb
CHANGED
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
|
|
data/lib/html2doc/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|