summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormakoto kuwata <kwa@kuwata-lab.com>2006-12-25 22:22:05 +0000
committermakoto kuwata <kwa@kuwata-lab.com>2006-12-25 22:22:05 +0000
commite084cdd5d66e84f99be954787361a899eb5ebced (patch)
tree7493125c5b4934e6323055e66f22d548c1281bff
parent953573ac6c2878ec63c36cf507f0e60a5dc10b96 (diff)
downloaderubis-e084cdd5d66e84f99be954787361a899eb5ebced.tar.gz
- [enhance] add Context#each() method
- [change] rename ChangeLog to CHANGES
-rw-r--r--CHANGES (renamed from ChangeLog)0
-rw-r--r--ChangeLog.txt4
-rw-r--r--ReleaseNote.txt4
-rw-r--r--lib/erubis/context.rb11
-rw-r--r--lib/erubis/converter.rb26
-rw-r--r--lib/erubis/engine/eruby.rb1
-rw-r--r--lib/erubis/generator.rb3
-rw-r--r--lib/erubis/helper.rb1
-rw-r--r--lib/erubis/local-setting.rb2
-rw-r--r--website/.properties2
-rw-r--r--website/Rookbook.rb10
-rw-r--r--website/download.cgi7
-rw-r--r--website/index.txt27
-rw-r--r--website/index.xhtml41
14 files changed, 98 insertions, 41 deletions
diff --git a/ChangeLog b/CHANGES
index eaf90bc..eaf90bc 100644
--- a/ChangeLog
+++ b/CHANGES
diff --git a/ChangeLog.txt b/ChangeLog.txt
index c284274..b392b29 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -3,6 +3,10 @@
.?version: $Rev$
+.: Rev.42 (2006-12-26)
+ .- [enhance] add Context#each() method
+ .- [change] rename ChangeLog to CHANGES
+
.: Rev.41 (2006-09-24)
.- [bugfix] main.rb: typo fixed
diff --git a/ReleaseNote.txt b/ReleaseNote.txt
index adaf328..0301d20 100644
--- a/ReleaseNote.txt
+++ b/ReleaseNote.txt
@@ -1,7 +1,7 @@
$ [ANN] Erubis 2.1.0 release - a fast eRuby implementation
I have released Erubis 2.1.0.
-http://rubyforge.org/projects/erubis/
+http://www.kuwata-lab.com/erubis/
Erubis is a pure ruby implementation of eRuby.
@@ -159,7 +159,7 @@ Bugfix:
Have fun!
--
-kwa
+kwatch
$ [ANN] Erubis 2.0.1 release - a fast eRuby implementation
diff --git a/lib/erubis/context.rb b/lib/erubis/context.rb
index e2bae7a..008aa11 100644
--- a/lib/erubis/context.rb
+++ b/lib/erubis/context.rb
@@ -29,6 +29,7 @@ module Erubis
## print eruby.evaluate(context)
##
class Context
+ include Enumerable
def initialize(hash=nil)
hash.each do |name, value|
@@ -45,7 +46,15 @@ module Erubis
end
def keys
- return instance_variables.collect { |name| name[1,name.length-1] }
+ return instance_variables.collect { |name| name[1..-1] }
+ end
+
+ def each
+ instance_variables.each do |name|
+ key = name[1..-1]
+ value = instance_variable_get(name)
+ yield(key, value)
+ end
end
end
diff --git a/lib/erubis/converter.rb b/lib/erubis/converter.rb
index 11d0fab..12456ad 100644
--- a/lib/erubis/converter.rb
+++ b/lib/erubis/converter.rb
@@ -96,9 +96,9 @@ module Erubis
pos = 0
input.scan(regexp) do |lspace, indicator, code, rspace|
match = Regexp.last_match()
- index = match.begin(0)
- text = input[pos, index - pos]
- pos = match.end(0)
+ len = match.begin(0) - pos
+ text = input[pos, len]
+ pos = match.end(0)
add_text(src, text)
## * when '<%= %>', do nothing
## * when '<% %>' or '<%# %>', delete spaces iff only spaces are around '<% %>'
@@ -171,7 +171,7 @@ module Erubis
def init_converter(properties={})
super(properties)
- @trim = !(properties[:trim] == false)
+ @trim = properties[:trim] != false
@pi = properties[:pi] if properties[:pi]
@embchar = properties[:embchar] || '@'
@pattern = properties[:pattern]
@@ -197,9 +197,9 @@ module Erubis
pos = 0
input.scan(@stmt_pattern) do |lspace, pi_arg, code, rspace|
match = Regexp.last_match
- index = match.begin(0)
- text = input[pos, index - pos]
- pos = match.end(0)
+ len = match.begin(0) - pos
+ text = input[pos, len]
+ pos = match.end(0)
parse_exprs(codebuf, text) # unless text.empty?
if @trim && lspace && rspace
add_pi_stmt(codebuf, "#{lspace}#{code}#{rspace}", pi_arg)
@@ -228,9 +228,9 @@ module Erubis
indicator = indicator1 || indicator2
code = code1 || code2
match = Regexp.last_match
- index = match.begin(0)
- text = input[pos, index - pos]
- pos = match.end(0)
+ len = match.begin(0) - pos
+ text = input[pos, len]
+ pos = match.end(0)
add_text(codebuf, text) # unless text.empty?
add_pi_expr(codebuf, code, indicator)
end
@@ -278,9 +278,9 @@ module Erubis
input.scan(@embedded_pattern) do |lspace, pi_arg, stmt, rspace,
indicator1, expr1, indicator2, expr2|
match = Regexp.last_match
- index = match.begin(0)
- text = input[pos, index - pos]
- pos = match.end(0)
+ len = match.begin(0) - pos
+ text = input[pos, len]
+ pos = match.end(0)
add_text(codebuf, text) # unless text.empty?
if stmt
code = stmt
diff --git a/lib/erubis/engine/eruby.rb b/lib/erubis/engine/eruby.rb
index 5c841cd..9390253 100644
--- a/lib/erubis/engine/eruby.rb
+++ b/lib/erubis/engine/eruby.rb
@@ -6,7 +6,6 @@
require 'erubis/engine'
require 'erubis/enhancer'
-require 'abstract'
module Erubis
diff --git a/lib/erubis/generator.rb b/lib/erubis/generator.rb
index 046a6ef..9a26ddf 100644
--- a/lib/erubis/generator.rb
+++ b/lib/erubis/generator.rb
@@ -9,6 +9,9 @@ require 'abstract'
module Erubis
+ ##
+ ## code generator, called by Converter module
+ ##
module Generator
def self.supported_properties() # :nodoc:
diff --git a/lib/erubis/helper.rb b/lib/erubis/helper.rb
index cd46fa5..bf05763 100644
--- a/lib/erubis/helper.rb
+++ b/lib/erubis/helper.rb
@@ -26,7 +26,6 @@ module Erubis
#table = ESCAPE_TABLE
#obj.to_s.gsub(/[&<>"]/) { |s| table[s] } # or /[&<>"']/
obj.to_s.gsub(/[&<>"]/) { |s| ESCAPE_TABLE[s] } # or /[&<>"']/
- #obj.to_s.gsub(SCAN_REGEXP) { |s| ESCAPE_TABLE[s] }
#obj.to_s.gsub(/[&<>"]/) { ESCAPE_TABLE[$&] }
end
diff --git a/lib/erubis/local-setting.rb b/lib/erubis/local-setting.rb
index 747b313..c2f75e8 100644
--- a/lib/erubis/local-setting.rb
+++ b/lib/erubis/local-setting.rb
@@ -6,5 +6,5 @@
##
## you can add site-local settings here.
-## this files is 'require'd by erubis.rb
+## this files is required by erubis.rb
##
diff --git a/website/.properties b/website/.properties
index f3a69ac..2a0aa25 100644
--- a/website/.properties
+++ b/website/.properties
@@ -2,5 +2,5 @@ name: erubis
title: Erubis
#parent: ../../../../work/kuwata-lab
parent: ../../../kuwata-lab
-cssfile: default.css
+#cssfile: default.css
#maincolor: #FFCC66
diff --git a/website/Rookbook.rb b/website/Rookbook.rb
index 3b84da1..3afd11a 100644
--- a/website/Rookbook.rb
+++ b/website/Rookbook.rb
@@ -10,7 +10,7 @@ material 'index.txt'
## recipes for kuwata-lab.com
##
#all = %W[index.xhtml README.xhtml #{U}.01.xhtml ChangeLog.txt]
-all = %W[index.xhtml #{U}.01.xhtml ChangeLog]
+all = %W[index.xhtml #{U}.01.xhtml CHANGES ReleaseNote.txt]
recipe :default , :all
@@ -19,7 +19,7 @@ recipe :all , all
recipe :clean do
files = []
files.concat Dir.glob("README.*")
- files.concat Dir.glob("ChangeLog")
+ files.concat Dir.glob("CHANGES")
files.concat Dir.glob("#{U}.*")
files.concat(%w[m18n.rb guide.d index.xhtml])
rm_rf [files]
@@ -66,8 +66,12 @@ recipe "index.xhtml" , "index.txt",
# sys "kwaser -t #{tagfile} -b #{@ingred} > #{@product}"
# end
-recipe "ChangeLog" , "../ChangeLog" do
+recipe "CHANGES" , "../CHANGES" do
#copy r.ingreds[0], r.product
cp @ingred, "."
end
+recipe "ReleaseNote.txt" , "../ReleaseNote.txt" do
+ cp @ingred, @product
+ end
+
diff --git a/website/download.cgi b/website/download.cgi
index e2028c6..32fe037 100644
--- a/website/download.cgi
+++ b/website/download.cgi
@@ -5,7 +5,12 @@
* redirecto url
*/
#$redirect_url = "http://sourceforge.net/projects/kwaff/";
-$redirect_url = "http://rubyforge.net/projects/erubis/";
+if ($_REQUEST['project'] == 'erubisj') {
+ $redirect_url = "http://sourceforge.net/project/showfiles.php?group_id=178490";
+} else {
+ //$redirect_url = "http://rubyforge.net/projects/erubis/";
+ $redirect_url = "http://rubyforge.org/frs/?group_id=1320&release_id=7090";
+}
/*
diff --git a/website/index.txt b/website/index.txt
index 04ba397..0d6fcb7 100644
--- a/website/index.txt
+++ b/website/index.txt
@@ -6,6 +6,7 @@
.$ News
+.* [2006-09-28] {{<erubis-j_1.0.0|download.cgi>}} (porting to Java) released.
.* [2006-09-24] {{<erubis_2.1.0|download.cgi>}} released.
.* [2006-05-20] {{<erubis_2.0.0|download.cgi>}} released.
.* [2006-03-05] {{<erubis_1.1.0|download.cgi>}} released.
@@ -94,22 +95,30 @@ list:
.#Erubis supports not only Ruby but also PHP, C, Java, Scheme, Perl, and Javascript.
.#You can embed these language code into your document and compile it into target program code.
-.#Erubis is implemented in Ruby and is now ported into Java.
-.#You can use Erubis in Java with Rhino.
+Erubis is implemented in Ruby and is now ported into Java.
+You can use Erubis in Java with Rhino.
.$ Download
- .* if you have installed RubyGems, just type `{{,gem install -r erubis,}}' to install Erubis
- .* Or {{<download|download.cgi>}}.^
- (Erubis requires {{<abstract|http://rubyforge.org/projects/abstract>}} library.
- Download and install it at first.)
+ .* Erubis (implemented in Ruby)
+ .- if you have installed RubyGems, just type `{{,gem install -r erubis,}}' to install Erubis
+ .- Or {{<download|download.cgi>}}.^
+ (Erubis requires {{<abstract|http://rubyforge.org/projects/abstract>}} library.
+ Download and install it at first.)
+ .* Erubis-J (implemented in Java) {{!(New!)!}}
+ .- {{<download|download.cgi?project=erubisj>}}
.$ Documents
.#.* {{<README|README.en.html>}}
- .* {{<Users' guide|users-guide.html>}}
- .* {{<Changelog|ChangeLog>}}
- .* {{<ReleaseNote|ReleaseNote.txt>}}
+ .* Erubis (implemented in Ruby)
+ .- {{<Users' guide|users-guide.html>}}
+ .- {{<CHANGES|CHANGES>}}
+ .- {{<ReleaseNote|ReleaseNote.txt>}}
+ .* Erubis-J (implemented in Java)
+ .- {{<Users' guide|erubisj-users-guide.html>}}
+ .#.- {{<Changelog|erubisj-ChangeLog>}}
+ .#.- {{<ReleaseNote|erubisj-ReleaseNote.txt>}}
.$ License
.* {{<LGPL ver.2|http://www.gnu.org/copyleft/lgpl.html>}}
diff --git a/website/index.xhtml b/website/index.xhtml
index e655a1f..424bd1c 100644
--- a/website/index.xhtml
+++ b/website/index.xhtml
@@ -24,6 +24,8 @@
<a name="News"></a>
<h2 class="section">News</h2>
<ul class="ul1">
+<li>[2006-09-28] <a href="download.cgi">erubis-j_1.0.0</a> (porting to Java) released.
+</li>
<li>[2006-09-24] <a href="download.cgi">erubis_2.1.0</a> released.
</li>
<li>[2006-05-20] <a href="download.cgi">erubis_2.0.0</a> released.
@@ -122,17 +124,30 @@ Hello Erubis!
* bbb
* ccc
</pre>
+<p>Erubis is implemented in Ruby and is now ported into Java.
+You can use Erubis in Java with Rhino.
+</p>
<a name="Download"></a>
<h2 class="section">Download</h2>
<ul class="ul1">
- <li>if you have installed RubyGems, just type `<code>gem install -r erubis</code>' to install Erubis
+ <li>Erubis (implemented in Ruby)
+ <ul class="ul2">
+ <li>if you have installed RubyGems, just type `<code>gem install -r erubis</code>' to install Erubis
+ </li>
+ <li>Or <a href="download.cgi">download</a><br />
+ (Erubis requires <a href="http://rubyforge.org/projects/abstract">abstract</a> library.
+ Download and install it at first.)
+ </li>
+ </ul>
</li>
- <li>Or <a href="download.cgi">download</a><br />
- (Erubis requires <a href="http://rubyforge.org/projects/abstract">abstract</a> library.
- Download and install it at first.)
+ <li>Erubis-J (implemented in Java) <span style="color:#FF0000">(New!)</span>
+ <ul class="ul2">
+ <li><a href="download.cgi?project=erubisj">download</a>
+ </li>
+ </ul>
</li>
</ul>
@@ -141,11 +156,21 @@ Hello Erubis!
<a name="Documents"></a>
<h2 class="section">Documents</h2>
<ul class="ul1">
- <li><a href="users-guide.html">Users' guide</a>
- </li>
- <li><a href="ChangeLog">Changelog</a>
+ <li>Erubis (implemented in Ruby)
+ <ul class="ul2">
+ <li><a href="users-guide.html">Users' guide</a>
+ </li>
+ <li><a href="CHANGES">CHANGES</a>
+ </li>
+ <li><a href="ReleaseNote.txt">ReleaseNote</a>
+ </li>
+ </ul>
</li>
- <li><a href="ReleaseNote.txt">ReleaseNote</a>
+ <li>Erubis-J (implemented in Java)
+ <ul class="ul2">
+ <li><a href="erubisj-users-guide.html">Users' guide</a>
+ </li>
+ </ul>
</li>
</ul>