math-to-itex 0.3.0 → 0.4.0
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 +4 -4
- data/lib/math-to-itex.rb +7 -1
- data/lib/math-to-itex/parser.rb +3 -3
- data/lib/math-to-itex/version.rb +1 -1
- data/math-to-itex.gemspec +1 -0
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc9008b23eedaa458a2962e43000547a02dfb9d7
|
4
|
+
data.tar.gz: e9d3cbf8ae1af8e27a30f85ae1a2fa0a61aeecea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91cf777900121b4697153ac63b1f80566d33c7895a282b5ec140b165dc47b57942ab00482f613bdf46bf4b41c5e50b28898d27172caf365db9e158c766c5c2f4
|
7
|
+
data.tar.gz: 0ba37e2ebce7d44ba1ddcfd073771ad85b8aa8d47fb639e6766aaf9ba872df73f9211544d8c0c110709b1c26f9a7dbfc8938205bf9fbf4daa1c157b7ba5833fe
|
data/lib/math-to-itex.rb
CHANGED
@@ -23,9 +23,15 @@ module MathToItex
|
|
23
23
|
elsif maths =~ /\A\\\[(?!\\\[)/
|
24
24
|
just_maths = maths[2..-3]
|
25
25
|
type = :display
|
26
|
-
elsif maths =~ /\A\\begin(?!\\begin)/
|
26
|
+
elsif maths =~ /\A\\begin{equation}(?!\\begin{equation})/
|
27
27
|
just_maths = maths[16..-15]
|
28
28
|
type = :display
|
29
|
+
elsif maths =~ /\A\\begin{math}(?!\\begin{math})/
|
30
|
+
just_maths = maths[12..-11]
|
31
|
+
type = :inline
|
32
|
+
elsif maths =~ /\A\\begin{displaymath}(?!\\begin{displaymath})/
|
33
|
+
just_maths = maths[19..-18]
|
34
|
+
type = :display
|
29
35
|
end
|
30
36
|
|
31
37
|
# this is the format itex2MML expects
|
data/lib/math-to-itex/parser.rb
CHANGED
@@ -12,18 +12,18 @@ module MathToItex
|
|
12
12
|
# group 3, match escaped bracket
|
13
13
|
(\\\[)|
|
14
14
|
# group 4, match begin equation
|
15
|
-
(\\begin\{equation\})
|
15
|
+
(\\begin\{(?:equation|math|displaymath)\})
|
16
16
|
)
|
17
17
|
(.*?(\g<1>)?.*?) # match everything in between including nested LaTeX equations
|
18
18
|
(?<!\\) # negative look-behind to make sure end is not escaped
|
19
19
|
# if group 1 was start, match \1
|
20
|
-
(?(1)(?<!\$)\1(
|
20
|
+
(?(1)(?<!\$)\1(?!\$|\d)|
|
21
21
|
# if group 2 was start, escaped parenthesis is end
|
22
22
|
(?(2)\\\)|
|
23
23
|
# if group 3 was start, escaped bracket is end
|
24
24
|
(?(3)\\\]|
|
25
25
|
# otherwise group 4 was start, match end equation
|
26
|
-
\\end\{equation\}
|
26
|
+
\\end\{(?:equation|math|displaymath)\}
|
27
27
|
)))
|
28
28
|
/xm
|
29
29
|
end
|
data/lib/math-to-itex/version.rb
CHANGED
data/math-to-itex.gemspec
CHANGED
metadata
CHANGED
@@ -1,27 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: math-to-itex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: test-unit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '0'
|
27
41
|
description: Pass in a string and turn all math equations into itex equations. Or,
|
@@ -35,11 +49,11 @@ files:
|
|
35
49
|
- LICENSE.txt
|
36
50
|
- README.md
|
37
51
|
- Rakefile
|
38
|
-
- math-to-itex.
|
52
|
+
- lib/math-to-itex.rb
|
39
53
|
- lib/math-to-itex/parser.rb
|
40
54
|
- lib/math-to-itex/support_parens.rb
|
41
55
|
- lib/math-to-itex/version.rb
|
42
|
-
-
|
56
|
+
- math-to-itex.gemspec
|
43
57
|
homepage: https://github.com/gjtorikian/math-to-itex
|
44
58
|
licenses:
|
45
59
|
- MIT
|
@@ -50,17 +64,17 @@ require_paths:
|
|
50
64
|
- lib
|
51
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
66
|
requirements:
|
53
|
-
- -
|
67
|
+
- - ">="
|
54
68
|
- !ruby/object:Gem::Version
|
55
69
|
version: '2.0'
|
56
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
|
-
- -
|
72
|
+
- - ">="
|
59
73
|
- !ruby/object:Gem::Version
|
60
74
|
version: '0'
|
61
75
|
requirements: []
|
62
76
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.4.5.1
|
64
78
|
signing_key:
|
65
79
|
specification_version: 4
|
66
80
|
summary: Turn math syntaxes into itex equations.
|