math_ml 0.9 → 0.10
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 +17 -6
- data/Rakefile.utirake +62 -24
- data/lib/math_ml/latex/builtin/symbol.rb +549 -0
- data/lib/math_ml/latex/builtin.rb +5 -0
- data/lib/math_ml/latex.rb +20 -14
- data/lib/math_ml/symbol/character_reference.rb +2107 -0
- data/lib/math_ml/symbol/entity_reference.rb +2106 -0
- data/lib/math_ml/symbol/utf8.rb +2107 -0
- data/lib/math_ml.rb +2 -2
- data/spec/{math_ml_element_spec.rb → math_ml/element_spec.rb} +0 -0
- data/spec/{math_ml_latex_macro_spec.rb → math_ml/latex/macro_spec.rb} +0 -0
- data/spec/{math_ml_latex_parser_spec.rb → math_ml/latex/parser_spec.rb} +85 -1
- data/spec/{math_ml_latex_scanner_spec.rb → math_ml/latex/scanner_spec.rb} +0 -0
- data/spec/{math_ml_string_spec.rb → math_ml/string_spec.rb} +0 -0
- data/spec/{math_ml_util_spec.rb → math_ml/util_spec.rb} +0 -0
- data/spec/util.rb +13 -7
- metadata +20 -16
- data/lib/math_ml/latex/builtin_commands.rb +0 -547
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
load "Rakefile.utirake"
|
2
2
|
|
3
|
-
VER = "0.
|
3
|
+
VER = "0.10"
|
4
4
|
|
5
5
|
UtiRake.setup do
|
6
6
|
external("https://hg.hinet.mydns.jp", %w[eim_xml])
|
@@ -27,7 +27,10 @@ UtiRake.setup do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
rcov_spec do |s|
|
30
|
-
s.
|
30
|
+
s.ruby_opts = %w[-rubygems]
|
31
|
+
s.pattern ||= %w[spec/util.rb spec/*_spec.rb]
|
32
|
+
s.pattern = [s.pattern] unless s.pattern.is_a?(Array)
|
33
|
+
s.pattern << "symbols/**/*_spec.rb"
|
31
34
|
end
|
32
35
|
|
33
36
|
spec do |s|
|
@@ -37,10 +40,18 @@ UtiRake.setup do
|
|
37
40
|
end
|
38
41
|
|
39
42
|
namespace :spec do
|
40
|
-
|
41
|
-
s.
|
42
|
-
s.
|
43
|
-
|
43
|
+
RSpec::Core::RakeTask.new(:symbols) do |s|
|
44
|
+
s.pattern = "./symbols/**/*_spec.rb"
|
45
|
+
s.rspec_opts = %w[-c -I lib -I external/lib]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
task :package do
|
50
|
+
name = "math_ml-#{VER}"
|
51
|
+
cp "external/eim_xml/lib/eim_xml.rb", "pkg/#{name}/lib/"
|
52
|
+
Dir.chdir "pkg" do
|
53
|
+
rm "#{name}.tar.gz"
|
54
|
+
sh "tar zcf #{name}.tar.gz #{name}/"
|
44
55
|
end
|
45
56
|
end
|
46
57
|
|
data/Rakefile.utirake
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
require "rake/clean"
|
7
7
|
require "rake/testtask"
|
8
8
|
require "rake/rdoctask"
|
9
|
-
require "rake/gempackagetask"
|
10
9
|
require "rake/contrib/rubyforgepublisher"
|
11
10
|
require "rubygems/package_task"
|
12
11
|
|
@@ -23,12 +22,19 @@ class UtiRake
|
|
23
22
|
def setup(opt={}, &proc)
|
24
23
|
@opt = opt
|
25
24
|
directory "external"
|
26
|
-
|
25
|
+
CLEAN << "coverage" << "coverage.spec" << "coverage.cuke" << "doc"
|
26
|
+
CLOBBER << "external"
|
27
27
|
|
28
28
|
instance_eval(&proc) if proc
|
29
29
|
|
30
30
|
if need_spec?
|
31
|
-
|
31
|
+
begin
|
32
|
+
@rspec2_flg = false
|
33
|
+
require "rspec/core/rake_task"
|
34
|
+
@rspec2_flg = true
|
35
|
+
rescue LoadError
|
36
|
+
require "spec/rake/spectask"
|
37
|
+
end
|
32
38
|
define_spec_task
|
33
39
|
end
|
34
40
|
|
@@ -44,6 +50,12 @@ class UtiRake
|
|
44
50
|
define_alias_task if @alias_task
|
45
51
|
end
|
46
52
|
|
53
|
+
def rspec2?; @rspec2_flg; end
|
54
|
+
|
55
|
+
def spec_task
|
56
|
+
rspec2? ? RSpec::Core::RakeTask : Spec::Rake::SpecTask
|
57
|
+
end
|
58
|
+
|
47
59
|
def need_spec?
|
48
60
|
File.directory?("spec")
|
49
61
|
end
|
@@ -160,22 +172,21 @@ class UtiRake
|
|
160
172
|
spec = Gem::Specification.new do |s|
|
161
173
|
s.platform = Gem::Platform::RUBY
|
162
174
|
s.files = FileList["Rakefile*", "lib/**/*", "spec/**/*"]
|
163
|
-
s.version =
|
175
|
+
s.version = "0.0.0.noversion"
|
164
176
|
gemspec_proc.call(s) if gemspec_proc
|
165
177
|
end
|
166
178
|
|
167
179
|
gem = Gem::PackageTask.new(spec) do |t|
|
168
180
|
t.need_tar_gz = true
|
169
|
-
t.need_zip = true
|
170
181
|
package_proc.call(t) if package_proc
|
171
182
|
end
|
172
183
|
|
173
|
-
task "utirake:
|
184
|
+
task "utirake:copy_for_package" do
|
174
185
|
mv "Rakefile.utirake", "Rakefile.utirake_#{$$}"
|
175
|
-
|
186
|
+
cp "external/utirake/utirake.rb", "Rakefile.utirake"
|
176
187
|
end
|
177
188
|
|
178
|
-
file
|
189
|
+
file gem.package_dir_path => "utirake:copy_for_package"
|
179
190
|
|
180
191
|
task :gem do
|
181
192
|
rm "Rakefile.utirake"
|
@@ -197,8 +208,15 @@ class UtiRake
|
|
197
208
|
end
|
198
209
|
|
199
210
|
def set_spec_opts(spec)
|
200
|
-
spec.
|
201
|
-
|
211
|
+
spec.verbose = false
|
212
|
+
if rspec2?
|
213
|
+
spec.rspec_opts ||= []
|
214
|
+
spec.rspec_opts << "-c"
|
215
|
+
spec.rspec_opts << "-I" << "." << "-I" << "./lib" << "-I" << "./external/lib"
|
216
|
+
else
|
217
|
+
spec.spec_opts << "-c"
|
218
|
+
spec.libs << "." << "./lib" << "./external/lib"
|
219
|
+
end
|
202
220
|
end
|
203
221
|
|
204
222
|
def define_spec_task
|
@@ -206,8 +224,12 @@ class UtiRake
|
|
206
224
|
namespace :spec do
|
207
225
|
spec_files.each do |f|
|
208
226
|
desc ""
|
209
|
-
|
210
|
-
|
227
|
+
spec_task.new(:apart) do |s|
|
228
|
+
if rspec2?
|
229
|
+
s.pattern = f
|
230
|
+
else
|
231
|
+
s.spec_files = FileList[f]
|
232
|
+
end
|
211
233
|
set_spec_opts(s)
|
212
234
|
spec_proc.call(s) if spec_proc
|
213
235
|
end
|
@@ -215,27 +237,36 @@ class UtiRake
|
|
215
237
|
task(:apart).comment = "Run all specs separately"
|
216
238
|
|
217
239
|
desc "Run all specs in a lump"
|
218
|
-
|
219
|
-
s.spec_files = spec_files
|
240
|
+
spec_task.new(:lump) do |s|
|
241
|
+
s.spec_files = spec_files unless rspec2?
|
220
242
|
set_spec_opts(s)
|
221
243
|
spec_proc.call(s) if spec_proc
|
222
244
|
end
|
223
245
|
|
224
246
|
desc "Run all specs to profile"
|
225
|
-
|
247
|
+
spec_task.new(:profile) do |s|
|
226
248
|
set_spec_opts(s)
|
227
|
-
|
249
|
+
if rspec2?
|
250
|
+
s.rspec_opts << "-p"
|
251
|
+
else
|
252
|
+
s.spec_opts << "-f" << "profile"
|
253
|
+
end
|
228
254
|
end
|
229
255
|
|
230
|
-
`grep -sRn '#[[:space:]]*here[[:space:]]
|
256
|
+
`grep -sRn '#[[:space:]]*here\\([[:space:]]\\|$\\)' spec`.split(/\n/).map{|l|
|
231
257
|
next nil unless l=~/\A(.*?):(\d+):/
|
232
258
|
[$1, $2.to_i]
|
233
259
|
}.compact.sort{|a, b| FILE_SORT.call(a[0], b[0])}.reverse.each do |file, line|
|
234
260
|
desc ""
|
235
|
-
|
236
|
-
s.spec_files = [file]
|
261
|
+
spec_task.new(:here) do |s|
|
237
262
|
set_spec_opts(s)
|
238
|
-
|
263
|
+
if rspec2?
|
264
|
+
s.pattern = file
|
265
|
+
s.rspec_opts << "-l#{line}"
|
266
|
+
else
|
267
|
+
s.spec_files = [file]
|
268
|
+
s.spec_opts << "-l#{line}"
|
269
|
+
end
|
239
270
|
spec_proc.call(s) if spec_proc
|
240
271
|
end
|
241
272
|
end
|
@@ -273,6 +304,8 @@ class UtiRake
|
|
273
304
|
end
|
274
305
|
|
275
306
|
def rcov_opts(t, aggregation)
|
307
|
+
t.rcov_opts ||= []
|
308
|
+
t.rcov_opts << "-I" << "./spec:./lib:./external/lib"
|
276
309
|
t.rcov_opts << "--exclude" << "gems\/,features\/,external\/"
|
277
310
|
t.rcov_opts << "--aggregate" << "coverage.data" if aggregation
|
278
311
|
t.rcov = true
|
@@ -280,12 +313,17 @@ class UtiRake
|
|
280
313
|
|
281
314
|
def define_rcov_each_task(aggregation)
|
282
315
|
if need_spec?
|
283
|
-
|
284
|
-
t.
|
316
|
+
spec_task.new do |t|
|
317
|
+
t.verbose = false
|
285
318
|
rcov_opts(t, aggregation)
|
286
|
-
|
319
|
+
if rspec2?
|
320
|
+
t.rcov_opts << "-o" << "coverage.spec" unless aggregation
|
321
|
+
else
|
322
|
+
set_spec_opts(t)
|
323
|
+
t.spec_files = spec_files
|
324
|
+
t.rcov_dir = "coverage.spec" unless aggregation
|
325
|
+
end
|
287
326
|
rcov_spec_proc.call(t) if rcov_spec_proc
|
288
|
-
t.rcov_dir = "coverage.spec" unless aggregation
|
289
327
|
end
|
290
328
|
else
|
291
329
|
task "spec"
|