mathematical 1.6.3 → 1.6.4

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: 4568108bfbc246057ca2e9db23882463e1601cc7
4
- data.tar.gz: b94b870f6af15c07f5d0e39c2cdb2057c99803ac
3
+ metadata.gz: 2207bcef44b1c9ae1c2dd1b1f7348c5fd70ce47b
4
+ data.tar.gz: 88f6e65f7fad7e0f1ffb8f346f105f303632dccc
5
5
  SHA512:
6
- metadata.gz: 88c8d49ac39d67747a485af87320a37b896fe3f3c29b2bfde3fb5399ad8e4072bfece30a12fd84e20dbbd67f8ba8dd679eae400e6c138ecc0176a8344eed437f
7
- data.tar.gz: 06999c4712c0a7f0e28611b509793a6ea748326236a7a5db7c097bf25b4b5b081cfcc8daa6309c17f81d4aa760e7f6f801c49cfb0fbddc901ef1bc47ca7a5841
6
+ metadata.gz: 29066ed876e4164a42a493db07949ce1d788012337ede737028fa31f5ee536959a777406be1d704bead5cca94afb32f0f8d7782f2cd0619db5a78ae1e1c1cb0c
7
+ data.tar.gz: dee14be9d6b0210864e6b7d7e2037f5ceca27607e27868e8ff31195f64be719b4b0e9b4b50b72579bac9ca6d58da6994ebbb4f5208e72e911143c963fc1fb215
data/README.md CHANGED
@@ -90,7 +90,7 @@ That is, while the first and last elements are valid TeX math, the middle one is
90
90
  | `:base64` | A boolean determining whether Mathematical's output should be a base64-encoded SVG string | `false`
91
91
  | `:maxsize` | A numeral indicating the `MAXSIZE` the output string can be. | `unsigned long`
92
92
  | `:format` | A symbol indicating whether you want an `:svg`, `:png`, or `:mathml` output. | `:svg`
93
- | `:delimiter` | A symbol indicating whether you want an `:dollar` for inline (`$..$`), `:double` for display (`$$..$$`), `:parens` for inline (`\(..\)`), or `:brackets` for display (`[..\]`). You can also pass in an array of symbols to have multiple delimiters considered. | `[:dollar, :double]`
93
+ | `:delimiter` | A symbol indicating whether you want an `:dollar` for inline (`$..$`), `:double` for display (`$$..$$`), `:parens` for inline (`\(..\)`), `:brackets` for display (`[..\]`), or `:environments` for parsing bare `\\begin..\\end` environments. You can also pass in an array of symbols to have multiple delimiters considered. | `[:dollar, :double]`
94
94
 
95
95
  Pass these in like this:
96
96
 
@@ -7,7 +7,7 @@
7
7
  //
8
8
 
9
9
  #ifndef _WIN32
10
- #ifndef MATHEMATICAL_SKIP_STRDUP
10
+ #ifndef IS_TRAVISCI
11
11
  #ifndef HAVE_STRDUP
12
12
 
13
13
  #include <stdlib.h>
@@ -7,7 +7,7 @@
7
7
  //
8
8
 
9
9
  #ifndef _WIN32
10
- #ifndef MATHEMATICAL_SKIP_STRDUP
10
+ #ifndef IS_TRAVISCI
11
11
  #ifndef HAVE_STRDUP
12
12
  #define HAVE_STRDUP
13
13
 
@@ -219,3 +219,24 @@ void test_delimiters__filter_mixed_environment(void)
219
219
  cl_assert_equal_s(fixture_mml, trim(result));
220
220
  free(fixture_tex);
221
221
  }
222
+
223
+ void test_delimiters__parse_environment_single_equation(void)
224
+ {
225
+ fixture_tex = read_fixture_tex("delimiters/single_equation.txt");
226
+ fixture_mml = read_fixture_mml("delimiters/single_equation.html");
227
+ result = mtex2MML_parse(fixture_tex, strlen(fixture_tex), MTEX2MML_DELIMITER_ENVIRONMENTS);
228
+
229
+ cl_assert_equal_s(fixture_mml, trim(result));
230
+ free(fixture_tex);
231
+ }
232
+
233
+ void test_delimiters__filter_environment_single_equation(void)
234
+ {
235
+ fixture_tex = read_fixture_tex("delimiters/single_equation.txt");
236
+ fixture_mml = read_fixture_mml("delimiters/single_equation.html");
237
+ mtex2MML_text_filter(fixture_tex, strlen(fixture_tex), MTEX2MML_DELIMITER_ENVIRONMENTS);
238
+ result = mtex2MML_output();
239
+
240
+ cl_assert_equal_s(fixture_mml, trim(result));
241
+ free(fixture_tex);
242
+ }
@@ -0,0 +1 @@
1
+ <math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><semantics><mrow><mtable><mlabeledtr><mtd><mtext>(1)</mtext></mtd><mtd><mi>f</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mo stretchy="false">(</mo><mi>x</mi><mo>+</mo><mi>a</mi><mo stretchy="false">)</mo><mo stretchy="false">(</mo><mi>x</mi><mo>+</mo><mi>b</mi><mo stretchy="false">)</mo></mtd></mlabeledtr></mtable></mrow><annotation encoding='application/x-tex'></annotation></semantics></math>
@@ -0,0 +1,3 @@
1
+ \begin{equation}
2
+ f(x)=(x+a)(x+b)
3
+ \end{equation}
@@ -9,6 +9,7 @@ class Configuration
9
9
  define :double, 2
10
10
  define :parens, 4
11
11
  define :brackets, 8
12
+ define :environments, 16
12
13
 
13
14
  def self.option_exists?(option)
14
15
  unless Delimiters.keys.include?(option)
@@ -1,3 +1,3 @@
1
1
  class Mathematical
2
- VERSION = '1.6.3'.freeze
2
+ VERSION = '1.6.4'.freeze
3
3
  end
@@ -45,6 +45,17 @@ class Mathematical::BasicTest < MiniTest::Test
45
45
  assert_equal(fixture_mml, output)
46
46
  end
47
47
 
48
+ def test_environments
49
+ render = Mathematical.new(:delimiter => :environments, :format => :mathml)
50
+
51
+ fixture_tex = "\\begin{equation}f(x)=(x+a)(x+b)\\end{equation}"
52
+ fixture_mml = File.read(File.join(MTEX2MML_FIXTURES_DIR, 'delimiters', 'single_equation.html')).strip
53
+ result = render.render(fixture_tex)
54
+ output = result[:data]
55
+
56
+ assert_equal(fixture_mml, output)
57
+ end
58
+
48
59
  def test_mixed
49
60
  render = Mathematical.new(:delimiter => [:brackets, :double], :format => :mathml)
50
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathematical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.3
4
+ version: 1.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -1401,6 +1401,8 @@ files:
1401
1401
  - ext/mathematical/mtex2MML/tests/fixtures/delimiters/mixed_env.txt
1402
1402
  - ext/mathematical/mtex2MML/tests/fixtures/delimiters/parens.html
1403
1403
  - ext/mathematical/mtex2MML/tests/fixtures/delimiters/single_dollar.html
1404
+ - ext/mathematical/mtex2MML/tests/fixtures/delimiters/single_equation.html
1405
+ - ext/mathematical/mtex2MML/tests/fixtures/delimiters/single_equation.txt
1404
1406
  - ext/mathematical/mtex2MML/tests/fixtures/env/aligned_ex_spacing.html
1405
1407
  - ext/mathematical/mtex2MML/tests/fixtures/env/aligned_ex_spacing.txt
1406
1408
  - ext/mathematical/mtex2MML/tests/fixtures/env/aligned_no_ex_spacing.html