math-to-itex 0.3.0 → 0.4.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
  SHA1:
3
- metadata.gz: 3798f2a18ba6cc7bf8b193b536692991fa6c9083
4
- data.tar.gz: 331b2da8e3eebf487aa8e824f6d60c990122aedc
3
+ metadata.gz: dc9008b23eedaa458a2962e43000547a02dfb9d7
4
+ data.tar.gz: e9d3cbf8ae1af8e27a30f85ae1a2fa0a61aeecea
5
5
  SHA512:
6
- metadata.gz: 83e5a19d8280ebfb4ec19b421925422ae3c457b79cfb6823cd1c913ff7954c3070b493adb0e6ebea0ffed4913406fa32bcc574c67cb338483bfe1cca12548f8d
7
- data.tar.gz: d877e75e3d63f47b3c6a17fdc808185ea1caa32c5467d0bfe9ed6dfb384994be829230aabfe71d9eaf50aa34f4a20c48f72165063f4b70ecae0f3f3653a7462c
6
+ metadata.gz: 91cf777900121b4697153ac63b1f80566d33c7895a282b5ec140b165dc47b57942ab00482f613bdf46bf4b41c5e50b28898d27172caf365db9e158c766c5c2f4
7
+ data.tar.gz: 0ba37e2ebce7d44ba1ddcfd073771ad85b8aa8d47fb639e6766aaf9ba872df73f9211544d8c0c110709b1c26f9a7dbfc8938205bf9fbf4daa1c157b7ba5833fe
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module MathToItex
2
- VERSION = "0.3.0"
2
+ VERSION = '0.4.0'
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "test-unit"
24
25
  end
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.3.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: 2014-06-13 00:00:00.000000000 Z
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.gemspec
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
- - lib/math-to-itex.rb
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.0.3
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.