erubis 1.1.0 → 2.0.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.
Files changed (116) hide show
  1. data/ChangeLog +45 -18
  2. data/README.txt +80 -0
  3. data/benchmark/erubybench-lib.rb +189 -0
  4. data/benchmark/erubybench.rb +364 -0
  5. data/benchmark/erubybench.rhtml +61 -0
  6. data/benchmark/erubybench.yaml +61 -0
  7. data/bin/erubis +4 -180
  8. data/contrib/erubis +2297 -0
  9. data/contrib/inline-require +151 -0
  10. data/doc-api/classes/Erubis.html +236 -0
  11. data/doc-api/classes/Erubis/ArrayBufferEnhancer.html +175 -0
  12. data/doc-api/classes/Erubis/ArrayBufferEruby.html +120 -0
  13. data/doc-api/classes/Erubis/ArrayEnhancer.html +174 -0
  14. data/doc-api/classes/Erubis/ArrayEruby.html +120 -0
  15. data/doc-api/classes/Erubis/BiPatternEnhancer.html +212 -0
  16. data/doc-api/classes/Erubis/BiPatternEruby.html +120 -0
  17. data/doc-api/classes/Erubis/CommandOptionError.html +113 -0
  18. data/doc-api/classes/Erubis/Context.html +249 -0
  19. data/doc-api/classes/Erubis/Ec.html +399 -0
  20. data/doc-api/classes/Erubis/Ejava.html +366 -0
  21. data/doc-api/classes/Erubis/Ejavascript.html +390 -0
  22. data/doc-api/classes/Erubis/Engine.html +711 -0
  23. data/doc-api/classes/Erubis/Eperl.html +350 -0
  24. data/doc-api/classes/Erubis/Ephp.html +308 -0
  25. data/doc-api/classes/Erubis/ErubisError.html +117 -0
  26. data/doc-api/classes/Erubis/Eruby.html +310 -0
  27. data/doc-api/classes/Erubis/EscapeEnhancer.html +167 -0
  28. data/doc-api/classes/Erubis/EscapedEc.html +120 -0
  29. data/doc-api/classes/Erubis/EscapedEjava.html +120 -0
  30. data/doc-api/classes/Erubis/EscapedEjavascript.html +120 -0
  31. data/doc-api/classes/Erubis/EscapedEperl.html +120 -0
  32. data/doc-api/classes/Erubis/EscapedEphp.html +120 -0
  33. data/doc-api/classes/Erubis/EscapedEruby.html +127 -0
  34. data/doc-api/classes/Erubis/EscapedEscheme.html +120 -0
  35. data/doc-api/classes/Erubis/Escheme.html +389 -0
  36. data/doc-api/classes/Erubis/HeaderFooterEnhancer.html +264 -0
  37. data/doc-api/classes/Erubis/HeaderFooterEruby.html +120 -0
  38. data/doc-api/classes/Erubis/Main.html +318 -0
  39. data/doc-api/classes/Erubis/NoTextEnhancer.html +159 -0
  40. data/doc-api/classes/Erubis/NoTextEruby.html +120 -0
  41. data/doc-api/classes/Erubis/OptimizedEruby.html +445 -0
  42. data/doc-api/classes/Erubis/OptimizedXmlEruby.html +163 -0
  43. data/doc-api/classes/Erubis/PercentLineEnhancer.html +174 -0
  44. data/doc-api/classes/Erubis/PercentLineEruby.html +120 -0
  45. data/doc-api/classes/Erubis/PrintEnabledEnhancer.html +212 -0
  46. data/doc-api/classes/Erubis/PrintEnabledEruby.html +120 -0
  47. data/doc-api/classes/Erubis/PrintOutEnhancer.html +244 -0
  48. data/doc-api/classes/Erubis/PrintOutEruby.html +120 -0
  49. data/doc-api/classes/Erubis/PrintOutSimplifiedEruby.html +121 -0
  50. data/doc-api/classes/Erubis/SimplifiedEruby.html +120 -0
  51. data/doc-api/classes/Erubis/SimplifyEnhancer.html +185 -0
  52. data/doc-api/classes/Erubis/StdoutEnhancer.html +173 -0
  53. data/doc-api/classes/Erubis/StdoutEruby.html +120 -0
  54. data/doc-api/classes/Erubis/StdoutSimplifiedEruby.html +121 -0
  55. data/doc-api/classes/Erubis/StringBufferEnhancer.html +174 -0
  56. data/doc-api/classes/Erubis/StringBufferEruby.html +120 -0
  57. data/doc-api/classes/Erubis/StringIOEruby.html +120 -0
  58. data/doc-api/classes/Erubis/TinyEruby.html +305 -0
  59. data/doc-api/classes/Erubis/XmlEruby.html +130 -0
  60. data/doc-api/classes/Erubis/XmlHelper.html +193 -0
  61. data/doc-api/created.rid +1 -0
  62. data/doc-api/files/__/README_txt.html +214 -0
  63. data/doc-api/files/erubis/engine/ec_rb.html +115 -0
  64. data/doc-api/files/erubis/engine/ejava_rb.html +115 -0
  65. data/doc-api/files/erubis/engine/ejavascript_rb.html +115 -0
  66. data/doc-api/files/erubis/engine/enhanced_rb.html +115 -0
  67. data/doc-api/files/erubis/engine/eperl_rb.html +115 -0
  68. data/doc-api/files/erubis/engine/ephp_rb.html +115 -0
  69. data/doc-api/files/erubis/engine/eruby_rb.html +115 -0
  70. data/doc-api/files/erubis/engine/escheme_rb.html +115 -0
  71. data/doc-api/files/erubis/engine/optimized_rb.html +114 -0
  72. data/doc-api/files/erubis/engine_rb.html +114 -0
  73. data/doc-api/files/erubis/enhancer_rb.html +114 -0
  74. data/doc-api/files/erubis/helper_rb.html +107 -0
  75. data/doc-api/files/erubis/local-setting_rb.html +107 -0
  76. data/doc-api/files/erubis/main_rb.html +125 -0
  77. data/doc-api/files/erubis/tiny_rb.html +107 -0
  78. data/doc-api/files/erubis_rb.html +118 -0
  79. data/doc-api/fr_class_index.html +77 -0
  80. data/doc-api/fr_file_index.html +43 -0
  81. data/doc-api/fr_method_index.html +157 -0
  82. data/doc-api/index.html +24 -0
  83. data/doc-api/rdoc-style.css +208 -0
  84. data/doc/users-guide.html +1507 -375
  85. data/examples/Makefile +53 -0
  86. data/examples/example.ec +24 -0
  87. data/examples/example.ejava +41 -0
  88. data/examples/example.ejavascript +16 -0
  89. data/examples/example.eperl +16 -0
  90. data/examples/example.ephp +17 -0
  91. data/examples/example.eruby +15 -0
  92. data/examples/example.escheme +26 -0
  93. data/lib/erubis.rb +37 -269
  94. data/lib/erubis/engine.rb +260 -0
  95. data/lib/erubis/engine/ec.rb +106 -0
  96. data/lib/erubis/engine/ejava.rb +101 -0
  97. data/lib/erubis/engine/ejavascript.rb +104 -0
  98. data/lib/erubis/engine/enhanced.rb +102 -0
  99. data/lib/erubis/engine/eperl.rb +83 -0
  100. data/lib/erubis/engine/ephp.rb +84 -0
  101. data/lib/erubis/engine/eruby.rb +91 -0
  102. data/lib/erubis/engine/escheme.rb +96 -0
  103. data/lib/erubis/engine/optimized.rb +114 -0
  104. data/lib/erubis/enhancer.rb +487 -0
  105. data/lib/erubis/helper.rb +53 -0
  106. data/lib/erubis/local-setting.rb +10 -0
  107. data/lib/erubis/main.rb +368 -0
  108. data/lib/erubis/tiny.rb +65 -0
  109. data/test/assert-text-equal.rb +45 -0
  110. data/test/test-bin.rb +222 -45
  111. data/test/test-engines.rb +343 -0
  112. data/test/test-erubis.rb +836 -501
  113. data/test/test.rb +27 -0
  114. data/test/testutil.rb +86 -0
  115. metadata +131 -8
  116. data/README +0 -50
@@ -0,0 +1,27 @@
1
+ ##
2
+ ## $Rev$
3
+ ## $Release: 2.0.0 $
4
+ ## copyright(c) 2006 kuwata-lab all rights reserved.
5
+ ##
6
+
7
+
8
+ unless defined?(TESTDIR)
9
+ TESTDIR = File.dirname(__FILE__)
10
+ LIBDIR = TESTDIR == '.' ? '../lib' : File.dirname(TESTDIR) + '/lib'
11
+ $: << TESTDIR
12
+ $: << LIBDIR
13
+ end
14
+
15
+
16
+ require 'test/unit'
17
+ #require 'test/unit/ui/console/testrunner'
18
+ require 'assert-text-equal'
19
+ require 'yaml'
20
+ require 'testutil'
21
+
22
+
23
+ if $0 == __FILE__
24
+ require "#{TESTDIR}/test-erubis.rb"
25
+ require "#{TESTDIR}/test-engines.rb"
26
+ require "#{TESTDIR}/test-bin.rb"
27
+ end
@@ -0,0 +1,86 @@
1
+ ###
2
+ ### $Rev: 103 $
3
+ ### $Release: 2.0.0 $
4
+ ### copyright(c) 2006 kuwata-lab all rights reserved.
5
+ ###
6
+
7
+ require 'yaml'
8
+
9
+
10
+ module TestEnhancer
11
+
12
+
13
+ module_function
14
+
15
+
16
+ def load_testdata(filename, options={}, &block)
17
+ _load_yaml(filename, :doc, options, &block)
18
+ end
19
+
20
+
21
+ def load_yaml_document(filename, options={}, &block)
22
+ _load_yaml(filename, :doc, options, &block)
23
+ end
24
+
25
+
26
+ def load_yaml_documents(filename, options={}, &block)
27
+ _load_yaml(filename, :docs, options, &block)
28
+ end
29
+
30
+
31
+ def _load_yaml(filename, type, options={}, &block) # :nodoc:
32
+ s = File.read(filename)
33
+ if filename =~ /\.rb$/
34
+ s =~ /^__END__$/ or raise "*** error: __END__ is not found in '#{filename}'."
35
+ s = $'
36
+ end
37
+ unless options[:tabify] == false
38
+ s = s.inject('') do |sb, line|
39
+ sb << line.gsub(/([^\t]{8})|([^\t]*)\t/n) { [$+].pack("A8") }
40
+ end
41
+ end
42
+ #
43
+ case type
44
+ when :docs
45
+ hash_list = []
46
+ YAML.load_documents(s) do |hash| hash_list << hash end
47
+ when :doc
48
+ hash_list = YAML.load(s)
49
+ else
50
+ raise "*** internal error"
51
+ end
52
+ #
53
+ identkey = options[:identkey] || 'name'
54
+ table = {}
55
+ hash_list.each do |hash|
56
+ ident = hash[identkey]
57
+ ident or raise "*** #{identkey} is not found."
58
+ table[ident] and raise "*** #{identkey} '#{ident}' is duplicated."
59
+ table[ident] = hash
60
+ yield(hash) if block
61
+ end
62
+ #
63
+ return hash_list
64
+ end
65
+
66
+
67
+ def define_testmethods(testdata_list, options={}, &block)
68
+ identkey = options[:identkey] || 'name'
69
+ testmethod = options[:testmethod] || '_test'
70
+ testdata_list.each do |hash|
71
+ yield(hash) if block
72
+ ident = hash[identkey]
73
+ s = "def test_#{ident}\n"
74
+ hash.each do |key, val|
75
+ code = " @#{key} = #{val.inspect}\n"
76
+ s << " @#{key} = #{val.inspect}\n"
77
+ end
78
+ s << " #{testmethod}\n"
79
+ s << "end\n"
80
+ $stderr.puts "*** load_yaml_testdata(): eval_str=<<'END'\n#{s}END" if $DEBUG
81
+ self.module_eval s
82
+ end
83
+ end
84
+
85
+
86
+ end
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: erubis
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2006-03-05 00:00:00 +09:00
8
- summary: an implementation of eRuby
6
+ version: 2.0.0
7
+ date: 2006-05-20 00:00:00 +09:00
8
+ summary: a fast and extensible eRuby implementation which supports multi-language
9
9
  require_paths:
10
10
  - lib
11
11
  email:
12
12
  homepage: http://rubyforge.org/projects/erubis
13
13
  rubyforge_project:
14
- description: "Erubis is an implementation of eRuby and has the following features: * Auto trimming spaces around '<% %>' * Auto sanitizing * Change embedded pattern (default '<% %>') * Context object available * Easy to expand in subclass"
14
+ description: "Erubis is an implementation of eRuby and has the following features: * Very fast (about three times faster than ERB) * Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript) * Auto trimming spaces around '<% %>' * Auto sanitizing * Change embedded pattern (default '<% %>') * Context object available * Easy to expand in subclass"
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -28,18 +28,133 @@ cert_chain:
28
28
  authors:
29
29
  - kwatch
30
30
  files:
31
+ - lib/erubis
31
32
  - lib/erubis.rb
33
+ - lib/erubis/engine
34
+ - lib/erubis/engine.rb
35
+ - lib/erubis/enhancer.rb
36
+ - lib/erubis/helper.rb
37
+ - lib/erubis/local-setting.rb
38
+ - lib/erubis/main.rb
39
+ - lib/erubis/tiny.rb
40
+ - lib/erubis/engine/ec.rb
41
+ - lib/erubis/engine/ejava.rb
42
+ - lib/erubis/engine/ejavascript.rb
43
+ - lib/erubis/engine/enhanced.rb
44
+ - lib/erubis/engine/eperl.rb
45
+ - lib/erubis/engine/ephp.rb
46
+ - lib/erubis/engine/eruby.rb
47
+ - lib/erubis/engine/escheme.rb
48
+ - lib/erubis/engine/optimized.rb
32
49
  - bin/erubis
50
+ - examples/example.ec
51
+ - examples/example.ejava
52
+ - examples/example.ejavascript
53
+ - examples/example.eperl
54
+ - examples/example.ephp
55
+ - examples/example.eruby
56
+ - examples/example.escheme
57
+ - examples/Makefile
58
+ - test/assert-text-equal.rb
33
59
  - test/test-bin.rb
60
+ - test/test-engines.rb
34
61
  - test/test-erubis.rb
62
+ - test/test.rb
63
+ - test/testutil.rb
35
64
  - doc/users-guide.html
36
65
  - doc/docstyle.css
37
- - README
66
+ - README.txt
38
67
  - ChangeLog
39
68
  - COPYING
40
69
  - setup.rb
70
+ - contrib/erubis
71
+ - contrib/inline-require
72
+ - benchmark/erubybench-lib.rb
73
+ - benchmark/erubybench.rb
74
+ - benchmark/erubybench.rhtml
75
+ - benchmark/erubybench.yaml
76
+ - doc-api/classes
77
+ - doc-api/created.rid
78
+ - doc-api/files
79
+ - doc-api/fr_class_index.html
80
+ - doc-api/fr_file_index.html
81
+ - doc-api/fr_method_index.html
82
+ - doc-api/index.html
83
+ - doc-api/rdoc-style.css
84
+ - doc-api/classes/Erubis
85
+ - doc-api/classes/Erubis.html
86
+ - doc-api/classes/Erubis/ArrayBufferEnhancer.html
87
+ - doc-api/classes/Erubis/ArrayBufferEruby.html
88
+ - doc-api/classes/Erubis/ArrayEnhancer.html
89
+ - doc-api/classes/Erubis/ArrayEruby.html
90
+ - doc-api/classes/Erubis/BiPatternEnhancer.html
91
+ - doc-api/classes/Erubis/BiPatternEruby.html
92
+ - doc-api/classes/Erubis/CommandOptionError.html
93
+ - doc-api/classes/Erubis/Context.html
94
+ - doc-api/classes/Erubis/Ec.html
95
+ - doc-api/classes/Erubis/Ejava.html
96
+ - doc-api/classes/Erubis/Ejavascript.html
97
+ - doc-api/classes/Erubis/Engine.html
98
+ - doc-api/classes/Erubis/Eperl.html
99
+ - doc-api/classes/Erubis/Ephp.html
100
+ - doc-api/classes/Erubis/ErubisError.html
101
+ - doc-api/classes/Erubis/Eruby.html
102
+ - doc-api/classes/Erubis/EscapedEc.html
103
+ - doc-api/classes/Erubis/EscapedEjava.html
104
+ - doc-api/classes/Erubis/EscapedEjavascript.html
105
+ - doc-api/classes/Erubis/EscapedEperl.html
106
+ - doc-api/classes/Erubis/EscapedEphp.html
107
+ - doc-api/classes/Erubis/EscapedEruby.html
108
+ - doc-api/classes/Erubis/EscapedEscheme.html
109
+ - doc-api/classes/Erubis/EscapeEnhancer.html
110
+ - doc-api/classes/Erubis/Escheme.html
111
+ - doc-api/classes/Erubis/HeaderFooterEnhancer.html
112
+ - doc-api/classes/Erubis/HeaderFooterEruby.html
113
+ - doc-api/classes/Erubis/Main.html
114
+ - doc-api/classes/Erubis/NoTextEnhancer.html
115
+ - doc-api/classes/Erubis/NoTextEruby.html
116
+ - doc-api/classes/Erubis/OptimizedEruby.html
117
+ - doc-api/classes/Erubis/OptimizedXmlEruby.html
118
+ - doc-api/classes/Erubis/PercentLineEnhancer.html
119
+ - doc-api/classes/Erubis/PercentLineEruby.html
120
+ - doc-api/classes/Erubis/PrintEnabledEnhancer.html
121
+ - doc-api/classes/Erubis/PrintEnabledEruby.html
122
+ - doc-api/classes/Erubis/PrintOutEnhancer.html
123
+ - doc-api/classes/Erubis/PrintOutEruby.html
124
+ - doc-api/classes/Erubis/PrintOutSimplifiedEruby.html
125
+ - doc-api/classes/Erubis/SimplifiedEruby.html
126
+ - doc-api/classes/Erubis/SimplifyEnhancer.html
127
+ - doc-api/classes/Erubis/StdoutEnhancer.html
128
+ - doc-api/classes/Erubis/StdoutEruby.html
129
+ - doc-api/classes/Erubis/StdoutSimplifiedEruby.html
130
+ - doc-api/classes/Erubis/StringBufferEnhancer.html
131
+ - doc-api/classes/Erubis/StringBufferEruby.html
132
+ - doc-api/classes/Erubis/StringIOEruby.html
133
+ - doc-api/classes/Erubis/TinyEruby.html
134
+ - doc-api/classes/Erubis/XmlEruby.html
135
+ - doc-api/classes/Erubis/XmlHelper.html
136
+ - doc-api/files/__
137
+ - doc-api/files/erubis
138
+ - doc-api/files/erubis_rb.html
139
+ - doc-api/files/__/README_txt.html
140
+ - doc-api/files/erubis/engine
141
+ - doc-api/files/erubis/engine_rb.html
142
+ - doc-api/files/erubis/enhancer_rb.html
143
+ - doc-api/files/erubis/helper_rb.html
144
+ - doc-api/files/erubis/local-setting_rb.html
145
+ - doc-api/files/erubis/main_rb.html
146
+ - doc-api/files/erubis/tiny_rb.html
147
+ - doc-api/files/erubis/engine/ec_rb.html
148
+ - doc-api/files/erubis/engine/ejava_rb.html
149
+ - doc-api/files/erubis/engine/ejavascript_rb.html
150
+ - doc-api/files/erubis/engine/enhanced_rb.html
151
+ - doc-api/files/erubis/engine/eperl_rb.html
152
+ - doc-api/files/erubis/engine/ephp_rb.html
153
+ - doc-api/files/erubis/engine/eruby_rb.html
154
+ - doc-api/files/erubis/engine/escheme_rb.html
155
+ - doc-api/files/erubis/engine/optimized_rb.html
41
156
  test_files:
42
- - test/test-erubis.rb
157
+ - test/test.rb
43
158
  rdoc_options: []
44
159
 
45
160
  extra_rdoc_files: []
@@ -50,5 +165,13 @@ extensions: []
50
165
 
51
166
  requirements: []
52
167
 
53
- dependencies: []
54
-
168
+ dependencies:
169
+ - !ruby/object:Gem::Dependency
170
+ name: abstract
171
+ version_requirement:
172
+ version_requirements: !ruby/object:Gem::Version::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: 1.0.0
177
+ version:
data/README DELETED
@@ -1,50 +0,0 @@
1
- .=title: README
2
- .?release: $Release: 1.1.0 $
3
- .?copyright: copyright(c) 2006 kuwata-lab all rights reserved.
4
-
5
-
6
- .$ About Erubis
7
-
8
- Erubis is an implementation of eRuby. It has the following features.
9
- .* Auto trimming spaces around '<% %>'
10
- .* Auto sanitizing
11
- .* Change embedded pattern (default '<% %>')
12
- .* Context object available
13
- .* Easy to expand in subclass
14
-
15
- Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
16
-
17
- See doc/users-guide.html for detail.
18
-
19
-
20
-
21
- .$ Installation
22
-
23
- .* If you have installed RubyGems, just type {{,gem install --remote erubis,}}.
24
- .====================
25
- $ sudo gem install --remote erubis
26
- .====================
27
-
28
- .* Or if you can be root user, download erubis-X.X.X.tar.bz2 and install by setup.rb.
29
- .====================
30
- $ tar xjf erubis-X.X.X.tar.bz2
31
- $ cd erubis-X.X.X/
32
- $ ruby setup.rb config
33
- $ ruby setup.rb setup
34
- $ sudo ruby setup.rb install
35
- .====================
36
-
37
- .* Else you should copy 'lib/erubis.rb' and 'bin/erubis' into proper directory manually.
38
- .====================
39
- $ tar xjf erubis-X.X.X.tar.bz2
40
- $ cd erubis-X.X.X/
41
- $ cp lib/erubis.rb /usr/local/lib/ruby/site_ruby/1.8
42
- $ cp bin/erubis /usr/local/bin
43
- .====================
44
-
45
-
46
-
47
- .$ License
48
-
49
- GPL ver.2
50
-