math_ml 0.9

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.
data/spec/util.rb ADDED
@@ -0,0 +1,32 @@
1
+ module MathML
2
+ module Spec
3
+ module Util
4
+ def raise_parse_error(message, done, rest)
5
+ simple_matcher("parse_error") do |given|
6
+ given.should raise_error(MathML::LaTeX::ParseError){ |e|
7
+ e.message.should == message
8
+ e.done.should == done
9
+ e.rest.should == rest
10
+ }
11
+ end
12
+ end
13
+
14
+ def new_parser
15
+ MathML::LaTeX::Parser.new
16
+ end
17
+
18
+ def math_ml(src, display_style=false, parser=nil)
19
+ parser ||= new_parser
20
+ parser.parse(src, display_style)
21
+ end
22
+
23
+ def strip_math_ml(math_ml)
24
+ math_ml.to_s.gsub(/>\s*/, ">").gsub(/\s*</, "<")[/\A<math [^>]*>(.*)<\/math>\Z/m, 1]
25
+ end
26
+
27
+ def smml(src, display_style=false, parser=nil)
28
+ strip_math_ml(math_ml(src, display_style, parser))
29
+ end
30
+ end
31
+ end
32
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: math_ml
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ version: "0.9"
10
+ platform: ruby
11
+ authors:
12
+ - KURODA Hiraku
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-06 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: eim_xml
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: hiraku@hinet.mydns.jp
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - Rakefile.utirake
44
+ - Rakefile
45
+ - lib/math_ml.rb
46
+ - lib/math_ml/latex/builtin_commands.rb
47
+ - lib/math_ml/util.rb
48
+ - lib/math_ml/latex.rb
49
+ - lib/math_ml/string.rb
50
+ - lib/math_ml/element.rb
51
+ - spec/math_ml_latex_scanner_spec.rb
52
+ - spec/math_ml_element_spec.rb
53
+ - spec/math_ml_latex_parser_spec.rb
54
+ - spec/util.rb
55
+ - spec/math_ml_latex_macro_spec.rb
56
+ - spec/math_ml_util_spec.rb
57
+ - spec/math_ml_spec.rb
58
+ - spec/math_ml_string_spec.rb
59
+ has_rdoc: true
60
+ homepage: http://mathml.rubyforge.org/
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options: []
65
+
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ">"
81
+ - !ruby/object:Gem::Version
82
+ hash: 25
83
+ segments:
84
+ - 1
85
+ - 3
86
+ - 1
87
+ version: 1.3.1
88
+ requirements: []
89
+
90
+ rubyforge_project: mathml
91
+ rubygems_version: 1.3.7
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: MathML Library
95
+ test_files: []
96
+