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 +4 -4
- data/README.md +1 -1
- data/ext/mathematical/lib/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/build/libmtex2MML.a +0 -0
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.c +1 -1
- data/ext/mathematical/mtex2MML/deps/strdup/strdup.h +1 -1
- data/ext/mathematical/mtex2MML/tests/delimiters.c +21 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/single_equation.html +1 -0
- data/ext/mathematical/mtex2MML/tests/fixtures/delimiters/single_equation.txt +3 -0
- data/lib/mathematical/configuration.rb +1 -0
- data/lib/mathematical/version.rb +1 -1
- data/test/mathematical/delimiters_test.rb +11 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2207bcef44b1c9ae1c2dd1b1f7348c5fd70ce47b
|
4
|
+
data.tar.gz: 88f6e65f7fad7e0f1ffb8f346f105f303632dccc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 (`\(..\)`),
|
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
|
|
Binary file
|
Binary file
|
@@ -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>
|
data/lib/mathematical/version.rb
CHANGED
@@ -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.
|
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
|