math_ml 0.10 → 0.11

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/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  load "Rakefile.utirake"
2
2
 
3
- VER = "0.10"
3
+ VER = "0.11"
4
4
 
5
5
  UtiRake.setup do
6
6
  external("https://hg.hinet.mydns.jp", %w[eim_xml])
@@ -8,7 +8,7 @@ UtiRake.setup do
8
8
  rdoc do |t|
9
9
  t.title = "MathML Library"
10
10
  t.main = "README"
11
- t.rdoc_files << FileList["lib/**/*.rb", "README"]
11
+ t.rdoc_files.include(FileList["lib/**/*.rb", "README"])
12
12
  end
13
13
 
14
14
  publish("mathml", "hiraku") do
@@ -28,9 +28,9 @@ UtiRake.setup do
28
28
 
29
29
  rcov_spec do |s|
30
30
  s.ruby_opts = %w[-rubygems]
31
- s.pattern ||= %w[spec/util.rb spec/*_spec.rb]
31
+ s.pattern ||= %w[spec/util.rb spec/**/*_spec.rb]
32
32
  s.pattern = [s.pattern] unless s.pattern.is_a?(Array)
33
- s.pattern << "symbols/**/*_spec.rb"
33
+ # s.pattern << "symbols/**/*_spec.rb"
34
34
  end
35
35
 
36
36
  spec do |s|
data/Rakefile.utirake CHANGED
@@ -5,11 +5,13 @@
5
5
 
6
6
  require "rake/clean"
7
7
  require "rake/testtask"
8
- require "rake/rdoctask"
8
+ require "rdoc/task"
9
9
  require "rake/contrib/rubyforgepublisher"
10
10
  require "rubygems/package_task"
11
11
 
12
12
  class UtiRake
13
+ include Rake::DSL
14
+
13
15
  def self.setup(opt={}, &proc)
14
16
  ur = new
15
17
  ur.setup(opt, &proc)
@@ -196,7 +198,7 @@ class UtiRake
196
198
 
197
199
  def publish(project_name, user_id)
198
200
  task :publish => "rdoc" do
199
- yield if block_given
201
+ yield if block_given?
200
202
  Rake::RubyForgePublisher.new(project_name, user_id).upload
201
203
  end
202
204
  end
@@ -253,7 +255,7 @@ class UtiRake
253
255
  end
254
256
  end
255
257
 
256
- `grep -sRn '#[[:space:]]*here\\([[:space:]]\\|$\\)' spec`.split(/\n/).map{|l|
258
+ `grep -sRn '#[[:space:]]*here\\([[:space:]]\\|$\\)' --include='*.rb' spec`.split(/\n/).map{|l|
257
259
  next nil unless l=~/\A(.*?):(\d+):/
258
260
  [$1, $2.to_i]
259
261
  }.compact.sort{|a, b| FILE_SORT.call(a[0], b[0])}.reverse.each do |file, line|
data/lib/math_ml/latex.rb CHANGED
@@ -564,7 +564,9 @@ EOS
564
564
  raise ParseError.new("Double superscript.", @scanner[0]) if e.sup
565
565
  if /'+/=~@scanner[0]
566
566
  prime = Operator.new
567
- prime << MathML.pcstring('&prime;'*@scanner[0].size, true)
567
+ @scanner[0].size.times do
568
+ prime << symbol_table.convert("prime")
569
+ end
568
570
  unless @scanner.scan(/\^/)
569
571
  e.sup = prime
570
572
  return e
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  module MathML
2
3
  module Symbol
3
4
  MAP = {} unless const_defined?(:MAP)
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  require "eim_xml/parser"
2
3
  require "eim_xml/dsl"
3
4
  require "math_ml"
@@ -102,17 +103,31 @@ describe MathML::LaTeX::Parser do
102
103
  check_hash("mo", {'\backslash'=>'\\', '\%'=>'%', '\{'=>'{', '\}'=>'}', '\$'=>'$', '\#'=>'#'})
103
104
  end
104
105
 
105
- it "should process prime" do
106
- smml("a'").should == "<msup><mi>a</mi><mo>&prime;</mo></msup>"
107
- smml("a''").should == "<msup><mi>a</mi><mo>&prime;&prime;</mo></msup>"
108
- smml("a'''").should == "<msup><mi>a</mi><mo>&prime;&prime;&prime;</mo></msup>"
109
- smml("'").should == "<msup><none /><mo>&prime;</mo></msup>"
106
+ describe "should process prime" do
107
+ it "entity reference" do
108
+ smml("a'").should == "<msup><mi>a</mi><mo>&prime;</mo></msup>"
109
+ smml("a''").should == "<msup><mi>a</mi><mo>&prime;&prime;</mo></msup>"
110
+ smml("a'''").should == "<msup><mi>a</mi><mo>&prime;&prime;&prime;</mo></msup>"
111
+ smml("'").should == "<msup><none /><mo>&prime;</mo></msup>"
110
112
 
111
- lambda{smml("a^b'")}.should raise_parse_error("Double superscript.", "a^b", "'")
113
+ lambda{smml("a^b'")}.should raise_parse_error("Double superscript.", "a^b", "'")
112
114
 
113
- smml("a'^b").should == "<msup><mi>a</mi><mrow><mo>&prime;</mo><mi>b</mi></mrow></msup>"
114
- smml("a'''^b").should == "<msup><mi>a</mi><mrow><mo>&prime;&prime;&prime;</mo><mi>b</mi></mrow></msup>"
115
- smml("a'b").should == "<msup><mi>a</mi><mo>&prime;</mo></msup><mi>b</mi>"
115
+ smml("a'^b").should == "<msup><mi>a</mi><mrow><mo>&prime;</mo><mi>b</mi></mrow></msup>"
116
+ smml("a'''^b").should == "<msup><mi>a</mi><mrow><mo>&prime;&prime;&prime;</mo><mi>b</mi></mrow></msup>"
117
+ smml("a'b").should == "<msup><mi>a</mi><mo>&prime;</mo></msup><mi>b</mi>"
118
+ end
119
+
120
+ it "utf8" do
121
+ @parser = MathML::LaTeX::Parser.new(:symbol=>MathML::Symbol::UTF8)
122
+ smml("a'").should == "<msup><mi>a</mi><mo>′</mo></msup>"
123
+ smml("a'''").should == "<msup><mi>a</mi><mo>′′′</mo></msup>"
124
+ end
125
+
126
+ it "character reference" do
127
+ @parser = MathML::LaTeX::Parser.new(:symbol=>MathML::Symbol::CharacterReference)
128
+ smml("a'").should == "<msup><mi>a</mi><mo>&#x2032;</mo></msup>"
129
+ smml("a'''").should == "<msup><mi>a</mi><mo>&#x2032;&#x2032;&#x2032;</mo></msup>"
130
+ end
116
131
  end
117
132
 
118
133
  it "should process sqrt" do
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: math_ml
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 10
9
- version: "0.10"
8
+ - 11
9
+ version: "0.11"
10
10
  platform: ruby
11
11
  authors:
12
12
  - KURODA Hiraku
@@ -14,8 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-12 00:00:00 +09:00
18
- default_executable:
17
+ date: 2011-07-19 00:00:00 Z
19
18
  dependencies:
20
19
  - !ruby/object:Gem::Dependency
21
20
  name: eim_xml
@@ -40,27 +39,26 @@ extensions: []
40
39
  extra_rdoc_files: []
41
40
 
42
41
  files:
43
- - Rakefile
44
42
  - Rakefile.utirake
45
- - lib/math_ml/element.rb
43
+ - Rakefile
44
+ - lib/math_ml.rb
46
45
  - lib/math_ml/string.rb
47
46
  - lib/math_ml/util.rb
48
- - lib/math_ml/latex.rb
49
- - lib/math_ml/latex/builtin.rb
50
- - lib/math_ml/latex/builtin/symbol.rb
51
- - lib/math_ml/symbol/character_reference.rb
52
47
  - lib/math_ml/symbol/entity_reference.rb
53
48
  - lib/math_ml/symbol/utf8.rb
54
- - lib/math_ml.rb
49
+ - lib/math_ml/symbol/character_reference.rb
50
+ - lib/math_ml/latex/builtin/symbol.rb
51
+ - lib/math_ml/latex/builtin.rb
52
+ - lib/math_ml/latex.rb
53
+ - lib/math_ml/element.rb
54
+ - spec/util.rb
55
55
  - spec/math_ml_spec.rb
56
56
  - spec/math_ml/element_spec.rb
57
- - spec/math_ml/util_spec.rb
58
57
  - spec/math_ml/string_spec.rb
59
- - spec/math_ml/latex/macro_spec.rb
60
58
  - spec/math_ml/latex/scanner_spec.rb
61
59
  - spec/math_ml/latex/parser_spec.rb
62
- - spec/util.rb
63
- has_rdoc: true
60
+ - spec/math_ml/latex/macro_spec.rb
61
+ - spec/math_ml/util_spec.rb
64
62
  homepage: http://mathml.rubyforge.org/
65
63
  licenses: []
66
64
 
@@ -92,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
90
  requirements: []
93
91
 
94
92
  rubyforge_project: mathml
95
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.8.5
96
94
  signing_key:
97
95
  specification_version: 3
98
96
  summary: MathML Library