mathematical 1.2.2 → 1.3.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -45
  3. data/Rakefile +6 -0
  4. data/ext/mathematical/extconf.rb +1 -1
  5. data/ext/mathematical/lasem/Makefile +1037 -0
  6. data/ext/mathematical/lasem/config.h +87 -0
  7. data/ext/mathematical/lasem/docs/Makefile +793 -0
  8. data/ext/mathematical/lasem/docs/reference/Makefile +735 -0
  9. data/ext/mathematical/lasem/docs/reference/lasem/Makefile +1023 -0
  10. data/ext/mathematical/lasem/itex2mml/Makefile +742 -0
  11. data/ext/mathematical/lasem/itex2mml/lex.yy.c +6294 -0
  12. data/ext/mathematical/lasem/itex2mml/y.tab.c +5796 -0
  13. data/ext/mathematical/lasem/itex2mml/y.tab.h +378 -0
  14. data/ext/mathematical/lasem/po/Makefile +413 -0
  15. data/ext/mathematical/lasem/src/Makefile +1322 -0
  16. data/ext/mathematical/lasem/src/lsmdomenumtypes.c +99 -0
  17. data/ext/mathematical/lasem/src/lsmdomenumtypes.h +26 -0
  18. data/ext/mathematical/lasem/src/lsmmathmlattributes.c +22 -0
  19. data/ext/mathematical/lasem/src/lsmmathmlenums.c +8 -0
  20. data/ext/mathematical/lasem/src/lsmmathmlenums.h +7 -0
  21. data/ext/mathematical/lasem/src/lsmmathmlenumtypes.c +737 -0
  22. data/ext/mathematical/lasem/src/lsmmathmlenumtypes.h +93 -0
  23. data/ext/mathematical/lasem/src/lsmmathmlmathelement.c +9 -1
  24. data/ext/mathematical/lasem/src/lsmmathmlstyle.h +8 -0
  25. data/ext/mathematical/lasem/src/lsmmathmlstyleelement.c +78 -0
  26. data/ext/mathematical/lasem/src/lsmmathmlstyleelement.h +7 -0
  27. data/ext/mathematical/lasem/src/lsmmathmltablerowelement.c +2 -2
  28. data/ext/mathematical/lasem/src/lsmmathmltraits.h +8 -0
  29. data/ext/mathematical/lasem/src/lsmsvgenumtypes.c +1083 -0
  30. data/ext/mathematical/lasem/src/lsmsvgenumtypes.h +111 -0
  31. data/ext/mathematical/lasem/tests/Makefile +765 -0
  32. data/ext/mathematical/mtex2MML/Makefile +25 -16
  33. data/ext/mathematical/mtex2MML/build/libmtex2MML.a +0 -0
  34. data/ext/mathematical/mtex2MML/build/mtex2MML.h +1 -1
  35. data/ext/mathematical/mtex2MML/src/lex.yy.c +3140 -3130
  36. data/ext/mathematical/mtex2MML/src/main.c +1 -1
  37. data/ext/mathematical/mtex2MML/src/mtex2MML.h +1 -1
  38. data/ext/mathematical/mtex2MML/src/mtex2MML.l +4 -1
  39. data/ext/mathematical/mtex2MML/src/mtex2MML.y +41 -42
  40. data/ext/mathematical/mtex2MML/src/parse_extras.c +148 -58
  41. data/ext/mathematical/mtex2MML/src/parse_extras.h +11 -3
  42. data/ext/mathematical/mtex2MML/src/y.tab.c +5902 -6075
  43. data/ext/mathematical/mtex2MML/src/y.tab.h +306 -313
  44. data/ext/mathematical/mtex2MML/tests/basic.c +2 -2
  45. data/ext/mathematical/mtex2MML/tests/deps/trim/trim.h +1 -1
  46. data/ext/mathematical/mtex2MML/tests/maliciousness.c +0 -1
  47. data/ext/mathematical/mtex2MML/tests/mathjax.c +11 -1
  48. data/ext/mathematical/mtex2MML/tests/numbered_equations.c +28 -1
  49. data/lib/mathematical/version.rb +1 -1
  50. data/mathematical.gemspec +3 -3
  51. data/test/mathematical/fixtures/png/numeric_test_1.png +0 -0
  52. data/test/mathematical/fixtures/png/numeric_test_3.png +0 -0
  53. data/test/mathematical/fixtures_test.rb +1 -6
  54. data/test/mathematical/mathjax_test.rb +2 -0
  55. data/test/test_helper.rb +10 -0
  56. metadata +28 -11
@@ -5,7 +5,7 @@
5
5
 
6
6
  static char *fixture_tex;
7
7
  static char *fixture_mml;
8
- static char *result;
8
+ static const char *result;
9
9
 
10
10
  void test_basic__initialize(void)
11
11
  {
@@ -58,7 +58,7 @@ void test_basic__filter(void)
58
58
  {
59
59
  fixture_tex = read_fixture_tex("basic/filter.txt");
60
60
  fixture_mml = read_fixture_mml("basic/filter.html");
61
- int status = mtex2MML_filter(fixture_tex, strlen(fixture_tex));
61
+ mtex2MML_filter(fixture_tex, strlen(fixture_tex));
62
62
  result = mtex2MML_output();
63
63
 
64
64
  cl_assert_equal_s(fixture_mml, result);
@@ -4,4 +4,4 @@
4
4
  char *
5
5
  trim(char *str);
6
6
 
7
- #endif /*__TRIM__*/
7
+ #endif /*__TRIM__*/
@@ -5,7 +5,6 @@
5
5
  static char *fixture_tex;
6
6
  static char *fixture_mml;
7
7
  static char *result;
8
- static char *huge;
9
8
 
10
9
  void test_maliciousness__initialize(void)
11
10
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
  static char *fixture_tex;
7
7
  static char *fixture_mml;
8
- static char *result;
8
+ static const char *result;
9
9
 
10
10
  void test_mathjax__initialize(void)
11
11
  {
@@ -1869,6 +1869,16 @@ void test_mathjax__otherverb2(void)
1869
1869
  cl_assert_equal_s(fixture_mml, result);
1870
1870
  }
1871
1871
 
1872
+ void test_mathjax__referencesnotag1(void)
1873
+ {
1874
+ fixture_tex = read_fixture_tex("MathJax/LaTeXToMathML-tex/references/notag-1.txt");
1875
+ fixture_mml = read_fixture_mml("MathJax/LaTeXToMathML-out/references/notag-1.html");
1876
+ mtex2MML_filter(fixture_tex, strlen(fixture_tex));
1877
+ result = mtex2MML_output();
1878
+
1879
+ cl_assert_equal_s(fixture_mml, result);
1880
+ }
1881
+
1872
1882
  void test_mathjax__rootsroot1(void)
1873
1883
  {
1874
1884
  fixture_tex = read_fixture_tex("MathJax/LaTeXToMathML-tex/roots/root-1.txt");
@@ -5,7 +5,7 @@
5
5
 
6
6
  static char *fixture_tex;
7
7
  static char *fixture_mml;
8
- static char *result;
8
+ static const char *result;
9
9
 
10
10
  void test_numbered_equations__initialize(void)
11
11
  {
@@ -45,3 +45,30 @@ void test_numbered_equations__multiple_equations(void)
45
45
 
46
46
  cl_assert_equal_s(fixture_mml, result);
47
47
  }
48
+
49
+ void test_numbered_equations__single_notag(void)
50
+ {
51
+ fixture_tex = read_fixture_tex("numbered_equations/single_notag.txt");
52
+ fixture_mml = read_fixture_mml("numbered_equations/single_notag.html");
53
+ result = mtex2MML_global_parse(fixture_tex, strlen(fixture_tex), 1);
54
+
55
+ cl_assert_equal_s(fixture_mml, result);
56
+ }
57
+
58
+ void test_numbered_equations__single_nonumber(void)
59
+ {
60
+ fixture_tex = read_fixture_tex("numbered_equations/single_nonumber.txt");
61
+ fixture_mml = read_fixture_mml("numbered_equations/single_nonumber.html");
62
+ result = mtex2MML_global_parse(fixture_tex, strlen(fixture_tex), 1);
63
+
64
+ cl_assert_equal_s(fixture_mml, result);
65
+ }
66
+
67
+ void test_numbered_equations__multiple_notag_nonumber(void)
68
+ {
69
+ fixture_tex = read_fixture_tex("numbered_equations/multiple_notag_nonumber.txt");
70
+ fixture_mml = read_fixture_mml("numbered_equations/multiple_notag_nonumber.html");
71
+ result = mtex2MML_global_parse(fixture_tex, strlen(fixture_tex), 1);
72
+
73
+ cl_assert_equal_s(fixture_mml, result);
74
+ }
@@ -1,3 +1,3 @@
1
1
  class Mathematical
2
- VERSION = '1.2.2'
2
+ VERSION = '1.3.0'
3
3
  end
data/mathematical.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Mathematical::VERSION
9
9
  spec.authors = ['Garen Torikian']
10
10
  spec.email = ['gjtorikian@gmail.com']
11
- spec.summary = %w(Quickly convert math equations into beautiful SVGs/PNGs/MathML.)
12
- spec.description = %w(A very fast way to turn LaTeX math equations into beautifully rendered SVGs, to embed on the web. This library is mostly written in C and is a general purpose wrapper to GNOME's Lasem.)
11
+ spec.summary = 'Quickly convert math equations into beautiful SVGs/PNGs/MathML.'
12
+ spec.description = 'A very fast way to turn LaTeX math equations into beautifully rendered SVGs, to embed on the web. This library is mostly written in C and is a general purpose wrapper to GNOME\'s Lasem.'
13
13
  spec.homepage = 'https://github.com/gjtorikian/mathematical'
14
14
  spec.license = 'MIT'
15
15
 
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'rake-compiler', '~> 0.9'
27
27
  spec.add_development_dependency 'bundler', '~> 1.5'
28
28
  spec.add_development_dependency 'minitest', '~> 5.6'
29
- spec.add_development_dependency 'math-to-itex', '0.3.0'
29
+ spec.add_development_dependency 'math-to-itex', '~> 0.3'
30
30
  spec.add_development_dependency 'nokogiri', '~> 1.6'
31
31
  end
@@ -14,12 +14,7 @@ class Mathematical::FixturesTest < MiniTest::Test
14
14
 
15
15
  if ENV['MATHEMATICAL_GENERATE_SAMPLE']
16
16
  next unless name.match /compliance/
17
- actual = MathToItex(source).convert do |eq, type|
18
- svg_content = Mathematical.new(:base64 => false).render(eq)
19
- # remove \ and $, remove whitespace, keep alphanums, remove extraneous - and trailing -
20
- filename = eq.gsub(/[\$\\]*/, '').gsub(/\s+/, '-').gsub(/[^a-zA-Z\d]/, '-').gsub(/-{2,}/, '-').gsub(/-$/, '')
21
- File.open("samples/fixtures/#{filename}.svg", 'w') { |file| file.write svg_content[:data] }
22
- end
17
+ write_sample(source)
23
18
  end
24
19
 
25
20
  actual = MathToItex(source).convert do |eq, type|
@@ -14,6 +14,8 @@ class Mathematical::MathJaxTest < MiniTest::Test
14
14
  tex_contents = File.read(tex)
15
15
  data = render_svg.render(tex_contents)
16
16
 
17
+ write_sample(tex_contents, File.basename(tex, '.txt')) if ENV['MATHEMATICAL_GENERATE_SAMPLE']
18
+
17
19
  # assert the SVG actually rendered
18
20
  doc = Nokogiri::HTML(data[:data])
19
21
  assert_empty doc.search(%(//svg[@width='0pt']))
data/test/test_helper.rb CHANGED
@@ -51,3 +51,13 @@ def write_svg_to_test_file(converted)
51
51
 
52
52
  File.open('test.html', 'w') { |f| f.write(text) }
53
53
  end
54
+
55
+ def write_sample(source, name = nil)
56
+ return unless ENV['MATHEMATICAL_GENERATE_SAMPLE']
57
+ MathToItex(source).convert do |eq, type|
58
+ svg_content = Mathematical.new(:base64 => false).render(eq)
59
+ # remove \ and $, remove whitespace, keep alphanums, remove extraneous - and trailing -
60
+ filename = name || eq.gsub(/[\$\\]*/, '').gsub(/\s+/, '-').gsub(/[^a-zA-Z\d]/, '-').gsub(/-{2,}/, '-').gsub(/-$/, '')
61
+ File.open("samples/fixtures/#{filename}.svg", 'w') { |file| file.write svg_content[:data] }
62
+ end
63
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mathematical
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.3.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: 2015-05-06 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: math-to-itex
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.0
75
+ version: '0.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.0
82
+ version: '0.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: nokogiri
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -94,10 +94,9 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.6'
97
- description: '["A", "very", "fast", "way", "to", "turn", "LaTeX", "math", "equations",
98
- "into", "beautifully", "rendered", "SVGs,", "to", "embed", "on", "the", "web.",
99
- "This", "library", "is", "mostly", "written", "in", "C", "and", "is", "a", "general",
100
- "purpose", "wrapper", "to", "GNOME''s", "Lasem."]'
97
+ description: A very fast way to turn LaTeX math equations into beautifully rendered
98
+ SVGs, to embed on the web. This library is mostly written in C and is a general
99
+ purpose wrapper to GNOME's Lasem.
101
100
  email:
102
101
  - gjtorikian@gmail.com
103
102
  executables: []
@@ -111,9 +110,20 @@ files:
111
110
  - ext/mathematical/cairo_callbacks.c
112
111
  - ext/mathematical/cairo_callbacks.h
113
112
  - ext/mathematical/extconf.rb
113
+ - ext/mathematical/lasem/Makefile
114
+ - ext/mathematical/lasem/config.h
115
+ - ext/mathematical/lasem/docs/Makefile
116
+ - ext/mathematical/lasem/docs/reference/Makefile
117
+ - ext/mathematical/lasem/docs/reference/lasem/Makefile
118
+ - ext/mathematical/lasem/itex2mml/Makefile
114
119
  - ext/mathematical/lasem/itex2mml/itex2MML.h
115
120
  - ext/mathematical/lasem/itex2mml/itex2MML.l
116
121
  - ext/mathematical/lasem/itex2mml/itex2MML.y
122
+ - ext/mathematical/lasem/itex2mml/lex.yy.c
123
+ - ext/mathematical/lasem/itex2mml/y.tab.c
124
+ - ext/mathematical/lasem/itex2mml/y.tab.h
125
+ - ext/mathematical/lasem/po/Makefile
126
+ - ext/mathematical/lasem/src/Makefile
117
127
  - ext/mathematical/lasem/src/lasemrender.c
118
128
  - ext/mathematical/lasem/src/lsm.c
119
129
  - ext/mathematical/lasem/src/lsm.h
@@ -134,6 +144,8 @@ files:
134
144
  - ext/mathematical/lasem/src/lsmdomelement.h
135
145
  - ext/mathematical/lasem/src/lsmdomentities.c
136
146
  - ext/mathematical/lasem/src/lsmdomentities.h
147
+ - ext/mathematical/lasem/src/lsmdomenumtypes.c
148
+ - ext/mathematical/lasem/src/lsmdomenumtypes.h
137
149
  - ext/mathematical/lasem/src/lsmdomimplementation.c
138
150
  - ext/mathematical/lasem/src/lsmdomimplementation.h
139
151
  - ext/mathematical/lasem/src/lsmdomnamednodemap.c
@@ -168,6 +180,8 @@ files:
168
180
  - ext/mathematical/lasem/src/lsmmathmlencloseelement.h
169
181
  - ext/mathematical/lasem/src/lsmmathmlenums.c
170
182
  - ext/mathematical/lasem/src/lsmmathmlenums.h
183
+ - ext/mathematical/lasem/src/lsmmathmlenumtypes.c
184
+ - ext/mathematical/lasem/src/lsmmathmlenumtypes.h
171
185
  - ext/mathematical/lasem/src/lsmmathmlerrorelement.c
172
186
  - ext/mathematical/lasem/src/lsmmathmlerrorelement.h
173
187
  - ext/mathematical/lasem/src/lsmmathmlfencedelement.c
@@ -249,6 +263,8 @@ files:
249
263
  - ext/mathematical/lasem/src/lsmsvgellipseelement.h
250
264
  - ext/mathematical/lasem/src/lsmsvgenums.c
251
265
  - ext/mathematical/lasem/src/lsmsvgenums.h
266
+ - ext/mathematical/lasem/src/lsmsvgenumtypes.c
267
+ - ext/mathematical/lasem/src/lsmsvgenumtypes.h
252
268
  - ext/mathematical/lasem/src/lsmsvgfilterblend.c
253
269
  - ext/mathematical/lasem/src/lsmsvgfilterblend.h
254
270
  - ext/mathematical/lasem/src/lsmsvgfiltercomposite.c
@@ -331,6 +347,7 @@ files:
331
347
  - ext/mathematical/lasem/src/lsmtypes.h
332
348
  - ext/mathematical/lasem/src/lsmutils.c
333
349
  - ext/mathematical/lasem/src/lsmutils.h
350
+ - ext/mathematical/lasem/tests/Makefile
334
351
  - ext/mathematical/lasem/tests/dom.c
335
352
  - ext/mathematical/lasem/tests/lsmtest.c
336
353
  - ext/mathematical/lasem/tests/str.c
@@ -451,7 +468,7 @@ rubyforge_project:
451
468
  rubygems_version: 2.2.3
452
469
  signing_key:
453
470
  specification_version: 4
454
- summary: '["Quickly", "convert", "math", "equations", "into", "beautiful", "SVGs/PNGs/MathML."]'
471
+ summary: Quickly convert math equations into beautiful SVGs/PNGs/MathML.
455
472
  test_files:
456
473
  - test/mathematical/basic_test.rb
457
474
  - test/mathematical/corrections_test.rb