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
data/script/console
ADDED
|
@@ -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"
|
data/script/destroy
ADDED
|
@@ -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)
|
data/script/generate
ADDED
|
@@ -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)
|
data/script/txt2html
ADDED
|
@@ -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)
|
data/tasks/extconf.rake
ADDED
|
@@ -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 @@
|
|
|
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,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>
|