html-template-pro 0.0.1
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/.autotest +9 -0
- data/ARTISTIC +131 -0
- data/History.txt +4 -0
- data/LGPL +504 -0
- data/Manifest.txt +221 -0
- data/README.rdoc +52 -0
- data/Rakefile +18 -0
- data/benchmark.rb +136 -0
- data/config/website.yml +2 -0
- data/ext/html/template/internal/Pro.xs +679 -0
- data/ext/html/template/internal/builtin_findfile.inc +361 -0
- data/ext/html/template/internal/calc.h +26 -0
- data/ext/html/template/internal/calc.inc +120 -0
- data/ext/html/template/internal/callback_stubs.inc +63 -0
- data/ext/html/template/internal/expr.c +2267 -0
- data/ext/html/template/internal/expr.y +476 -0
- data/ext/html/template/internal/expr_iface.c +94 -0
- data/ext/html/template/internal/exprpstr.h +36 -0
- data/ext/html/template/internal/exprpstr.inc +144 -0
- data/ext/html/template/internal/exprtool.h +99 -0
- data/ext/html/template/internal/exprtool.inc +289 -0
- data/ext/html/template/internal/exprtype.h +62 -0
- data/ext/html/template/internal/exprval.h +30 -0
- data/ext/html/template/internal/extconf.rb +6 -0
- data/ext/html/template/internal/internal.c +449 -0
- data/ext/html/template/internal/loadfile.h +11 -0
- data/ext/html/template/internal/loadfile.inc +171 -0
- data/ext/html/template/internal/pabidecl.h +54 -0
- data/ext/html/template/internal/pabstract.h +426 -0
- data/ext/html/template/internal/parse_expr.h +15 -0
- data/ext/html/template/internal/pbuffer.c +76 -0
- data/ext/html/template/internal/pbuffer.h +31 -0
- data/ext/html/template/internal/pmiscdef.h +54 -0
- data/ext/html/template/internal/pparam.h +101 -0
- data/ext/html/template/internal/ppport.h +1098 -0
- data/ext/html/template/internal/procore.c +1189 -0
- data/ext/html/template/internal/procore.h +18 -0
- data/ext/html/template/internal/proparam.c +443 -0
- data/ext/html/template/internal/proparam.h +571 -0
- data/ext/html/template/internal/proscope.h +32 -0
- data/ext/html/template/internal/proscope.inc +107 -0
- data/ext/html/template/internal/prostate.h +49 -0
- data/ext/html/template/internal/prostate.inc +24 -0
- data/ext/html/template/internal/provalue.h +14 -0
- data/ext/html/template/internal/pstring.h +60 -0
- data/ext/html/template/internal/pstrutils.h +25 -0
- data/ext/html/template/internal/pstrutils.inc +150 -0
- data/ext/html/template/internal/tagstack.h +30 -0
- data/ext/html/template/internal/tagstack.inc +65 -0
- data/ext/html/template/internal/tmpllog.c +62 -0
- data/ext/html/template/internal/tmpllog.h +27 -0
- data/ext/html/template/internal/tmplpro.h +218 -0
- data/ext/html/template/internal/tmplpro_version.c +35 -0
- data/lib/html/template/pro.rb +225 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +71 -0
- data/tasks/extconf.rake +13 -0
- data/tasks/extconf/tmplpro.rake +43 -0
- data/templates-Pro/a.incl +1 -0
- data/templates-Pro/empty.incl +0 -0
- data/templates-Pro/include/1/a.incl +1 -0
- data/templates-Pro/include/2.out +3 -0
- data/templates-Pro/include/2.tmpl +1 -0
- data/templates-Pro/include/2/a.incl +1 -0
- data/templates-Pro/include/3.tmpl +1 -0
- data/templates-Pro/include/4.tmpl +1 -0
- data/templates-Pro/include/a.incl +1 -0
- data/templates-Pro/test_broken.tmpl +25 -0
- data/templates-Pro/test_broken1.out +1 -0
- data/templates-Pro/test_broken1.tmpl +1 -0
- data/templates-Pro/test_esc1.out +4 -0
- data/templates-Pro/test_esc1.tmpl +4 -0
- data/templates-Pro/test_esc2.out +5 -0
- data/templates-Pro/test_esc2.tmpl +6 -0
- data/templates-Pro/test_esc3.out +4 -0
- data/templates-Pro/test_esc3.tmpl +4 -0
- data/templates-Pro/test_esc4.out +3 -0
- data/templates-Pro/test_esc4.tmpl +4 -0
- data/templates-Pro/test_expr1.out +26 -0
- data/templates-Pro/test_expr1.tmpl +26 -0
- data/templates-Pro/test_expr2.out +34 -0
- data/templates-Pro/test_expr2.tmpl +34 -0
- data/templates-Pro/test_expr3.out +6 -0
- data/templates-Pro/test_expr3.tmpl +6 -0
- data/templates-Pro/test_expr4.out +4 -0
- data/templates-Pro/test_expr4.tmpl +4 -0
- data/templates-Pro/test_expr5.out +18 -0
- data/templates-Pro/test_expr5.tmpl +18 -0
- data/templates-Pro/test_expr6.out +18 -0
- data/templates-Pro/test_expr6.tmpl +18 -0
- data/templates-Pro/test_expr7.out +44 -0
- data/templates-Pro/test_expr7.tmpl +20 -0
- data/templates-Pro/test_expr8.out +15 -0
- data/templates-Pro/test_expr8.tmpl +15 -0
- data/templates-Pro/test_if1.out +25 -0
- data/templates-Pro/test_if1.tmpl +28 -0
- data/templates-Pro/test_if2.out +17 -0
- data/templates-Pro/test_if2.tmpl +25 -0
- data/templates-Pro/test_if3.out +12 -0
- data/templates-Pro/test_if3.tmpl +14 -0
- data/templates-Pro/test_if4.out +15 -0
- data/templates-Pro/test_if4.tmpl +31 -0
- data/templates-Pro/test_if5.out +16 -0
- data/templates-Pro/test_if5.tmpl +16 -0
- data/templates-Pro/test_if6.out +15 -0
- data/templates-Pro/test_if6.tmpl +31 -0
- data/templates-Pro/test_if7.out +14 -0
- data/templates-Pro/test_if7.tmpl +18 -0
- data/templates-Pro/test_include1.out +23 -0
- data/templates-Pro/test_include1.tmpl +7 -0
- data/templates-Pro/test_include2.out +120 -0
- data/templates-Pro/test_include2.tmpl +10 -0
- data/templates-Pro/test_include3.out +8 -0
- data/templates-Pro/test_include3.tmpl +8 -0
- data/templates-Pro/test_include4.out +7 -0
- data/templates-Pro/test_include4.tmpl +6 -0
- data/templates-Pro/test_include5.out +7 -0
- data/templates-Pro/test_include5.tmpl +6 -0
- data/templates-Pro/test_loop1.erb +17 -0
- data/templates-Pro/test_loop1.out +12 -0
- data/templates-Pro/test_loop1.tmpl +16 -0
- data/templates-Pro/test_loop2.erb +19 -0
- data/templates-Pro/test_loop2.out +40 -0
- data/templates-Pro/test_loop2.tmpl +19 -0
- data/templates-Pro/test_loop3.out +38 -0
- data/templates-Pro/test_loop3.tmpl +40 -0
- data/templates-Pro/test_loop4.out +44 -0
- data/templates-Pro/test_loop4.tmpl +20 -0
- data/templates-Pro/test_loop5.out +9 -0
- data/templates-Pro/test_loop5.tmpl +11 -0
- data/templates-Pro/test_loop6.out +33 -0
- data/templates-Pro/test_loop6.tmpl +15 -0
- data/templates-Pro/test_malloc.tmpl +1 -0
- data/templates-Pro/test_userfunc1.out +14 -0
- data/templates-Pro/test_userfunc1.tmpl +14 -0
- data/templates-Pro/test_userfunc2.out +35 -0
- data/templates-Pro/test_userfunc2.tmpl +5 -0
- data/templates-Pro/test_userfunc3.out +5 -0
- data/templates-Pro/test_userfunc3.tmpl +5 -0
- data/templates-Pro/test_userfunc4.out +10 -0
- data/templates-Pro/test_userfunc4.tmpl +10 -0
- data/templates-Pro/test_userfunc5.out +4 -0
- data/templates-Pro/test_userfunc5.tmpl +4 -0
- data/templates-Pro/test_userfunc6.out +4 -0
- data/templates-Pro/test_userfunc6.tmpl +4 -0
- data/templates-Pro/test_var1.erb +23 -0
- data/templates-Pro/test_var1.out +20 -0
- data/templates-Pro/test_var1.tmpl +23 -0
- data/templates-Pro/test_var2.erb +7 -0
- data/templates-Pro/test_var2.out +6 -0
- data/templates-Pro/test_var2.tmpl +7 -0
- data/templates-Pro/test_var3.out +14 -0
- data/templates-Pro/test_var3.tmpl +16 -0
- data/templates/case_loop.tmpl +3 -0
- data/templates/context.tmpl +3 -0
- data/templates/counter.tmpl +2 -0
- data/templates/default.tmpl +1 -0
- data/templates/default_escape.tmpl +4 -0
- data/templates/double_loop.tmpl +7 -0
- data/templates/escape.tmpl +5 -0
- data/templates/global-loops.tmpl +9 -0
- data/templates/globals.tmpl +11 -0
- data/templates/if.tmpl +7 -0
- data/templates/ifelse.tmpl +6 -0
- data/templates/include.tmpl +14 -0
- data/templates/include_path/a.tmpl +2 -0
- data/templates/include_path/b.tmpl +1 -0
- data/templates/include_path/inner.tmpl +1 -0
- data/templates/include_path/one.tmpl +2 -0
- data/templates/include_path2/inner.tmpl +1 -0
- data/templates/included.tmpl +4 -0
- data/templates/included2.tmpl +3 -0
- data/templates/js.tmpl +1 -0
- data/templates/long_loops.tmpl +307 -0
- data/templates/loop-context.tmpl +2 -0
- data/templates/loop-if.tmpl +9 -0
- data/templates/medium.tmpl +217 -0
- data/templates/multiline_tags.tmpl +7 -0
- data/templates/newline_test1.tmpl +1 -0
- data/templates/newline_test2.tmpl +1 -0
- data/templates/other-loop.tmpl +7 -0
- data/templates/outer.tmpl +3 -0
- data/templates/query-test.tmpl +21 -0
- data/templates/query-test2.tmpl +12 -0
- data/templates/recursive.tmpl +2 -0
- data/templates/searchpath/included.tmpl +4 -0
- data/templates/searchpath/three.tmpl +1 -0
- data/templates/searchpath/two.tmpl +2 -0
- data/templates/simple-loop-nonames.tmpl +13 -0
- data/templates/simple-loop.tmpl +12 -0
- data/templates/simple.tmpl +9 -0
- data/templates/unless.tmpl +5 -0
- data/templates/urlescape.tmpl +3 -0
- data/templates/vanguard1.tmpl +2 -0
- data/templates/vanguard2.tmpl +3 -0
- data/test/templates/complex.tmpl +24 -0
- data/test/templates/foo.tmpl +6 -0
- data/test/templates/func.tmpl +2 -0
- data/test/templates/loop.tmpl +14 -0
- data/test/templates/negative.tmpl +1 -0
- data/test/templates/numerics.tmpl +6 -0
- data/test/templates/register.tmpl +2 -0
- data/test/test_basic.rb +23 -0
- data/test/test_coderefs.rb +16 -0
- data/test/test_complex.rb +106 -0
- data/test/test_helper.rb +3 -0
- data/test/test_html_template.rb +583 -0
- data/test/test_html_template_internal_extn.rb +10 -0
- data/test/test_html_template_pro.rb +177 -0
- data/test/test_path_like_variable_scope.rb +59 -0
- data/test/test_random.rb +21 -0
- data/test/test_realloc.rb +16 -0
- data/test/test_register.rb +25 -0
- data/test/test_tmplpro.rb +9 -0
- data/test/tests.rb +9 -0
- data/website/index.txt +57 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +159 -0
- data/website/template.html.erb +50 -0
- metadata +303 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<HTML>
|
|
2
|
+
<body>
|
|
3
|
+
<H1> test_loop4 </H1>
|
|
4
|
+
|
|
5
|
+
We test inner loop variables
|
|
6
|
+
|
|
7
|
+
<table>
|
|
8
|
+
<TMPL_LOOP NAME=HASHREF1>
|
|
9
|
+
<tr>
|
|
10
|
+
<td>first:<tmpl_var NAME="__first__"></td>
|
|
11
|
+
<td>last: <tmpl_var NAME="__last__"></td>
|
|
12
|
+
<td>odd:<tmpl_var NAME="__odd__"></td>
|
|
13
|
+
<td>inner:<tmpl_var NAME="__inner__"></td>
|
|
14
|
+
<td>count:<tmpl_var NAME="__counter__"></td>
|
|
15
|
+
</tr>
|
|
16
|
+
</tmpl_loop>
|
|
17
|
+
</table>
|
|
18
|
+
|
|
19
|
+
</body>
|
|
20
|
+
</HTML>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<H1> test_loop6: global vars inside a loop </H1>
|
|
2
|
+
|
|
3
|
+
Inside a Loop
|
|
4
|
+
<TMPL_LOOP NAME="OUTER">
|
|
5
|
+
<TMPL_VAR NAME="TEST">
|
|
6
|
+
<TMPL_LOOP NAME="INNER">
|
|
7
|
+
<TMPL_VAR NAME="TST">
|
|
8
|
+
</TMPL_LOOP>
|
|
9
|
+
</TMPL_LOOP>
|
|
10
|
+
Outside a Loop
|
|
11
|
+
<TMPL_LOOP NAME="INNER">
|
|
12
|
+
<TMPL_VAR NAME="TST">
|
|
13
|
+
</TMPL_LOOP>
|
|
14
|
+
|
|
15
|
+
<H1> end test_loop6 </H1>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<tmpl_var name=text escape=HTML>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<HTML><BODY>
|
|
2
|
+
<H1> test expr with perl-supplied functions </H1>
|
|
3
|
+
hello('dad')=hi, dad!
|
|
4
|
+
lc('DAD')=dad
|
|
5
|
+
lc(ONE)=1
|
|
6
|
+
sprintf('1+1=%d', TWO)=1+1=2
|
|
7
|
+
<H1> test expr with user-defined functions </H1>
|
|
8
|
+
registered_func('self')=self
|
|
9
|
+
hello_string()=hello!
|
|
10
|
+
arglist()=[]
|
|
11
|
+
arglist('')=[]
|
|
12
|
+
arglist('','')=[][]
|
|
13
|
+
arglist('a','b')=[a][b]
|
|
14
|
+
</body></html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<HTML><BODY>
|
|
2
|
+
<H1> test expr with perl-supplied functions </H1>
|
|
3
|
+
hello('dad')=<tmpl_var expr="hello('dad')">
|
|
4
|
+
lc('DAD')=<tmpl_var expr="lc('DAD')">
|
|
5
|
+
lc(ONE)=<tmpl_var expr="lc(ONE)">
|
|
6
|
+
sprintf('1+1=%d', TWO)=<TMPL_VAR EXPR="sprintf('1+1=%d', TWO)">
|
|
7
|
+
<H1> test expr with user-defined functions </H1>
|
|
8
|
+
registered_func('self')=<tmpl_var expr="registered_func('self')">
|
|
9
|
+
hello_string()=<tmpl_var expr="hello_string()">
|
|
10
|
+
arglist()=<tmpl_var expr="arglist()">
|
|
11
|
+
arglist('')=<tmpl_var expr="arglist('')">
|
|
12
|
+
arglist('','')=<tmpl_var expr="arglist('','')">
|
|
13
|
+
arglist('a','b')=<tmpl_var expr="arglist('a','b')">
|
|
14
|
+
</body></html>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<HTML><BODY>
|
|
2
|
+
<H1> test_expr5 (include) </H1>
|
|
3
|
+
<HTML><BODY>
|
|
4
|
+
<H1> test_if2 </H1>
|
|
5
|
+
undefined (TRUE)
|
|
6
|
+
(if test 1)
|
|
7
|
+
|
|
8
|
+
undefined (FALSE)
|
|
9
|
+
(if test 2)
|
|
10
|
+
|
|
11
|
+
defined (if test 3 level 1) HIDDEN
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<H1> END test_if2 </H1>
|
|
16
|
+
</body></html>
|
|
17
|
+
|
|
18
|
+
<H1> test_if1 </H1>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
------------------ <hr>
|
|
26
|
+
defined (TRUE)
|
|
27
|
+
(if test 1)
|
|
28
|
+
|
|
29
|
+
defined (FALSE)
|
|
30
|
+
(if test 2)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</body></html>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<HTML><BODY>
|
|
2
|
+
<H1> test unescape in func args </H1>
|
|
3
|
+
arglist('\'','s\a\\nki')=<tmpl_var expr="arglist('\'','s\a\\nki')">
|
|
4
|
+
arglist('\'','\a\\n')=<tmpl_var expr="arglist('\'','\a\\n')">
|
|
5
|
+
arglist('\'','\a\\')=<tmpl_var expr="arglist('\'','\a\\')">
|
|
6
|
+
arglist('\a\\')=<tmpl_var expr="arglist('\a\\')">
|
|
7
|
+
arglist('\a')=<tmpl_var expr="arglist('\a')">
|
|
8
|
+
arglist('\\')=<tmpl_var expr="arglist('\\')">
|
|
9
|
+
arglist('\'')=<tmpl_var expr="arglist('\'')">
|
|
10
|
+
</body></html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<H1> test_var1 </H1>
|
|
2
|
+
------------------ <br>
|
|
3
|
+
<bar Name>
|
|
4
|
+
|
|
5
|
+
<%= params[:VAR1] %> step1
|
|
6
|
+
|
|
7
|
+
<%=
|
|
8
|
+
params[:VAR1] %> <%= params[:VAR1] %> step3 <%= params[:VAR1] %> <%=
|
|
9
|
+
params[:VAR2] %> step5 <%=
|
|
10
|
+
params[:VAR3] %> step6 <%= params[:VAR10] %> step7
|
|
11
|
+
<BR> <%= params[:VAR10] %> step8 <%= params[:VAR10] %> step9
|
|
12
|
+
|
|
13
|
+
<%= params[:VAR1] %> step10
|
|
14
|
+
|
|
15
|
+
<%= params[:VAR4] || "test 1 passed. ':)" %>
|
|
16
|
+
|
|
17
|
+
template tags could be decorated as html comments
|
|
18
|
+
<%= params[:VAR4] || "test 2 passed. ':)" %>
|
|
19
|
+
|
|
20
|
+
template tags could also be decorated as xml (starting from version 0.90)
|
|
21
|
+
<%= params[:VAR1] %> no trailing slash here.
|
|
22
|
+
----- end ------- <br>
|
|
23
|
+
<H1> end test_var1 </H1>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<H1> test_var1 </H1>
|
|
2
|
+
------------------ <br>
|
|
3
|
+
<bar Name>
|
|
4
|
+
|
|
5
|
+
VAR1 step1
|
|
6
|
+
|
|
7
|
+
VAR1 VAR1 step3 VAR1 VAR2 step5 VAR3 step6 VAR10 step7
|
|
8
|
+
<BR> VAR10 step8 VAR10 step9
|
|
9
|
+
|
|
10
|
+
VAR1 step10
|
|
11
|
+
|
|
12
|
+
test 1 passed. ':)
|
|
13
|
+
|
|
14
|
+
template tags could be decorated as html comments
|
|
15
|
+
test 2 passed. ':)
|
|
16
|
+
|
|
17
|
+
template tags could also be decorated as xml (starting from version 0.90)
|
|
18
|
+
VAR1 no trailing slash here.
|
|
19
|
+
----- end ------- <br>
|
|
20
|
+
<H1> end test_var1 </H1>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<H1> test_var1 </H1>
|
|
2
|
+
------------------ <br>
|
|
3
|
+
<bar Name>
|
|
4
|
+
|
|
5
|
+
<tmPl_var VAR1> step1
|
|
6
|
+
|
|
7
|
+
<tmpl_var
|
|
8
|
+
"VAR1"> <tmpl_var NAME= "VAR1" > step3 <Tmpl_var NAME ="VAR1" > <TMPL_vAr
|
|
9
|
+
NAME ="VAR2" > step5 <tmpl_Var NAME
|
|
10
|
+
="VAR3" > step6 <tmpl_var NAME= VAR10 > step7
|
|
11
|
+
<BR> <tmpl_var NAME=VAR10 > step8 <tmpl_var NAME =VAR10> step9
|
|
12
|
+
|
|
13
|
+
<tmpl_var NAME= 'VAR1' > step10
|
|
14
|
+
|
|
15
|
+
<tmpl_var NAME = "VAR4" default="test 1 passed. ':)">
|
|
16
|
+
|
|
17
|
+
template tags could be decorated as html comments
|
|
18
|
+
<!-- tmpl_var NAME = "VAR4" default="test 2 passed. ':)" -->
|
|
19
|
+
|
|
20
|
+
template tags could also be decorated as xml (starting from version 0.90)
|
|
21
|
+
<tmpl_var name="VAR1" /> no trailing slash here.
|
|
22
|
+
----- end ------- <br>
|
|
23
|
+
<H1> end test_var1 </H1>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<HTML><BODY>
|
|
2
|
+
<H1> test_var3 </H1>
|
|
3
|
+
<tmpl_iF VAR4> <tmpl_var escape=0 DEFAULT="test failed" NAME="STUFF1">
|
|
4
|
+
<tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe=0>
|
|
5
|
+
</tmpl_if>
|
|
6
|
+
<tmpl_iF VAR4> <tmpl_var escape="URL" DEFAULT="test failed" NAME="STUFF1">
|
|
7
|
+
<tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe="URL">
|
|
8
|
+
</tmpl_if>
|
|
9
|
+
<tmpl_iF VAR4> <tmpl_var escape='HTML' DEFAULT="test failed" NAME="STUFF1">
|
|
10
|
+
<tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe="HTML">
|
|
11
|
+
</tmpl_if>
|
|
12
|
+
<tmpl_iF VAR4> <tmpl_var escape="JS" DEFAULT="test failed" NAME="STUFF1">
|
|
13
|
+
<tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe='js'>
|
|
14
|
+
</tmpl_if>
|
|
15
|
+
<H1> END test_var3 </H1>
|
|
16
|
+
</body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cause it's <tmpl_var name=a default=getting> hard to <tmpl_var default=think b>, and <tmpl_var c default=my> <tmpl_var name=cl default=clots> are <tmpl_var name=start escape=1 default=foo>ing to <tmpl_var escape=html name=sh default=shrink>
|
data/templates/if.tmpl
ADDED