erubis 2.4.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +55 -2
- data/README.txt +1 -1
- data/benchmark/bench.rb +1 -1
- data/bin/erubis +1 -1
- data/contrib/erubis +57 -34
- data/contrib/inline-require +1 -1
- data/doc-api/classes/Erubis.html +6 -1
- data/doc-api/classes/Erubis/DeleteIndentEnhancer.html +1 -1
- data/doc-api/classes/Erubis/Evaluator.html +3 -3
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +2 -2
- data/doc-api/classes/Erubis/InterpolationEnhancer.html +5 -5
- data/doc-api/classes/Erubis/JavascriptGenerator.html +16 -11
- data/doc-api/classes/Erubis/PI/Ejavascript.html +1 -1
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +22 -18
- data/doc-api/classes/Erubis/RubyEvaluator.html +4 -4
- data/doc-api/created.rid +1 -1
- data/doc-api/files/README_txt.html +2 -2
- data/doc-api/files/erubis/context_rb.html +1 -1
- data/doc-api/files/erubis/converter_rb.html +1 -1
- data/doc-api/files/erubis/engine/ec_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejava_rb.html +1 -1
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +1 -1
- data/doc-api/files/erubis/engine/eperl_rb.html +1 -1
- data/doc-api/files/erubis/engine/ephp_rb.html +1 -1
- data/doc-api/files/erubis/engine/eruby_rb.html +1 -1
- data/doc-api/files/erubis/engine/escheme_rb.html +1 -1
- data/doc-api/files/erubis/engine/optimized_rb.html +1 -1
- data/doc-api/files/erubis/engine_rb.html +1 -1
- data/doc-api/files/erubis/enhancer_rb.html +2 -2
- data/doc-api/files/erubis/error_rb.html +1 -1
- data/doc-api/files/erubis/evaluator_rb.html +2 -2
- data/doc-api/files/erubis/generator_rb.html +1 -1
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/helpers/rails_helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +1 -1
- data/doc-api/files/erubis/tiny_rb.html +1 -1
- data/doc-api/files/erubis_rb.html +1 -1
- data/doc/users-guide.html +126 -14
- data/lib/erubis.rb +2 -2
- data/lib/erubis/context.rb +1 -1
- data/lib/erubis/converter.rb +1 -1
- data/lib/erubis/engine.rb +1 -1
- data/lib/erubis/engine/ec.rb +1 -1
- data/lib/erubis/engine/ejava.rb +1 -1
- data/lib/erubis/engine/ejavascript.rb +9 -3
- data/lib/erubis/engine/enhanced.rb +1 -1
- data/lib/erubis/engine/eperl.rb +1 -1
- data/lib/erubis/engine/ephp.rb +1 -1
- data/lib/erubis/engine/eruby.rb +1 -1
- data/lib/erubis/engine/escheme.rb +1 -1
- data/lib/erubis/engine/optimized.rb +1 -1
- data/lib/erubis/enhancer.rb +23 -8
- data/lib/erubis/error.rb +1 -1
- data/lib/erubis/evaluator.rb +5 -3
- data/lib/erubis/generator.rb +1 -1
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helpers/rails_helper.rb +1 -1
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +1 -1
- data/lib/erubis/tiny.rb +1 -1
- data/test/assert-text-equal.rb +1 -1
- data/test/data/users-guide/main_program1.rb +8 -0
- data/test/data/users-guide/main_program1.result +6 -0
- data/test/data/users-guide/main_program2.rb +8 -0
- data/test/data/users-guide/main_program2.result +6 -0
- data/test/data/users-guide/stderr.log +3 -0
- data/test/data/users-guide/template1.rhtml +4 -0
- data/test/data/users-guide/template2.rhtml +4 -0
- data/test/test-engines.rb +29 -4
- data/test/test-enhancers.rb +4 -4
- data/test/test-erubis.rb +17 -2
- data/test/test-main.rb +2 -2
- data/test/test-users-guide.rb +1 -1
- data/test/test.rb +1 -1
- data/test/testutil.rb +1 -1
- metadata +9 -2
data/CHANGES
CHANGED
@@ -1,7 +1,60 @@
|
|
1
|
-
# $Rev:
|
2
|
-
# $Release: 2.4.
|
1
|
+
# $Rev: 95 $
|
2
|
+
# $Release: 2.4.1 $
|
3
3
|
# copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
4
4
|
|
5
|
+
#
|
6
|
+
- release: 2.4.1
|
7
|
+
date: 2007-09-25
|
8
|
+
enhancements:
|
9
|
+
|
10
|
+
- |
|
11
|
+
Add new section 'evaluate(context) v.s. result(binding)' to user's guide.
|
12
|
+
This section describes why Erubis::Eruby#evaluate(context) is recommended
|
13
|
+
rather than Erubis::Eruby#result(binding).
|
14
|
+
User's Guide > Other Topics > evaluate(context) v.s. result(binding)
|
15
|
+
http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding
|
16
|
+
|
17
|
+
- |
|
18
|
+
Add new command-line property '--docwrite={true|false}' to
|
19
|
+
Erubis::Ejavascript.
|
20
|
+
If this property is true then 'document.write(_buf.join(""));' is used
|
21
|
+
as postamble and if it is false then '_buf.join("")' is used.
|
22
|
+
Default is true for compatibility reason but it will be false in the
|
23
|
+
future release.
|
24
|
+
(This feature was proposed by D.Dribin. Thank you.)
|
25
|
+
|
26
|
+
bugfix:
|
27
|
+
|
28
|
+
- |
|
29
|
+
When using Erubis::Eruby#evaluate(), changing local variables in
|
30
|
+
templates have affected to variables accessible with TOPLEVEL_BINDING.
|
31
|
+
It means that if you change variables in templates, it is possible to
|
32
|
+
change variables in main program.
|
33
|
+
This was a bug and is now fixed not to affect to variables in main
|
34
|
+
program.
|
35
|
+
|
36
|
+
ex. template.rhtml
|
37
|
+
--------------------
|
38
|
+
<% for x in @items %>
|
39
|
+
item = <%= x %>
|
40
|
+
<% end %>
|
41
|
+
--------------------
|
42
|
+
|
43
|
+
ex. main-program.rb
|
44
|
+
--------------------
|
45
|
+
require 'erubis'
|
46
|
+
x = 10
|
47
|
+
items = ['foo', 'bar', 'baz']
|
48
|
+
eruby = Erubis::Eruby.new(File.read('template.rhtml'))
|
49
|
+
s = eruby.evaluate(:items=>items)
|
50
|
+
print s
|
51
|
+
$stderr.puts "*** debug: x=#{x.inspect}" #=> x="baz" (2.4.0)
|
52
|
+
#=> x=10 (2.4.1)
|
53
|
+
--------------------
|
54
|
+
|
55
|
+
- |
|
56
|
+
PercentLineEnhancer was very slow. Now performance problem is solved.
|
57
|
+
|
5
58
|
|
6
59
|
#
|
7
60
|
- release: 2.4.0
|
data/README.txt
CHANGED
data/benchmark/bench.rb
CHANGED
data/bin/erubis
CHANGED
data/contrib/erubis
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
###
|
4
4
|
### $Rev: 77 $
|
5
|
-
### $Release: 2.4.
|
5
|
+
### $Release: 2.4.1 $
|
6
6
|
### copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
7
7
|
###
|
8
8
|
|
9
9
|
#--begin of require 'erubis/main'
|
10
10
|
###
|
11
11
|
### $Rev: 91 $
|
12
|
-
### $Release: 2.4.
|
12
|
+
### $Release: 2.4.1 $
|
13
13
|
### copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
14
14
|
###
|
15
15
|
|
@@ -17,7 +17,7 @@ require 'yaml'
|
|
17
17
|
#--begin of require 'erubis'
|
18
18
|
##
|
19
19
|
## $Rev: 59 $
|
20
|
-
## 2.4.
|
20
|
+
## 2.4.1
|
21
21
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
22
22
|
##
|
23
23
|
|
@@ -65,13 +65,13 @@ require 'yaml'
|
|
65
65
|
|
66
66
|
|
67
67
|
module Erubis
|
68
|
-
VERSION = ('$Release: 2.4.
|
68
|
+
VERSION = ('$Release: 2.4.1 $' =~ /([.\d]+)/) && $1
|
69
69
|
end
|
70
70
|
|
71
71
|
#--begin of require 'erubis/engine'
|
72
72
|
##
|
73
73
|
## $Rev: 77 $
|
74
|
-
## $Release: 2.4.
|
74
|
+
## $Release: 2.4.1 $
|
75
75
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
76
76
|
##
|
77
77
|
|
@@ -79,7 +79,7 @@ end
|
|
79
79
|
#--begin of require 'erubis/generator'
|
80
80
|
##
|
81
81
|
## $Rev: 77 $
|
82
|
-
## $Release: 2.4.
|
82
|
+
## $Release: 2.4.1 $
|
83
83
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
84
84
|
##
|
85
85
|
|
@@ -243,7 +243,7 @@ end
|
|
243
243
|
#--begin of require 'erubis/converter'
|
244
244
|
##
|
245
245
|
## $Rev: 89 $
|
246
|
-
## $Release: 2.4.
|
246
|
+
## $Release: 2.4.1 $
|
247
247
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
248
248
|
##
|
249
249
|
|
@@ -596,15 +596,15 @@ end
|
|
596
596
|
#--end of require 'erubis/converter'
|
597
597
|
#--begin of require 'erubis/evaluator'
|
598
598
|
##
|
599
|
-
## $Rev:
|
600
|
-
## $Release: 2.4.
|
599
|
+
## $Rev: 94 $
|
600
|
+
## $Release: 2.4.1 $
|
601
601
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
602
602
|
##
|
603
603
|
|
604
604
|
#--begin of require 'erubis/error'
|
605
605
|
##
|
606
606
|
## $Rev: 77 $
|
607
|
-
## $Release: 2.4.
|
607
|
+
## $Release: 2.4.1 $
|
608
608
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
609
609
|
##
|
610
610
|
|
@@ -630,7 +630,7 @@ end
|
|
630
630
|
#--begin of require 'erubis/context'
|
631
631
|
##
|
632
632
|
## $Rev: 77 $
|
633
|
-
## $Release: 2.4.
|
633
|
+
## $Release: 2.4.1 $
|
634
634
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
635
635
|
##
|
636
636
|
|
@@ -717,6 +717,8 @@ end
|
|
717
717
|
|
718
718
|
module Erubis
|
719
719
|
|
720
|
+
EMPTY_BINDING = binding()
|
721
|
+
|
720
722
|
|
721
723
|
##
|
722
724
|
## evaluate code
|
@@ -771,7 +773,7 @@ module Erubis
|
|
771
773
|
def evaluate(context=Context.new)
|
772
774
|
context = Context.new(context) if context.is_a?(Hash)
|
773
775
|
#return context.instance_eval(@src, @filename || '(erubis)')
|
774
|
-
@_proc ||= eval("proc { #{@src} }",
|
776
|
+
@_proc ||= eval("proc { #{@src} }", Erubis::EMPTY_BINDING, @filename || '(erubis)')
|
775
777
|
return context.instance_eval(&@_proc)
|
776
778
|
end
|
777
779
|
|
@@ -905,7 +907,7 @@ end
|
|
905
907
|
#--begin of require 'erubis/helper'
|
906
908
|
##
|
907
909
|
## $Rev: 89 $
|
908
|
-
## $Release: 2.4.
|
910
|
+
## $Release: 2.4.1 $
|
909
911
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
910
912
|
##
|
911
913
|
|
@@ -954,8 +956,8 @@ end
|
|
954
956
|
#--end of require 'erubis/helper'
|
955
957
|
#--begin of require 'erubis/enhancer'
|
956
958
|
##
|
957
|
-
## $Rev:
|
958
|
-
## $Release: 2.4.
|
959
|
+
## $Rev: 93 $
|
960
|
+
## $Release: 2.4.1 $
|
959
961
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
960
962
|
##
|
961
963
|
|
@@ -1398,18 +1400,33 @@ module Erubis
|
|
1398
1400
|
"regard lines starting with '%' as program code"
|
1399
1401
|
end
|
1400
1402
|
|
1401
|
-
PERCENT_LINE_PATTERN = /(.*?)^\%(.*?\r?\n)/m
|
1402
|
-
|
1403
1403
|
def add_text(src, text)
|
1404
|
-
|
1405
|
-
|
1404
|
+
pos = 0
|
1405
|
+
text2 = ''
|
1406
|
+
text.scan(/^\%(.*?\r?\n)/) do
|
1407
|
+
line = $1
|
1408
|
+
match = Regexp.last_match
|
1409
|
+
len = match.begin(0) - pos
|
1410
|
+
str = text[pos, len]
|
1411
|
+
pos = match.end(0)
|
1412
|
+
if text2.empty?
|
1413
|
+
text2 = str
|
1414
|
+
else
|
1415
|
+
text2 << str
|
1416
|
+
end
|
1406
1417
|
if line[0] == ?%
|
1407
|
-
|
1418
|
+
text2 << line
|
1408
1419
|
else
|
1420
|
+
super(src, text2)
|
1421
|
+
text2 = ''
|
1409
1422
|
add_stmt(src, line)
|
1410
1423
|
end
|
1411
1424
|
end
|
1412
|
-
rest = $' || text
|
1425
|
+
rest = pos == 0 ? text : $' # or $' || text
|
1426
|
+
unless text2.empty?
|
1427
|
+
text2 << rest if rest
|
1428
|
+
rest = text2
|
1429
|
+
end
|
1413
1430
|
super(src, rest)
|
1414
1431
|
end
|
1415
1432
|
|
@@ -1614,7 +1631,7 @@ end
|
|
1614
1631
|
#--begin of require 'erubis/engine/eruby'
|
1615
1632
|
##
|
1616
1633
|
## $Rev: 77 $
|
1617
|
-
## $Release: 2.4.
|
1634
|
+
## $Release: 2.4.1 $
|
1618
1635
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
1619
1636
|
##
|
1620
1637
|
|
@@ -1750,7 +1767,7 @@ end
|
|
1750
1767
|
#--begin of require 'erubis/local-setting'
|
1751
1768
|
##
|
1752
1769
|
## $Rev: 77 $
|
1753
|
-
## $Release: 2.4.
|
1770
|
+
## $Release: 2.4.1 $
|
1754
1771
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
1755
1772
|
##
|
1756
1773
|
|
@@ -1763,7 +1780,7 @@ end
|
|
1763
1780
|
#--begin of require 'erubis/tiny'
|
1764
1781
|
##
|
1765
1782
|
## $Rev: 77 $
|
1766
|
-
## $Release: 2.4.
|
1783
|
+
## $Release: 2.4.1 $
|
1767
1784
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
1768
1785
|
##
|
1769
1786
|
|
@@ -1909,7 +1926,7 @@ end
|
|
1909
1926
|
#--begin of require 'erubis/engine/enhanced'
|
1910
1927
|
##
|
1911
1928
|
## $Rev: 77 $
|
1912
|
-
## $Release: 2.4.
|
1929
|
+
## $Release: 2.4.1 $
|
1913
1930
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
1914
1931
|
##
|
1915
1932
|
|
@@ -2033,7 +2050,7 @@ end
|
|
2033
2050
|
#--begin of require 'erubis/engine/optimized'
|
2034
2051
|
##
|
2035
2052
|
## $Rev: 77 $
|
2036
|
-
## $Release: 2.4.
|
2053
|
+
## $Release: 2.4.1 $
|
2037
2054
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2038
2055
|
##
|
2039
2056
|
|
@@ -2164,7 +2181,7 @@ end
|
|
2164
2181
|
#--begin of require 'erubis/engine/ephp'
|
2165
2182
|
##
|
2166
2183
|
## $Rev: 77 $
|
2167
|
-
## $Release: 2.4.
|
2184
|
+
## $Release: 2.4.1 $
|
2168
2185
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2169
2186
|
##
|
2170
2187
|
|
@@ -2266,7 +2283,7 @@ end
|
|
2266
2283
|
#--begin of require 'erubis/engine/ec'
|
2267
2284
|
##
|
2268
2285
|
## $Rev: 77 $
|
2269
|
-
## $Release: 2.4.
|
2286
|
+
## $Release: 2.4.1 $
|
2270
2287
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2271
2288
|
##
|
2272
2289
|
|
@@ -2386,7 +2403,7 @@ end
|
|
2386
2403
|
#--begin of require 'erubis/engine/ejava'
|
2387
2404
|
##
|
2388
2405
|
## $Rev: 77 $
|
2389
|
-
## $Release: 2.4.
|
2406
|
+
## $Release: 2.4.1 $
|
2390
2407
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2391
2408
|
##
|
2392
2409
|
|
@@ -2499,7 +2516,7 @@ end
|
|
2499
2516
|
#--begin of require 'erubis/engine/escheme'
|
2500
2517
|
##
|
2501
2518
|
## $Rev: 77 $
|
2502
|
-
## $Release: 2.4.
|
2519
|
+
## $Release: 2.4.1 $
|
2503
2520
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2504
2521
|
##
|
2505
2522
|
|
@@ -2616,7 +2633,7 @@ end
|
|
2616
2633
|
#--begin of require 'erubis/engine/eperl'
|
2617
2634
|
##
|
2618
2635
|
## $Rev: 77 $
|
2619
|
-
## $Release: 2.4.
|
2636
|
+
## $Release: 2.4.1 $
|
2620
2637
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2621
2638
|
##
|
2622
2639
|
|
@@ -2713,8 +2730,8 @@ end
|
|
2713
2730
|
#--end of require 'erubis/engine/eperl'
|
2714
2731
|
#--begin of require 'erubis/engine/ejavascript'
|
2715
2732
|
##
|
2716
|
-
## $Rev:
|
2717
|
-
## $Release: 2.4.
|
2733
|
+
## $Rev: 95 $
|
2734
|
+
## $Release: 2.4.1 $
|
2718
2735
|
## copyright(c) 2006-2007 kuwata-lab.com all rights reserved.
|
2719
2736
|
##
|
2720
2737
|
|
@@ -2732,6 +2749,7 @@ module Erubis
|
|
2732
2749
|
list = []
|
2733
2750
|
#list << [:indent, '', "indent spaces (ex. ' ')"]
|
2734
2751
|
#list << [:buf, '_buf', "output buffer name"]
|
2752
|
+
list << [:docwrite, true, "use 'document.write()' when true"]
|
2735
2753
|
return list
|
2736
2754
|
end
|
2737
2755
|
|
@@ -2740,6 +2758,7 @@ module Erubis
|
|
2740
2758
|
@escapefunc ||= 'escape'
|
2741
2759
|
@indent = properties[:indent] || ''
|
2742
2760
|
@buf = properties[:out] || '_buf'
|
2761
|
+
@docwrite = properties[:docwrite] != false # '!= false' will be removed in the next release
|
2743
2762
|
end
|
2744
2763
|
|
2745
2764
|
def add_preamble(src)
|
@@ -2790,7 +2809,11 @@ module Erubis
|
|
2790
2809
|
|
2791
2810
|
def add_postamble(src)
|
2792
2811
|
src << "\n" if src[-1] == ?;
|
2793
|
-
|
2812
|
+
if @docwrite
|
2813
|
+
src << @indent << 'document.write(' << @buf << ".join(\"\"));\n"
|
2814
|
+
else
|
2815
|
+
src << @indent << @buf << ".join(\"\");\n"
|
2816
|
+
end
|
2794
2817
|
end
|
2795
2818
|
|
2796
2819
|
end
|
data/contrib/inline-require
CHANGED
data/doc-api/classes/Erubis.html
CHANGED
@@ -300,6 +300,11 @@ Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
|
|
300
300
|
|
301
301
|
<div class="name-list">
|
302
302
|
<table summary="Constants">
|
303
|
+
<tr class="top-aligned-row context-row">
|
304
|
+
<td class="context-item-name">EMPTY_BINDING</td>
|
305
|
+
<td>=</td>
|
306
|
+
<td class="context-item-value">binding()</td>
|
307
|
+
</tr>
|
303
308
|
<tr class="top-aligned-row context-row">
|
304
309
|
<td class="context-item-name">Ejs</td>
|
305
310
|
<td>=</td>
|
@@ -313,7 +318,7 @@ Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
|
|
313
318
|
<tr class="top-aligned-row context-row">
|
314
319
|
<td class="context-item-name">VERSION</td>
|
315
320
|
<td>=</td>
|
316
|
-
<td class="context-item-value">('$Release: 2.4.
|
321
|
+
<td class="context-item-value">('$Release: 2.4.1 $' =~ /([.\d]+)/) && $1</td>
|
317
322
|
</tr>
|
318
323
|
</table>
|
319
324
|
</div>
|
@@ -125,7 +125,7 @@ this is language-independent.
|
|
125
125
|
onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
|
126
126
|
<div class="method-source-code" id="M000163-source">
|
127
127
|
<pre>
|
128
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
128
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 571</span>
|
129
129
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
|
130
130
|
<span class="ruby-identifier">input</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^[ \t]+</</span>, <span class="ruby-value str">'<'</span>)
|
131
131
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
|
@@ -142,7 +142,7 @@
|
|
142
142
|
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
|
143
143
|
<div class="method-source-code" id="M000062-source">
|
144
144
|
<pre>
|
145
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
145
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 35</span>
|
146
146
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
147
147
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotSupportedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"evaluation of code except Ruby is not supported."</span>)
|
148
148
|
<span class="ruby-keyword kw">end</span>
|
@@ -165,7 +165,7 @@
|
|
165
165
|
onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
|
166
166
|
<div class="method-source-code" id="M000060-source">
|
167
167
|
<pre>
|
168
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
168
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 27</span>
|
169
169
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_evaluator</span>(<span class="ruby-identifier">properties</span>)
|
170
170
|
<span class="ruby-ivar">@filename</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:filename</span>]
|
171
171
|
<span class="ruby-keyword kw">end</span>
|
@@ -188,7 +188,7 @@
|
|
188
188
|
onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
|
189
189
|
<div class="method-source-code" id="M000061-source">
|
190
190
|
<pre>
|
191
|
-
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line
|
191
|
+
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 31</span>
|
192
192
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
193
193
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotSupportedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">"evaluation of code except Ruby is not supported."</span>)
|
194
194
|
<span class="ruby-keyword kw">end</span>
|
@@ -207,7 +207,7 @@ this is language-independent.
|
|
207
207
|
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
|
208
208
|
<div class="method-source-code" id="M000094-source">
|
209
209
|
<pre>
|
210
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
210
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 537</span>
|
211
211
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
|
212
212
|
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">HEADER_FOOTER_PATTERN</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">lspace</span>, <span class="ruby-identifier">word</span>, <span class="ruby-identifier">content</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
|
213
213
|
<span class="ruby-identifier">flag_trim</span> = <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">rspace</span>
|
@@ -239,7 +239,7 @@ this is language-independent.
|
|
239
239
|
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
|
240
240
|
<div class="method-source-code" id="M000095-source">
|
241
241
|
<pre>
|
242
|
-
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line
|
242
|
+
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 552</span>
|
243
243
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
|
244
244
|
<span class="ruby-identifier">source</span> = <span class="ruby-keyword kw">super</span>
|
245
245
|
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@src</span> = <span class="ruby-node">"#{@header}#{source}#{@footer}"</span>
|