html-template-pro 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. data/.autotest +9 -0
  2. data/ARTISTIC +131 -0
  3. data/History.txt +4 -0
  4. data/LGPL +504 -0
  5. data/Manifest.txt +221 -0
  6. data/README.rdoc +52 -0
  7. data/Rakefile +18 -0
  8. data/benchmark.rb +136 -0
  9. data/config/website.yml +2 -0
  10. data/ext/html/template/internal/Pro.xs +679 -0
  11. data/ext/html/template/internal/builtin_findfile.inc +361 -0
  12. data/ext/html/template/internal/calc.h +26 -0
  13. data/ext/html/template/internal/calc.inc +120 -0
  14. data/ext/html/template/internal/callback_stubs.inc +63 -0
  15. data/ext/html/template/internal/expr.c +2267 -0
  16. data/ext/html/template/internal/expr.y +476 -0
  17. data/ext/html/template/internal/expr_iface.c +94 -0
  18. data/ext/html/template/internal/exprpstr.h +36 -0
  19. data/ext/html/template/internal/exprpstr.inc +144 -0
  20. data/ext/html/template/internal/exprtool.h +99 -0
  21. data/ext/html/template/internal/exprtool.inc +289 -0
  22. data/ext/html/template/internal/exprtype.h +62 -0
  23. data/ext/html/template/internal/exprval.h +30 -0
  24. data/ext/html/template/internal/extconf.rb +6 -0
  25. data/ext/html/template/internal/internal.c +449 -0
  26. data/ext/html/template/internal/loadfile.h +11 -0
  27. data/ext/html/template/internal/loadfile.inc +171 -0
  28. data/ext/html/template/internal/pabidecl.h +54 -0
  29. data/ext/html/template/internal/pabstract.h +426 -0
  30. data/ext/html/template/internal/parse_expr.h +15 -0
  31. data/ext/html/template/internal/pbuffer.c +76 -0
  32. data/ext/html/template/internal/pbuffer.h +31 -0
  33. data/ext/html/template/internal/pmiscdef.h +54 -0
  34. data/ext/html/template/internal/pparam.h +101 -0
  35. data/ext/html/template/internal/ppport.h +1098 -0
  36. data/ext/html/template/internal/procore.c +1189 -0
  37. data/ext/html/template/internal/procore.h +18 -0
  38. data/ext/html/template/internal/proparam.c +443 -0
  39. data/ext/html/template/internal/proparam.h +571 -0
  40. data/ext/html/template/internal/proscope.h +32 -0
  41. data/ext/html/template/internal/proscope.inc +107 -0
  42. data/ext/html/template/internal/prostate.h +49 -0
  43. data/ext/html/template/internal/prostate.inc +24 -0
  44. data/ext/html/template/internal/provalue.h +14 -0
  45. data/ext/html/template/internal/pstring.h +60 -0
  46. data/ext/html/template/internal/pstrutils.h +25 -0
  47. data/ext/html/template/internal/pstrutils.inc +150 -0
  48. data/ext/html/template/internal/tagstack.h +30 -0
  49. data/ext/html/template/internal/tagstack.inc +65 -0
  50. data/ext/html/template/internal/tmpllog.c +62 -0
  51. data/ext/html/template/internal/tmpllog.h +27 -0
  52. data/ext/html/template/internal/tmplpro.h +218 -0
  53. data/ext/html/template/internal/tmplpro_version.c +35 -0
  54. data/lib/html/template/pro.rb +225 -0
  55. data/script/console +10 -0
  56. data/script/destroy +14 -0
  57. data/script/generate +14 -0
  58. data/script/txt2html +71 -0
  59. data/tasks/extconf.rake +13 -0
  60. data/tasks/extconf/tmplpro.rake +43 -0
  61. data/templates-Pro/a.incl +1 -0
  62. data/templates-Pro/empty.incl +0 -0
  63. data/templates-Pro/include/1/a.incl +1 -0
  64. data/templates-Pro/include/2.out +3 -0
  65. data/templates-Pro/include/2.tmpl +1 -0
  66. data/templates-Pro/include/2/a.incl +1 -0
  67. data/templates-Pro/include/3.tmpl +1 -0
  68. data/templates-Pro/include/4.tmpl +1 -0
  69. data/templates-Pro/include/a.incl +1 -0
  70. data/templates-Pro/test_broken.tmpl +25 -0
  71. data/templates-Pro/test_broken1.out +1 -0
  72. data/templates-Pro/test_broken1.tmpl +1 -0
  73. data/templates-Pro/test_esc1.out +4 -0
  74. data/templates-Pro/test_esc1.tmpl +4 -0
  75. data/templates-Pro/test_esc2.out +5 -0
  76. data/templates-Pro/test_esc2.tmpl +6 -0
  77. data/templates-Pro/test_esc3.out +4 -0
  78. data/templates-Pro/test_esc3.tmpl +4 -0
  79. data/templates-Pro/test_esc4.out +3 -0
  80. data/templates-Pro/test_esc4.tmpl +4 -0
  81. data/templates-Pro/test_expr1.out +26 -0
  82. data/templates-Pro/test_expr1.tmpl +26 -0
  83. data/templates-Pro/test_expr2.out +34 -0
  84. data/templates-Pro/test_expr2.tmpl +34 -0
  85. data/templates-Pro/test_expr3.out +6 -0
  86. data/templates-Pro/test_expr3.tmpl +6 -0
  87. data/templates-Pro/test_expr4.out +4 -0
  88. data/templates-Pro/test_expr4.tmpl +4 -0
  89. data/templates-Pro/test_expr5.out +18 -0
  90. data/templates-Pro/test_expr5.tmpl +18 -0
  91. data/templates-Pro/test_expr6.out +18 -0
  92. data/templates-Pro/test_expr6.tmpl +18 -0
  93. data/templates-Pro/test_expr7.out +44 -0
  94. data/templates-Pro/test_expr7.tmpl +20 -0
  95. data/templates-Pro/test_expr8.out +15 -0
  96. data/templates-Pro/test_expr8.tmpl +15 -0
  97. data/templates-Pro/test_if1.out +25 -0
  98. data/templates-Pro/test_if1.tmpl +28 -0
  99. data/templates-Pro/test_if2.out +17 -0
  100. data/templates-Pro/test_if2.tmpl +25 -0
  101. data/templates-Pro/test_if3.out +12 -0
  102. data/templates-Pro/test_if3.tmpl +14 -0
  103. data/templates-Pro/test_if4.out +15 -0
  104. data/templates-Pro/test_if4.tmpl +31 -0
  105. data/templates-Pro/test_if5.out +16 -0
  106. data/templates-Pro/test_if5.tmpl +16 -0
  107. data/templates-Pro/test_if6.out +15 -0
  108. data/templates-Pro/test_if6.tmpl +31 -0
  109. data/templates-Pro/test_if7.out +14 -0
  110. data/templates-Pro/test_if7.tmpl +18 -0
  111. data/templates-Pro/test_include1.out +23 -0
  112. data/templates-Pro/test_include1.tmpl +7 -0
  113. data/templates-Pro/test_include2.out +120 -0
  114. data/templates-Pro/test_include2.tmpl +10 -0
  115. data/templates-Pro/test_include3.out +8 -0
  116. data/templates-Pro/test_include3.tmpl +8 -0
  117. data/templates-Pro/test_include4.out +7 -0
  118. data/templates-Pro/test_include4.tmpl +6 -0
  119. data/templates-Pro/test_include5.out +7 -0
  120. data/templates-Pro/test_include5.tmpl +6 -0
  121. data/templates-Pro/test_loop1.erb +17 -0
  122. data/templates-Pro/test_loop1.out +12 -0
  123. data/templates-Pro/test_loop1.tmpl +16 -0
  124. data/templates-Pro/test_loop2.erb +19 -0
  125. data/templates-Pro/test_loop2.out +40 -0
  126. data/templates-Pro/test_loop2.tmpl +19 -0
  127. data/templates-Pro/test_loop3.out +38 -0
  128. data/templates-Pro/test_loop3.tmpl +40 -0
  129. data/templates-Pro/test_loop4.out +44 -0
  130. data/templates-Pro/test_loop4.tmpl +20 -0
  131. data/templates-Pro/test_loop5.out +9 -0
  132. data/templates-Pro/test_loop5.tmpl +11 -0
  133. data/templates-Pro/test_loop6.out +33 -0
  134. data/templates-Pro/test_loop6.tmpl +15 -0
  135. data/templates-Pro/test_malloc.tmpl +1 -0
  136. data/templates-Pro/test_userfunc1.out +14 -0
  137. data/templates-Pro/test_userfunc1.tmpl +14 -0
  138. data/templates-Pro/test_userfunc2.out +35 -0
  139. data/templates-Pro/test_userfunc2.tmpl +5 -0
  140. data/templates-Pro/test_userfunc3.out +5 -0
  141. data/templates-Pro/test_userfunc3.tmpl +5 -0
  142. data/templates-Pro/test_userfunc4.out +10 -0
  143. data/templates-Pro/test_userfunc4.tmpl +10 -0
  144. data/templates-Pro/test_userfunc5.out +4 -0
  145. data/templates-Pro/test_userfunc5.tmpl +4 -0
  146. data/templates-Pro/test_userfunc6.out +4 -0
  147. data/templates-Pro/test_userfunc6.tmpl +4 -0
  148. data/templates-Pro/test_var1.erb +23 -0
  149. data/templates-Pro/test_var1.out +20 -0
  150. data/templates-Pro/test_var1.tmpl +23 -0
  151. data/templates-Pro/test_var2.erb +7 -0
  152. data/templates-Pro/test_var2.out +6 -0
  153. data/templates-Pro/test_var2.tmpl +7 -0
  154. data/templates-Pro/test_var3.out +14 -0
  155. data/templates-Pro/test_var3.tmpl +16 -0
  156. data/templates/case_loop.tmpl +3 -0
  157. data/templates/context.tmpl +3 -0
  158. data/templates/counter.tmpl +2 -0
  159. data/templates/default.tmpl +1 -0
  160. data/templates/default_escape.tmpl +4 -0
  161. data/templates/double_loop.tmpl +7 -0
  162. data/templates/escape.tmpl +5 -0
  163. data/templates/global-loops.tmpl +9 -0
  164. data/templates/globals.tmpl +11 -0
  165. data/templates/if.tmpl +7 -0
  166. data/templates/ifelse.tmpl +6 -0
  167. data/templates/include.tmpl +14 -0
  168. data/templates/include_path/a.tmpl +2 -0
  169. data/templates/include_path/b.tmpl +1 -0
  170. data/templates/include_path/inner.tmpl +1 -0
  171. data/templates/include_path/one.tmpl +2 -0
  172. data/templates/include_path2/inner.tmpl +1 -0
  173. data/templates/included.tmpl +4 -0
  174. data/templates/included2.tmpl +3 -0
  175. data/templates/js.tmpl +1 -0
  176. data/templates/long_loops.tmpl +307 -0
  177. data/templates/loop-context.tmpl +2 -0
  178. data/templates/loop-if.tmpl +9 -0
  179. data/templates/medium.tmpl +217 -0
  180. data/templates/multiline_tags.tmpl +7 -0
  181. data/templates/newline_test1.tmpl +1 -0
  182. data/templates/newline_test2.tmpl +1 -0
  183. data/templates/other-loop.tmpl +7 -0
  184. data/templates/outer.tmpl +3 -0
  185. data/templates/query-test.tmpl +21 -0
  186. data/templates/query-test2.tmpl +12 -0
  187. data/templates/recursive.tmpl +2 -0
  188. data/templates/searchpath/included.tmpl +4 -0
  189. data/templates/searchpath/three.tmpl +1 -0
  190. data/templates/searchpath/two.tmpl +2 -0
  191. data/templates/simple-loop-nonames.tmpl +13 -0
  192. data/templates/simple-loop.tmpl +12 -0
  193. data/templates/simple.tmpl +9 -0
  194. data/templates/unless.tmpl +5 -0
  195. data/templates/urlescape.tmpl +3 -0
  196. data/templates/vanguard1.tmpl +2 -0
  197. data/templates/vanguard2.tmpl +3 -0
  198. data/test/templates/complex.tmpl +24 -0
  199. data/test/templates/foo.tmpl +6 -0
  200. data/test/templates/func.tmpl +2 -0
  201. data/test/templates/loop.tmpl +14 -0
  202. data/test/templates/negative.tmpl +1 -0
  203. data/test/templates/numerics.tmpl +6 -0
  204. data/test/templates/register.tmpl +2 -0
  205. data/test/test_basic.rb +23 -0
  206. data/test/test_coderefs.rb +16 -0
  207. data/test/test_complex.rb +106 -0
  208. data/test/test_helper.rb +3 -0
  209. data/test/test_html_template.rb +583 -0
  210. data/test/test_html_template_internal_extn.rb +10 -0
  211. data/test/test_html_template_pro.rb +177 -0
  212. data/test/test_path_like_variable_scope.rb +59 -0
  213. data/test/test_random.rb +21 -0
  214. data/test/test_realloc.rb +16 -0
  215. data/test/test_register.rb +25 -0
  216. data/test/test_tmplpro.rb +9 -0
  217. data/test/tests.rb +9 -0
  218. data/website/index.txt +57 -0
  219. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  220. data/website/stylesheets/screen.css +159 -0
  221. data/website/template.html.erb +50 -0
  222. metadata +303 -0
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/tmplpro.rb'}"
9
+ puts "Loading tmplpro gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.dirname(__FILE__) + "/../Rakefile"
4
+ require 'rubyforge'
5
+ require 'redcloth'
6
+ require 'syntax/convertors/html'
7
+ require 'erb'
8
+
9
+ download = "http://rubyforge.org/projects/#{$hoe.rubyforge_name}"
10
+ version = $hoe.version
11
+
12
+ def rubyforge_project_id
13
+ RubyForge.new.configure.autoconfig["group_ids"][$hoe.rubyforge_name]
14
+ end
15
+
16
+ class Fixnum
17
+ def ordinal
18
+ # teens
19
+ return 'th' if (10..19).include?(self % 100)
20
+ # others
21
+ case self % 10
22
+ when 1; return 'st'
23
+ when 2; return 'nd'
24
+ when 3; return 'rd'
25
+ else return 'th'
26
+ end
27
+ end
28
+ end
29
+
30
+ class Time
31
+ def pretty
32
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
33
+ end
34
+ end
35
+
36
+ def convert_syntax(syntax, source)
37
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
38
+ end
39
+
40
+ if ARGV.length >= 1
41
+ src, template = ARGV
42
+ template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
43
+ else
44
+ puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
45
+ exit!
46
+ end
47
+
48
+ template = ERB.new(File.open(template).read)
49
+
50
+ title = nil
51
+ body = nil
52
+ File.open(src) do |fsrc|
53
+ title_text = fsrc.readline
54
+ body_text_template = fsrc.read
55
+ body_text = ERB.new(body_text_template).result(binding)
56
+ syntax_items = []
57
+ body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
58
+ ident = syntax_items.length
59
+ element, syntax, source = $1, $2, $3
60
+ syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
61
+ "syntax-temp-#{ident}"
62
+ }
63
+ title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
64
+ body = RedCloth.new(body_text).to_html
65
+ body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
66
+ end
67
+ stat = File.stat(src)
68
+ created = stat.ctime
69
+ modified = stat.mtime
70
+
71
+ $stdout << template.result(binding)
@@ -0,0 +1,13 @@
1
+ namespace :extconf do
2
+ desc "Compiles the Ruby extension"
3
+ task :compile
4
+ end
5
+
6
+ task :compile => "extconf:compile"
7
+
8
+ task :test => :compile
9
+
10
+ BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}"
11
+ $hoe.clean_globs |= ["ext/**/#{BIN}", "lib/**/#{BIN}", 'ext/**/Makefile']
12
+ $hoe.spec.require_paths = Dir['{lib,ext/*}']
13
+ $hoe.spec.extensions = FileList["ext/**/extconf.rb"].to_a
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = 'html/template/internal'
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/internal.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}/internal.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build #{GEM_NAME}."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(RUBY_PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1 @@
1
+ A-ROOT
File without changes
@@ -0,0 +1 @@
1
+ A-1
@@ -0,0 +1,3 @@
1
+ 01!
2
+ 02!
3
+
@@ -0,0 +1 @@
1
+ <tmpl_loop list><tmpl_include "include/3.tmpl"></tmpl_loop>
@@ -0,0 +1 @@
1
+ A-2
@@ -0,0 +1 @@
1
+ <tmpl_include "include/4.tmpl">
@@ -0,0 +1 @@
1
+ 0<tmpl_var test>!
@@ -0,0 +1 @@
1
+ A-PARENT
@@ -0,0 +1,25 @@
1
+ <tmpl_if "ISS4">
2
+ </tmpl_include name="foo">
3
+ </tmpl_else>
4
+ </tmpl_if>
5
+
6
+ <tmpl_var "ISS1
7
+ >
8
+ <tmpl_var name ISS2"
9
+ >
10
+
11
+ <tmpl_var mame="ISS3"
12
+ >
13
+
14
+ <tmpl_if "ISS4">
15
+ <tmpl_loop EDDD>
16
+
17
+ </tmpl_unless>
18
+
19
+ <tmpl_var ISS4>
20
+
21
+ </tmpl_loop>
22
+ </tmpl_if "ISS4">
23
+ </tmpl_loop>
24
+
25
+ </tmpl_var mame="ISS3">
@@ -0,0 +1 @@
1
+ 'ONE>
@@ -0,0 +1 @@
1
+ <tmpl_var name='ONE>
@@ -0,0 +1,4 @@
1
+ <H1> test_esc1 </H1>
2
+ \<>"; %FAhidden:
3
+ end
4
+
@@ -0,0 +1,4 @@
1
+ <H1> test_esc1 </H1>
2
+ <tmpl_iF VAR4> <tmpl_var escape=0 DEFAULT="test failed" NAME="STUFF1">
3
+ <tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe=0>
4
+ </tmpl_if>
@@ -0,0 +1,5 @@
1
+ <H1> test_esc2 </H1>
2
+ \%3C%3E%22%3B%20%25FAhidden%3A%0D%0Aend
3
+
4
+
5
+ Some%22%27%20Txt%27
@@ -0,0 +1,6 @@
1
+ <H1> test_esc2 </H1>
2
+ <tmpl_iF VAR4> <tmpl_var escape="URL" DEFAULT="test failed" NAME="STUFF1">
3
+ <tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe="URL">
4
+ </tmpl_if>
5
+
6
+ <tmpl_var escape="URL" NAME="STUFF2">
@@ -0,0 +1,4 @@
1
+ <H1> test_esc3 </H1>
2
+ \&lt;&gt;&quot;; %FAhidden:
3
+ end
4
+
@@ -0,0 +1,4 @@
1
+ <H1> test_esc3 </H1>
2
+ <tmpl_iF VAR4> <tmpl_var escape='HTML' DEFAULT="test failed" NAME="STUFF1">
3
+ <tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe="HTML">
4
+ </tmpl_if>
@@ -0,0 +1,3 @@
1
+ <H1> test_esc4 </H1>
2
+ \\<>\"; %FAhidden:\r\nend
3
+
@@ -0,0 +1,4 @@
1
+ <H1> test_esc4 </H1>
2
+ <tmpl_iF VAR4> <tmpl_var escape="JS" DEFAULT="test failed" NAME="STUFF1">
3
+ <tmpl_else> <tmpl_var DEFault="test failed" name="STUFF1" ESCApe='js'>
4
+ </tmpl_if>
@@ -0,0 +1,26 @@
1
+ <HTML><BODY>
2
+ <H1> test numeric expr </H1>
3
+ ok
4
+ true
5
+ true
6
+ ok
7
+ true
8
+ ok
9
+ 2+2=4
10
+ ONE+2=3
11
+ ONE + TWO=3
12
+ THREE=3
13
+ (ONE+TWO)==THREE=1
14
+ ONE+TWO == THREE=1
15
+ (ONE+TWO == THREE) and (THREE && TWO) and sin(ONE)=1
16
+ sin(ONE)=0.841471
17
+ 111.111 + 222.333555=333.444555
18
+ 7%3=1
19
+ (70*5)%33-20=0
20
+ 7 && 3=1
21
+ strings are true:
22
+ 'aaa' && 'bbb'=1
23
+ 'aaa' || 0=1
24
+ minus is handled properly:
25
+ MINUSTEN+8=-2
26
+ </body></html>
@@ -0,0 +1,26 @@
1
+ <HTML><BODY>
2
+ <H1> test numeric expr </H1>
3
+ <tmpl_if EXPR="0">not ok<tmpl_else>ok</tmpl_if>
4
+ <tmpl_if EXPR="2">true<tmpl_else>false</tmpl_if>
5
+ <tmpl_if EXPR="2+2">true<tmpl_else>false</tmpl_if>
6
+ <tmpl_if EXPR="3>5">not ok<tmpl_else>ok</tmpl_if>
7
+ <tmpl_if EXPR="2>=2">true<tmpl_else>false</tmpl_if>
8
+ <tmpl_if EXPR="ONE>2">not ok<tmpl_else>ok</tmpl_if>
9
+ 2+2=<tmpl_var expr="2+2">
10
+ ONE+2=<tmpl_var expr="ONE+2">
11
+ ONE + TWO=<tmpl_var expr="ONE + TWO">
12
+ THREE=<tmpl_var expr="THREE">
13
+ (ONE+TWO)==THREE=<tmpl_var expr="(ONE+TWO)==THREE">
14
+ ONE+TWO == THREE=<tmpl_var expr="ONE+TWO == THREE">
15
+ (ONE+TWO == THREE) and (THREE && TWO) and sin(ONE)=<tmpl_var expr="(ONE+TWO == THREE) and (THREE && TWO) and sin(ONE)">
16
+ sin(ONE)=<tmpl_var expr="sin(ONE)">
17
+ 111.111 + 222.333555=<tmpl_var expr="111.111 + 222.333555">
18
+ 7%3=<tmpl_var expr="7%3">
19
+ (70*5)%33-20=<tmpl_var expr="(70*5)%33-20">
20
+ 7 && 3=<tmpl_var expr="7 && 3">
21
+ strings are true:
22
+ 'aaa' && 'bbb'=<tmpl_var expr="'aaa' && 'bbb'">
23
+ 'aaa' || 0=<tmpl_var expr="'aaa' || 0">
24
+ minus is handled properly:
25
+ MINUSTEN+8=<tmpl_var expr="MINUSTEN+8">
26
+ </body></html>
@@ -0,0 +1,34 @@
1
+ <HTML><BODY>
2
+ <H1> test string expr </H1>
3
+ ONE lt THREE=1
4
+ ONE gt THREE=0
5
+ ONE ne THREE=1
6
+ ONE eq THREE=0
7
+ '1' lt '3'=1
8
+ '1' gt '3'=0
9
+ '1' ne '3'=1
10
+ '1' eq '3'=0
11
+ '1' lt THREE=1
12
+ '1' gt THREE=0
13
+ '1' ne THREE=1
14
+ '1' eq THREE=0
15
+ ONE lt '3'=1
16
+ ONE gt '3'=0
17
+ ONE ne '3'=1
18
+ ONE eq '3'=0
19
+ '100' lt '3'=1
20
+ '100' lt '30'=1
21
+ '100' le '30'=1
22
+ '100' gt '30'=0
23
+ '100' ge '30'=0
24
+ 100 lt '30'=1
25
+ 100 lt 30=1
26
+ 'aaa' le 'b'=1
27
+ 'aaa' ge 'b'=0
28
+ 'bbb' le 'a'=0
29
+ 'bbb' ge 'a'=1
30
+ 'bbb' cmp 'a'=1
31
+ 'aaa' cmp 'b'=-1
32
+ ONE=1
33
+ foo=foo
34
+ </body></html>
@@ -0,0 +1,34 @@
1
+ <HTML><BODY>
2
+ <H1> test string expr </H1>
3
+ ONE lt THREE=<tmpl_var expr="ONE lt THREE">
4
+ ONE gt THREE=<tmpl_var expr="ONE gt THREE">
5
+ ONE ne THREE=<tmpl_var expr="ONE ne THREE">
6
+ ONE eq THREE=<tmpl_var expr="ONE eq THREE">
7
+ '1' lt '3'=<tmpl_var expr="'1' lt '3'">
8
+ '1' gt '3'=<tmpl_var expr="'1' gt '3'">
9
+ '1' ne '3'=<tmpl_var expr="'1' ne '3'">
10
+ '1' eq '3'=<tmpl_var expr="'1' eq '3'">
11
+ '1' lt THREE=<tmpl_var expr="'1' lt THREE">
12
+ '1' gt THREE=<tmpl_var expr="'1' gt THREE">
13
+ '1' ne THREE=<tmpl_var expr="'1' ne THREE">
14
+ '1' eq THREE=<tmpl_var expr="'1' eq THREE">
15
+ ONE lt '3'=<tmpl_var expr="ONE lt '3'">
16
+ ONE gt '3'=<tmpl_var expr="ONE gt '3'">
17
+ ONE ne '3'=<tmpl_var expr="ONE ne '3'">
18
+ ONE eq '3'=<tmpl_var expr="ONE eq '3'">
19
+ '100' lt '3'=<tmpl_var expr="'100' lt '3'">
20
+ '100' lt '30'=<tmpl_var expr="'100' lt '30'">
21
+ '100' le '30'=<tmpl_var expr="'100' le '30'">
22
+ '100' gt '30'=<tmpl_var expr="'100' gt '30'">
23
+ '100' ge '30'=<tmpl_var expr="'100' ge '30'">
24
+ 100 lt '30'=<tmpl_var expr="100 lt '30'">
25
+ 100 lt 30=<tmpl_var expr="100 lt 30">
26
+ 'aaa' le 'b'=<tmpl_var expr="'aaa' le 'b'">
27
+ 'aaa' ge 'b'=<tmpl_var expr="'aaa' ge 'b'">
28
+ 'bbb' le 'a'=<tmpl_var expr="'bbb' le 'a'">
29
+ 'bbb' ge 'a'=<tmpl_var expr="'bbb' ge 'a'">
30
+ 'bbb' cmp 'a'=<tmpl_var expr="'bbb' cmp 'a'">
31
+ 'aaa' cmp 'b'=<tmpl_var expr="'aaa' cmp 'b'">
32
+ ONE=<tmpl_var expr="ONE">
33
+ foo=<tmpl_var expr="'foo'">
34
+ </body></html>
@@ -0,0 +1,6 @@
1
+ <HTML><BODY>
2
+ <H1> test nt aryphmetics </H1>
3
+ 1+1=2
4
+ 2*2=4
5
+ 4/2=2
6
+ </body></html>
@@ -0,0 +1,6 @@
1
+ <HTML><BODY>
2
+ <H1> test nt aryphmetics </H1>
3
+ 1+1=<tmpl_var expr="1+1">
4
+ 2*2=<tmpl_var expr="2*2">
5
+ 4/2=<tmpl_var expr="4/2">
6
+ </body></html>
@@ -0,0 +1,4 @@
1
+ <HTML><BODY>
2
+ <H1> test expr with var quote extension of Emiliano Bruno </H1>
3
+ ${foo.bar}=<test passed>
4
+ </body></html>
@@ -0,0 +1,4 @@
1
+ <HTML><BODY>
2
+ <H1> test expr with var quote extension of Emiliano Bruno </H1>
3
+ ${foo.bar}=<tmpl_var expr="${foo.bar}">
4
+ </body></html>
@@ -0,0 +1,18 @@
1
+ <HTML><BODY>
2
+ <H1> test on string compare </H1>
3
+ true:1
4
+ false:0
5
+ false:0
6
+
7
+ false:0
8
+ false:0
9
+
10
+ false:0
11
+ false:0
12
+ false:0
13
+
14
+ testing unescape string
15
+ false:0
16
+ true:1
17
+
18
+ </body></html>