deplate 0.8.1 → 0.8.2
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/AUTHORS.TXT +2 -1
- data/CHANGES.TXT +56 -211
- data/NEWS.TXT +15 -38
- data/VERSION.TXT +1 -1
- data/bin/deplate +0 -0
- data/bin/deplate.bat +0 -0
- data/etc/deplate.ini +11 -0
- data/lib/deplate/commands.rb +8 -3
- data/lib/deplate/common.rb +2 -2
- data/lib/deplate/core.rb +157 -45
- data/lib/deplate/css/article.css +19 -3
- data/lib/deplate/css/doc.css +770 -0
- data/lib/deplate/elements.rb +7 -7
- data/lib/deplate/ents/general-latin1.entities +100 -0
- data/lib/deplate/ents/general-utf-8.entities +252 -0
- data/lib/deplate/external.rb +3 -2
- data/lib/deplate/fmt/html.rb +12 -10
- data/lib/deplate/fmt/latex.rb +25 -14
- data/lib/deplate/fmt/plain.rb +4 -5
- data/lib/deplate/fmt/xhtml11m.rb +25 -0
- data/lib/deplate/formatter.rb +106 -32
- data/lib/deplate/input.rb +8 -7
- data/lib/deplate/lib/Makefile.config +11 -1
- data/lib/deplate/locale/de.latin1 +9 -0
- data/lib/deplate/macros.rb +23 -18
- data/lib/deplate/mod/code-coderay.rb +45 -0
- data/lib/deplate/mod/code-gvim.rb +3 -2
- data/lib/deplate/mod/code-gvim71.rb +3 -6
- data/lib/deplate/mod/code-highlight.rb +3 -2
- data/lib/deplate/mod/entities-decode.rb +72 -0
- data/lib/deplate/mod/entities-encode.rb +50 -0
- data/lib/deplate/mod/guesslanguage.rb +3 -3
- data/lib/deplate/mod/html-jsmath.rb +5 -5
- data/lib/deplate/mod/html-mathml.rb +40 -0
- data/lib/deplate/mod/latex-styles.rb +21 -11
- data/lib/deplate/mod/makefile.rb +21 -11
- data/lib/deplate/mod/markup-1.rb +3 -3
- data/lib/deplate/mod/particle-math.rb +15 -6
- data/lib/deplate/particles.rb +2 -2
- data/lib/deplate/regions.rb +50 -15
- data/lib/deplate/template.rb +7 -2
- data/lib/deplate/themes/presentation.html/css/highstep.css +29 -0
- data/lib/deplate/themes/presentation.html/css/presentation.css +206 -0
- data/lib/deplate/themes/presentation.html/css/website.css +281 -0
- data/lib/deplate/themes/presentation.html/prelude.txt +19 -0
- data/lib/deplate/themes/presentation.html/resources/spacer.png +0 -0
- data/lib/deplate/themes/presentation.html/templates/presentation.html +26 -0
- data/lib/deplate/themes/presentation.html/theme.ini +20 -0
- data/man/man1/deplate.1 +147 -73
- metadata +67 -40
- data/bin/deplate.exy +0 -192
data/lib/deplate/macros.rb
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 25-M�r-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 2008-04-14.
|
7
|
+
# @Revision: 0.1354
|
8
8
|
|
9
9
|
require 'forwardable'
|
10
10
|
|
@@ -113,7 +113,7 @@ class Deplate::Macro::Unknown < Deplate::Macro
|
|
113
113
|
def setup(text)
|
114
114
|
text = @args[:match][0][1..-2]
|
115
115
|
# @elt = plain_text(text)
|
116
|
-
@elt = @deplate.parse(@container, text, @alt,
|
116
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
117
117
|
end
|
118
118
|
|
119
119
|
def process
|
@@ -254,7 +254,7 @@ class Deplate::Macro::Arg < Deplate::Argument
|
|
254
254
|
end
|
255
255
|
@text = Deplate::Core.escape_characters(@text, @args)
|
256
256
|
if !@args['asString']
|
257
|
-
@elt = @deplate.parse(@container, @text, @alt,
|
257
|
+
@elt = @deplate.parse(@container, @text, @alt, :pcontainer => self)
|
258
258
|
end
|
259
259
|
end
|
260
260
|
end
|
@@ -270,7 +270,7 @@ class Deplate::Macro::XArg < Deplate::Argument
|
|
270
270
|
c = @deplate.variables[text] || @args["default"]
|
271
271
|
if c
|
272
272
|
c = Deplate::Core.escape_characters(c, @args)
|
273
|
-
@elt = @deplate.parse(@container, c, @alt,
|
273
|
+
@elt = @deplate.parse(@container, c, @alt, :pcontainer => self)
|
274
274
|
else
|
275
275
|
log(["Unknown variable", '{xarg}', text])
|
276
276
|
end
|
@@ -293,7 +293,7 @@ class Deplate::Macro::Msg < Deplate::Macro
|
|
293
293
|
register_as 'msg'
|
294
294
|
|
295
295
|
def setup(text)
|
296
|
-
@elt = @deplate.parse(@container, @deplate.msg(text), @alt,
|
296
|
+
@elt = @deplate.parse(@container, @deplate.msg(text), @alt, :pcontainer => self)
|
297
297
|
# @text = @deplate.msg(text)
|
298
298
|
end
|
299
299
|
end
|
@@ -352,7 +352,7 @@ class Deplate::Macro::Ruby < Deplate::Macro
|
|
352
352
|
if @args['native'] or @args['ins']
|
353
353
|
@text = rv
|
354
354
|
else
|
355
|
-
@elt = @deplate.parse(self, rv, @alt,
|
355
|
+
@elt = @deplate.parse(self, rv, @alt, :pcontainer => self)
|
356
356
|
end
|
357
357
|
end
|
358
358
|
end
|
@@ -428,9 +428,14 @@ class Deplate::Macro::Math < Deplate::Macro::Latex
|
|
428
428
|
|
429
429
|
def setup(text)
|
430
430
|
prelude = @deplate.formatter.prelude('mathPrelude')
|
431
|
-
|
431
|
+
fmt = is_block? ? '\\[%s\\]' : '$%s$'
|
432
|
+
@text = [prelude, fmt % text].flatten.compact.join("\n")
|
432
433
|
super(@text)
|
433
434
|
end
|
435
|
+
|
436
|
+
def is_block?
|
437
|
+
return @args['block']
|
438
|
+
end
|
434
439
|
end
|
435
440
|
|
436
441
|
class Deplate::Macro::List < Deplate::Macro
|
@@ -439,7 +444,7 @@ class Deplate::Macro::List < Deplate::Macro
|
|
439
444
|
register_as 'list'
|
440
445
|
|
441
446
|
def setup(text)
|
442
|
-
@elt = @deplate.parse(self, text, @alt,
|
447
|
+
@elt = @deplate.parse(self, text, @alt, :pcontainer => self)
|
443
448
|
case @args['type']
|
444
449
|
when 'dl'
|
445
450
|
@type = 'Description'
|
@@ -469,7 +474,7 @@ class Deplate::Macro::Item < Deplate::Macro
|
|
469
474
|
register_as 'item'
|
470
475
|
|
471
476
|
def setup(text)
|
472
|
-
@elt = @deplate.parse(@container, text, @alt,
|
477
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
473
478
|
end
|
474
479
|
|
475
480
|
def process
|
@@ -488,7 +493,7 @@ class Deplate::Macro::Term < Deplate::Macro
|
|
488
493
|
register_as 'term'
|
489
494
|
|
490
495
|
def setup(text)
|
491
|
-
@elt = @deplate.parse(@container, text, @alt,
|
496
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
492
497
|
end
|
493
498
|
|
494
499
|
def process
|
@@ -507,7 +512,7 @@ class Deplate::Macro::Subscript < Deplate::Macro
|
|
507
512
|
register_as 'sub'
|
508
513
|
|
509
514
|
def setup(text)
|
510
|
-
@elt = @deplate.parse(@container, text, @alt,
|
515
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
511
516
|
end
|
512
517
|
|
513
518
|
def process
|
@@ -523,7 +528,7 @@ class Deplate::Macro::Superscript < Deplate::Macro
|
|
523
528
|
register_as 'super'
|
524
529
|
|
525
530
|
def setup(text)
|
526
|
-
@elt = @deplate.parse(@container, text, @alt,
|
531
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
527
532
|
end
|
528
533
|
|
529
534
|
def process
|
@@ -538,7 +543,7 @@ class Deplate::Macro::Stacked < Deplate::Macro
|
|
538
543
|
register_as 'stacked'
|
539
544
|
|
540
545
|
def setup(text)
|
541
|
-
@elt = @deplate.parse(@container, text, @alt,
|
546
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
542
547
|
end
|
543
548
|
|
544
549
|
def process
|
@@ -555,7 +560,7 @@ class Deplate::Macro::Text < Deplate::Macro
|
|
555
560
|
register_as 'text'
|
556
561
|
|
557
562
|
def setup(text)
|
558
|
-
@elt = @deplate.parse(@container, text, @alt,
|
563
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
559
564
|
end
|
560
565
|
|
561
566
|
def process
|
@@ -630,7 +635,7 @@ end
|
|
630
635
|
|
631
636
|
class Deplate::Macro::FormattedText < Deplate::Macro
|
632
637
|
def setup(text)
|
633
|
-
@elt = @deplate.parse(@container, text, @alt,
|
638
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
634
639
|
end
|
635
640
|
end
|
636
641
|
|
@@ -680,7 +685,7 @@ class Deplate::Macro::Pagenumber < Deplate::Macro
|
|
680
685
|
register_as 'pagenum'
|
681
686
|
|
682
687
|
def setup(text)
|
683
|
-
@elt = @deplate.parse(@container, text, @alt,
|
688
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
684
689
|
end
|
685
690
|
|
686
691
|
def process
|
@@ -722,7 +727,7 @@ class Deplate::Macro::Let < Deplate::Macro
|
|
722
727
|
args[key] = val1 || val
|
723
728
|
end
|
724
729
|
Deplate::Define.let_variables(@deplate, args) do
|
725
|
-
@elt = @deplate.parse(@container, text, @alt,
|
730
|
+
@elt = @deplate.parse(@container, text, @alt, :pcontainer => self)
|
726
731
|
end
|
727
732
|
end
|
728
733
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# @Author: Thomas Link (micathom AT gmail com)
|
2
|
+
# @Website: http://deplate.sf.net/
|
3
|
+
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
4
|
+
# @Created: 26-Feb-2005.
|
5
|
+
# @Last Change: 2008-04-15.
|
6
|
+
# @Revision: 0.115
|
7
|
+
#
|
8
|
+
# = Description
|
9
|
+
# This module provides a specialized syntax highlighter using
|
10
|
+
# http://coderay.rubychan.de/
|
11
|
+
|
12
|
+
require 'coderay'
|
13
|
+
|
14
|
+
class Deplate::Regions::Code
|
15
|
+
langs = ['ruby', 'c', 'delphi', 'pascal', 'html', 'rhtml', 'xhtml']
|
16
|
+
add_highlighter(langs, 'html', :coderay_to_html)
|
17
|
+
add_highlighter(langs, 'htmlslides', :coderay_to_html)
|
18
|
+
add_highlighter(langs, 'htmlsite', :coderay_to_html)
|
19
|
+
add_highlighter(langs, 'html-snippet', :coderay_to_html)
|
20
|
+
add_highlighter(langs, 'xhtml10t', :coderay_to_html)
|
21
|
+
add_highlighter(langs, 'xhtml11m', :coderay_to_html)
|
22
|
+
add_highlighter(langs, 'php', :coderay_to_html)
|
23
|
+
add_highlighter(langs, 'phpsite', :coderay_to_html)
|
24
|
+
highlighter_option(:coderay_to_html, :no_cache => true)
|
25
|
+
|
26
|
+
def coderay_to_html(syntax, style, text)
|
27
|
+
unless @deplate.allow_external
|
28
|
+
return
|
29
|
+
end
|
30
|
+
tokens = CodeRay.scan text, syntax.intern
|
31
|
+
args = {}
|
32
|
+
# args[:css] = :class
|
33
|
+
if @args['lineNumers'] or @deplate.variables['codeLineNumbers']
|
34
|
+
args[:line_numbers] = :table
|
35
|
+
end
|
36
|
+
begin
|
37
|
+
rv = [tokens.div(args)]
|
38
|
+
return rv
|
39
|
+
rescue Exception => e
|
40
|
+
log(['Error in module', 'code-coderay', e], :error)
|
41
|
+
end
|
42
|
+
return nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 26-Feb-2005.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 2008-04-15.
|
7
|
+
# @Revision: 0.107
|
8
8
|
#
|
9
9
|
# = Description
|
10
10
|
# This module provides a specialized syntax highlighter using gvim. Adds
|
@@ -23,6 +23,7 @@ class Deplate::Regions::Code
|
|
23
23
|
add_highlighter(nil, 'htmlsite', :gvim_to_html)
|
24
24
|
add_highlighter(nil, 'html-snippet', :gvim_to_html)
|
25
25
|
add_highlighter(nil, 'xhtml10t', :gvim_to_html)
|
26
|
+
add_highlighter(nil, 'xhtml11m', :gvim_to_html)
|
26
27
|
add_highlighter(nil, 'php', :gvim_to_html)
|
27
28
|
add_highlighter(nil, 'phpsite', :gvim_to_html)
|
28
29
|
|
@@ -3,16 +3,12 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 26-Feb-2005.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 2008-04-15.
|
7
|
+
# @Revision: 0.111
|
8
8
|
#
|
9
9
|
# = Description
|
10
10
|
# This module provides a specialized syntax highlighter using gvim. Adds
|
11
11
|
# Deplate::Regions::Code#gvim_to_html.
|
12
|
-
#
|
13
|
-
# = Usage
|
14
|
-
# = TODO
|
15
|
-
# = CHANGES
|
16
12
|
|
17
13
|
require 'fileutils'
|
18
14
|
require 'tmpdir'
|
@@ -24,6 +20,7 @@ class Deplate::Regions::Code
|
|
24
20
|
add_highlighter(nil, 'htmlsite', :gvim_to_html)
|
25
21
|
add_highlighter(nil, 'html-snippet', :gvim_to_html)
|
26
22
|
add_highlighter(nil, 'xhtml10t', :gvim_to_html)
|
23
|
+
add_highlighter(nil, 'xhtml11m', :gvim_to_html)
|
27
24
|
add_highlighter(nil, 'php', :gvim_to_html)
|
28
25
|
add_highlighter(nil, 'phpsite', :gvim_to_html)
|
29
26
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 27-Feb-2005.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 2008-04-15.
|
7
|
+
# @Revision: 0.66
|
8
8
|
#
|
9
9
|
# = Description
|
10
10
|
# Highlight code regions using Andr� Simon's
|
@@ -36,6 +36,7 @@ class Deplate::Regions::Code
|
|
36
36
|
add_highlighter(nil, 'php', :highlight)
|
37
37
|
add_highlighter(nil, 'phpsite', :highlight)
|
38
38
|
add_highlighter(nil, 'xhtml10t', :highlight)
|
39
|
+
add_highlighter(nil, 'xhtml11m', :highlight)
|
39
40
|
add_highlighter(nil, 'latex', :highlight)
|
40
41
|
add_highlighter(nil, 'latex-snippet', :highlight)
|
41
42
|
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# entities.rb
|
3
|
+
# @Last Change: 2007-12-03.
|
4
|
+
# Author:: Thomas Link (micathom AT gmail com)
|
5
|
+
# License:: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
6
|
+
# Created:: 2007-11-28.
|
7
|
+
|
8
|
+
require 'singleton'
|
9
|
+
|
10
|
+
|
11
|
+
class Deplate::EntityDecode
|
12
|
+
include Singleton
|
13
|
+
class << self
|
14
|
+
def with_deplate(deplate)
|
15
|
+
ent = self.instance
|
16
|
+
deplate.formatter.setup_entities
|
17
|
+
ent.deplate = deplate
|
18
|
+
ent
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_accessor :deplate
|
23
|
+
|
24
|
+
def char_by_number(number)
|
25
|
+
@deplate.formatter.entities_table.each do |char, named, numbered|
|
26
|
+
if numbered == number
|
27
|
+
return char
|
28
|
+
end
|
29
|
+
end
|
30
|
+
return number
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def char_by_name(name)
|
35
|
+
@deplate.formatter.entities_table.each do |char, named, numbered|
|
36
|
+
if named == name
|
37
|
+
return char
|
38
|
+
end
|
39
|
+
end
|
40
|
+
return name
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
class Deplate::Particle::EntityDecode < Deplate::Particle
|
47
|
+
register_particle
|
48
|
+
set_rx(/^&#\d+;/)
|
49
|
+
def_get :text, 0
|
50
|
+
|
51
|
+
def process
|
52
|
+
@elt = Deplate::EntityDecode.with_deplate(@deplate).char_by_number(get_text)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
class Deplate::Particle::NamedEntityDecode < Deplate::Particle
|
59
|
+
register_particle
|
60
|
+
set_rx(/^&\w+?;/)
|
61
|
+
def_get :text, 0
|
62
|
+
|
63
|
+
def process
|
64
|
+
@elt = Deplate::EntityDecode.with_deplate(@deplate).char_by_name(get_text)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# Local Variables:
|
71
|
+
# revisionRx: REVISION\s\+=\s\+\'
|
72
|
+
# End:
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# entities.rb
|
3
|
+
# @Last Change: 2007-12-04.
|
4
|
+
# Author:: Thomas Link (micathom AT gmail com)
|
5
|
+
# License:: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
6
|
+
# Created:: 2007-11-28.
|
7
|
+
|
8
|
+
|
9
|
+
class Deplate::Core
|
10
|
+
def module_initialize_entities_encode
|
11
|
+
@formatter.setup_entities
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Deplate::Formatter
|
16
|
+
alias :entities_encode_plain_text :plain_text
|
17
|
+
def plain_text(text, escaped=false)
|
18
|
+
if escaped
|
19
|
+
entities_encode_plain_text(text, escaped)
|
20
|
+
else
|
21
|
+
ntxt = []
|
22
|
+
max = text.size
|
23
|
+
idx = 0
|
24
|
+
while idx < max
|
25
|
+
catch(:next) do
|
26
|
+
# This probably is the most inefficient way to do this.
|
27
|
+
# On the other hand, "char" could be about any byte
|
28
|
+
# sequence you want.
|
29
|
+
@deplate.formatter.entities_table.each do |char, named, numbered|
|
30
|
+
i = idx + char.size
|
31
|
+
j = i - 1
|
32
|
+
if text[idx..j] == char
|
33
|
+
ntxt << (named.nil? || named.empty? ? numbered : named)
|
34
|
+
idx = i
|
35
|
+
throw :next
|
36
|
+
end
|
37
|
+
end
|
38
|
+
ntxt << text[idx..idx]
|
39
|
+
idx += 1
|
40
|
+
end
|
41
|
+
end
|
42
|
+
return ntxt.join
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# Local Variables:
|
49
|
+
# revisionRx: REVISION\s\+=\s\+\'
|
50
|
+
# End:
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# @Author: Thomas Link (micathom AT gmail com)
|
3
3
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
4
4
|
# @Created: 2006-12-29.
|
5
|
-
# @Last Change:
|
6
|
-
# @Revision: 0.1.
|
5
|
+
# @Last Change: 2008-07-05.
|
6
|
+
# @Revision: 0.1.74
|
7
7
|
|
8
8
|
require 'deplate/guesslanguage'
|
9
9
|
|
@@ -12,7 +12,7 @@ class Deplate::Core
|
|
12
12
|
@options.guesslanguage = Guesslanguage.new
|
13
13
|
@options.guesslanguage_once = false
|
14
14
|
@options.guesslanguage_collected = {}
|
15
|
-
for dir in Deplate::Core.library_directories(true, 'locale')
|
15
|
+
for dir in Deplate::Core.library_directories(@vanilla, true, ['locale'])
|
16
16
|
for file in Dir[File.join(dir, '*_data')]
|
17
17
|
lang = File.basename(file, '.*')
|
18
18
|
text = File.read(file)
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# @Website: http://deplate.sf.net/
|
4
4
|
# @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
5
5
|
# @Created: 30-Dez-2004.
|
6
|
-
# @Last Change:
|
7
|
-
# @Revision: 0.
|
6
|
+
# @Last Change: 2008-04-14.
|
7
|
+
# @Revision: 0.59
|
8
8
|
|
9
9
|
class Deplate::Formatter::HTML
|
10
10
|
def prepare_html_jsmath
|
@@ -28,9 +28,9 @@ END_OF_HTML
|
|
28
28
|
|
29
29
|
alias :format_math_re_jsmath :format_math
|
30
30
|
def format_math(invoker)
|
31
|
-
|
32
|
-
if
|
33
|
-
%{<span class="math">#{
|
31
|
+
block, formula = bare_latex_formula(invoker.text)
|
32
|
+
if formula
|
33
|
+
%{<span class="math">#{formula}</span>}
|
34
34
|
else
|
35
35
|
invoker.log(['Internal error', invoker.text], :error)
|
36
36
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# @Last Change: 2008-04-14.
|
2
|
+
# Author:: Thomas Link (micathom AT gmail com)
|
3
|
+
# License:: GPL (see http://www.gnu.org/licenses/gpl.txt)
|
4
|
+
# Created:: 2008-04-13.
|
5
|
+
|
6
|
+
|
7
|
+
require 'math_ml/string'
|
8
|
+
|
9
|
+
|
10
|
+
class Deplate::Formatter::HTML
|
11
|
+
alias :inlatex_re_mathml :inlatex
|
12
|
+
def inlatex(invoker)
|
13
|
+
case invoker
|
14
|
+
when Deplate::Macro::Math
|
15
|
+
else
|
16
|
+
inlatex_re_mathml(invoker)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
alias :format_math_re_mathml :format_math
|
21
|
+
def format_math(invoker)
|
22
|
+
case @deplate.formatter.class.myname
|
23
|
+
when 'xhtml11m'
|
24
|
+
else
|
25
|
+
invoker.log(['Inadequate formatter', @deplate.formatter.class.myname], :error)
|
26
|
+
end
|
27
|
+
block, formula = bare_latex_formula(invoker.text)
|
28
|
+
if formula
|
29
|
+
begin
|
30
|
+
mathml = formula.to_mathml(block)
|
31
|
+
return mathml.to_s
|
32
|
+
rescue Exception => e
|
33
|
+
invoker.log(['Error in module', 'mathml', e], :error)
|
34
|
+
end
|
35
|
+
else
|
36
|
+
invoker.log(['Internal error', invoker.text], :error)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|