erubis 2.0.1 → 2.1.0
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/ChangeLog +150 -2
- data/LGPL +504 -0
- data/README.txt +14 -8
- data/benchmark/erubybench.rb +1 -1
- data/benchmark/erubybench.rhtml +3 -3
- data/bin/erubis +1 -1
- data/bin/notext +154 -0
- data/contrib/erubis +1036 -374
- data/contrib/inline-require +5 -3
- data/doc-api/classes/Erubis.html +43 -1
- data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +14 -14
- data/doc-api/classes/Erubis/ArrayEnhancer.html +14 -14
- data/doc-api/classes/Erubis/Basic.html +112 -0
- data/doc-api/classes/Erubis/Basic/Converter.html +318 -0
- data/doc-api/classes/Erubis/Basic/Engine.html +130 -0
- data/doc-api/classes/Erubis/BiPatternEnhancer.html +14 -14
- data/doc-api/classes/Erubis/CGenerator.html +386 -0
- data/doc-api/classes/Erubis/Context.html +31 -32
- data/doc-api/classes/Erubis/Converter.html +231 -0
- data/doc-api/classes/Erubis/Ec.html +9 -283
- data/doc-api/classes/Erubis/Ejava.html +9 -274
- data/doc-api/classes/Erubis/Ejavascript.html +9 -298
- data/doc-api/classes/Erubis/Engine.html +68 -508
- data/doc-api/classes/Erubis/Eperl.html +9 -259
- data/doc-api/classes/Erubis/Ephp.html +9 -239
- data/doc-api/classes/Erubis/ErubisError.html +2 -2
- data/doc-api/classes/Erubis/Eruby.html +4 -187
- data/doc-api/classes/Erubis/EscapeEnhancer.html +9 -11
- data/doc-api/classes/Erubis/Escheme.html +9 -272
- data/doc-api/classes/Erubis/Evaluator.html +212 -0
- data/doc-api/classes/Erubis/Generator.html +410 -0
- data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +16 -16
- data/doc-api/classes/Erubis/Helper.html +112 -0
- data/doc-api/classes/Erubis/Helper/CachedRailsTemplate.html +198 -0
- data/doc-api/classes/Erubis/Helper/RailsTemplate.html +366 -0
- data/doc-api/classes/Erubis/JavaGenerator.html +359 -0
- data/doc-api/classes/Erubis/JavascriptGenerator.html +381 -0
- data/doc-api/classes/Erubis/Main.html +27 -25
- data/doc-api/classes/Erubis/NoCodeEnhancer.html +249 -0
- data/doc-api/classes/Erubis/NoCodeEruby.html +120 -0
- data/doc-api/classes/Erubis/NoTextEnhancer.html +8 -8
- data/doc-api/classes/Erubis/NotSupportedError.html +119 -0
- data/doc-api/classes/Erubis/OptimizedEruby.html +22 -304
- data/doc-api/classes/Erubis/OptimizedGenerator.html +439 -0
- data/doc-api/classes/Erubis/OptimizedXmlEruby.html +7 -7
- data/doc-api/classes/Erubis/PI.html +124 -0
- data/doc-api/classes/Erubis/PI/Converter.html +318 -0
- data/doc-api/classes/Erubis/PI/Ec.html +166 -0
- data/doc-api/classes/Erubis/PI/Ejava.html +166 -0
- data/doc-api/classes/Erubis/PI/Ejavascript.html +166 -0
- data/doc-api/classes/Erubis/PI/Engine.html +122 -0
- data/doc-api/classes/Erubis/PI/Eperl.html +166 -0
- data/doc-api/classes/Erubis/PI/Ephp.html +166 -0
- data/doc-api/classes/Erubis/PI/Eruby.html +155 -0
- data/doc-api/classes/Erubis/PI/Escheme.html +166 -0
- data/doc-api/classes/Erubis/PI/TinyEruby.html +305 -0
- data/doc-api/classes/Erubis/PercentLineEnhancer.html +7 -7
- data/doc-api/classes/Erubis/PerlGenerator.html +344 -0
- data/doc-api/classes/Erubis/PhpGenerator.html +350 -0
- data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +24 -24
- data/doc-api/classes/Erubis/PrintOutEnhancer.html +35 -35
- data/doc-api/classes/Erubis/RubyEvaluator.html +190 -0
- data/doc-api/classes/Erubis/RubyGenerator.html +327 -0
- data/doc-api/classes/Erubis/SchemeGenerator.html +382 -0
- data/doc-api/classes/Erubis/SimplifyEnhancer.html +17 -13
- data/doc-api/classes/Erubis/StdoutEnhancer.html +14 -14
- data/doc-api/classes/Erubis/StringBufferEnhancer.html +14 -14
- data/doc-api/classes/Erubis/TinyEruby.html +45 -40
- data/doc-api/classes/Erubis/XmlHelper.html +14 -14
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +27 -9
- data/doc-api/files/erubis/context_rb.html +107 -0
- data/doc-api/files/erubis/converter_rb.html +114 -0
- data/doc-api/files/erubis/engine/ec_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejava_rb.html +2 -2
- data/doc-api/files/erubis/engine/ejavascript_rb.html +2 -2
- data/doc-api/files/erubis/engine/enhanced_rb.html +2 -2
- data/doc-api/files/erubis/engine/eperl_rb.html +2 -2
- data/doc-api/files/erubis/engine/ephp_rb.html +2 -2
- data/doc-api/files/erubis/engine/eruby_rb.html +3 -2
- data/doc-api/files/erubis/engine/escheme_rb.html +2 -2
- data/doc-api/files/erubis/engine/optimized_rb.html +2 -2
- data/doc-api/files/erubis/engine_rb.html +6 -3
- data/doc-api/files/erubis/enhancer_rb.html +2 -9
- data/doc-api/files/erubis/error_rb.html +107 -0
- data/doc-api/files/erubis/evaluator_rb.html +115 -0
- data/doc-api/files/erubis/generator_rb.html +114 -0
- data/doc-api/files/erubis/helper/rails_rb.html +140 -0
- data/doc-api/files/erubis/helper_rb.html +1 -1
- data/doc-api/files/erubis/local-setting_rb.html +1 -1
- data/doc-api/files/erubis/main_rb.html +2 -2
- data/doc-api/files/erubis/tiny_rb.html +2 -2
- data/doc-api/files/erubis_rb.html +2 -2
- data/doc-api/fr_class_index.html +32 -0
- data/doc-api/fr_file_index.html +6 -0
- data/doc-api/fr_method_index.html +178 -136
- data/doc/users-guide.html +538 -199
- data/examples/{Makefile → basic/Makefile} +11 -11
- data/examples/basic/example.ec +42 -0
- data/examples/{example.ejava → basic/example.ejava} +5 -1
- data/examples/{example.ejavascript → basic/example.ejs} +0 -0
- data/examples/{example.eperl → basic/example.eperl} +2 -2
- data/examples/{example.ephp → basic/example.ephp} +0 -0
- data/examples/{example.eruby → basic/example.eruby} +0 -0
- data/examples/{example.escheme → basic/example.escheme} +0 -0
- data/examples/pi/Makefile +54 -0
- data/examples/pi/example.ec +42 -0
- data/examples/pi/example.ejava +45 -0
- data/examples/pi/example.ejs +16 -0
- data/examples/pi/example.eperl +16 -0
- data/examples/pi/example.ephp +17 -0
- data/examples/pi/example.eruby +15 -0
- data/examples/pi/example.escheme +26 -0
- data/lib/erubis.rb +15 -8
- data/lib/erubis/context.rb +54 -0
- data/lib/erubis/converter.rb +307 -0
- data/lib/erubis/engine.rb +57 -227
- data/lib/erubis/engine/ec.rb +31 -20
- data/lib/erubis/engine/ejava.rb +33 -21
- data/lib/erubis/engine/ejavascript.rb +30 -18
- data/lib/erubis/engine/enhanced.rb +7 -2
- data/lib/erubis/engine/eperl.rb +33 -19
- data/lib/erubis/engine/ephp.rb +32 -14
- data/lib/erubis/engine/eruby.rb +34 -7
- data/lib/erubis/engine/escheme.rb +34 -15
- data/lib/erubis/engine/optimized.rb +25 -11
- data/lib/erubis/enhancer.rb +53 -19
- data/lib/erubis/error.rb +24 -0
- data/lib/erubis/evaluator.rb +71 -0
- data/lib/erubis/generator.rb +83 -0
- data/lib/erubis/helper.rb +1 -1
- data/lib/erubis/helper/rails.rb +159 -0
- data/lib/erubis/local-setting.rb +1 -1
- data/lib/erubis/main.rb +87 -46
- data/lib/erubis/tiny.rb +81 -7
- data/test/assert-text-equal.rb +1 -1
- data/test/test-engines.rb +8 -9
- data/test/test-erubis.rb +196 -18
- data/test/{test-bin.rb → test-main.rb} +123 -21
- data/test/test-notext.rb +27 -0
- data/test/test.rb +5 -3
- data/test/testutil.rb +25 -36
- metadata +75 -13
- data/COPYING +0 -340
- data/examples/example.ec +0 -24
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Module: Erubis::PI</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Erubis::PI</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/erubis/converter_rb.html">
|
|
59
|
+
erubis/converter.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../../files/erubis/tiny_rb.html">
|
|
63
|
+
erubis/tiny.rb
|
|
64
|
+
</a>
|
|
65
|
+
<br />
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
|
|
69
|
+
</table>
|
|
70
|
+
</div>
|
|
71
|
+
<!-- banner header -->
|
|
72
|
+
|
|
73
|
+
<div id="bodyContent">
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<div id="contextContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
<!-- if includes -->
|
|
88
|
+
|
|
89
|
+
<div id="section">
|
|
90
|
+
|
|
91
|
+
<div id="class-list">
|
|
92
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
|
93
|
+
|
|
94
|
+
Module <a href="PI/Converter.html" class="link">Erubis::PI::Converter</a><br />
|
|
95
|
+
Class <a href="PI/Ec.html" class="link">Erubis::PI::Ec</a><br />
|
|
96
|
+
Class <a href="PI/Ejava.html" class="link">Erubis::PI::Ejava</a><br />
|
|
97
|
+
Class <a href="PI/Ejavascript.html" class="link">Erubis::PI::Ejavascript</a><br />
|
|
98
|
+
Class <a href="PI/Engine.html" class="link">Erubis::PI::Engine</a><br />
|
|
99
|
+
Class <a href="PI/Eperl.html" class="link">Erubis::PI::Eperl</a><br />
|
|
100
|
+
Class <a href="PI/Ephp.html" class="link">Erubis::PI::Ephp</a><br />
|
|
101
|
+
Class <a href="PI/Eruby.html" class="link">Erubis::PI::Eruby</a><br />
|
|
102
|
+
Class <a href="PI/Escheme.html" class="link">Erubis::PI::Escheme</a><br />
|
|
103
|
+
Class <a href="PI/TinyEruby.html" class="link">Erubis::PI::TinyEruby</a><br />
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<!-- if method_list -->
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<div id="validator-badges">
|
|
120
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
</body>
|
|
124
|
+
</html>
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Module: Erubis::PI::Converter</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Erubis::PI::Converter</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../../files/erubis/converter_rb.html">
|
|
59
|
+
erubis/converter.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
</table>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- banner header -->
|
|
68
|
+
|
|
69
|
+
<div id="bodyContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<div id="contextContent">
|
|
74
|
+
|
|
75
|
+
<div id="description">
|
|
76
|
+
<p>
|
|
77
|
+
Processing Instructions (<a href="../PI.html">PI</a>) converter for XML.
|
|
78
|
+
this class converts ’<?rb … ?>’ and
|
|
79
|
+
’${…}’ notation.
|
|
80
|
+
</p>
|
|
81
|
+
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div id="method-list">
|
|
88
|
+
<h3 class="section-bar">Methods</h3>
|
|
89
|
+
|
|
90
|
+
<div class="name-list">
|
|
91
|
+
<a href="#M000038">convert</a>
|
|
92
|
+
<a href="#M000039">convert_input</a>
|
|
93
|
+
<a href="#M000037">init_converter</a>
|
|
94
|
+
<a href="#M000041">parse_exprs</a>
|
|
95
|
+
<a href="#M000040">parse_stmts</a>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if includes -->
|
|
103
|
+
<div id="includes">
|
|
104
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
105
|
+
|
|
106
|
+
<div id="includes-list">
|
|
107
|
+
<span class="include-name"><a href="../Converter.html">Erubis::Converter</a></span>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div id="section">
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<div id="attribute-list">
|
|
118
|
+
<h3 class="section-bar">Attributes</h3>
|
|
119
|
+
|
|
120
|
+
<div class="name-list">
|
|
121
|
+
<table>
|
|
122
|
+
<tr class="top-aligned-row context-row">
|
|
123
|
+
<td class="context-item-name">pi</td>
|
|
124
|
+
<td class="context-item-value"> [RW] </td>
|
|
125
|
+
<td class="context-item-desc"></td>
|
|
126
|
+
</tr>
|
|
127
|
+
<tr class="top-aligned-row context-row">
|
|
128
|
+
<td class="context-item-name">prefix</td>
|
|
129
|
+
<td class="context-item-value"> [RW] </td>
|
|
130
|
+
<td class="context-item-desc"></td>
|
|
131
|
+
</tr>
|
|
132
|
+
</table>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
<!-- if method_list -->
|
|
139
|
+
<div id="methods">
|
|
140
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
141
|
+
|
|
142
|
+
<div id="method-M000038" class="method-detail">
|
|
143
|
+
<a name="M000038"></a>
|
|
144
|
+
|
|
145
|
+
<div class="method-heading">
|
|
146
|
+
<a href="#M000038" class="method-signature">
|
|
147
|
+
<span class="method-name">convert</span><span class="method-args">(input)</span>
|
|
148
|
+
</a>
|
|
149
|
+
</div>
|
|
150
|
+
|
|
151
|
+
<div class="method-description">
|
|
152
|
+
<p><a class="source-toggle" href="#"
|
|
153
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
|
154
|
+
<div class="method-source-code" id="M000038-source">
|
|
155
|
+
<pre>
|
|
156
|
+
<span class="ruby-comment cmt"># File erubis/converter.rb, line 181</span>
|
|
157
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
|
|
158
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">input</span>)
|
|
159
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@header</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@footer</span> <span class="ruby-operator">?</span> <span class="ruby-node">"#{@header}#{code}#{@footer}"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">code</span>
|
|
160
|
+
<span class="ruby-keyword kw">end</span>
|
|
161
|
+
</pre>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
<div id="method-M000037" class="method-detail">
|
|
167
|
+
<a name="M000037"></a>
|
|
168
|
+
|
|
169
|
+
<div class="method-heading">
|
|
170
|
+
<a href="#M000037" class="method-signature">
|
|
171
|
+
<span class="method-name">init_converter</span><span class="method-args">(properties={})</span>
|
|
172
|
+
</a>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="method-description">
|
|
176
|
+
<p><a class="source-toggle" href="#"
|
|
177
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
|
178
|
+
<div class="method-source-code" id="M000037-source">
|
|
179
|
+
<pre>
|
|
180
|
+
<span class="ruby-comment cmt"># File erubis/converter.rb, line 172</span>
|
|
181
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
|
|
182
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">properties</span>)
|
|
183
|
+
<span class="ruby-ivar">@trim</span> = <span class="ruby-operator">!</span>(<span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:trim</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>)
|
|
184
|
+
<span class="ruby-ivar">@pi</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:pi</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:pi</span>]
|
|
185
|
+
<span class="ruby-ivar">@embchar</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:embchar</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'@'</span>
|
|
186
|
+
<span class="ruby-ivar">@pattern</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:pattern</span>]
|
|
187
|
+
<span class="ruby-ivar">@pattern</span> = <span class="ruby-value str">'<% %>'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pattern</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-comment cmt">#|| @pattern == true</span>
|
|
188
|
+
<span class="ruby-keyword kw">end</span>
|
|
189
|
+
</pre>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
|
195
|
+
|
|
196
|
+
<div id="method-M000039" class="method-detail">
|
|
197
|
+
<a name="M000039"></a>
|
|
198
|
+
|
|
199
|
+
<div class="method-heading">
|
|
200
|
+
<a href="#M000039" class="method-signature">
|
|
201
|
+
<span class="method-name">convert_input</span><span class="method-args">(codebuf, input)</span>
|
|
202
|
+
</a>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<div class="method-description">
|
|
206
|
+
<p><a class="source-toggle" href="#"
|
|
207
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
|
208
|
+
<div class="method-source-code" id="M000039-source">
|
|
209
|
+
<pre>
|
|
210
|
+
<span class="ruby-comment cmt"># File erubis/converter.rb, line 188</span>
|
|
211
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
|
|
212
|
+
<span class="ruby-identifier">parse_stmts</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
|
|
213
|
+
<span class="ruby-comment cmt">#parse_stmts2(codebuf, input)</span>
|
|
214
|
+
<span class="ruby-keyword kw">end</span>
|
|
215
|
+
</pre>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div id="method-M000041" class="method-detail">
|
|
221
|
+
<a name="M000041"></a>
|
|
222
|
+
|
|
223
|
+
<div class="method-heading">
|
|
224
|
+
<a href="#M000041" class="method-signature">
|
|
225
|
+
<span class="method-name">parse_exprs</span><span class="method-args">(codebuf, input)</span>
|
|
226
|
+
</a>
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
<div class="method-description">
|
|
230
|
+
<p><a class="source-toggle" href="#"
|
|
231
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
|
232
|
+
<div class="method-source-code" id="M000041-source">
|
|
233
|
+
<pre>
|
|
234
|
+
<span class="ruby-comment cmt"># File erubis/converter.rb, line 216</span>
|
|
235
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_exprs</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
|
|
236
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@expr_pattern</span>
|
|
237
|
+
<span class="ruby-identifier">ch</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-ivar">@embchar</span>)
|
|
238
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pattern</span>
|
|
239
|
+
<span class="ruby-identifier">left</span>, <span class="ruby-identifier">right</span> = <span class="ruby-ivar">@pattern</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>)
|
|
240
|
+
<span class="ruby-ivar">@expr_pattern</span> = <span class="ruby-node">/#{ch}(!*)?\{(.*?)\}#{ch}|#{left}(=+)(.*?)#{right}/</span>
|
|
241
|
+
<span class="ruby-keyword kw">else</span>
|
|
242
|
+
<span class="ruby-ivar">@expr_pattern</span> = <span class="ruby-node">/#{ch}(!*)?\{(.*?)\}#{ch}/</span>
|
|
243
|
+
<span class="ruby-keyword kw">end</span>
|
|
244
|
+
<span class="ruby-keyword kw">end</span>
|
|
245
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
|
246
|
+
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@expr_pattern</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator1</span>, <span class="ruby-identifier">code1</span>, <span class="ruby-identifier">indicator2</span>, <span class="ruby-identifier">code2</span><span class="ruby-operator">|</span>
|
|
247
|
+
<span class="ruby-identifier">indicator</span> = <span class="ruby-identifier">indicator1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">indicator2</span>
|
|
248
|
+
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">code1</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">code2</span>
|
|
249
|
+
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
|
250
|
+
<span class="ruby-identifier">index</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>)
|
|
251
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>]
|
|
252
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
|
253
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">text</span>) <span class="ruby-comment cmt"># unless text.empty?</span>
|
|
254
|
+
<span class="ruby-identifier">add_pi_expr</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
|
|
255
|
+
<span class="ruby-keyword kw">end</span>
|
|
256
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span>
|
|
257
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">rest</span>)
|
|
258
|
+
<span class="ruby-keyword kw">end</span>
|
|
259
|
+
</pre>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
<div id="method-M000040" class="method-detail">
|
|
265
|
+
<a name="M000040"></a>
|
|
266
|
+
|
|
267
|
+
<div class="method-heading">
|
|
268
|
+
<a href="#M000040" class="method-signature">
|
|
269
|
+
<span class="method-name">parse_stmts</span><span class="method-args">(codebuf, input)</span>
|
|
270
|
+
</a>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div class="method-description">
|
|
274
|
+
<p><a class="source-toggle" href="#"
|
|
275
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
|
276
|
+
<div class="method-source-code" id="M000040-source">
|
|
277
|
+
<pre>
|
|
278
|
+
<span class="ruby-comment cmt"># File erubis/converter.rb, line 193</span>
|
|
279
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_stmts</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
|
|
280
|
+
<span class="ruby-comment cmt">#regexp = pattern_regexp(@pattern)</span>
|
|
281
|
+
<span class="ruby-ivar">@pi</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'e'</span>
|
|
282
|
+
<span class="ruby-ivar">@stmt_pattern</span> <span class="ruby-operator">||=</span> <span class="ruby-node">/(^[ \t]*)?<\?#{@pi}(?:-(\w+))?(\s.*?)\?>([ \t]*\r?\n)?/</span><span class="ruby-identifier">m</span>
|
|
283
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
|
284
|
+
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@stmt_pattern</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lspace</span>, <span class="ruby-identifier">pi_arg</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
|
|
285
|
+
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
|
286
|
+
<span class="ruby-identifier">index</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>)
|
|
287
|
+
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">index</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>]
|
|
288
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
|
289
|
+
<span class="ruby-identifier">parse_exprs</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">text</span>) <span class="ruby-comment cmt"># unless text.empty?</span>
|
|
290
|
+
<span class="ruby-keyword kw">if</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>
|
|
291
|
+
<span class="ruby-identifier">add_pi_stmt</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-node">"#{lspace}#{code}#{rspace}"</span>, <span class="ruby-identifier">pi_arg</span>)
|
|
292
|
+
<span class="ruby-keyword kw">else</span>
|
|
293
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">lspace</span>)
|
|
294
|
+
<span class="ruby-identifier">add_pi_stmt</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">pi_arg</span>)
|
|
295
|
+
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">rspace</span>)
|
|
296
|
+
<span class="ruby-keyword kw">end</span>
|
|
297
|
+
<span class="ruby-keyword kw">end</span>
|
|
298
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">$'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">input</span>
|
|
299
|
+
<span class="ruby-identifier">parse_exprs</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">rest</span>)
|
|
300
|
+
<span class="ruby-keyword kw">end</span>
|
|
301
|
+
</pre>
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
</div>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
<div id="validator-badges">
|
|
314
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
</body>
|
|
318
|
+
</html>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Erubis::PI::Ec</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Erubis::PI::Ec</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../../files/erubis/engine/ec_rb.html">
|
|
59
|
+
erubis/engine/ec.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
PI::Engine
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
class XmlEc < <a href="Ec.html">Ec</a>
|
|
84
|
+
</p>
|
|
85
|
+
<pre>
|
|
86
|
+
include EscapeEnhancer
|
|
87
|
+
</pre>
|
|
88
|
+
<p>
|
|
89
|
+
end
|
|
90
|
+
</p>
|
|
91
|
+
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div id="method-list">
|
|
98
|
+
<h3 class="section-bar">Methods</h3>
|
|
99
|
+
|
|
100
|
+
<div class="name-list">
|
|
101
|
+
<a href="#M000051">init_converter</a>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<!-- if includes -->
|
|
109
|
+
<div id="includes">
|
|
110
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
111
|
+
|
|
112
|
+
<div id="includes-list">
|
|
113
|
+
<span class="include-name"><a href="../CGenerator.html">CGenerator</a></span>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div id="section">
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<!-- if method_list -->
|
|
127
|
+
<div id="methods">
|
|
128
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
129
|
+
|
|
130
|
+
<div id="method-M000051" class="method-detail">
|
|
131
|
+
<a name="M000051"></a>
|
|
132
|
+
|
|
133
|
+
<div class="method-heading">
|
|
134
|
+
<a href="#M000051" class="method-signature">
|
|
135
|
+
<span class="method-name">init_converter</span><span class="method-args">(properties={})</span>
|
|
136
|
+
</a>
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
<div class="method-description">
|
|
140
|
+
<p><a class="source-toggle" href="#"
|
|
141
|
+
onclick="toggleCode('M000051-source');return false;">[Source]</a></p>
|
|
142
|
+
<div class="method-source-code" id="M000051-source">
|
|
143
|
+
<pre>
|
|
144
|
+
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 110</span>
|
|
145
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
|
|
146
|
+
<span class="ruby-ivar">@pi</span> = <span class="ruby-value str">'c'</span>
|
|
147
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">properties</span>)
|
|
148
|
+
<span class="ruby-keyword kw">end</span>
|
|
149
|
+
</pre>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<div id="validator-badges">
|
|
162
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
</body>
|
|
166
|
+
</html>
|