Rails_xss Plugin

I installed the rails_xss plugin, for
the main purpose of seeing what will
break with Rails 3.0 (where the behaviour
of the plugin is the default). I think
I've fixed everything, but let me know if you
see stuff that is HTML-escaped, which
shouldn't be.

As a side benefit, we now use Erubis,
rather than ERB, to render templates.
They tell me it's faster ...
This commit is contained in:
Jacques Distler 2010-05-26 00:27:49 -05:00
parent d6be09e0f0
commit a5e08f7bcc
343 changed files with 43874 additions and 37 deletions

View file

@ -31,7 +31,7 @@ require 'stringsupport'
end end
end end
html_options.join("\n") html_options.join("\n").html_safe
end end
# Creates a hyperlink to a Wiki page, without checking if the page exists or not # Creates a hyperlink to a Wiki page, without checking if the page exists or not
@ -39,18 +39,18 @@ require 'stringsupport'
link_to( link_to(
text || page.plain_name, text || page.plain_name,
{:web => @web.address, :action => 'show', :id => page.name, :only_path => true}, {:web => @web.address, :action => 'show', :id => page.name, :only_path => true},
html_options) html_options).html_safe
end end
# Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet # Creates a hyperlink to a Wiki page, or to a "new page" form if the page doesn't exist yet
def link_to_page(page_name, web = @web, text = nil, options = {}) def link_to_page(page_name, web = @web, text = nil, options = {})
raise 'Web not defined' if web.nil? raise 'Web not defined' if web.nil?
UrlGenerator.new(@controller).make_link(@web, page_name, web, text, UrlGenerator.new(@controller).make_link(@web, page_name, web, text,
options.merge(:base_url => "#{base_url}/#{web.address}")) options.merge(:base_url => "#{base_url}/#{web.address}")).html_safe
end end
def author_link(page, options = {}) def author_link(page, options = {})
UrlGenerator.new(@controller).make_link(@web, page.author.name, page.web, nil, options) UrlGenerator.new(@controller).make_link(@web, page.author.name, page.web, nil, options).purify.html_safe
end end
# Create a hyperlink to a particular revision of a Wiki page # Create a hyperlink to a particular revision of a Wiki page
@ -59,19 +59,19 @@ require 'stringsupport'
link_to( link_to(
text || page.plain_name, text || page.plain_name,
{:web => @web.address, :action => 'show', :id => page.name, {:web => @web.address, :action => 'show', :id => page.name,
:mode => mode}, html_options) : :mode => mode}, html_options).html_safe :
link_to( link_to(
text || page.plain_name + "(rev # #{revision_number})", text || page.plain_name + "(rev # #{revision_number})".html_safe,
{:web => @web.address, :action => 'revision', :id => page.name, {:web => @web.address, :action => 'revision', :id => page.name,
:rev => revision_number, :mode => mode}, html_options) :rev => revision_number, :mode => mode}, html_options).html_safe
end end
# Create a hyperlink to the history of a particular Wiki page # Create a hyperlink to the history of a particular Wiki page
def link_to_history(page, text = nil, html_options = {}) def link_to_history(page, text = nil, html_options = {})
link_to( link_to(
text || page.plain_name + "(history)", text || page.plain_name + "(history)".html_safe,
{:web => @web.address, :action => 'history', :id => page.name}, {:web => @web.address, :action => 'history', :id => page.name},
html_options) html_options).html_safe
end end
def base_url def base_url
@ -84,13 +84,13 @@ require 'stringsupport'
if @categories.empty? if @categories.empty?
'' ''
else else
"<div id=\"categories\">\n" + ("<div id=\"categories\">\n" +
'<strong>Categories</strong>:' + '<strong>Categories</strong>:' +
'[' + link_to_unless_current('Any', :web => @web.address, :action => self.action_name, :category => nil) + "]\n" + '[' + link_to_unless_current('Any', :web => @web.address, :action => self.action_name, :category => nil) + "]\n" +
@categories.map { |c| @categories.map { |c|
link_to_unless_current(c, :web => @web.address, :action => self.action_name, :category => c) link_to_unless_current(c.html_safe, :web => @web.address, :action => self.action_name, :category => c)
}.join(', ') + "\n" + }.join(', ') + "\n" +
'</div>' '</div>').html_safe
end end
end end
@ -115,14 +115,14 @@ require 'stringsupport'
def truncate(text, *args) def truncate(text, *args)
options = args.extract_options! options = args.extract_options!
options.reverse_merge!(:length => 30, :omission => "...") options.reverse_merge!(:length => 30, :omission => "...")
return text if text.num_chars <= options[:length] return text.html_safe if text.num_chars <= options[:length]
len = options[:length] - options[:omission].as_utf8.num_chars len = options[:length] - options[:omission].as_utf8.num_chars
t = '' t = ''
text.split.collect do |word| text.split.collect do |word|
if t.num_chars + word.num_chars <= len if t.num_chars + word.num_chars <= len
t << word + ' ' t << word + ' '
else else
return t.chop + options[:omission] return (t.chop + options[:omission]).html_safe
end end
end end
end end

View file

@ -90,7 +90,7 @@ class Page < ActiveRecord::Base
# Returns the original wiki-word name as separate words, so "MyPage" becomes "My Page". # Returns the original wiki-word name as separate words, so "MyPage" becomes "My Page".
def plain_name def plain_name
web.brackets_only? ? name.escapeHTML : WikiWords.separate(name).escapeHTML web.brackets_only? ? name.escapeHTML.html_safe : WikiWords.separate(name).escapeHTML.html_safe
end end
LOCKING_PERIOD = 30.minutes LOCKING_PERIOD = 30.minutes

View file

@ -46,18 +46,18 @@
}, @web.color) %> }, @web.color) %>
</select> </select>
<p> <p>
<input type="checkbox" class="disableAutoComplete" id="safe_mode" name="safe_mode" <%= 'checked="checked"' if @web.safe_mode? %> /> <input type="checkbox" class="disableAutoComplete" id="safe_mode" name="safe_mode" <%= raw 'checked="checked"' if @web.safe_mode? %> />
<label for="safe_mode">Safe mode <label for="safe_mode">Safe mode
<em>- strip HTML tags and stylesheet options from the content of all pages</em></label> <em>- strip HTML tags and stylesheet options from the content of all pages</em></label>
<br/> <br/>
<input type="checkbox" class="disableAutoComplete" id="brackets_only" name="brackets_only" <%= 'checked="checked"' if @web.brackets_only? %> /> <input type="checkbox" class="disableAutoComplete" id="brackets_only" name="brackets_only" <%= raw 'checked="checked"' if @web.brackets_only? %> />
<label for="brackets_only">Brackets only <label for="brackets_only">Brackets only
<em>- require all wiki words to be as [[wiki word]], WikiWord links won't be created</em></label> <em>- require all wiki words to be as [[wiki word]], WikiWord links won't be created</em></label>
<br/> <br/>
<input type="checkbox" class="disableAutoComplete" id="count_pages" name="count_pages" <%= 'checked="checked"' if @web.count_pages? %> /> <input type="checkbox" class="disableAutoComplete" id="count_pages" name="count_pages" <%= raw 'checked="checked"' if @web.count_pages? %> />
<label for="count_pages">Count pages</label> <label for="count_pages">Count pages</label>
<br/> <br/>
<input type="checkbox" class="disableAutoComplete" name="allow_uploads" <%= 'checked="checked"' if @web.allow_uploads? %> /> <input type="checkbox" class="disableAutoComplete" name="allow_uploads" <%= raw 'checked="checked"' if @web.allow_uploads? %> />
Allow uploads of no more than Allow uploads of no more than
<input type="text" class="disableAutoComplete" name="max_upload_size" value="<%= @web.max_upload_size %>" <input type="text" class="disableAutoComplete" name="max_upload_size" value="<%= @web.max_upload_size %>"
size="20" /> size="20" />
@ -100,7 +100,7 @@
The published version is accessible through URLs like /<%= @web.address %>/published/HomePage. The published version is accessible through URLs like /<%= @web.address %>/published/HomePage.
</div> </div>
<div class="inputBox"> <div class="inputBox">
<input type="checkbox" id="published" name="published" class="disableAutoComplete" <%= 'checked="checked"' if @web.published? %> /> <input type="checkbox" id="published" name="published" class="disableAutoComplete" <%= raw 'checked="checked"' if @web.published? %> />
<label for="published">Publish this web</label> <label for="published">Publish this web</label>
</div> </div>

View file

@ -1,5 +1,5 @@
<%- <%-
@title = "Delete #{@file_name}" @title = "Delete #{@file_name}".html_safe
@hide_navigation = true @hide_navigation = true
-%> -%>

View file

@ -1,13 +1,13 @@
<%- unless @page.linked_from.empty? -%> <%- unless @page.linked_from.empty? -%>
<span class="linked"> <span class="linked">
| Linked from: | Linked from:
<%= @page.linked_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ") %> <%= @page.linked_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ").html_safe %>
</span> </span>
<%- end -%> <%- end -%>
<%- unless @page.included_from.empty? -%> <%- unless @page.included_from.empty? -%>
<span class="linked"> <span class="linked">
| Included from: | Included from:
<%= @page.included_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ") %> <%= @page.included_from.collect { |referring_page| link_to_existing_page referring_page }.join(", ").html_safe %>
</span> </span>
<%- end -%> <%- end -%>

View file

@ -5,7 +5,7 @@
<li> <li>
<%= link_to_page author.purify %> <%= link_to_page author.purify %>
co- or authored: co- or authored:
<%= @page_names_by_author[author].collect { |page_name| link_to_page(page_name) }.sort.join ', ' %> <%= raw @page_names_by_author[author].collect { |page_name| link_to_page(page_name) }.sort.join ', ' %>
</li> </li>
<%- end -%> <%- end -%>
</ul> </ul>

View file

@ -1,5 +1,5 @@
<%- <%-
@title = "Editing #{@page.name.escapeHTML}" @title = "Editing #{@page.name.escapeHTML}".html_safe
@content_width = 720 @content_width = 720
@hide_navigation = true @hide_navigation = true
-%> -%>

View file

@ -20,7 +20,7 @@
<a href="<%= url_for :web => @web.address, :action => 'files', <a href="<%= url_for :web => @web.address, :action => 'files',
:id => file.file_name %>"><%= file.file_name%></a> (<%= file.created_at.asctime %>) <span class="linked"><%= "Linked to by: " unless :id => file.file_name %>"><%= file.file_name%></a> (<%= file.created_at.asctime %>) <span class="linked"><%= "Linked to by: " unless
@web.pages_that_link_to_file(file.file_name).empty? -%> @web.pages_that_link_to_file(file.file_name).empty? -%>
<%= @web.pages_that_link_to_file(file.file_name).collect { |referring_page| link_to_page(referring_page) }.join(", ") %></span> <%= @web.pages_that_link_to_file(file.file_name).collect { |referring_page| link_to_page(referring_page) }.join(", ").html_safe %></span>
</li> </li>
<%- end -%> <%- end -%>
</ul> </ul>

View file

@ -1,4 +1,4 @@
<%- @title = @page.plain_name + " (history)" -%> <%- @title = @page.plain_name + " (history)".html_safe -%>
<%- @show_footer = true -%> <%- @show_footer = true -%>
<%- @revisions_by_day.keys.sort.reverse.each do |day| -%> <%- @revisions_by_day.keys.sort.reverse.each do |day| -%>

View file

@ -41,7 +41,7 @@
wanted by wanted by
<%= @web.select.pages_that_reference(wanted_page_name).collect { |referring_page| <%= @web.select.pages_that_reference(wanted_page_name).collect { |referring_page|
link_to_existing_page referring_page link_to_existing_page referring_page
}.join(", ") }.join(", ").html_safe
%> %>
</li> </li>
<%- end -%> <%- end -%>

View file

@ -18,7 +18,7 @@
<div class="byline"> <div class="byline">
<%= @page.revisions? ? "Revised" : "Created" %> on <%= format_date(@page.revised_at) %> <%= @page.revisions? ? "Revised" : "Created" %> on <%= format_date(@page.revised_at) %>
by <%= author_link(@page).purify %> by <%= author_link(@page) %>
<%= "(#{@page.author.ip})" if @page.author.respond_to?(:ip) %> <%= "(#{@page.author.ip})" if @page.author.respond_to?(:ip) %>
<% if @web.count_pages? %> <% if @web.count_pages? %>
<% total_chars = @page.content.length %> <% total_chars = @page.content.length %>
@ -28,7 +28,7 @@
<div class="navigation navfoot"> <div class="navigation navfoot">
<%= navigation_menu_for_page.join(' | ') %> <%= raw navigation_menu_for_page.join(' | ') %>
<span class="views"> <span class="views">
| Views: | Views:

View file

@ -1,5 +1,5 @@
<%- <%-
@title = "#{@page.plain_name} (Rev ##{@revision_number}#{@show_diff ? ', changes' : ''})" @title = "#{@page.plain_name} (Rev ##{@revision_number}#{@show_diff ? ', changes' : ''})".html_safe
-%> -%>
@ -21,6 +21,6 @@
</div> </div>
<div class="navigation navfoot"> <div class="navigation navfoot">
<%= navigation_menu_for_revision.join(' | ') %> <%= raw navigation_menu_for_revision.join(' | ') %>
<%= render :partial => 'inbound_links' %> <%= render :partial => 'inbound_links' %>
</div> </div>

View file

@ -1,5 +1,5 @@
<%- <%-
@title = "Rollback to #{@page.plain_name} Rev ##{@revision_number}" @title = "Rollback to #{@page.plain_name} Rev ##{@revision_number}".html_safe
@content_width = 720 @content_width = 720
@hide_navigation = true @hide_navigation = true
-%> -%>

View file

@ -247,6 +247,6 @@
\section*{<%= @page.name %>} \section*{<%= @page.name %>}
<%= @tex_content %> <%= @tex_content.html_safe %>
\end{document} \end{document}

View file

@ -19,7 +19,7 @@
- Last Update: <%= web.last_page.nil? ? format_date(web.created_at) : format_date(web.last_page.revised_at) %><br/> - Last Update: <%= web.last_page.nil? ? format_date(web.created_at) : format_date(web.last_page.revised_at) %><br/>
<%- if ! web.last_page.nil? -%> <%- if ! web.last_page.nil? -%>
Last Document: <%= link_to_page(web.last_page.name,web) %> Last Document: <%= link_to_page(web.last_page.name,web) %>
<%= web.last_page.revisions? ? "Revised" : "Created" %> by <%= author_link(web.last_page).purify %> (<%= web.last_page.current_revision.ip %>) <%= web.last_page.revisions? ? "Revised" : "Created" %> by <%= author_link(web.last_page) %> (<%= web.last_page.current_revision.ip %>)
<%- end -%> <%- end -%>
</div> </div>
</div> </div>

View file

@ -57,7 +57,7 @@ class PageRenderer
diffs = '' diffs = ''
diff_doc.write(diffs, -1, true, true) diff_doc.write(diffs, -1, true, true)
diffs.gsub(/\A<div class='xhtmldiff_wrapper'>(.*)<\/div>\Z/m, '\1') diffs.gsub(/\A<div class='xhtmldiff_wrapper'>(.*)<\/div>\Z/m, '\1').html_safe
else else
display_content display_content
end end

View file

@ -0,0 +1,3 @@
: release 1.0.0 (2006-03-12)
- first release (1.0.0)

View file

@ -0,0 +1,57 @@
= README
revision:: $Rev: 1 $
release:: $Release: 1.0.0 $
copyright:: copyright(c) 2006 kuwata-lab.com all rights reserved.
== Introduction
'abstract.rb' is a library which enable you to define abstract method in Ruby.
The followings are examples:
## example1. (shorter notation)
require 'rubygems' # if installed with 'gem install'
require 'abstract'
class Foo
abstract_method 'arg1, arg2=""', :method1, :method2, :method3
end
## example2. (RDoc friendly notation)
require 'rubygems' # if installed with 'gem install'
require 'abstract'
class Bar
# ... method1 description ...
def method1(arg1, arg2="")
not_implemented
end
# ... method2 description ...
def method2(arg1, arg2="")
not_implemented
end
end
Abstract method makes your code more descriptive.
It is useful even for dynamic language such as Ruby.
== Installation
* Type 'gem install -r abstract' with root account if you have installed RubyGems.
* Or type 'ruby setup.rb' with root account if you can be root account.
* Or copy lib/abstract.rb into proper directory such as '/usr/local/lib/ruby/site_ruby'.
== License
Ruby's
== Copyright
copyright(c) 2006 kuwata-lab.com all rights reserved.

View file

@ -0,0 +1,48 @@
#!/usr/bin/env ruby
###
### RubyGems Specification file for abstract.rb
###
### $Rev: 1 $
### $Release: 1.0.0 $
### copyright(c) 2006 kuwata-lab.com all rights reserved.
###
require 'rubygems'
spec = Gem::Specification.new do |s|
## package information
s.name = 'abstract'
s.author = 'makoto kuwata'
s.version = ("$Release: 1.0.0 $" =~ /[\.\d]+/) && $&
s.platform = Gem::Platform::RUBY
s.homepage = 'http://rubyforge.org/projects/abstract'
s.summary = "a library which enable you to define abstract method in Ruby"
s.description = <<-'END'
'abstract.rb' is a library which enable you to define abstract method in Ruby.
END
## files
files = []
files += Dir.glob('lib/**/*')
files += Dir.glob('test/**/*')
files += %w[README.txt ChangeLog setup.rb abstract.gemspec]
#s.files = files.delete_if { |path| path =~ /\.svn/ }
s.files = files
s.test_file = 'test/test.rb'
end
# Quick fix for Ruby 1.8.3 / YAML bug (thanks to Ross Bamford)
if (RUBY_VERSION == '1.8.3')
def spec.to_yaml
out = super
out = '--- ' + out unless out =~ /^---/
out
end
end
if $0 == __FILE__
Gem::manage_gems
Gem::Builder.new(spec).build
end

View file

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Kernel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Kernel</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/abstract_rb.html">
lib/abstract.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000002">not_implemented</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Private Instance methods</h3>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="Kernel.src/M000002.html" target="Code" class="method-signature"
onclick="popupCode('Kernel.src/M000002.html');return false;">
<span class="method-name">not_implemented</span><span class="method-args">(</span>
</a>
</div>
<div class="method-description">
<p>
raise NotImplementedError
</p>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>not_implemented (Kernel)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/abstract.rb, line 65</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_implemented</span> <span class="ruby-comment cmt">#:doc:</span>
<span class="ruby-identifier">backtrace</span> = <span class="ruby-identifier">caller</span>()
<span class="ruby-identifier">method_name</span> = (<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`(\w+)'$/</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">$1</span>
<span class="ruby-identifier">mesg</span> = <span class="ruby-node">&quot;class #{self.class.name} must implement abstract method '#{method_name}()'.&quot;</span>
<span class="ruby-comment cmt">#mesg = &quot;#{self.class.name}##{method_name}() is not implemented.&quot;</span>
<span class="ruby-identifier">err</span> = <span class="ruby-constant">NotImplementedError</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">mesg</span>
<span class="ruby-identifier">err</span>.<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">backtrace</span>
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">err</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>

View file

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Module</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Module</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/lib/abstract_rb.html">
lib/abstract.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">abstract_method</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="Module.src/M000001.html" target="Code" class="method-signature"
onclick="popupCode('Module.src/M000001.html');return false;">
<span class="method-name">abstract_method</span><span class="method-args">(args_str, *method_names)</span>
</a>
</div>
<div class="method-description">
<p>
define abstract methods
</p>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>abstract_method (Module)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
<pre><span class="ruby-comment cmt"># File lib/abstract.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">abstract_method</span> <span class="ruby-identifier">args_str</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_names</span>
<span class="ruby-identifier">method_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">module_eval</span> <span class="ruby-value str">&quot;def \#{name}(\#{args_str})\nmesg = \&quot;class \\\#{self.class.name} must implement abstract method `\#{self.name}#\#{name}()'.\&quot;\n#mesg = \&quot;\\\#{self.class.name}#\#{name}() is not implemented.\&quot;\nerr = NotImplementedError.new mesg\nerr.set_backtrace caller()\nraise err\nend\n&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>

View file

@ -0,0 +1 @@
Mon Mar 13 06:08:02 JST 2006

View file

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: README.txt</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>README.txt</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>README.txt
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Mon Mar 13 06:08:02 JST 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<h1>README</h1>
<table>
<tr><td valign="top">revision:</td><td>$Rev: 1 $
</td></tr>
<tr><td valign="top">release:</td><td>$Release: 1.0.0 $
</td></tr>
<tr><td valign="top">copyright:</td><td>copyright&#169; 2006 kuwata-lab.com all rights reserved.
</td></tr>
</table>
<h2>Introduction</h2>
<p>
&#8216;abstract.rb&#8217; is a library which enable you to define abstract
method in Ruby.
</p>
<p>
The followings are examples:
</p>
<pre>
## example1. (shorter notation)
require 'rubygems' # if installed with 'gem install'
require 'abstract'
class Foo
abstract_method 'arg1, arg2=&quot;&quot;', :method1, :method2, :method3
end
## example2. (RDoc friendly notation)
require 'rubygems' # if installed with 'gem install'
require 'abstract'
class Bar
# ... method1 description ...
def method1(arg1, arg2=&quot;&quot;)
not_implemented
end
# ... method2 description ...
def method2(arg1, arg2=&quot;&quot;)
not_implemented
end
end
</pre>
<p>
Abstract method makes your code more descriptive. It is useful even for
dynamic language such as Ruby.
</p>
<h2>Installation</h2>
<ul>
<li>Type &#8216;gem install -r abstract&#8217; with root account if you have
installed RubyGems.
</li>
<li>Or type &#8216;ruby setup.rb&#8217; with root account if you can be root
account.
</li>
<li>Or copy lib/abstract.rb into proper directory such as
&#8217;/usr/local/lib/ruby/site_ruby&#8217;.
</li>
</ul>
<h2>License</h2>
<p>
Ruby&#8217;s
</p>
<h2>Copyright</h2>
<p>
copyright&#169; 2006 kuwata-lab.com all rights reserved.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>File: abstract.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="fileHeader">
<h1>abstract.rb</h1>
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Path:</strong></td>
<td>lib/abstract.rb
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Last Update:</strong></td>
<td>Mon Mar 13 06:08:02 JST 2006</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
$Rev: 1 $ $Release: 1.0.0 $ copyright&#169; 2006 kuwata-lab.com all rights
reserved.
</p>
<p>
helper to define abstract method in Ruby.
</p>
<p>
example1. (shorter notation)
</p>
<pre>
require 'abstract'
class Foo
abstract_method 'arg1, arg2=&quot;&quot;', :method1, :method2, :method3
end
</pre>
<p>
example2. (RDoc friendly notation)
</p>
<pre>
require 'abstract'
class Bar
# ... method1 description ...
def method1(arg1, arg2=&quot;&quot;)
not_implemented
end
# ... method2 description ...
def method2(arg1, arg2=&quot;&quot;)
not_implemented
end
end
</pre>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Classes
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Classes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Classes</h1>
<div id="index-entries">
<a href="classes/Kernel.html">Kernel</a><br />
<a href="classes/Module.html">Module</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Files
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Files</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Files</h1>
<div id="index-entries">
<a href="files/README_txt.html">README.txt</a><br />
<a href="files/lib/abstract_rb.html">lib/abstract.rb</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Methods
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Methods</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
<base target="docwin" />
</head>
<body>
<div id="index">
<h1 class="section-bar">Methods</h1>
<div id="index-entries">
<a href="classes/Module.html#M000001">abstract_method (Module)</a><br />
<a href="classes/Kernel.html#M000002">not_implemented (Kernel)</a><br />
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<!--
abstract.rb documentation
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>abstract.rb documentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<frameset rows="20%, 80%">
<frameset cols="25%,35%,45%">
<frame src="fr_file_index.html" title="Files" name="Files" />
<frame src="fr_class_index.html" name="Classes" />
<frame src="fr_method_index.html" name="Methods" />
</frameset>
<frame src="files/README_txt.html" name="docwin" />
</frameset>
</html>

View file

@ -0,0 +1,208 @@
body {
font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: 90%;
margin: 0;
margin-left: 40px;
padding: 0;
background: white;
}
h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
h1 { font-size: 150%; }
h2,h3,h4 { margin-top: 1em; }
a { background: #eef; color: #039; text-decoration: none; }
a:hover { background: #039; color: #eef; }
/* Override the base stylesheet's Anchor inside a table cell */
td > a {
background: transparent;
color: #039;
text-decoration: none;
}
/* and inside a section title */
.section-title > a {
background: transparent;
color: #eee;
text-decoration: none;
}
/* === Structural elements =================================== */
div#index {
margin: 0;
margin-left: -40px;
padding: 0;
font-size: 90%;
}
div#index a {
margin-left: 0.7em;
}
div#index .section-bar {
margin-left: 0px;
padding-left: 0.7em;
background: #ccc;
font-size: small;
}
div#classHeader, div#fileHeader {
width: auto;
color: white;
padding: 0.5em 1.5em 0.5em 1.5em;
margin: 0;
margin-left: -40px;
border-bottom: 3px solid #006;
}
div#classHeader a, div#fileHeader a {
background: inherit;
color: white;
}
div#classHeader td, div#fileHeader td {
background: inherit;
color: white;
}
div#fileHeader {
background: #057;
}
div#classHeader {
background: #048;
}
.class-name-in-header {
font-size: 180%;
font-weight: bold;
}
div#bodyContent {
padding: 0 1.5em 0 1.5em;
}
div#description {
padding: 0.5em 1.5em;
background: #efefef;
border: 1px dotted #999;
}
div#description h1,h2,h3,h4,h5,h6 {
color: #125;;
background: transparent;
}
div#validator-badges {
text-align: center;
}
div#validator-badges img { border: 0; }
div#copyright {
color: #333;
background: #efefef;
font: 0.75em sans-serif;
margin-top: 5em;
margin-bottom: 0;
padding: 0.5em 2em;
}
/* === Classes =================================== */
table.header-table {
color: white;
font-size: small;
}
.type-note {
font-size: small;
color: #DEDEDE;
}
.xxsection-bar {
background: #eee;
color: #333;
padding: 3px;
}
.section-bar {
color: #333;
border-bottom: 1px solid #999;
margin-left: -20px;
}
.section-title {
background: #79a;
color: #eee;
padding: 3px;
margin-top: 2em;
margin-left: -30px;
border: 1px solid #999;
}
.top-aligned-row { vertical-align: top }
.bottom-aligned-row { vertical-align: bottom }
/* --- Context section classes ----------------------- */
.context-row { }
.context-item-name { font-family: monospace; font-weight: bold; color: black; }
.context-item-value { font-size: small; color: #448; }
.context-item-desc { color: #333; padding-left: 2em; }
/* --- Method classes -------------------------- */
.method-detail {
background: #efefef;
padding: 0;
margin-top: 0.5em;
margin-bottom: 1em;
border: 1px dotted #ccc;
}
.method-heading {
color: black;
background: #ccc;
border-bottom: 1px solid #666;
padding: 0.2em 0.5em 0 0.5em;
}
.method-signature { color: black; background: inherit; }
.method-name { font-weight: bold; }
.method-args { font-style: italic; }
.method-description { padding: 0 0.5em 0 0.5em; }
/* --- Source code sections -------------------- */
a.source-toggle { font-size: 90%; }
div.method-source-code {
background: #262626;
color: #ffdead;
margin: 1em;
padding: 0.5em;
border: 1px dashed #999;
overflow: hidden;
}
div.method-source-code pre { color: #ffdead; overflow: hidden; }
/* --- Ruby keyword styles --------------------- */
.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
.ruby-constant { color: #7fffd4; background: transparent; }
.ruby-keyword { color: #00ffff; background: transparent; }
.ruby-ivar { color: #eedd82; background: transparent; }
.ruby-operator { color: #00ffee; background: transparent; }
.ruby-identifier { color: #ffdead; background: transparent; }
.ruby-node { color: #ffa07a; background: transparent; }
.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; }

View file

@ -0,0 +1,75 @@
##
## $Rev: 1 $
## $Release: 1.0.0 $
## copyright(c) 2006 kuwata-lab.com all rights reserved.
##
##
## helper to define abstract method in Ruby.
##
##
## example1. (shorter notation)
##
## require 'abstract'
## class Foo
## abstract_method 'arg1, arg2=""', :method1, :method2, :method3
## end
##
##
## example2. (RDoc friendly notation)
##
## require 'abstract'
## class Bar
## # ... method1 description ...
## def method1(arg1, arg2="")
## not_implemented
## end
##
## # ... method2 description ...
## def method2(arg1, arg2="")
## not_implemented
## end
## end
##
##
class Module
##
## define abstract methods
##
def abstract_method args_str, *method_names
method_names.each do |name|
module_eval <<-END
def #{name}(#{args_str})
mesg = "class \#{self.class.name} must implement abstract method `#{self.name}##{name}()'."
#mesg = "\#{self.class.name}##{name}() is not implemented."
err = NotImplementedError.new mesg
err.set_backtrace caller()
raise err
end
END
end
end
end
##
module Kernel
##
## raise NotImplementedError
##
def not_implemented #:doc:
backtrace = caller()
method_name = (backtrace.shift =~ /`(\w+)'$/) && $1
mesg = "class #{self.class.name} must implement abstract method '#{method_name}()'."
#mesg = "#{self.class.name}##{method_name}() is not implemented."
err = NotImplementedError.new mesg
err.set_backtrace backtrace
raise err
end
private :not_implemented
end

1331
vendor/plugins/abstract_1.0.0/setup.rb vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
##
## $Rev: 1 $
## $Release: 1.0.0 $
## copyright(c) 2006 kuwata-lab.com all rights reserved.
##
testdir = File.dirname(File.expand_path(__FILE__))
libdir = File.dirname(testdir) + "/lib"
$: << libdir
require 'test/unit'
require 'abstract'
class Foo
abstract_method "arg1, arg2=''", :m1, :m2, :m3
end
class Bar
def m1(arg1, arg2='')
not_implemented
end
end
class AbstractTest < Test::Unit::TestCase
def _test(obj)
assert_raise(NotImplementedError) do
begin
obj = Foo.new
obj.m1 'a'
rescue => ex
linenum = (ex.backtrace[0] =~ /:(\d+)/) && $1
raise ex
end
end
end
def test_abstract_method1
obj = Foo.new
assert_raise(NotImplementedError) { obj.m1 'a' }
assert_raise(NotImplementedError) { obj.m2 'a', 'b' }
end
def test_abstract_method2
begin
obj = Foo.new
linenum = __LINE__; obj.m1 'a'
rescue NotImplementedError => ex
actual_linenum = (ex.backtrace[0] =~ /:(\d+)/) && $1.to_i
end
assert_equal linenum, actual_linenum
end
def test_not_implemented1
obj = Bar.new
assert_raise(NotImplementedError) { obj.m1 123 }
end
def test_not_implemented2
begin
obj = Bar.new
linenum = __LINE__; obj.m1 'a'
rescue NotImplementedError => ex
actual_linenum = (ex.backtrace[0] =~ /:(\d+)/) && $1.to_i
end
assert_equal linenum, actual_linenum
end
def test_not_implemented3
begin
obj = Bar.new
obj.not_implemented
rescue Exception => ex
assert_instance_of(NoMethodError, ex)
assert_match(/private method/, ex.message)
end
end
end

744
vendor/plugins/erubis-2.6.5/CHANGES.txt vendored Normal file
View file

@ -0,0 +1,744 @@
# -*- coding: utf-8 -*-
# $Release: 2.6.5 $
# copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
- release: 2.6.5
date: 2009-07-20
bugfixes:
- |
Fixed bug around '-z' option.
- release: 2.6.4
date: 2009-02-18
enhancemens:
- |
Rails 2.2 and 2.3 support.
- release: 2.6.3
date: 2009-02-07
bugfixes:
- Enhancer name was not displayed in Ruby 1.9.1 when it was missing.
- Command option argument name was not displayed correctly as a part of error message.
- MethoNotFound error was raised when invalid option was specified.
- release: 2.6.2
date: 2008-06-12
enhancements:
- |
Ruby 1.9 support.
bugfixes:
- |
Fixed installation problem on Windows (Thanks to Tim Morgan and Allen).
- release: 2.6.1
date: 2008-06-06
enhancements:
- |
Rails 2.1 support. (special thanks José Valim)
- release: 2.6.0
date: 2008-05-05
enhancements:
- |
Improved support of Ruby on Rails 2.0.2.
New class ActionView::TemplateHandlers::Erubis is defined and
registered as default handler of *.html.erb and *.rhtml.
- |
'<%% %>' and '<%%= %>' are converted into '<% %>' and '<%= %>' respectively.
This is for compatibility with ERB.
ex1.rhtml:
<ul>
<%% for item in @list %>
<li><%%= item %></li>
<%% end %>
</ul>
result:
$ erubis ex1.rhtml
<ul>
<% for item in @list %>
<li><%= item %></li>
<% end %>
</ul>
- |
'<%= -%>' removes tail spaces and newlines.
This is for compatibiliy with ERB when trim mode is '-'.
'<%= =%>' also removes tail spaces and newlines, and this is
Erubis-original enhancement (cooler than '<%= -%>', isn't it?).
ex2.rhtml:
<div>
<%= @var -%> # or <%= @var =%>
</div>
result (version 2.6.0):
$ erubis -c '{var: "AAA\n"}' ex2.rhtml
<div>
AAA
</div>
result (version 2.5.0):
$ erubis -c '{var: "AAA\n"}' ex2.rhtml
<div>
AAA
</div>
- |
Erubis::Eruby.load_file() now allows you to change cache filename.
ex.
eruby = Erubis::Eruby.load_file("ex3.rhtml",
:cachename=>'ex3.rhtml.cache')
- release: 2.5.0
date: 2008-01-30
enhancements:
- |
Ruby on Rails 2.0 support.
If you are using preprocessing, notice that _?('foo.id') will be NG
because it contains period ('.') character.
--------------------
<!-- NG in Rails 2.0 -->
[%= link_to 'Edit', edit_user_path(_?('@user.id')) %]
[%= link_to 'Show', @user %]
[%= link_to 'Delete', @user, :confirm=>'OK?', :method=>:delete %]
<!-- OK in Rails 2.0 -->
<%= user_id = @user.id %>
[%= link_to 'Edit', edit_user_path(_?('user_id')) %]
[%= link_to 'Show', :action=>'show', :id=>_?('user_id') %]
[%= link_to 'Delete', {:action=>'destroy', :id=>_?('user_id')},
{:confirm=>'OK?', :method=>:delete} %]
--------------------
- |
(experimental)
Rails form helper methods for preprocessing are added.
These helper methos are available with preprocessing.
ex. _form.rhtml
--------------------
Name: <%= text_field :user, :name %>
Name: [%= pp_text_field :user, :name %]
--------------------
preprocessed:
--------------------
Name: <%= text_field :user, :name %>
Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="<%=h @stock.name%>" />
--------------------
Ruby code:
--------------------
_buf << '
Name: '; _buf << ( text_field :stock, :name ).to_s; _buf << '
Name: <input id="stock_name" name="stock[name]" size="30" type="text" value="'; _buf << (h @stock.name).to_s; _buf << '" />
';
--------------------
This shows that text_filed() is called every time when rendering,
but pp_text_filed() is called only once when loading template,
so pp_text_field() with prepocessing is much faster than text_field().
See User's guide for details.
http://www.kuwata-lab.com/erubis/users-guide.05.html#rails-formhelpers
#
- release: 2.4.1
date: 2007-09-25
enhancements:
- |
Add new section 'evaluate(context) v.s. result(binding)' to user's guide.
This section describes why Erubis::Eruby#evaluate(context) is recommended
rather than Erubis::Eruby#result(binding).
User's Guide > Other Topics > evaluate(context) v.s. result(binding)
http://www.kuwata-lab.com/erubis/users-guide.06.html#topics-context-vs-binding
- |
Add new command-line property '--docwrite={true|false}' to
Erubis::Ejavascript.
If this property is true then 'document.write(_buf.join(""));' is used
as postamble and if it is false then '_buf.join("")' is used.
Default is true for compatibility reason but it will be false in the
future release.
(This feature was proposed by D.Dribin. Thank you.)
bugfix:
- |
When using Erubis::Eruby#evaluate(), changing local variables in
templates have affected to variables accessible with TOPLEVEL_BINDING.
It means that if you change variables in templates, it is possible to
change variables in main program.
This was a bug and is now fixed not to affect to variables in main
program.
ex. template.rhtml
--------------------
<% for x in @items %>
item = <%= x %>
<% end %>
--------------------
ex. main-program.rb
--------------------
require 'erubis'
x = 10
items = ['foo', 'bar', 'baz']
eruby = Erubis::Eruby.new(File.read('template.rhtml'))
s = eruby.evaluate(:items=>items)
print s
$stderr.puts "*** debug: x=#{x.inspect}" #=> x="baz" (2.4.0)
#=> x=10 (2.4.1)
--------------------
- |
PercentLineEnhancer was very slow. Now performance problem is solved.
#
- release: 2.4.0
date: 2007-07-19
enhancements:
- |
Preprocessing is supported by Ruby on Rails helper.
Preprocessing makes Ruby on Rails application about 20-40 percent faster.
For example,
[%= link_to 'Show', :action=>'show', :id=>_?('@user.id') %]
is evaluate by preprocessor and expanded into the following
when template file is loaded.
<a href="/users/show/<%=@user.id%>">Show</a>
It means that link_to() is not called when template is rendered
and rendering speed will be much faster in the result.
See User's Guide for details.
- |
Erubis::Eruby#evaluate() (or Erubis::RubyEvaluator#evaluate()) now
creates Proc object from @src and eval it.
def evaluate(context=Context.new)
context = Context.new(context) if context.is_a?(Hash)
@_proc ||= eval("proc { #{@src} }", TOPLEVEL_BINDING, @filename || '(erubis)')
return context.instance_eval(&@_proc)
end
This makes evaluate() much faster when eruby object is reused.
- |
Erubis::Eruby#def_method() is supported.
This method defines ruby code as instance method or singleton metod.
require 'erubis'
s = "hello <%= name %>"
eruby = Erubis::Eruby.new(s)
filename = 'hello.rhtml'
## define instance method to Dummy class (or module)
class Dummy; end
eruby.def_method(Dummy, 'render(name)', filename) # filename is optional
p Dummy.new.render('world') #=> "hello world"
## define singleton method to an object
obj = Object.new
eruby.def_method(obj, 'render(name)', filename) # filename is optional
p obj.render('world') #=> "hello world"
This is equivarent to ERB#def_method().
- |
Erubis::XmlHelper.url_escape() and u() which is alias of url_escape()
are added.
This is equivarent to ERB#Util.url_escape().
bugfix:
- Help message was not shown when '-h' is specified. Fixed.
- 'def method()' was not availabe in template file. Fixed.
#
- release: 2.3.1
date: 2007-05-26
bugfix:
- A serious bug in 'helpers/rails_helper.rb' is fixed.
You must be update if you are using Erubis with Ruby on Rails.
#
- release: 2.3.0
date: 2007-05-23
enhancements:
- |
New class 'Erubis::FastEruby' is added.
It is a subclass of Erubis::Eruby and includes InterpolationEnhancer.
Erubis::FastEruby is compatible with and faster than Erubis::Eruby.
- |
New enhancer 'InterpolationEnhancer' is added.
This enhancer uses expression interpolation to eliminate method call
of String#<<. In the result, this enhancer makes Eruby a little faster.
--------------------
## Assume that input is '<a href="<%=url%>"><%=name%></a>'.
## Eruby convert input into the following code. String#<< is called 5 times.
_buf << '<a href="'; _buf << (url).to_s; _buf << '">'; _buf << (name).to_s; _buf << '</a>';
## When InterpolationEnhancer is used, String#<< is called only once.
_buf << %Q`<a href="#{url}">#{name}</a>`;
--------------------
- |
New enhancer 'ErboutEnhancer' is added.
ErboutEnhancer set '_erbout' as well as '_buf' to be compatible with ERB.
ex.
====================
$ cat ex.rhtml
<p>Hello</p>
$ erubis -x ex.rhtml
_buf = ''; _buf << '<p>Hello</p>
';
_buf.to_s
$ erubis -xE Erbout ex.rhtml
_erbout = _buf = ''; _buf << '<p>Hello</p>
';
_buf.to_s
====================
- |
[experimental]
New enhancer 'DeleteIndentEnhancer' is added.
This enhancer deletes indentation of HTML file.
ex.
====================
$ cat ex.rhtml
<div>
<ul>
<% for item in ['AAA', 'BBB', 'CCC'] %>
<li><%= item %></li>
<% end %>
</ul>
</div>
$ erubis ex.rhtml
<div>
<ul>
<li>AAA</li>
<li>BBB</li>
<li>CCC</li>
</ul>
</div>
$ erubis -E DeleteIndent ex.rhtml
<div>
<ul>
<li>AAA</li>
<li>BBB</li>
<li>CCC</li>
</ul>
</div>
====================
- |
Mod_ruby is supported (very thanks to Andrew R Jackson!).
See users-guide and 'contrib/erubis-run.rb' for details.
- |
New command-line option '-X', '-N', '-U', and '-C' are added.
These are intended to be a replacement of 'notext' command.
'-X' shows only ruby statements and expressions.
'-N' adds line numbers.
'-U' compress empty lines into a line.
'-C' removes empty lines.
changes:
- |
'helpers/rails_helper.rb' is changed to use ErboutEnhancer.
The following is an examle to use Erubis with Ruby on Rails.
File 'config/environment.rb':
----------------------------------------
require 'erubis/helpers/rails_helper'
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
----------------------------------------
- |
Command 'notext' has been removed. Use '-X', '-N', '-U', and '-C'
instead.
- |
Tab characters in YAML file are expaneded automatically.
If you want not to expand tab characters, add command-line optio '-T'.
- |
Benchmark scripts (benchmark/bench.*) are rewrited.
- |
Users-guide (doc/users-guide.html) is updated.
#
- release: 2.2.0
date: 2007-02-11
enhancements:
- |
Performance tuned up. Release 2.2.0 works about 8 percent faster
than 2.1.0.
As a result, Erubis works more than 10 percent faster than eruby.
(eruby is the extension module of eRuby written in C.)
- |
Support of Ruby on Rails improved.
If you want to use Erubis with Ruby on Rails, add the following code
into your 'config/environment.rb' and restart web server.
This will set Erubis as eRuby compiler in Ruby on Rails instead of ERB.
--------------------
require 'erubis/helpers/rails_helper'
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = true
--------------------
Methods 'capture()' and 'content_for()' of ActionView::Helpers::CaptureHelper
are available. Methd ActionView::Helpers::TextHelper#concat() is also available.
If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted
Ruby code into log file (such as 'log/development.log').
- |
Erubis::Engine.load_file(filename) creates cache file (filename +
'.cache') automatically if cache file is old or not exist.
Caching makes Erubis about 40-50 percent faster.
ex.
--------------------
require 'erubis'
eruby = Erubis::Eruby.load_file('example.rhtml')
## cache file 'example.rhtml.cache' is created automatically
--------------------
- |
Command-line option '-f datafile' can take Ruby script ('*.rb')
as well as YAML file ('*.yaml' or '*.yml').
ex.
====================
$ cat context.rb
@title = 'Example'
@list = %w[AAA BBB CCC]
$ cat example.rhtml
<h1><%= @title %></h1>
<ul>
<% for item in @list %>
<li><%= item %></li>
<% end %>
</ul>
$ erubis -f context.rb example.rhtml
<h1>Example</h1>
<ul>
<li>AAA</li>
<li>BBB</li>
<li>CCC</li>
</ul>
====================
- |
New command-line option '-c context' support. It takes context string
in YAML inline style or Ruby code style.
ex. YAML inline style
====================
$ erubis -c '{title: Example, list: [AAA, BBB, CCC]}' example.rhtml
====================
ex. Ruby style
====================
$ erubis -c '@title="Example"; @list=%w[AAA BBB CCC]' example.rhtml
====================
- |
New command-line option '-z' (syntax checking) support. It is similar
to 'erubis -x file.rhtml | ruby -wc', but it can take several filenames.
ex.
====================
$ erubis -z app/views/*/*.rhtml
Syntax OK
====================
- |
New constant Erubis::VERSION added.
changes:
- |
Class Erubis::Eruby changed to include Erubis::StringBufferEnhancer
instead of Erubis::ArrayBufferEnhancer.
This is for Ruby on Rails support.
ex.
====================
$ cat example.rhtml
<ul>
<% for item in @list %>
<li><%= item %></li>
<% end %>
</ul>
$ erubis -x example.rhtml
_buf = ''; _buf << '<ul>
'; for item in @list
_buf << ' <li>'; _buf << ( item ).to_s; _buf << '</li>
'; end
_buf << '</ul>
';
_buf.to_s
====================
- |
Erubis::StringBufferEnhancer#add_postamble() prints "_buf.to_s"
instead of "_buf".
This is useful for 'erubis -x file.rhtml | ruby -wc'.
- |
Command-line option '-T' is removed. Use '--trim=false' instead.
- |
License is changed to MIT License.
- |
Embedded pattern '<%- -%>' can be handled.
#
- release: 2.1.0
date: 2006-09-23
enhancements:
- |
Ruby on Rails support. Add the following code to
your 'app/controllers/application.rb' and restart web server.
--------------------
require 'erubis/helper/rails'
suffix = 'erubis'
ActionView::Base.register_template_handler(suffix, Erubis::Helper::RailsTemplate)
#Erubis::Helper::RailsTemplate.engine_class = Erubis::EscapedEruby ## or Erubis::PI::Eruby
#Erubis::Helper::RailsTemplate.default_properties = { :escape=>true, :escapefunc=>'h' }
--------------------
And rename your view template as 'xxx.erubis'.
If you got the "(eval):10:in `render': no block given" error,
use '@content_for_layout' instead 'yield' in your layout template.
- |
Another eRuby engine (PIEngine) support. This engine doesn't
break HTML design because it uses Processing Instructions (PI)
'<?rb .. ?>' as embedded pattern instead of '<% .. %>'.
example.rhtml
--------------------
<table>
<?rb @list.each_with_index do |item, i| ?>
<?rb klass = i % 2 == 0 ? 'odd' : 'even' ?>
<tr class="@{klass}@">
<td>@!{item}@</td>
</tr>
<?rb end ?>
</table>
--------------------
compile:
====================
$ erubis -x --pi example.rhtml
_buf = []; _buf << '<table>
'; @list.each_with_index do |item, i|
klass = i % 2 == 0 ? 'odd' : 'even'
_buf << ' <tr class="'; _buf << Erubis::XmlHelper.escape_xml(klass); _buf << '">
<td>'; _buf << (item).to_s; _buf << '</td>
</tr>
'; end
_buf << '</table>
';
_buf.join
====================
- |
Add new command 'notext' which remove text part from eRuby
script and leaves only Ruby code.
This is very useful for debug of eRuby script.
example2.rhtml
--------------------
<html>
<body>
<table>
<% @list.each_with_index do |item, i| %>
<% klass = i % 2 == 0 ? 'odd' : 'even' %>
<tr class="<%= klass %>">
<td><%== item %></td>
</tr>
<% end %>
</table>
</body>
</html>
--------------------
command line example:
====================
$ notext example2.rhtml
_buf = [];
@list.each_with_index do |item, i| ;
klass = i % 2 == 0 ? 'odd' : 'even' ;
_buf << ( klass ).to_s;
_buf << Erubis::XmlHelper.escape_xml( item );
end ;
_buf.join
$ notext -nc example2.rhtml
1: _buf = [];
4: @list.each_with_index do |item, i| ;
5: klass = i % 2 == 0 ? 'odd' : 'even' ;
6: _buf << ( klass ).to_s;
7: _buf << Erubis::XmlHelper.escape_xml( item );
9: end ;
13: _buf.join
====================
- |
Add new enhance 'NoCode' which removes ruby code from
eRuby script and leaves only HTML text part.
It is very useful to validate HTML of eRuby script.
command-line example:
====================
$ erubis -x -E NoCode example2.rhtml
<html>
<body>
<table>
<tr class="">
<td></td>
</tr>
</table>
</body>
</html>
====================
changes:
- License is changed to LGPL.
- Command-line property '--escape=name' is renamed to
'--escapefunc=name'.
- When command-line option '-l perl' is specified, function
'encode_entities()' is used ad escaping function which is
available wth HTML::Entities module.
bugfix:
- There is a certain pattern which makes Engine#convert()
too slow. Now Engne#convert() is fixed not to be slown.
- Command name is now displayed when '-h' is specified.
#
- release: 2.0.1
date: 2006-06-21
bugfix:
- some minor bugs are fixed
#
- release: 2.0.0
date: 2006-05-20
changes:
- module 'PrintEnhancer' is renamed to 'PrintEnabledEnahncer'
- module 'FastEnhancer' and class 'FastEruby' is obsolete because they are integrated into Eruby class
- Eruby#evaluate() calls instance_eval() instead of eval()
- XmlEruby.escape_xml() is moved to XmlHelper.escape_xml()
enhancements:
- multi programming language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
- class Eruby runs very fast because FastEnhancer module is integrated into Eruby by default
- TinyEruby class (tiny.rb) is added
- module ArrayBufferEnhancer added
- module ArrayEnhancer added
- module BiPatternEnhancer added
- module EscapeEnhancer added
- module HeaderFooterEnhancer added
- module NoTextEnhancer added
- module PercentLineEnhancer added
- module PrintEnabledEnhancer added
- module PrintOutEnhancer added
- module SimplifyEnhancer added
- module StringBufferEnhancer added
- module StringIOEnhancer added
- command-line option '-b' (body only) added
- command-line option '-e' (escape) added
- command-line option '-l' (lang) added
- command-line option '-E' (enhancer) added
- command-line option '-I' (require path) added
- command-line option '-K' (kanji code) added
- command-line option '-S' (string to symbol) added
- command-line option '-B' (call result(binding())) added
#
- release: 1.1.0
date: 2006-03-05
enhancements:
- '<%# ... %>' is supported
- PrintEnhancer, PrintEruby, and PrintXmlEruby added
- release: 1.0.1
date: 2006-02-01
bugfixes:
- bin/erubis is available with RubyGems
#
- release: 1.0.0
date: 2006-02-01
bugfixes:
- first release

20
vendor/plugins/erubis-2.6.5/MIT-LICENSE vendored Normal file
View file

@ -0,0 +1,20 @@
copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

102
vendor/plugins/erubis-2.6.5/README.txt vendored Normal file
View file

@ -0,0 +1,102 @@
= README
release:: 2.6.5
copyright:: copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
== About Erubis
Erubis is an implementation of eRuby. It has the following features.
* Very fast, almost three times faster than ERB and even 10% faster than eruby
* Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
* Auto escaping support
* Auto trimming spaces around '<% %>'
* Embedded pattern changeable (default '<% %>')
* Enable to handle Processing Instructions (PI) as embedded pattern (ex. '<?rb ... ?>')
* Context object available and easy to combine eRuby template with YAML datafile
* Print statement available
* Easy to extend and customize in subclass
* Ruby on Rails support
Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher.
Erubis now supports Ruby 1.9.
See doc/users-guide.html for details.
== Installation
* If you have installed RubyGems, just type <tt>gem install erubis</tt>.
$ sudo gem install erubis
* Else install abstract[http://rubyforge.org/projects/abstract/] at first,
and download erubis_X.X.X.tar.bz2 and install it by setup.rb.
$ tar xjf abstract_X.X.X.tar.bz2
$ cd abstract_X.X.X/
$ sudo ruby setup.rb
$ cd ..
$ tar xjf erubis_X.X.X.tar.bz2
$ cd erubis_X.X.X/
$ sudo ruby setup.rb
* (Optional) It is able to merge 'lib/**/*.rb' into 'bin/erubis' by
'contrib/inline-require' script.
$ tar xjf erubis_X.X.X.tar.bz2
$ cd erubis_X.X.X/
$ cp /tmp/abstract_X.X.X/lib/abstract.rb lib
$ unset RUBYLIB
$ contrib/inline-require -I lib bin/erubis > contrib/erubis
== Ruby on Rails Support
Erubis supports Ruby on Rails.
All you have to do is to add the following code into your 'config/environment.rb'
and restart web server.
require 'erubis/helpers/rails_helper'
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = nil
If Erubis::Helpers::RailsHelper.show_src is ture, Erubis prints converted Ruby code
into log file ('log/development.log' or so). It is useful for debug.
== Exploring Guide
If you are exploring Eruby, see the following class at first.
* Erubis::TinyEruby (erubis/tiny.rb) --
the most simple eRuby implementation.
* Erubis::Engine (erubis/engine.rb) --
base class of Eruby, Ephp, Ejava, and so on.
* Erubis::Eruby (erubis/engine/eruby.rb) --
engine class for eRuby.
* Erubis::Converter (erubis/converter.rb) --
convert eRuby script into Ruby code.
== Benchmark
'benchmark/erubybenchmark.rb' is a benchmark script of Erubis.
Try 'ruby erubybenchmark.rb' in benchmark directory.
== License
MIT License
== Author
makoto kuwata <kwa(at)kuwata-lab.com>

View file

@ -0,0 +1,6 @@
bench:
ruby bench.rb -n 10000
clean:
rm -rf bench_*.rhtml*

View file

@ -0,0 +1,313 @@
#!/usr/bin/env ruby
###
### $Release: 2.6.5 $
### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
###
require 'erb'
require 'erubis'
require 'erubis/tiny'
require 'erubis/engine/enhanced'
require 'yaml'
require 'cgi'
include ERB::Util
begin
require 'eruby'
rescue LoadError
ERuby = nil
end
def File.write(filename, content)
File.open(filename, 'w') { |f| f.write(content) }
end
## change benchmark library to use $stderr instead of $stdout
require 'benchmark'
module Benchmark
class Report
def print(*args)
$stderr.print(*args)
end
end
module_function
def print(*args)
$stderr.print(*args)
end
end
class BenchmarkApplication
TARGETS = %w[eruby
ERB ERB(cached)
Erubis::Eruby Erubis::Eruby(cached)
Erubis::FastEruby Erubis::FastEruby(cached)
Erubis::TinyEruby
Erubis::ArrayBufferEruby
Erubis::PrintOutEruby
Erubis::StdoutEruby
]
def initialize(ntimes, context, targets=nil, params={})
@ntimes = ntimes
@context = context
@targets = targets && !targets.empty? ? targets : TARGETS.dup
@testmode = params[:testmode] || 'execute'
@erubyfile = params[:erubyfile] || 'erubybench.rhtml'
@printout = params[:printout] || false
end
attr_accessor :ntimes, :targets
attr_accessor :testmode, :erubyfile, :contextfile, :printout
def context2code(context, varname='context')
s = ''
context.each { |k, | s << "#{k} = #{varname}[#{k.inspect}]; " }
return s
end
def perform_benchmark
width = 30
$stderr.puts "*** ntimes=#{@ntimes}, testmode=#{@testmode}"
Benchmark.bm(width) do |job|
for target in @targets do
method = "#{@testmode}_#{target.gsub(/::|-|\(/, '_').gsub(/\)/, '').downcase}"
#$stderr.puts "*** debug: method=#{method.inspect}"
next unless self.respond_to?(method)
filename = "bench_#{(target =~ /^(\w+)/) && $1.downcase}.rhtml"
title = target
output = nil
job.report(title) do
output = self.__send__(method, filename, @context)
end
File.write("output.#{target.gsub(/[^\w]/,'')}", output) if @printout && output && !output.empty?
end
end
end
##
def execute_eruby(filename, context)
return unless ERuby
#eval context2code(context)
list = context['list']
@ntimes.times do
ERuby.import(filename)
end
return nil
end
def execute_erb(filename, context)
#eval context2code(context)
list = context['list']
output = nil
@ntimes.times do
eruby = ERB.new(File.read(filename))
output = eruby.result(binding())
print output
end
return output
end
def execute_erb_cached(filename, context)
#eval context2code(context)
list = context['list']
output = nil
cachefile = filename + '.cache'
File.unlink(cachefile) if test(?f, cachefile)
@ntimes.times do
if !test(?f, cachefile) || File.mtime(filename) > File.mtime(cachefile)
eruby = ERB.new(File.read(filename))
File.write(cachefile, eruby.src)
else
eruby = ERB.new('')
#eruby.src = File.read(cachefile)
eruby.instance_variable_set("@src", File.read(cachefile))
end
output = eruby.result(binding())
print output
end
return output
end
## no cached
for klass in %w[Eruby FastEruby TinyEruby ArrayBufferEruby PrintOutEruby StdoutEruby] do
s = <<-END
def execute_erubis_#{klass.downcase}(filename, context)
#eval context2code(context)
list = context['list']
output = nil
@ntimes.times do
eruby = Erubis::#{klass}.new(File.read(filename))
output = eruby.result(binding())
print output
end
return output
end
END
eval s
end
## cached
for klass in %w[Eruby FastEruby] do
s = <<-END
def execute_erubis_#{klass.downcase}_cached(filename, context)
#eval context2code(context)
list = context['list']
cachefile = filename + '.cache'
File.unlink(cachefile) if test(?f, cachefile)
output = nil
@ntimes.times do
eruby = Erubis::#{klass}.load_file(filename)
output = eruby.result(binding())
print output
end
savefile = cachefile.sub(/\\.cache$/, '.#{klass.downcase}.cache')
File.rename(cachefile, savefile)
return output
end
END
eval s
end
##
def convert_eruby(filename, context)
return unless ERuby
#eval context2code(context)
list = context['list']
output = nil
@ntimes.times do
output = ERuby::Compiler.new.compile_string(File.read(filename))
end
return output
end
def convert_erb(filename, context)
#eval context2code(context)
list = context['list']
output = nil
@ntimes.times do
eruby = ERB.new(File.read(filename))
output = eruby.src
end
return output
end
for klass in %w[Eruby FastEruby TinyEruby]
s = <<-END
def convert_erubis_#{klass.downcase}(filename, context)
#eval context2code(context)
list = context['list']
output = nil
@ntimes.times do
eruby = Erubis::#{klass}.new(File.read(filename))
output = eruby.src
end
return output
end
END
eval s
end
end
require 'optparse'
class MainApplication
def parse_argv(argv=ARGV)
optparser = OptionParser.new
options = {}
['-h', '-n N', '-t erubyfile', '-f contextfile', '-A', '-e',
'-x exclude', '-m testmode', '-X', '-p', '-D'].each do |opt|
optparser.on(opt) { |val| options[opt[1].chr] = val }
end
begin
targets = optparser.parse!(argv)
rescue => ex
$stderr.puts "#{@script}: #{ex.to_s}"
exit(1)
end
return options, targets
end
def execute
@script = File.basename($0)
ntimes = 1000
targets = BenchmarkApplication::TARGETS.dup
testmode = 'execute'
contextfile = 'bench_context.yaml'
#
options, args = parse_argv(ARGV)
ntimes = options['n'].to_i if options['n']
targets = args if args && !args.empty?
targets = targets - options['x'].split(/,/) if options['x']
testmode = options['m'] if options['m']
contextfile = options['f'] if options['f']
erubyfile = options['t'] if options['t']
#
if options['h']
$stderr.puts "Usage: ruby #{@script} [..options..] [..targets..]"
$stderr.puts " -h : help"
$stderr.puts " -n N : loop N times"
$stderr.puts " -f datafile : context data filename (*.yaml)"
$stderr.puts " -x exclude : exclude target name"
$stdout.puts " -m testmode : 'execute' or 'convert' (default 'execute')"
$stderr.puts " -p : print output to file (filename: 'output.TARGETNAME')"
return
end
#
#if ! options['t']
for item in %w[eruby erb erubis]
fname = "bench_#{item}.rhtml"
header = File.read("templates/_header.html")
#body = File.read("templates/#{erubyfile}")
body = File.read("templates/#{fname}")
footer = File.read("templates/_footer.html")
content = header + body + footer
File.write(fname, content)
end
#
if options['e'] # escape
tuples = [
[ 'bench_eruby.rhtml', '<%= CGI.escapeHTML((\1).to_s) %>' ],
[ 'bench_erb.rhtml', '<%=h \1 %>' ],
[ 'bench_erubis.rhtml', '<%== \1 %>' ],
]
for fname, replace in tuples
content = File.read(fname).gsub(/<%= ?(.*?) ?%>/, replace)
File.write(fname, content)
end
targets.delete('Erubis::TinyEruby') ## because TinyEruby doesn't support '<%== =>'
end
#
context = YAML.load_file(contextfile)
#
params = {
:printout=>options['p'],
:testmode=>testmode,
}
app = BenchmarkApplication.new(ntimes, context, targets, params)
app.perform_benchmark()
end
end
if __FILE__ == $0
## open /dev/null
$stdout = File.open('/dev/null', 'w')
at_exit do
$stdout.close()
end
## start benchmark
MainApplication.new().execute()
end

View file

@ -0,0 +1,141 @@
list:
- name: Adobe Systems
name2: Adobe Systems Inc.
url: http://www.adobe.com
symbol: ADBE
price: 39.26
change: 0.13
ratio: 0.33
- name: Advanced Micro Devices
name2: Advanced Micro Devices Inc.
url: http://www.amd.com
symbol: AMD
price: 16.22
change: 0.17
ratio: 1.06
- name: Amazon.com
name2: Amazon.com Inc
url: http://www.amazon.com
symbol: AMZN
price: 36.85
change: -0.23
ratio: -0.62
- name: Apple
name2: Apple Inc.
url: http://www.apple.com
symbol: AAPL
price: 85.38
change: -0.87
ratio: -1.01
- name: BEA Systems
name2: BEA Systems Inc.
url: http://www.bea.com
symbol: BEAS
price: 12.46
change: 0.09
ratio: 0.73
- name: CA
name2: CA, Inc.
url: http://www.ca.com
symbol: CA
price: 24.66
change: 0.38
ratio: 1.57
- name: Cisco Systems
name2: Cisco Systems Inc.
url: http://www.cisco.com
symbol: CSCO
price: 26.35
change: 0.13
ratio: 0.5
- name: Dell
name2: Dell Corp.
url: http://www.dell.com/
symbol: DELL
price: 23.73
change: -0.42
ratio: -1.74
- name: eBay
name2: eBay Inc.
url: http://www.ebay.com
symbol: EBAY
price: 31.65
change: -0.8
ratio: -2.47
- name: Google
name2: Google Inc.
url: http://www.google.com
symbol: GOOG
price: 495.84
change: 7.75
ratio: 1.59
- name: Hewlett-Packard
name2: Hewlett-Packard Co.
url: http://www.hp.com
symbol: HPQ
price: 41.69
change: -0.02
ratio: -0.05
- name: IBM
name2: International Business Machines Corp.
url: http://www.ibm.com
symbol: IBM
price: 97.45
change: -0.06
ratio: -0.06
- name: Intel
name2: Intel Corp.
url: http://www.intel.com
symbol: INTC
price: 20.53
change: -0.07
ratio: -0.34
- name: Juniper Networks
name2: Juniper Networks, Inc
url: http://www.juniper.net/
symbol: JNPR
price: 18.96
change: 0.5
ratio: 2.71
- name: Microsoft
name2: Microsoft Corp
url: http://www.microsoft.com
symbol: MSFT
price: 30.6
change: 0.15
ratio: 0.49
- name: Oracle
name2: Oracle Corp.
url: http://www.oracle.com
symbol: ORCL
price: 17.15
change: 0.17
ratio: 1.0
- name: SAP
name2: SAP AG
url: http://www.sap.com
symbol: SAP
price: 46.2
change: -0.16
ratio: -0.35
- name: Seagate Technology
name2: Seagate Technology
url: http://www.seagate.com/
symbol: STX
price: 27.35
change: -0.36
ratio: -1.3
- name: Sun Microsystems
name2: Sun Microsystems Inc.
url: http://www.sun.com
symbol: SUNW
price: 6.33
change: -0.01
ratio: -0.16
- name: Yahoo
name2: Yahoo! Inc.
url: http://www.yahoo.com
symbol: YHOO
price: 28.04
change: -0.17
ratio: -0.6

View file

@ -0,0 +1,4 @@
</table>
</body>
</html>

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Stock Prices</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/css/style.css" media="all" />
<script type="text/javascript" src="/js/util.js"></script>
<style type="text/css">
/*<![CDATA[*/
body {
color: #333333;
line-height: 150%;
}
thead {
font-weight: bold;
background-color: #CCCCCC;
}
.odd {
background-color: #FFCCCC;
}
.even {
background-color: #CCCCFF;
}
.minus {
color: #FF0000;
}
/*]]>*/
</style>
</head>
<body>
<h1>Stock Prices</h1>
<table>
<thead>
<tr>
<th>#</th><th>symbol</th><th>name</th><th>price</th><th>change</th><th>ratio</th>
</tr>
</thead>

View file

@ -0,0 +1,29 @@
<tbody>
<%
n = 0
for item in list
n += 1
%>
<tr class="<%= n % 2 == 0 ? 'even' : 'odd' %>">
<td style="text-align: center"><%= n %></td>
<td>
<a href="/stocks/<%= item['symbol'] %>"><%= item['symbol'] %></a>
</td>
<td>
<a href="<%= item['url'] %>"><%= item['name'] %></a>
</td>
<td>
<strong><%= item['price'] %></strong>
</td>
<% if item['change'] < 0.0 %>
<td class="minus"><%= item['change'] %></td>
<td class="minus"><%= item['ratio'] %></td>
<% else %>
<td><%= item['change'] %></td>
<td><%= item['ratio'] %></td>
<% end %>
</tr>
<%
end
%>
</tbody>

View file

@ -0,0 +1,29 @@
<tbody>
<%
n = 0
for item in list
n += 1
%>
<tr class="<%= n % 2 == 0 ? 'even' : 'odd' %>">
<td style="text-align: center"><%= n %></td>
<td>
<a href="/stocks/<%= item['symbol'] %>"><%= item['symbol'] %></a>
</td>
<td>
<a href="<%= item['url'] %>"><%= item['name'] %></a>
</td>
<td>
<strong><%= item['price'] %></strong>
</td>
<% if item['change'] < 0.0 %>
<td class="minus"><%= item['change'] %></td>
<td class="minus"><%= item['ratio'] %></td>
<% else %>
<td><%= item['change'] %></td>
<td><%= item['ratio'] %></td>
<% end %>
</tr>
<%
end
%>
</tbody>

View file

@ -0,0 +1,29 @@
<tbody>
<%
n = 0
for item in list
n += 1
%>
<tr class="<%= n % 2 == 0 ? 'even' : 'odd' %>">
<td style="text-align: center"><%= n %></td>
<td>
<a href="/stocks/<%= item['symbol'] %>"><%= item['symbol'] %></a>
</td>
<td>
<a href="<%= item['url'] %>"><%= item['name'] %></a>
</td>
<td>
<strong><%= item['price'] %></strong>
</td>
<% if item['change'] < 0.0 %>
<td class="minus"><%= item['change'] %></td>
<td class="minus"><%= item['ratio'] %></td>
<% else %>
<td><%= item['change'] %></td>
<td><%= item['ratio'] %></td>
<% end %>
</tr>
<%
end
%>
</tbody>

10
vendor/plugins/erubis-2.6.5/bin/erubis vendored Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env ruby
###
### $Release: 2.6.5 $
### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
###
require 'erubis/main'
Erubis::Main.main(ARGV)

3330
vendor/plugins/erubis-2.6.5/contrib/erubis vendored Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,132 @@
=begin
= apache/erubis-run.rb
Copyright (C) 2007 Andrew R Jackson <arjackson at acm dot org>
Built from original by Shugo Maeda:
Copyright (C) 2001 Shugo Maeda <shugo@modruby.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WAreqANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WAreqANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTEreqUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
== Overview
Apache::ErubisRun handles eRuby files with erubis
== Example of httpd.conf
RubyRequire apache/erubis-run
<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ErubisRun.instance
</Location>
=end
require "singleton"
require "tempfile"
require "eruby" # Still needed to bring in a couple useful helper methods
require "erubis"
module Erubis
@@cgi = nil
def self.cgi
return @@cgi
end
def self.cgi=(cgi)
@@cgi = cgi
end
end
module Apache
class ErubisRun
include Singleton
def handler(req)
status = check_request(req)
return status if(status != OK)
filename = req.filename.dup
filename.untaint
erubis = compile(filename)
prerun(req)
begin
run(erubis, filename)
ensure
postrun(req)
end
return OK
end
private
def initialize
@compiler = nil
end
def check_request(req)
if(req.method_number == M_OPTIONS)
req.allowed |= (1 << M_GET)
req.allowed |= (1 << M_POST)
return DECLINED
end
if(req.finfo.mode == 0)
return NOT_FOUND
end
return OK
end
def compile(filename)
@compiler = Erubis::Eruby.load_file(filename) # use caching version as much as possible
return @compiler
end
def prerun(req)
Erubis.cgi = nil
req.setup_cgi_env
Apache.chdir_file(req.filename)
end
def run(erubis, filename)
binding = eval_string_wrap("binding")
puts erubis.result(binding) # eval the code in the context of the same binding ERuby uses
end
def postrun(req)
if(cgi = Erubis.cgi)
# TODO: pull the content type header from the cgi object, if set there?
elsif(req.sync_output or req.sync_header)
# Do nothing: header has already been sent
else
unless(req.content_type)
req.content_type = format("text/html;")
end
req.send_http_header
end
end
end
end

View file

@ -0,0 +1,179 @@
#!/usr/bin/env ruby
###
### inline-require - expand 'require "foo"' into inline code
###
### usage: inline-require [-h] [-I path[,path2,..]] script
###
### copyright(c) 2006-2009 kuwata-lab.com all rights reserved.
### 2.6.5
### $Rev: 10 $
###
class InlineRequire
def initialize(opts={})
@opts = opts.dup
end
attr_accessor :opts
def expand(filename)
sbuf = ''
inlined = []
level = 0
expand_require(filename, sbuf, inlined, level)
return sbuf
end
private
def expand_require(filename, sbuf, inlined, level)
raise "*** assertion error" if inlined.include?(filename)
remove_comment = @opts[:remove_comment]
expand_indented = @opts[:expand_indented]
keep_filename = @opts[:keep_filename]
loaded_features = @opts[:loaded_features]
inlined << filename
prog = File.read(filename)
n = 0
flag_if_file = false
prog.each_line do |line|
n += 1
## comment out from 'if __FILE__ == $0' to 'end'
if level > 0
if flag_if_file
sbuf << "#" << line
flag_if_file = false if line =~ /^end$/
next
end
if line =~ /^if\s+__FILE__\s*==\s*\$0(\s+then)?$/ || line =~ /^if\s+\$0\s*==\s*__FILE__(\s+then)?$/
flag_if_file = true
sbuf << "#" << line
next
end
end
## find 'require "foo"' and expand it to inline code
flag_inline = false
pattern = expand_indented ? /^[ \t]*require ['"](.*)["']\s*$/ \
: /^require ['"](.*)["']\s*$/
if line =~ pattern
libname = $1
libpath = find_library(libname)
$stderr.puts "*** debug: libpath=#{libpath.inspect}" if $debug_mode
unless libpath
#raise "file '#{filename}'(line #{n}): library '#{libname}' not found."
warn "file '#{filename}'(line #{n}): library '#{libname}' not found."
else
flag_inline = true if libpath =~ /\.rb$/ && local_library?(libpath)
end
end
if !flag_inline
sbuf << line unless remove_comment && line =~ /^[ \t]*\#/
elsif inlined.include?(libpath)
sbuf << "#--already included #{line}" unless remove_comment
else
if keep_filename
@n ||= 0; @n += 1; n = @n
end
sbuf << "#--begin of #{line}" unless remove_comment
sbuf << "$LOADED_FEATURES << '#{libname}.rb'\n" if loaded_features
sbuf << "eval <<'END_OF_SCRIPT__#{n}', TOPLEVEL_BINDING, '#{libpath}', 1\n" if keep_filename
expand_require(libpath, sbuf, inlined, level+1)
sbuf << "END_OF_SCRIPT__#{n}\n" if keep_filename
sbuf << "#--end of #{line}" unless remove_comment
end
end
#sbuf << "\n" if sbuf[-1] != ?\n
end
def local_library?(libpath)
return libpath !~ /^\//
end
def find_library(libname)
if libname =~ /^\.rb$/
libname_rb = libname
libname_so = nil
elsif libname =~ /^\.so$/
libname_rb = nil
libname_so = libname
else
libname_rb = libname + ".rb"
libname_so = libname + ".so"
end
$LOAD_PATH.each do |path|
if libname_rb
libpath = path + "/" + libname_rb
return libpath if test(?f, libpath)
end
if libname_so
libpath = path + "/" + libname_so
return libpath if test(?f, libpath)
end
end
return nil
end
end
if __FILE__ == $0
begin
require "optparse"
op = OptionParser.new
options = {}
op.on("-h", "--help") {|v| options[:help] = v }
op.on("-I libpath") {|v| options[:libpath] = v }
op.on("-i") {|v| options[:expand_indented] = v }
op.on("-c") {|v| options[:remove_comment] = v }
op.on("-k") {|v| options[:keep_filename] = v }
op.on("-l") {|v| options[:loaded_features] = v }
op.on("-D") {|v| options[:debug] = v }
op.parse!()
$debug_mode = options[:debug]
if options[:help]
command = File.basename($0)
puts "Usage: #{command} [-h] [-I path[,path2,..]] script"
puts " -h : help"
puts " -i : expand indented require(), too"
puts " -c : remove comment lines start with '#'"
puts " -k : keep filename (for debugging)"
puts " -l : append libs to $LOADED_FEATURES"
puts " -I path[,path2,...] : ruby library path"
exit(0)
end
if options[:libpath]
rubylib_paths = options[:libpath].split(/,/)
else
rubylib_paths = []
end
$stderr.puts "*** debug: rubylib_paths=#{rubylib_paths.inspect}" if $debug_mode
$LOAD_PATH.concat(rubylib_paths)
filenames = ARGV
opts = { :expand_indented => options[:expand_indented],
:remove_comment => options[:remove_comment],
:keep_filename => options[:keep_filename],
:loaded_features => options[:loaded_features] }
inline_require = InlineRequire.new(opts)
filenames.each do |filename|
print inline_require.expand(filename)
end
rescue => ex
if $debug_mode
raise ex
else
$stderr.puts ex.message
end
end
end

View file

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ActionView</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ActionView</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,209 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: ActionView::TemplateHandlers::ErubisHandler</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">ActionView::TemplateHandlers::ErubisHandler</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
TemplateHandler
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000001">compile</a>&nbsp;&nbsp;
<a href="#M000002">compile</a>&nbsp;&nbsp;
<a href="#M000003">compile</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name">Compilable</span>
<span class="include-name"><a href="../../Erubis/Helpers/RailsHelper/TemplateConverter.html">::Erubis::Helpers::RailsHelper::TemplateConverter</a></span>
<span class="include-name"><a href="../../Erubis/PreprocessingHelper.html">::Erubis::PreprocessingHelper</a></span>
<span class="include-name">Compilable</span>
<span class="include-name"><a href="../../Erubis/Helpers/RailsHelper/TemplateConverter.html">Erubis::Helpers::RailsHelper::TemplateConverter</a></span>
<span class="include-name"><a href="../../Erubis/PreprocessingHelper.html">Erubis::PreprocessingHelper</a></span>
<span class="include-name"><a href="../../Erubis/Helpers/RailsHelper/TemplateConverter.html">Erubis::Helpers::RailsHelper::TemplateConverter</a></span>
<span class="include-name"><a href="../../Erubis/PreprocessingHelper.html">Erubis::PreprocessingHelper</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000001" class="method-detail">
<a name="M000001"></a>
<div class="method-heading">
<a href="#M000001" class="method-signature">
<span class="method-name">compile</span><span class="method-args">(template)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000001-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 153</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">template</span>)
<span class="ruby-comment cmt">#src = ::ERB.new(&quot;&lt;% __in_erb_template=true %&gt;#{template.source}&quot;, nil, erb_trim_mode, '@output_buffer').src</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_convert_template</span>(<span class="ruby-node">&quot;&lt;% __in_erb_template=true %&gt;#{template.source}&quot;</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000002" class="method-detail">
<a name="M000002"></a>
<div class="method-heading">
<a href="#M000002" class="method-signature">
<span class="method-name">compile</span><span class="method-args">(template)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000002-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 179</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">template</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_convert_template</span>(<span class="ruby-identifier">template</span>.<span class="ruby-identifier">source</span>) <span class="ruby-comment cmt"># template.is_a?(ActionView::Template)</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000003" class="method-detail">
<a name="M000003"></a>
<div class="method-heading">
<a href="#M000003" class="method-signature">
<span class="method-name">compile</span><span class="method-args">(template)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000003-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 209</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compile</span>(<span class="ruby-identifier">template</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_convert_template</span>(<span class="ruby-identifier">template</span>) <span class="ruby-comment cmt"># template.is_a?(String)</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: ERB</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">ERB</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,353 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../files/erubis/context_rb.html">
erubis/context.rb
</a>
<br />
<a href="../files/erubis/converter_rb.html">
erubis/converter.rb
</a>
<br />
<a href="../files/erubis/engine/ec_rb.html">
erubis/engine/ec.rb
</a>
<br />
<a href="../files/erubis/engine/ejava_rb.html">
erubis/engine/ejava.rb
</a>
<br />
<a href="../files/erubis/engine/ejavascript_rb.html">
erubis/engine/ejavascript.rb
</a>
<br />
<a href="../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
<a href="../files/erubis/engine/eperl_rb.html">
erubis/engine/eperl.rb
</a>
<br />
<a href="../files/erubis/engine/ephp_rb.html">
erubis/engine/ephp.rb
</a>
<br />
<a href="../files/erubis/engine/eruby_rb.html">
erubis/engine/eruby.rb
</a>
<br />
<a href="../files/erubis/engine/escheme_rb.html">
erubis/engine/escheme.rb
</a>
<br />
<a href="../files/erubis/engine/optimized_rb.html">
erubis/engine/optimized.rb
</a>
<br />
<a href="../files/erubis/engine_rb.html">
erubis/engine.rb
</a>
<br />
<a href="../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
<a href="../files/erubis/error_rb.html">
erubis/error.rb
</a>
<br />
<a href="../files/erubis/evaluator_rb.html">
erubis/evaluator.rb
</a>
<br />
<a href="../files/erubis/generator_rb.html">
erubis/generator.rb
</a>
<br />
<a href="../files/erubis/helper_rb.html">
erubis/helper.rb
</a>
<br />
<a href="../files/erubis/helpers/rails_form_helper_rb.html">
erubis/helpers/rails_form_helper.rb
</a>
<br />
<a href="../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
<a href="../files/erubis/main_rb.html">
erubis/main.rb
</a>
<br />
<a href="../files/erubis/preprocessing_rb.html">
erubis/preprocessing.rb
</a>
<br />
<a href="../files/erubis/tiny_rb.html">
erubis/tiny.rb
</a>
<br />
<a href="../files/erubis_rb.html">
erubis.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
an implementation of eRuby
</p>
<p>
ex.
</p>
<pre>
input = &lt;&lt;'END'
&lt;ul&gt;
&lt;% for item in @list %&gt;
&lt;li&gt;&lt;%= item %&gt;
&lt;%== item %&gt;&lt;/li&gt;
&lt;% end %&gt;
&lt;/ul&gt;
END
list = ['&lt;aaa&gt;', 'b&amp;b', '&quot;ccc&quot;']
eruby = Erubis::Eruby.new(input)
puts &quot;--- code ---&quot;
puts eruby.src
puts &quot;--- result ---&quot;
context = Erubis::Context.new() # or new(:list=&gt;list)
context[:list] = list
puts eruby.evaluate(context)
</pre>
<p>
result:
</p>
<pre>
--- source ---
_buf = ''; _buf &lt;&lt; '&lt;ul&gt;
'; for item in @list
_buf &lt;&lt; ' &lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '
'; _buf &lt;&lt; ' '; _buf &lt;&lt; Erubis::XmlHelper.escape_xml( item ); _buf &lt;&lt; '&lt;/li&gt;
'; end
_buf &lt;&lt; '&lt;/ul&gt;
';
_buf.to_s
--- result ---
&lt;ul&gt;
&lt;li&gt;&lt;aaa&gt;
&amp;lt;aaa&amp;gt;&lt;/li&gt;
&lt;li&gt;b&amp;b
b&amp;amp;b&lt;/li&gt;
&lt;li&gt;&quot;ccc&quot;
&amp;quot;ccc&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
</pre>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Erubis/ArrayBufferEnhancer.html" class="link">Erubis::ArrayBufferEnhancer</a><br />
Module <a href="Erubis/ArrayEnhancer.html" class="link">Erubis::ArrayEnhancer</a><br />
Module <a href="Erubis/Basic.html" class="link">Erubis::Basic</a><br />
Module <a href="Erubis/BiPatternEnhancer.html" class="link">Erubis::BiPatternEnhancer</a><br />
Module <a href="Erubis/CGenerator.html" class="link">Erubis::CGenerator</a><br />
Module <a href="Erubis/Converter.html" class="link">Erubis::Converter</a><br />
Module <a href="Erubis/DeleteIndentEnhancer.html" class="link">Erubis::DeleteIndentEnhancer</a><br />
Module <a href="Erubis/ErboutEnhancer.html" class="link">Erubis::ErboutEnhancer</a><br />
Module <a href="Erubis/EscapeEnhancer.html" class="link">Erubis::EscapeEnhancer</a><br />
Module <a href="Erubis/Evaluator.html" class="link">Erubis::Evaluator</a><br />
Module <a href="Erubis/Generator.html" class="link">Erubis::Generator</a><br />
Module <a href="Erubis/HeaderFooterEnhancer.html" class="link">Erubis::HeaderFooterEnhancer</a><br />
Module <a href="Erubis/Helpers.html" class="link">Erubis::Helpers</a><br />
Module <a href="Erubis/InterpolationEnhancer.html" class="link">Erubis::InterpolationEnhancer</a><br />
Module <a href="Erubis/JavaGenerator.html" class="link">Erubis::JavaGenerator</a><br />
Module <a href="Erubis/JavascriptGenerator.html" class="link">Erubis::JavascriptGenerator</a><br />
Module <a href="Erubis/NoCodeEnhancer.html" class="link">Erubis::NoCodeEnhancer</a><br />
Module <a href="Erubis/NoTextEnhancer.html" class="link">Erubis::NoTextEnhancer</a><br />
Module <a href="Erubis/OptimizedGenerator.html" class="link">Erubis::OptimizedGenerator</a><br />
Module <a href="Erubis/PI.html" class="link">Erubis::PI</a><br />
Module <a href="Erubis/PercentLineEnhancer.html" class="link">Erubis::PercentLineEnhancer</a><br />
Module <a href="Erubis/PerlGenerator.html" class="link">Erubis::PerlGenerator</a><br />
Module <a href="Erubis/PhpGenerator.html" class="link">Erubis::PhpGenerator</a><br />
Module <a href="Erubis/PreprocessingHelper.html" class="link">Erubis::PreprocessingHelper</a><br />
Module <a href="Erubis/PrintEnabledEnhancer.html" class="link">Erubis::PrintEnabledEnhancer</a><br />
Module <a href="Erubis/PrintOutEnhancer.html" class="link">Erubis::PrintOutEnhancer</a><br />
Module <a href="Erubis/RubyEvaluator.html" class="link">Erubis::RubyEvaluator</a><br />
Module <a href="Erubis/RubyGenerator.html" class="link">Erubis::RubyGenerator</a><br />
Module <a href="Erubis/SchemeGenerator.html" class="link">Erubis::SchemeGenerator</a><br />
Module <a href="Erubis/SimplifyEnhancer.html" class="link">Erubis::SimplifyEnhancer</a><br />
Module <a href="Erubis/StdoutEnhancer.html" class="link">Erubis::StdoutEnhancer</a><br />
Module <a href="Erubis/StringBufferEnhancer.html" class="link">Erubis::StringBufferEnhancer</a><br />
Module <a href="Erubis/XmlHelper.html" class="link">Erubis::XmlHelper</a><br />
Class <a href="Erubis/ArrayBufferEruby.html" class="link">Erubis::ArrayBufferEruby</a><br />
Class <a href="Erubis/ArrayEruby.html" class="link">Erubis::ArrayEruby</a><br />
Class <a href="Erubis/BiPatternEruby.html" class="link">Erubis::BiPatternEruby</a><br />
Class <a href="Erubis/CommandOptionError.html" class="link">Erubis::CommandOptionError</a><br />
Class <a href="Erubis/Context.html" class="link">Erubis::Context</a><br />
Class <a href="Erubis/DeleteIndentEruby.html" class="link">Erubis::DeleteIndentEruby</a><br />
Class <a href="Erubis/Ec.html" class="link">Erubis::Ec</a><br />
Class <a href="Erubis/Ejava.html" class="link">Erubis::Ejava</a><br />
Class <a href="Erubis/Ejavascript.html" class="link">Erubis::Ejavascript</a><br />
Class <a href="Erubis/Engine.html" class="link">Erubis::Engine</a><br />
Class <a href="Erubis/Eperl.html" class="link">Erubis::Eperl</a><br />
Class <a href="Erubis/Ephp.html" class="link">Erubis::Ephp</a><br />
Class <a href="Erubis/ErboutEruby.html" class="link">Erubis::ErboutEruby</a><br />
Class <a href="Erubis/ErubisError.html" class="link">Erubis::ErubisError</a><br />
Class <a href="Erubis/Eruby.html" class="link">Erubis::Eruby</a><br />
Class <a href="Erubis/EscapedEc.html" class="link">Erubis::EscapedEc</a><br />
Class <a href="Erubis/EscapedEjava.html" class="link">Erubis::EscapedEjava</a><br />
Class <a href="Erubis/EscapedEjavascript.html" class="link">Erubis::EscapedEjavascript</a><br />
Class <a href="Erubis/EscapedEperl.html" class="link">Erubis::EscapedEperl</a><br />
Class <a href="Erubis/EscapedEphp.html" class="link">Erubis::EscapedEphp</a><br />
Class <a href="Erubis/EscapedEruby.html" class="link">Erubis::EscapedEruby</a><br />
Class <a href="Erubis/EscapedEscheme.html" class="link">Erubis::EscapedEscheme</a><br />
Class <a href="Erubis/Escheme.html" class="link">Erubis::Escheme</a><br />
Class <a href="Erubis/FastEruby.html" class="link">Erubis::FastEruby</a><br />
Class <a href="Erubis/HeaderFooterEruby.html" class="link">Erubis::HeaderFooterEruby</a><br />
Class <a href="Erubis/InterpolationEruby.html" class="link">Erubis::InterpolationEruby</a><br />
Class <a href="Erubis/Main.html" class="link">Erubis::Main</a><br />
Class <a href="Erubis/NoCodeEruby.html" class="link">Erubis::NoCodeEruby</a><br />
Class <a href="Erubis/NoTextEruby.html" class="link">Erubis::NoTextEruby</a><br />
Class <a href="Erubis/NotSupportedError.html" class="link">Erubis::NotSupportedError</a><br />
Class <a href="Erubis/OptimizedEruby.html" class="link">Erubis::OptimizedEruby</a><br />
Class <a href="Erubis/OptimizedXmlEruby.html" class="link">Erubis::OptimizedXmlEruby</a><br />
Class <a href="Erubis/PercentLineEruby.html" class="link">Erubis::PercentLineEruby</a><br />
Class <a href="Erubis/PreprocessingEruby.html" class="link">Erubis::PreprocessingEruby</a><br />
Class <a href="Erubis/PrintEnabledEruby.html" class="link">Erubis::PrintEnabledEruby</a><br />
Class <a href="Erubis/PrintOutEruby.html" class="link">Erubis::PrintOutEruby</a><br />
Class <a href="Erubis/PrintOutSimplifiedEruby.html" class="link">Erubis::PrintOutSimplifiedEruby</a><br />
Class <a href="Erubis/SimplifiedEruby.html" class="link">Erubis::SimplifiedEruby</a><br />
Class <a href="Erubis/StdoutEruby.html" class="link">Erubis::StdoutEruby</a><br />
Class <a href="Erubis/StdoutSimplifiedEruby.html" class="link">Erubis::StdoutSimplifiedEruby</a><br />
Class <a href="Erubis/StringBufferEruby.html" class="link">Erubis::StringBufferEruby</a><br />
Class <a href="Erubis/StringIOEruby.html" class="link">Erubis::StringIOEruby</a><br />
Class <a href="Erubis/TinyEruby.html" class="link">Erubis::TinyEruby</a><br />
Class <a href="Erubis/XmlEruby.html" class="link">Erubis::XmlEruby</a><br />
</div>
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">EMPTY_BINDING</td>
<td>=</td>
<td class="context-item-value">binding()</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">Ejs</td>
<td>=</td>
<td class="context-item-value">Ejavascript</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">EscapedEjs</td>
<td>=</td>
<td class="context-item-value">EscapedEjavascript</td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">VERSION</td>
<td>=</td>
<td class="context-item-value">('$Release: 2.6.5 $' =~ /([.\d]+)/) &amp;&amp; $1</td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::ArrayBufferEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::ArrayBufferEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
use an Array object as buffer (included in <a href="Eruby.html">Eruby</a>
by default)
</p>
<p>
this is only for <a href="Eruby.html">Eruby</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000010">add_postamble</a>&nbsp;&nbsp;
<a href="#M000009">add_preamble</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000010" class="method-detail">
<a name="M000010"></a>
<div class="method-heading">
<a href="#M000010" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000010-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 191</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_buf.join\n&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000009" class="method-detail">
<a name="M000009"></a>
<div class="method-heading">
<a href="#M000009" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000009-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 187</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_buf = [];&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::ArrayBufferEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::ArrayBufferEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="ArrayBufferEnhancer.html">ArrayBufferEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::ArrayEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::ArrayEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
return array instead of string
</p>
<p>
this is only for <a href="Eruby.html">Eruby</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000194">add_postamble</a>&nbsp;&nbsp;
<a href="#M000193">add_preamble</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000194" class="method-detail">
<a name="M000194"></a>
<div class="method-heading">
<a href="#M000194" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000194-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000194-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 168</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_buf\n&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000193" class="method-detail">
<a name="M000193"></a>
<div class="method-heading">
<a href="#M000193" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000193-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000193-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 164</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_buf = [];&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::ArrayEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::ArrayEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="ArrayEnhancer.html">ArrayEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Basic</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Basic</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/converter_rb.html">
erubis/converter.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Basic/Converter.html" class="link">Erubis::Basic::Converter</a><br />
Class <a href="Basic/Engine.html" class="link">Erubis::Basic::Engine</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,327 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Basic::Converter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Basic::Converter</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/erubis/converter_rb.html">
erubis/converter.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
basic converter which supports &#8217;&lt;% &#8230; %&gt;&#8217; notation.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000141">add_expr</a>&nbsp;&nbsp;
<a href="#M000140">convert_input</a>&nbsp;&nbsp;
<a href="#M000138">init_converter</a>&nbsp;&nbsp;
<a href="#M000139">pattern_regexp</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="../Converter.html">Erubis::Converter</a></span>
</div>
</div>
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">DEFAULT_REGEXP</td>
<td>=</td>
<td class="context-item-value">pattern_regexp('&lt;% %&gt;')</td>
<td width="3em">&nbsp;</td>
<td class="context-item-desc">
DEFAULT_REGEXP = /(.*?)(^[ \t]*)?&lt;%(=+|\#)?(.*?)-?%&gt;([ \t]*\r?\n)?/m
DEFAULT_REGEXP = /(^[ \t]*)?&lt;%(=+|\#)?(.*?)-?%&gt;([ \t]*\r?\n)?/m
DEFAULT_REGEXP = /&lt;%(=+|\#)?(.*?)-?%&gt;([ \t]*\r?\n)?/m
</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">pattern</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">trim</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000141" class="method-detail">
<a name="M000141"></a>
<div class="method-heading">
<a href="#M000141" class="method-signature">
<span class="method-name">add_expr</span><span class="method-args">(src, code, indicator)</span>
</a>
</div>
<div class="method-description">
<p>
add expression code to src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000141-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000141-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 176</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">indicator</span>
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'='</span>
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'=='</span>
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'==='</span>
<span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000140" class="method-detail">
<a name="M000140"></a>
<div class="method-heading">
<a href="#M000140" class="method-signature">
<span class="method-name">convert_input</span><span class="method-args">(src, input)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000140-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000140-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 127</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-identifier">pat</span> = <span class="ruby-ivar">@pattern</span>
<span class="ruby-identifier">regexp</span> = <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">pat</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'&lt;% %&gt;'</span> <span class="ruby-operator">?</span> <span class="ruby-constant">DEFAULT_REGEXP</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pattern_regexp</span>(<span class="ruby-identifier">pat</span>)
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">is_bol</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-comment cmt"># is beginning of line</span>
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">tailch</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>()
<span class="ruby-identifier">len</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">len</span>]
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
<span class="ruby-identifier">ch</span> = <span class="ruby-identifier">indicator</span> <span class="ruby-value">? </span><span class="ruby-identifier">indicator</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">detect_spaces_at_bol</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">is_bol</span>)
<span class="ruby-identifier">is_bol</span> = <span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-comment cmt">## * when '&lt;%= %&gt;', do nothing</span>
<span class="ruby-comment cmt">## * when '&lt;% %&gt;' or '&lt;%# %&gt;', delete spaces iff only spaces are around '&lt;% %&gt;'</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-comment cmt"># &lt;%= %&gt;</span>
<span class="ruby-identifier">rspace</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tailch</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">tailch</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">lspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?\#</span> <span class="ruby-comment cmt"># &lt;%# %&gt;</span>
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">count</span>(<span class="ruby-value str">&quot;\n&quot;</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">lspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?%</span> <span class="ruby-comment cmt"># &lt;%% %&gt;</span>
<span class="ruby-identifier">s</span> = <span class="ruby-node">&quot;#{lspace}#{@prefix||='&lt;%'}#{code}#{tailch}#{@postfix||='%&gt;'}#{rspace}&quot;</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">s</span>)
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># &lt;% %&gt;</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-node">&quot;#{lspace}#{code}#{rspace}&quot;</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">lspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000138" class="method-detail">
<a name="M000138"></a>
<div class="method-heading">
<a href="#M000138" class="method-signature">
<span class="method-name">init_converter</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000138-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000138-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 103</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">properties</span>)
<span class="ruby-ivar">@pattern</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:pattern</span>]
<span class="ruby-ivar">@trim</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:trim</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">false</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Protected Instance methods</h3>
<div id="method-M000139" class="method-detail">
<a name="M000139"></a>
<div class="method-heading">
<a href="#M000139" class="method-signature">
<span class="method-name">pattern_regexp</span><span class="method-args">(pattern)</span>
</a>
</div>
<div class="method-description">
<p>
return regexp of pattern to parse eRuby script
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000139-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000139-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 112</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pattern_regexp</span>(<span class="ruby-identifier">pattern</span>)
<span class="ruby-ivar">@prefix</span>, <span class="ruby-ivar">@postfix</span> = <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">split</span>() <span class="ruby-comment cmt"># '&lt;% %&gt;' =&gt; '&lt;%', '%&gt;'</span>
<span class="ruby-comment cmt">#return /(.*?)(^[ \t]*)?#{@prefix}(=+|\#)?(.*?)-?#{@postfix}([ \t]*\r?\n)?/m</span>
<span class="ruby-comment cmt">#return /(^[ \t]*)?#{@prefix}(=+|\#)?(.*?)-?#{@postfix}([ \t]*\r?\n)?/m</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-node">/#{@prefix}(=+|-|\#|%)?(.*?)([-=])?#{@postfix}([ \t]*\r?\n)?/</span><span class="ruby-identifier">m</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Basic::Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Basic::Engine</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/erubis/engine_rb.html">
erubis/engine.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Engine.html">
Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
(abstract) base engine class for <a href="../Eruby.html">Eruby</a>, <a
href="../Eperl.html">Eperl</a>, <a href="../Ejava.html">Ejava</a>, and so
on. subclass must include generator.
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="../Evaluator.html">Evaluator</a></span>
<span class="include-name"><a href="Converter.html">Basic::Converter</a></span>
<span class="include-name"><a href="../Generator.html">Generator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::BiPatternEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::BiPatternEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
enable to use other embedded expression pattern (default is &#8217;\[=
=\]&#8217;).
</p>
<p>
notice! this is an experimental. spec may change in the future.
</p>
<p>
ex.
</p>
<pre>
input = &lt;&lt;END
&lt;% for item in list %&gt;
&lt;%= item %&gt; : &lt;%== item %&gt;
[= item =] : [== item =]
&lt;% end %&gt;
END
class BiPatternEruby
include BiPatternEnhancer
end
eruby = BiPatternEruby.new(input, :bipattern=&gt;'\[= =\]')
list = ['&lt;a&gt;', 'b&amp;b', '&quot;c&quot;']
print eruby.result(binding())
## output
&lt;a&gt; : &amp;lt;a&amp;gt;
&lt;a&gt; : &amp;lt;a&amp;gt;
b&amp;b : b&amp;amp;b
b&amp;b : b&amp;amp;b
&quot;c&quot; : &amp;quot;c&amp;quot;
&quot;c&quot; : &amp;quot;c&amp;quot;
</pre>
<p>
this is language independent.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000150">add_text</a>&nbsp;&nbsp;
<a href="#M000149">new</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000149" class="method-detail">
<a name="M000149"></a>
<div class="method-heading">
<a href="#M000149" class="method-signature">
<span class="method-name">new</span><span class="method-args">(input, properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000149-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000149-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 408</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">properties</span>={})
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bipattern</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:bipattern</span>] <span class="ruby-comment cmt"># or '\$\{ \}'</span>
<span class="ruby-keyword kw">super</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000150" class="method-detail">
<a name="M000150"></a>
<div class="method-heading">
<a href="#M000150" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000150-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000150-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 420</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">text</span>
<span class="ruby-identifier">m</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@bipattern_regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">txt</span>)
<span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">'='</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">indicator</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt">#rest = $' || text # ruby1.8</span>
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">m</span> <span class="ruby-value">? </span><span class="ruby-identifier">text</span>[<span class="ruby-identifier">m</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span> <span class="ruby-comment cmt"># ruby1.9</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::BiPatternEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::BiPatternEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="BiPatternEnhancer.html">BiPatternEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,386 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::CGenerator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::CGenerator</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ec_rb.html">
erubis/engine/ec.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000136">add_expr_debug</a>&nbsp;&nbsp;
<a href="#M000135">add_expr_escaped</a>&nbsp;&nbsp;
<a href="#M000134">add_expr_literal</a>&nbsp;&nbsp;
<a href="#M000137">add_postamble</a>&nbsp;&nbsp;
<a href="#M000129">add_preamble</a>&nbsp;&nbsp;
<a href="#M000133">add_stmt</a>&nbsp;&nbsp;
<a href="#M000132">add_text</a>&nbsp;&nbsp;
<a href="#M000130">escape_text</a>&nbsp;&nbsp;
<a href="#M000131">escaped_expr</a>&nbsp;&nbsp;
<a href="#M000128">init_generator</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Generator.html">Generator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000136" class="method-detail">
<a name="M000136"></a>
<div class="method-heading">
<a href="#M000136" class="method-signature">
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000136-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000136-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A\&quot;.*?\&quot;\s*,\s*(.*)/</span>
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[%&quot;]/</span>, <span class="ruby-value str">'\\\1'</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'='</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; fprintf(stderr, \&quot;*** debug: #{s}\&quot; #{code});&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000135" class="method-detail">
<a name="M000135"></a>
<div class="method-heading">
<a href="#M000135" class="method-signature">
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000135-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000135-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 67</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">';'</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000134" class="method-detail">
<a name="M000134"></a>
<div class="method-heading">
<a href="#M000134" class="method-signature">
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000134-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000134-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 62</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; fprintf(#{@out}, &quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">');'</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000137" class="method-detail">
<a name="M000137"></a>
<div class="method-heading">
<a href="#M000137" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000137-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000137-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 82</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-comment cmt"># empty</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000129" class="method-detail">
<a name="M000129"></a>
<div class="method-heading">
<a href="#M000129" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000129-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#line 1 \&quot;#{self.filename}\&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">filename</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000133" class="method-detail">
<a name="M000133"></a>
<div class="method-heading">
<a href="#M000133" class="method-signature">
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000133-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000133-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 58</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000132" class="method-detail">
<a name="M000132"></a>
<div class="method-heading">
<a href="#M000132" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000132-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000132-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 44</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">:</span> <span class="ruby-value str">' '</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;fputs(&quot;</span>
<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' '</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
<span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">line</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;, #{@out});&quot;</span> <span class="ruby-comment cmt">#&lt;&lt; (text[-1] == ?\n ? &quot;\n&quot; : &quot;&quot;)</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000130" class="method-detail">
<a name="M000130"></a>
<div class="method-heading">
<a href="#M000130" class="method-signature">
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000130-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
<span class="ruby-ivar">@@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">&quot;\r&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\r&quot;</span>, <span class="ruby-value str">&quot;\n&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\n&quot;</span>, <span class="ruby-value str">&quot;\t&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\t&quot;</span>, <span class="ruby-value str">'&quot;'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'\\&quot;'</span>, <span class="ruby-value str">&quot;\\&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\\\&quot;</span> }
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n\t&quot;\\]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@table_</span>[<span class="ruby-identifier">m</span>] }
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000131" class="method-detail">
<a name="M000131"></a>
<div class="method-heading">
<a href="#M000131" class="method-signature">
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000131-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000131-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 40</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{@escapefunc}(#{code.strip}, #{@out})&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000128" class="method-detail">
<a name="M000128"></a>
<div class="method-heading">
<a href="#M000128" class="method-signature">
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000128-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ec.rb, line 23</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-keyword kw">super</span>
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">&quot;escape&quot;</span>
<span class="ruby-ivar">@indent</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
<span class="ruby-ivar">@out</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:out</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'stdout'</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::CommandOptionError</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::CommandOptionError</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/main_rb.html">
erubis/main.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="ErubisError.html">
ErubisError
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,344 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Context</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Context</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/context_rb.html">
erubis/context.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
context object for Engine#evaluate
</p>
<p>
ex.
</p>
<pre>
template = &lt;&lt;'END'
Hello &lt;%= @user %&gt;!
&lt;% for item in @list %&gt;
- &lt;%= item %&gt;
&lt;% end %&gt;
END
context = Erubis::Context.new(:user=&gt;'World', :list=&gt;['a','b','c'])
# or
# context = Erubis::Context.new
# context[:user] = 'World'
# context[:list] = ['a', 'b', 'c']
eruby = Erubis::Eruby.new(template)
print eruby.evaluate(context)
</pre>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000219">[]</a>&nbsp;&nbsp;
<a href="#M000220">[]=</a>&nbsp;&nbsp;
<a href="#M000222">each</a>&nbsp;&nbsp;
<a href="#M000221">keys</a>&nbsp;&nbsp;
<a href="#M000218">new</a>&nbsp;&nbsp;
<a href="#M000223">to_hash</a>&nbsp;&nbsp;
<a href="#M000224">update</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name">Enumerable</span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000218" class="method-detail">
<a name="M000218"></a>
<div class="method-heading">
<a href="#M000218" class="method-signature">
<span class="method-name">new</span><span class="method-args">(hash=nil)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000218-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 33</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-identifier">hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>
<span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000219" class="method-detail">
<a name="M000219"></a>
<div class="method-heading">
<a href="#M000219" class="method-signature">
<span class="method-name">[]</span><span class="method-args">(key)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000219-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 39</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000220" class="method-detail">
<a name="M000220"></a>
<div class="method-heading">
<a href="#M000220" class="method-signature">
<span class="method-name">[]=</span><span class="method-args">(key, value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000220-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 43</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000222" class="method-detail">
<a name="M000222"></a>
<div class="method-heading">
<a href="#M000222" class="method-signature">
<span class="method-name">each</span><span class="method-args">() {|key, value| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000222-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 51</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
<span class="ruby-identifier">value</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">name</span>)
<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000221" class="method-detail">
<a name="M000221"></a>
<div class="method-heading">
<a href="#M000221" class="method-signature">
<span class="method-name">keys</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000221-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 47</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keys</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] }
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000223" class="method-detail">
<a name="M000223"></a>
<div class="method-heading">
<a href="#M000223" class="method-signature">
<span class="method-name">to_hash</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000223-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000223-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 59</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_hash</span>
<span class="ruby-identifier">hash</span> = {}
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] }
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">hash</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000224" class="method-detail">
<a name="M000224"></a>
<div class="method-heading">
<a href="#M000224" class="method-signature">
<span class="method-name">update</span><span class="method-args">(context_or_hash)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000224-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000224-source">
<pre>
<span class="ruby-comment cmt"># File erubis/context.rb, line 65</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update</span>(<span class="ruby-identifier">context_or_hash</span>)
<span class="ruby-identifier">arg</span> = <span class="ruby-identifier">context_or_hash</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
<span class="ruby-identifier">arg</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">arg</span>.<span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">varname</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">varname</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-identifier">varname</span>)
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">val</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,283 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Converter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Converter</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/converter_rb.html">
erubis/converter.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Converter.html#M000063">convert</a>
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000063">convert</a>&nbsp;&nbsp;
<a href="#M000065">convert_input</a>&nbsp;&nbsp;
<a href="#M000064">detect_spaces_at_bol</a>&nbsp;&nbsp;
<a href="#M000062">init_converter</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">escape</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">postamble</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">preamble</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000063" class="method-detail">
<a name="M000063"></a>
<div class="method-heading">
<a href="#M000063" class="method-signature">
<span class="method-name">convert</span><span class="method-args">(input)</span>
</a>
</div>
<div class="method-description">
<p>
<a href="Converter.html#M000063">convert</a> input string into target
language
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000063-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000063-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 33</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
<span class="ruby-identifier">codebuf</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-comment cmt"># or []</span>
<span class="ruby-ivar">@preamble</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">codebuf</span>) <span class="ruby-operator">:</span> (<span class="ruby-ivar">@preamble</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">codebuf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@preamble</span>))
<span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-ivar">@postamble</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">codebuf</span>) <span class="ruby-operator">:</span> (<span class="ruby-ivar">@postamble</span> <span class="ruby-operator">&amp;&amp;</span> (<span class="ruby-identifier">codebuf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@postamble</span>))
<span class="ruby-ivar">@_proc</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># clear cached proc object</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">codebuf</span> <span class="ruby-comment cmt"># or codebuf.join()</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000062" class="method-detail">
<a name="M000062"></a>
<div class="method-heading">
<a href="#M000062" class="method-signature">
<span class="method-name">init_converter</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000062-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 26</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-ivar">@preamble</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:preamble</span>]
<span class="ruby-ivar">@postamble</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:postamble</span>]
<span class="ruby-ivar">@escape</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:escape</span>]
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Protected Instance methods</h3>
<div id="method-M000065" class="method-detail">
<a name="M000065"></a>
<div class="method-heading">
<a href="#M000065" class="method-signature">
<span class="method-name">convert_input</span><span class="method-args">(codebuf, input)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) <a href="Converter.html#M000063">convert</a> input to code
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000065-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000065-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 77</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">codebuf</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000064" class="method-detail">
<a name="M000064"></a>
<div class="method-heading">
<a href="#M000064" class="method-signature">
<span class="method-name">detect_spaces_at_bol</span><span class="method-args">(text, is_bol)</span>
</a>
</div>
<div class="method-description">
<p>
detect spaces at beginning of line
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000064-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000064-source">
<pre>
<span class="ruby-comment cmt"># File erubis/converter.rb, line 47</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">detect_spaces_at_bol</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">is_bol</span>)
<span class="ruby-identifier">lspace</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_bol</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-value str">&quot;&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">rindex</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-value">?\n</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rindex</span>
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">text</span>[<span class="ruby-identifier">rindex</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A[ \t]*\z/</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-identifier">s</span>
<span class="ruby-comment cmt">#text = text[0..rindex]</span>
<span class="ruby-identifier">text</span>[<span class="ruby-identifier">rindex</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_bol</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A[ \t]*\z/</span>
<span class="ruby-comment cmt">#lspace = text</span>
<span class="ruby-comment cmt">#text = nil</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-identifier">text</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::DeleteIndentEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::DeleteIndentEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
delete indentation of HTML.
</p>
<p>
this is language-independent.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000192">convert_input</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000192" class="method-detail">
<a name="M000192"></a>
<div class="method-heading">
<a href="#M000192" class="method-signature">
<span class="method-name">convert_input</span><span class="method-args">(src, input)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000192-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 578</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-identifier">input</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^[ \t]+&lt;/</span>, <span class="ruby-value str">'&lt;'</span>)
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::DeleteIndentEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::DeleteIndentEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="DeleteIndentEnhancer.html">DeleteIndentEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Ec</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Ec</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ec_rb.html">
erubis/engine/ec.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for C
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="CGenerator.html">CGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Ejava</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Ejava</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejava_rb.html">
erubis/engine/ejava.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for Java
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="JavaGenerator.html">JavaGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Ejavascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Ejavascript</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejavascript_rb.html">
erubis/engine/ejavascript.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for JavaScript
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="JavascriptGenerator.html">JavascriptGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Engine</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Engine</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine_rb.html">
erubis/engine.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
Object
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
(abstract) abstract engine class. subclass must include evaluator and
converter module.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000210">convert!</a>&nbsp;&nbsp;
<a href="#M000211">load_file</a>&nbsp;&nbsp;
<a href="#M000209">new</a>&nbsp;&nbsp;
<a href="#M000212">process</a>&nbsp;&nbsp;
<a href="#M000213">process_proc</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000211" class="method-detail">
<a name="M000211"></a>
<div class="method-heading">
<a href="#M000211" class="method-signature">
<span class="method-name">load_file</span><span class="method-args">(filename, properties={})</span>
</a>
</div>
<div class="method-description">
<p>
load file, write cache file, and return engine object. this method create
code cache file automatically. cachefile name can be specified with
properties[:cachename], or filname + &#8216;cache&#8217; is used as
default.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000211-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine.rb, line 48</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">properties</span>={})
<span class="ruby-identifier">cachename</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:cachename</span>] <span class="ruby-operator">||</span> (<span class="ruby-identifier">filename</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'.cache'</span>)
<span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:filename</span>] = <span class="ruby-identifier">filename</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">cachename</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-operator">&lt;=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">mtime</span>(<span class="ruby-identifier">cachename</span>)
<span class="ruby-identifier">engine</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">properties</span>)
<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">src</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">cachename</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">input</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-value str">'rb'</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span> }
<span class="ruby-identifier">engine</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">properties</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">cachename</span>, <span class="ruby-value str">'wb'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">flock</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">LOCK_EX</span>)
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">flush</span>()
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">engine</span>.<span class="ruby-identifier">src</span>.<span class="ruby-identifier">untaint</span> <span class="ruby-comment cmt"># ok?</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">engine</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000209" class="method-detail">
<a name="M000209"></a>
<div class="method-heading">
<a href="#M000209" class="method-signature">
<span class="method-name">new</span><span class="method-args">(input=nil, properties={})</span>
</a>
</div>
<div class="method-description">
<p>
include <a href="Evaluator.html">Evaluator</a> include <a
href="Converter.html">Converter</a> include <a
href="Generator.html">Generator</a>
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000209-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine.rb, line 25</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">input</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">properties</span>={})
<span class="ruby-comment cmt">#@input = input</span>
<span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>)
<span class="ruby-identifier">init_converter</span>(<span class="ruby-identifier">properties</span>)
<span class="ruby-identifier">init_evaluator</span>(<span class="ruby-identifier">properties</span>)
<span class="ruby-ivar">@src</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">input</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000210" class="method-detail">
<a name="M000210"></a>
<div class="method-heading">
<a href="#M000210" class="method-signature">
<span class="method-name">convert!</span><span class="method-args">(input)</span>
</a>
</div>
<div class="method-description">
<p>
convert input string and set it to @src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000210-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine.rb, line 37</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert!</span>(<span class="ruby-identifier">input</span>)
<span class="ruby-ivar">@src</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000212" class="method-detail">
<a name="M000212"></a>
<div class="method-heading">
<a href="#M000212" class="method-signature">
<span class="method-name">process</span><span class="method-args">(input, context=nil, filename=nil)</span>
</a>
</div>
<div class="method-description">
<p>
helper method to convert and evaluate input text with context object.
context may be Binding, Hash, or Object.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000212-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000212-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">context</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">filename</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-identifier">code</span> = <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
<span class="ruby-identifier">filename</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'(erubis)'</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Binding</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">context</span>, <span class="ruby-identifier">filename</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">filename</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000213" class="method-detail">
<a name="M000213"></a>
<div class="method-heading">
<a href="#M000213" class="method-signature">
<span class="method-name">process_proc</span><span class="method-args">(proc_obj, context=nil, filename=nil)</span>
</a>
</div>
<div class="method-description">
<p>
helper method evaluate Proc object with contect object. context may be
Binding, Hash, or Object.
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000213-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000213-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine.rb, line 88</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_proc</span>(<span class="ruby-identifier">proc_obj</span>, <span class="ruby-identifier">context</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">filename</span>=<span class="ruby-keyword kw">nil</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Binding</span>)
<span class="ruby-identifier">filename</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'(erubis)'</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">eval</span>(<span class="ruby-identifier">proc_obj</span>, <span class="ruby-identifier">context</span>, <span class="ruby-identifier">filename</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">context</span> = <span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">context</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">proc_obj</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Eperl</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Eperl</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/eperl_rb.html">
erubis/engine/eperl.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for Perl
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="PerlGenerator.html">PerlGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Ephp</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Ephp</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ephp_rb.html">
erubis/engine/ephp.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for PHP
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="PhpGenerator.html">PhpGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::ErboutEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::ErboutEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
set buffer variable name to &#8216;_erbout&#8217; as well as
&#8216;_buf&#8216;
</p>
<p>
this is only for <a href="Eruby.html">Eruby</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000176">add_postamble</a>&nbsp;&nbsp;
<a href="#M000175">add_preamble</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000176" class="method-detail">
<a name="M000176"></a>
<div class="method-heading">
<a href="#M000176" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000176-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000176-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 260</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_buf.to_s\n&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000175" class="method-detail">
<a name="M000175"></a>
<div class="method-heading">
<a href="#M000175" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000175-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000175-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 256</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;_erbout = _buf = '';&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::ErboutEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::ErboutEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="ErboutEnhancer.html">ErboutEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::ErubisError</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::ErubisError</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/error_rb.html">
erubis/error.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
StandardError
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
base error class
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Eruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Eruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/eruby_rb.html">
erubis/engine/eruby.rb
</a>
<br />
<a href="../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for Ruby
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="RubyEvaluator.html">RubyEvaluator</a></span>
<span class="include-name"><a href="RubyGenerator.html">RubyGenerator</a></span>
<span class="include-name"><a href="ErboutEnhancer.html">ErboutEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,165 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::EscapeEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::EscapeEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
switch &#8217;&lt;%= &#8230; %&gt;&#8217; to escaped and &#8217;&lt;%==
&#8230; %&gt;&#8217; to unescaped
</p>
<p>
ex.
</p>
<pre>
class XmlEruby &lt; Eruby
include EscapeEnhancer
end
</pre>
<p>
this is language-indenedent.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000182">add_expr</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000182" class="method-detail">
<a name="M000182"></a>
<div class="method-heading">
<a href="#M000182" class="method-signature">
<span class="method-name">add_expr</span><span class="method-args">(src, code, indicator)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000182-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000182-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 37</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">indicator</span>
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'='</span>
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'=='</span>
<span class="ruby-ivar">@escape</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'==='</span>
<span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEc</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEc</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ec_rb.html">
erubis/engine/ec.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Ec.html">
Ec
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEjava</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEjava</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejava_rb.html">
erubis/engine/ejava.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Ejava.html">
Ejava
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEjavascript</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEjavascript</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejavascript_rb.html">
erubis/engine/ejavascript.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Ejavascript.html">
Ejavascript
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEperl</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEperl</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/eperl_rb.html">
erubis/engine/eperl.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eperl.html">
Eperl
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEphp</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEphp</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ephp_rb.html">
erubis/engine/ephp.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Ephp.html">
Ephp
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/eruby_rb.html">
erubis/engine/eruby.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
swtich &#8217;&lt;%= %&gt;&#8217; to escaped and &#8217;&lt;%==
%&gt;&#8217; to not escaped
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::EscapedEscheme</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::EscapedEscheme</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/escheme_rb.html">
erubis/engine/escheme.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Escheme.html">
Escheme
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="EscapeEnhancer.html">EscapeEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::Escheme</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::Escheme</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/escheme_rb.html">
erubis/engine/escheme.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Basic/Engine.html">
Basic::Engine
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
engine for Scheme
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="SchemeGenerator.html">SchemeGenerator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,212 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Evaluator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Evaluator</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/evaluator_rb.html">
erubis/evaluator.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
<a href="Evaluator.html#M000148">evaluate</a> code
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000148">evaluate</a>&nbsp;&nbsp;
<a href="#M000146">init_evaluator</a>&nbsp;&nbsp;
<a href="#M000147">result</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">filename</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">src</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000148" class="method-detail">
<a name="M000148"></a>
<div class="method-heading">
<a href="#M000148" class="method-signature">
<span class="method-name">evaluate</span><span class="method-args">(*args)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000148-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000148-source">
<pre>
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 34</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">evaluate</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotSupportedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;evaluation of code except Ruby is not supported.&quot;</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000146" class="method-detail">
<a name="M000146"></a>
<div class="method-heading">
<a href="#M000146" class="method-signature">
<span class="method-name">init_evaluator</span><span class="method-args">(properties)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000146-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000146-source">
<pre>
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 26</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_evaluator</span>(<span class="ruby-identifier">properties</span>)
<span class="ruby-ivar">@filename</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:filename</span>]
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000147" class="method-detail">
<a name="M000147"></a>
<div class="method-heading">
<a href="#M000147" class="method-signature">
<span class="method-name">result</span><span class="method-args">(*args)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000147-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000147-source">
<pre>
<span class="ruby-comment cmt"># File erubis/evaluator.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NotSupportedError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;evaluation of code except Ruby is not supported.&quot;</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::FastEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::FastEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/eruby_rb.html">
erubis/engine/eruby.rb
</a>
<br />
<a href="../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
fast engine for Ruby
</p>
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="InterpolationEnhancer.html">InterpolationEnhancer</a></span>
<span class="include-name"><a href="ErboutEnhancer.html">ErboutEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,416 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Generator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Generator</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/generator_rb.html">
erubis/generator.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
code generator, called by <a href="Converter.html">Converter</a> module
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000019">add_expr_debug</a>&nbsp;&nbsp;
<a href="#M000018">add_expr_escaped</a>&nbsp;&nbsp;
<a href="#M000017">add_expr_literal</a>&nbsp;&nbsp;
<a href="#M000020">add_postamble</a>&nbsp;&nbsp;
<a href="#M000014">add_preamble</a>&nbsp;&nbsp;
<a href="#M000016">add_stmt</a>&nbsp;&nbsp;
<a href="#M000015">add_text</a>&nbsp;&nbsp;
<a href="#M000012">escape_text</a>&nbsp;&nbsp;
<a href="#M000013">escaped_expr</a>&nbsp;&nbsp;
<a href="#M000011">init_generator</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">escapefunc</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000019" class="method-detail">
<a name="M000019"></a>
<div class="method-heading">
<a href="#M000019" class="method-signature">
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add expression code to src for debug. this is called by
add_expr().
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000019-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000018" class="method-detail">
<a name="M000018"></a>
<div class="method-heading">
<a href="#M000018" class="method-signature">
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add escaped expression code to src. this is called by
add_expr().
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000018-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 67</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000017" class="method-detail">
<a name="M000017"></a>
<div class="method-heading">
<a href="#M000017" class="method-signature">
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add expression literal code to src. this is called by
add_expr().
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000017-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 62</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000020" class="method-detail">
<a name="M000020"></a>
<div class="method-heading">
<a href="#M000020" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add @postamble to src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000020-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 77</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000014" class="method-detail">
<a name="M000014"></a>
<div class="method-heading">
<a href="#M000014" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add @preamble to src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000014-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 47</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000016" class="method-detail">
<a name="M000016"></a>
<div class="method-heading">
<a href="#M000016" class="method-signature">
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add statement code to src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000016-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 57</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000015" class="method-detail">
<a name="M000015"></a>
<div class="method-heading">
<a href="#M000015" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) add text string to src
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000015-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 52</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000012" class="method-detail">
<a name="M000012"></a>
<div class="method-heading">
<a href="#M000012" class="method-signature">
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
</a>
</div>
<div class="method-description">
<p>
(abstract) escape text string
</p>
<p>
ex.
</p>
<pre>
def escape_text(text)
return text.dump
# or return &quot;'&quot; + text.gsub(/['\\]/, '\\\\\&amp;') + &quot;'&quot;
end
</pre>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000012-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 36</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
<span class="ruby-identifier">not_implemented</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000013" class="method-detail">
<a name="M000013"></a>
<div class="method-heading">
<a href="#M000013" class="method-signature">
<span class="method-name">escaped_expr</span><span class="method-args">(code)</span>
</a>
</div>
<div class="method-description">
<p>
return escaped expression code (ex. &#8216;h(&#8230;)&#8217; or
&#8216;htmlspecialchars(&#8230;)&#8217;)
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000013-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>)
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{@escapefunc}(#{code})&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000011" class="method-detail">
<a name="M000011"></a>
<div class="method-heading">
<a href="#M000011" class="method-signature">
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000011-source">
<pre>
<span class="ruby-comment cmt"># File erubis/generator.rb, line 24</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-ivar">@escapefunc</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:escapefunc</span>]
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,267 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::HeaderFooterEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::HeaderFooterEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<dl>
<dt>experimental</dt><dd>allow header and footer in eRuby script
</dd>
</dl>
<p>
ex.
</p>
<pre>
====================
## without header and footer
$ cat ex1.eruby
&lt;% def list_items(list) %&gt;
&lt;% for item in list %&gt;
&lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
&lt;% end %&gt;
&lt;% end %&gt;
$ erubis -s ex1.eruby
_buf = []; def list_items(list)
; for item in list
; _buf &lt;&lt; '&lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '&lt;/li&gt;
'; end
; end
;
_buf.join
## with header and footer
$ cat ex2.eruby
&lt;!--#header:
def list_items(list)
#--&gt;
&lt;% for item in list %&gt;
&lt;li&gt;&lt;%= item %&gt;&lt;/li&gt;
&lt;% end %&gt;
&lt;!--#footer:
end
#--&gt;
$ erubis -s -c HeaderFooterEruby ex4.eruby
def list_items(list)
_buf = []; _buf &lt;&lt; '
'; for item in list
; _buf &lt;&lt; '&lt;li&gt;'; _buf &lt;&lt; ( item ).to_s; _buf &lt;&lt; '&lt;/li&gt;
'; end
; _buf &lt;&lt; '
';
_buf.join
end
====================
</pre>
<p>
this is language-independent.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000109">add_text</a>&nbsp;&nbsp;
<a href="#M000110">convert</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="constants-list">
<h3 class="section-bar">Constants</h3>
<div class="name-list">
<table summary="Constants">
<tr class="top-aligned-row context-row">
<td class="context-item-name">HEADER_FOOTER_PATTERN</td>
<td>=</td>
<td class="context-item-value">/(.*?)(^[ \t]*)?&lt;!--\#(\w+):(.*?)\#--&gt;([ \t]*\r?\n)?/m</td>
</tr>
</table>
</div>
</div>
<div id="attribute-list">
<h3 class="section-bar">Attributes</h3>
<div class="name-list">
<table>
<tr class="top-aligned-row context-row">
<td class="context-item-name">footer</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
<tr class="top-aligned-row context-row">
<td class="context-item-name">header</td>
<td class="context-item-value">&nbsp;[RW]&nbsp;</td>
<td class="context-item-desc"></td>
</tr>
</table>
</div>
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000109" class="method-detail">
<a name="M000109"></a>
<div class="method-heading">
<a href="#M000109" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000109-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000109-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 541</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-identifier">m</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-constant">HEADER_FOOTER_PATTERN</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">txt</span>, <span class="ruby-identifier">lspace</span>, <span class="ruby-identifier">word</span>, <span class="ruby-identifier">content</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
<span class="ruby-identifier">flag_trim</span> = <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">txt</span>)
<span class="ruby-identifier">content</span> = <span class="ruby-node">&quot;#{lspace}#{content}#{rspace}&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_trim</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">lspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">flag_trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{word}&quot;</span>, <span class="ruby-identifier">content</span>)
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rspace</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">flag_trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt">#rest = $' || text # ruby1.8</span>
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">m</span> <span class="ruby-value">? </span><span class="ruby-identifier">text</span>[<span class="ruby-identifier">m</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">text</span> <span class="ruby-comment cmt"># ruby1.9</span>
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">rest</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000110" class="method-detail">
<a name="M000110"></a>
<div class="method-heading">
<a href="#M000110" class="method-signature">
<span class="method-name">convert</span><span class="method-args">(input)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000110-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000110-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 559</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert</span>(<span class="ruby-identifier">input</span>)
<span class="ruby-identifier">source</span> = <span class="ruby-keyword kw">super</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@src</span> = <span class="ruby-node">&quot;#{@header}#{source}#{@footer}&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::HeaderFooterEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::HeaderFooterEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="HeaderFooterEnhancer.html">HeaderFooterEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Helpers</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Helpers</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/helpers/rails_form_helper_rb.html">
erubis/helpers/rails_form_helper.rb
</a>
<br />
<a href="../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="Helpers/RailsFormHelper.html" class="link">Erubis::Helpers::RailsFormHelper</a><br />
Module <a href="Helpers/RailsHelper.html" class="link">Erubis::Helpers::RailsHelper</a><br />
</div>
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,787 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Helpers::RailsFormHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Helpers::RailsFormHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/erubis/helpers/rails_form_helper_rb.html">
erubis/helpers/rails_form_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000092">_pp_check_box_checked?</a>&nbsp;&nbsp;
<a href="#M000082">_pp_error_tags</a>&nbsp;&nbsp;
<a href="#M000094">_pp_radio_button_checked?</a>&nbsp;&nbsp;
<a href="#M000083">_pp_remove_error_div</a>&nbsp;&nbsp;
<a href="#M000095">_pp_select</a>&nbsp;&nbsp;
<a href="#M000096">_pp_select_options</a>&nbsp;&nbsp;
<a href="#M000091">pp_check_box</a>&nbsp;&nbsp;
<a href="#M000098">pp_collection_select</a>&nbsp;&nbsp;
<a href="#M000099">pp_country_select</a>&nbsp;&nbsp;
<a href="#M000081">pp_error_on</a>&nbsp;&nbsp;
<a href="#M000089">pp_file_field</a>&nbsp;&nbsp;
<a href="#M000085">pp_form_tag</a>&nbsp;&nbsp;
<a href="#M000088">pp_hidden_field</a>&nbsp;&nbsp;
<a href="#M000102">pp_image_submit_tag</a>&nbsp;&nbsp;
<a href="#M000087">pp_password_field</a>&nbsp;&nbsp;
<a href="#M000093">pp_radio_button</a>&nbsp;&nbsp;
<a href="#M000080">pp_render_partial</a>&nbsp;&nbsp;
<a href="#M000097">pp_select</a>&nbsp;&nbsp;
<a href="#M000101">pp_submit_tag</a>&nbsp;&nbsp;
<a href="#M000084">pp_tag_helper</a>&nbsp;&nbsp;
<a href="#M000079">pp_template_filename</a>&nbsp;&nbsp;
<a href="#M000078">pp_template_filename</a>&nbsp;&nbsp;
<a href="#M000090">pp_text_area</a>&nbsp;&nbsp;
<a href="#M000086">pp_text_field</a>&nbsp;&nbsp;
<a href="#M000100">pp_time_zone_select</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000092" class="method-detail">
<a name="M000092"></a>
<div class="method-heading">
<a href="#M000092" class="method-signature">
<span class="method-name">_pp_check_box_checked?</span><span class="method-args">(value, checked_value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000092-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 106</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_check_box_checked?</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">checked_value</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceTag</span><span class="ruby-operator">::</span><span class="ruby-identifier">check_box_checked?</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">checked_value</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000082" class="method-detail">
<a name="M000082"></a>
<div class="method-heading">
<a href="#M000082" class="method-signature">
<span class="method-name">_pp_error_tags</span><span class="method-args">(value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000082-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 46</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_error_tags</span>(<span class="ruby-identifier">value</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">?</span> [<span class="ruby-value str">'&lt;div class=&quot;fieldWithErrors&quot;&gt;'</span>, <span class="ruby-value str">'&lt;/div&gt;'</span>] <span class="ruby-operator">:</span> [<span class="ruby-value str">''</span>, <span class="ruby-value str">''</span>]
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000094" class="method-detail">
<a name="M000094"></a>
<div class="method-heading">
<a href="#M000094" class="method-signature">
<span class="method-name">_pp_radio_button_checked?</span><span class="method-args">(value, tag_value)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000094-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 117</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_radio_button_checked?</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">tag_value</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span><span class="ruby-operator">::</span><span class="ruby-constant">InstanceTag</span><span class="ruby-operator">::</span><span class="ruby-identifier">radio_button_checked?</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">tag_value</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000083" class="method-detail">
<a name="M000083"></a>
<div class="method-heading">
<a href="#M000083" class="method-signature">
<span class="method-name">_pp_remove_error_div</span><span class="method-args">(s)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000083-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 50</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_remove_error_div</span>(<span class="ruby-identifier">s</span>)
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\A&lt;div class=&quot;fieldWithErrors&quot;&gt;(.*)&lt;\/div&gt;\z/</span>, <span class="ruby-value str">'\1'</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000095" class="method-detail">
<a name="M000095"></a>
<div class="method-heading">
<a href="#M000095" class="method-signature">
<span class="method-name">_pp_select</span><span class="method-args">(object, method, collection, priority_collection, options={}, html_options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000095-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 121</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">priority_collection</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">html_options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_error_on</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>) <span class="ruby-keyword kw">do</span>
<span class="ruby-identifier">s</span> = <span class="ruby-value str">&quot;&quot;</span>
<span class="ruby-comment cmt">## start tag</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;select id=\&quot;#{object}_#{method}\&quot; name=\&quot;#{object}[#{method}]\&quot;&quot;</span>
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">html_options</span><span class="ruby-operator">:</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; #{key}=\&quot;#{val}\&quot;&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&gt;\n&quot;</span>
<span class="ruby-comment cmt">## selected table</span>
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">:value</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">:value</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value'</span>) <span class="ruby-operator">?</span> <span class="ruby-value str">'value'</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">nil?</span> ; <span class="ruby-identifier">selected</span> = <span class="ruby-node">&quot;@#{object}.#{method}&quot;</span>
<span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">val</span>=<span class="ruby-identifier">options</span>[<span class="ruby-identifier">key</span>]).<span class="ruby-identifier">nil?</span> ; <span class="ruby-identifier">selected</span> = <span class="ruby-keyword kw">nil</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A&lt;%=(.*)%&gt;\z/</span> ; <span class="ruby-identifier">selected</span> = <span class="ruby-identifier">$1</span>
<span class="ruby-keyword kw">else</span> ; <span class="ruby-identifier">selected</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">inspect</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;% _table = {#{selected}=&gt;' selected=\&quot;selected\&quot;'} %&gt;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">selected</span>
<span class="ruby-comment cmt">## &lt;option&gt; tags</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:include_blank</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'include_blank'</span>]
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;option value=\&quot;\&quot;&gt;&lt;/option&gt;\n&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">priority_collection</span>.<span class="ruby-identifier">blank?</span>
<span class="ruby-identifier">_pp_select_options</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">priority_collection</span>, <span class="ruby-identifier">selected</span>, <span class="ruby-value str">'delete'</span>)
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;option value=\&quot;\&quot;&gt;-------------&lt;/option&gt;\n&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">_pp_select_options</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">selected</span>, <span class="ruby-value str">'[]'</span>)
<span class="ruby-comment cmt">## end tag</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;/select&gt;&quot;</span>
<span class="ruby-identifier">s</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000096" class="method-detail">
<a name="M000096"></a>
<div class="method-heading">
<a href="#M000096" class="method-signature">
<span class="method-name">_pp_select_options</span><span class="method-args">(s, collection, selected, operator)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000096-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 153</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_pp_select_options</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">selected</span>, <span class="ruby-identifier">operator</span>)
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">item</span> <span class="ruby-keyword kw">in</span> <span class="ruby-identifier">collection</span>
<span class="ruby-identifier">value</span>, <span class="ruby-identifier">text</span> = <span class="ruby-identifier">item</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">item</span> <span class="ruby-operator">:</span> [<span class="ruby-identifier">item</span>, <span class="ruby-identifier">item</span>]
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">selected</span>
<span class="ruby-identifier">t</span> = <span class="ruby-value str">''</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">operator</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'delete'</span>
<span class="ruby-identifier">t</span> = <span class="ruby-node">&quot;&lt;%= _table.delete(#{value.inspect}) %&gt;&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">t</span> = <span class="ruby-node">&quot;&lt;%= _table[#{value.inspect}] %&gt;&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;option value=\&quot;#{h value}\&quot;#{t}&gt;#{h text}&lt;/option&gt;\n&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000091" class="method-detail">
<a name="M000091"></a>
<div class="method-heading">
<a href="#M000091" class="method-signature">
<span class="method-name">pp_check_box</span><span class="method-args">(object_name, method, options={}, checked_value=&quot;1&quot;, unchecked_value=&quot;0&quot;)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000091-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 99</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_check_box</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">checked_value</span>=<span class="ruby-value str">&quot;1&quot;</span>, <span class="ruby-identifier">unchecked_value</span>=<span class="ruby-value str">&quot;0&quot;</span>)
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">check_box</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">checked_value</span>, <span class="ruby-identifier">unchecked_value</span>)
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\schecked=\&quot;checked\&quot;/</span>, <span class="ruby-value str">''</span>)
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/type=&quot;checkbox&quot;/</span>, <span class="ruby-node">&quot;\\&amp;&lt;%= _pp_check_box_checked?(@#{object_name}.#{method}, #{checked_value.inspect}) ? ' checked=\&quot;checked\&quot;' : '' %&gt;&quot;</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_error_on</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>) { <span class="ruby-identifier">_pp_remove_error_div</span>(<span class="ruby-identifier">s</span>) }
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000098" class="method-detail">
<a name="M000098"></a>
<div class="method-heading">
<a href="#M000098" class="method-signature">
<span class="method-name">pp_collection_select</span><span class="method-args">(object, method, collection, value_method, text_method, options={}, html_options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000098-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 171</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_collection_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">value_method</span>, <span class="ruby-identifier">text_method</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">html_options</span>={})
<span class="ruby-identifier">collection2</span> = <span class="ruby-identifier">collection</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
[<span class="ruby-identifier">e</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">value_method</span>), <span class="ruby-identifier">e</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">text_method</span>)]
}
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection2</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">html_options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000099" class="method-detail">
<a name="M000099"></a>
<div class="method-heading">
<a href="#M000099" class="method-signature">
<span class="method-name">pp_country_select</span><span class="method-args">(object, method, priority_countries=nil, options={}, html_options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000099-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 178</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_country_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">priority_countries</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">html_options</span>={})
<span class="ruby-identifier">collection</span> = <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span><span class="ruby-operator">::</span><span class="ruby-constant">FormOptionsHelper</span><span class="ruby-operator">::</span><span class="ruby-constant">COUNTRIES</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">priority_countries</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">html_options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000081" class="method-detail">
<a name="M000081"></a>
<div class="method-heading">
<a href="#M000081" class="method-signature">
<span class="method-name">pp_error_on</span><span class="method-args">(object_name, method) {|object_name, method| ...}</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000081-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 37</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_error_on</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>)
<span class="ruby-identifier">s</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;% _stag, _etag = _pp_error_tags(@#{object_name}.errors.on('#{method}')) %&gt;&quot;</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;%= _stag %&gt;&quot;</span>
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>)
<span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&lt;%= _etag %&gt;&quot;</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000089" class="method-detail">
<a name="M000089"></a>
<div class="method-heading">
<a href="#M000089" class="method-signature">
<span class="method-name">pp_file_field</span><span class="method-args">(object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000089-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000089-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 91</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_file_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">:file_field</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000085" class="method-detail">
<a name="M000085"></a>
<div class="method-heading">
<a href="#M000085" class="method-signature">
<span class="method-name">pp_form_tag</span><span class="method-args">(url_for_options={}, options={}, *parameters_for_url, &amp;block)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000085-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 69</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_form_tag</span>(<span class="ruby-identifier">url_for_options</span>={}, <span class="ruby-identifier">options</span>={}, <span class="ruby-operator">*</span><span class="ruby-identifier">parameters_for_url</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">form_tag</span>(<span class="ruby-identifier">url_for_options</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">parameters_for_url</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000088" class="method-detail">
<a name="M000088"></a>
<div class="method-heading">
<a href="#M000088" class="method-signature">
<span class="method-name">pp_hidden_field</span><span class="method-args">(object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000088-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 87</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_hidden_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">:hidden_field</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000102" class="method-detail">
<a name="M000102"></a>
<div class="method-heading">
<a href="#M000102" class="method-signature">
<span class="method-name">pp_image_submit_tag</span><span class="method-args">(source, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000102-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 193</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_image_submit_tag</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">image_submit_tag</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000087" class="method-detail">
<a name="M000087"></a>
<div class="method-heading">
<a href="#M000087" class="method-signature">
<span class="method-name">pp_password_field</span><span class="method-args">(object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000087-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 83</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_password_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">:password_field</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000093" class="method-detail">
<a name="M000093"></a>
<div class="method-heading">
<a href="#M000093" class="method-signature">
<span class="method-name">pp_radio_button</span><span class="method-args">(object_name, method, tag_value, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000093-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 110</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_radio_button</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">tag_value</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">radio_button</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">tag_value</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/\schecked=\&quot;checked\&quot;/</span>, <span class="ruby-value str">''</span>)
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/type=&quot;radio&quot;/</span>, <span class="ruby-node">&quot;\\&amp;&lt;%= _pp_radio_button_checked?(@#{object_name}.#{method}, #{tag_value.inspect}) ? ' checked=\&quot;checked\&quot;' : '' %&gt;&quot;</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_error_on</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>) { <span class="ruby-identifier">_pp_remove_error_div</span>(<span class="ruby-identifier">s</span>) }
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000080" class="method-detail">
<a name="M000080"></a>
<div class="method-heading">
<a href="#M000080" class="method-signature">
<span class="method-name">pp_render_partial</span><span class="method-args">(basename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000080-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 30</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_render_partial</span>(<span class="ruby-identifier">basename</span>)
<span class="ruby-identifier">basename</span> = <span class="ruby-node">&quot;_#{basename}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">basename</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?_</span>
<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">pp_template_filename</span>(<span class="ruby-identifier">basename</span>)
<span class="ruby-identifier">preprocessor</span> = <span class="ruby-identifier">_create_preprocessor</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filename</span>))
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">preprocessor</span>.<span class="ruby-identifier">evaluate</span>(<span class="ruby-identifier">_preprocessing_context_object</span>())
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000097" class="method-detail">
<a name="M000097"></a>
<div class="method-heading">
<a href="#M000097" class="method-signature">
<span class="method-name">pp_select</span><span class="method-args">(object, method, collection, options={}, html_options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000097-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 167</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">html_options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">html_options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000101" class="method-detail">
<a name="M000101"></a>
<div class="method-heading">
<a href="#M000101" class="method-signature">
<span class="method-name">pp_submit_tag</span><span class="method-args">(value=&quot;Save changes&quot;, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000101-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 189</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_submit_tag</span>(<span class="ruby-identifier">value</span>=<span class="ruby-value str">&quot;Save changes&quot;</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">submit_tag</span>(<span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000084" class="method-detail">
<a name="M000084"></a>
<div class="method-heading">
<a href="#M000084" class="method-signature">
<span class="method-name">pp_tag_helper</span><span class="method-args">(helper, object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000084-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 55</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">helper</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object_name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span><span class="ruby-operator">::</span><span class="ruby-constant">FormHelper</span>)
<span class="ruby-identifier">object_name</span> = <span class="ruby-identifier">object_name</span>.<span class="ruby-identifier">object_name</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">:value</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value str">'value'</span>)
<span class="ruby-identifier">options</span>[<span class="ruby-value str">'value'</span>] = <span class="ruby-identifier">_?</span>(<span class="ruby-node">&quot;h @#{object_name}.#{method}&quot;</span>)
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt">#$stderr.puts &quot;*** debug: pp_tag_helper(): options=#{options.inspect}&quot;</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_error_on</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>) {
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">helper</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-identifier">_pp_remove_error_div</span>(<span class="ruby-identifier">s</span>)
}
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000079" class="method-detail">
<a name="M000079"></a>
<div class="method-heading">
<a href="#M000079" class="method-signature">
<span class="method-name">pp_template_filename</span><span class="method-args">(basename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000079-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 23</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_template_filename</span>(<span class="ruby-identifier">basename</span>)
<span class="ruby-identifier">fname</span> = <span class="ruby-node">&quot;#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.html.erb&quot;</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">fname</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">fname</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000078" class="method-detail">
<a name="M000078"></a>
<div class="method-heading">
<a href="#M000078" class="method-signature">
<span class="method-name">pp_template_filename</span><span class="method-args">(basename)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000078-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 19</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_template_filename</span>(<span class="ruby-identifier">basename</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-node">&quot;#{RAILS_ROOT}/app/views/#{controller.controller_name}/#{basename}.rhtml&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000090" class="method-detail">
<a name="M000090"></a>
<div class="method-heading">
<a href="#M000090" class="method-signature">
<span class="method-name">pp_text_area</span><span class="method-args">(object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000090-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000090-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 95</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_text_area</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">:text_area</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000086" class="method-detail">
<a name="M000086"></a>
<div class="method-heading">
<a href="#M000086" class="method-signature">
<span class="method-name">pp_text_field</span><span class="method-args">(object_name, method, options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000086-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 79</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_text_field</span>(<span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>={})
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pp_tag_helper</span>(<span class="ruby-identifier">:text_field</span>, <span class="ruby-identifier">object_name</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000100" class="method-detail">
<a name="M000100"></a>
<div class="method-heading">
<a href="#M000100" class="method-signature">
<span class="method-name">pp_time_zone_select</span><span class="method-args">(object, method, priority_zones=nil, options={}, html_options={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000100-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_form_helper.rb, line 183</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pp_time_zone_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">priority_zones</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span>={}, <span class="ruby-identifier">html_options</span>={})
<span class="ruby-identifier">model</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:model</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">'model'</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">TimeZone</span>
<span class="ruby-identifier">collection</span> = <span class="ruby-identifier">model</span>.<span class="ruby-identifier">all</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">e</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">to_s</span>] }
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_pp_select</span>(<span class="ruby-identifier">object</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">collection</span>, <span class="ruby-identifier">priority_zones</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">html_options</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,349 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Helpers::RailsHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Helpers::RailsHelper</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
helper module for Ruby on Rails
</p>
<p>
howto:
</p>
<ol>
<li>add the folliwng code in your &#8216;config/environment.rb&#8216;
<pre>
require 'erubis/helpers/rails_helper'
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = false # set true for debugging
#Erubis::Helpers::RailsHelper.preprocessing = true # set true to enable preprocessing
</pre>
</li>
<li>restart web server.
</li>
</ol>
<p>
if Erubis::Helper::Rails.show_src is true, <a
href="../../Erubis.html">Erubis</a> prints converted Ruby code into log
file (&#8216;log/development.log&#8217; or so). if false, it doesn&#8216;t.
if nil, <a href="../../Erubis.html">Erubis</a> prints converted Ruby code
if ENV[&#8216;RAILS_ENV&#8217;] == &#8216;development&#8217;.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000066">engine_class</a>&nbsp;&nbsp;
<a href="#M000067">engine_class=</a>&nbsp;&nbsp;
<a href="#M000068">init_properties</a>&nbsp;&nbsp;
<a href="#M000069">init_properties=</a>&nbsp;&nbsp;
<a href="#M000072">preprocessing</a>&nbsp;&nbsp;
<a href="#M000073">preprocessing=</a>&nbsp;&nbsp;
<a href="#M000070">show_src</a>&nbsp;&nbsp;
<a href="#M000071">show_src=</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<div id="class-list">
<h3 class="section-bar">Classes and Modules</h3>
Module <a href="RailsHelper/TemplateConverter.html" class="link">Erubis::Helpers::RailsHelper::TemplateConverter</a><br />
</div>
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Class methods</h3>
<div id="method-M000066" class="method-detail">
<a name="M000066"></a>
<div class="method-heading">
<a href="#M000066" class="method-signature">
<span class="method-name">engine_class</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
@@<a href="RailsHelper.html#M000066">engine_class</a> = ::<a
href="../FastEruby.html">Erubis::FastEruby</a>
</p>
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000066-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000066-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 47</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class</span>
<span class="ruby-ivar">@@engine_class</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000067" class="method-detail">
<a name="M000067"></a>
<div class="method-heading">
<a href="#M000067" class="method-signature">
<span class="method-name">engine_class=</span><span class="method-args">(klass)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000067-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000067-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 50</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">engine_class=</span>(<span class="ruby-identifier">klass</span>)
<span class="ruby-ivar">@@engine_class</span> = <span class="ruby-identifier">klass</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000068" class="method-detail">
<a name="M000068"></a>
<div class="method-heading">
<a href="#M000068" class="method-signature">
<span class="method-name">init_properties</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000068-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000068-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 56</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init_properties</span>
<span class="ruby-ivar">@@init_properties</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000069" class="method-detail">
<a name="M000069"></a>
<div class="method-heading">
<a href="#M000069" class="method-signature">
<span class="method-name">init_properties=</span><span class="method-args">(hash)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000069-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000069-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 59</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">init_properties=</span>(<span class="ruby-identifier">hash</span>)
<span class="ruby-ivar">@@init_properties</span> = <span class="ruby-identifier">hash</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000072" class="method-detail">
<a name="M000072"></a>
<div class="method-heading">
<a href="#M000072" class="method-signature">
<span class="method-name">preprocessing</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000072-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000072-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 74</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocessing</span>
<span class="ruby-ivar">@@preprocessing</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000073" class="method-detail">
<a name="M000073"></a>
<div class="method-heading">
<a href="#M000073" class="method-signature">
<span class="method-name">preprocessing=</span><span class="method-args">(flag)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000073-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000073-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 77</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">preprocessing=</span>(<span class="ruby-identifier">flag</span>)
<span class="ruby-ivar">@@preprocessing</span> = <span class="ruby-identifier">flag</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000070" class="method-detail">
<a name="M000070"></a>
<div class="method-heading">
<a href="#M000070" class="method-signature">
<span class="method-name">show_src</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000070-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000070-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 65</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_src</span>
<span class="ruby-ivar">@@show_src</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000071" class="method-detail">
<a name="M000071"></a>
<div class="method-heading">
<a href="#M000071" class="method-signature">
<span class="method-name">show_src=</span><span class="method-args">(flag)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000071-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000071-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">show_src=</span>(<span class="ruby-identifier">flag</span>)
<span class="ruby-ivar">@@show_src</span> = <span class="ruby-identifier">flag</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::Helpers::RailsHelper::TemplateConverter</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::Helpers::RailsHelper::TemplateConverter</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../../../files/erubis/helpers/rails_helper_rb.html">
erubis/helpers/rails_helper.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000074">_create_preprocessor</a>&nbsp;&nbsp;
<a href="#M000076">_logger_info</a>&nbsp;&nbsp;
<a href="#M000077">_logger_info</a>&nbsp;&nbsp;
<a href="#M000075">_preprocessing_context_object</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000074" class="method-detail">
<a name="M000074"></a>
<div class="method-heading">
<a href="#M000074" class="method-signature">
<span class="method-name">_create_preprocessor</span><span class="method-args">(template)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000074-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000074-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 107</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_create_preprocessor</span>(<span class="ruby-identifier">template</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">PreprocessingEruby</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">template</span>, <span class="ruby-identifier">:escape=</span><span class="ruby-operator">&gt;</span><span class="ruby-keyword kw">true</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000076" class="method-detail">
<a name="M000076"></a>
<div class="method-heading">
<a href="#M000076" class="method-signature">
<span class="method-name">_logger_info</span><span class="method-args">(message)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000076-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 113</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_logger_info</span>(<span class="ruby-identifier">message</span>)
<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">message</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000077" class="method-detail">
<a name="M000077"></a>
<div class="method-heading">
<a href="#M000077" class="method-signature">
<span class="method-name">_logger_info</span><span class="method-args">(message)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000077-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 164</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_logger_info</span>(<span class="ruby-identifier">message</span>)
<span class="ruby-comment cmt">#logger.info message # logger.info seems not available in Rails 2.2</span>
<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info</span> <span class="ruby-identifier">message</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000075" class="method-detail">
<a name="M000075"></a>
<div class="method-heading">
<a href="#M000075" class="method-signature">
<span class="method-name">_preprocessing_context_object</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000075-source">
<pre>
<span class="ruby-comment cmt"># File erubis/helpers/rails_helper.rb, line 110</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_preprocessing_context_object</span>
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,306 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::InterpolationEnhancer</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::InterpolationEnhancer</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/enhancer_rb.html">
erubis/enhancer.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
<div id="description">
<p>
convert &quot;&lt;h1&gt;&lt;%=title%&gt;&lt;/h1&gt;&quot; into &quot;_buf
&lt;&lt; %Q`&lt;h1&gt;#{title}&lt;/h1&gt;`&quot;
</p>
<p>
this is only for <a href="Eruby.html">Eruby</a>.
</p>
</div>
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000200">_add_text_to_str</a>&nbsp;&nbsp;
<a href="#M000201">add_expr_escaped</a>&nbsp;&nbsp;
<a href="#M000202">add_expr_literal</a>&nbsp;&nbsp;
<a href="#M000199">add_text</a>&nbsp;&nbsp;
<a href="#M000198">convert_input</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000200" class="method-detail">
<a name="M000200"></a>
<div class="method-heading">
<a href="#M000200" class="method-signature">
<span class="method-name">_add_text_to_str</span><span class="method-args">(str, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000200-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000200-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 663</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/['\#\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">text</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000201" class="method-detail">
<a name="M000201"></a>
<div class="method-heading">
<a href="#M000201" class="method-signature">
<span class="method-name">add_expr_escaped</span><span class="method-args">(str, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000201-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000201-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 669</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\#{#{escaped_expr(code)}}&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000202" class="method-detail">
<a name="M000202"></a>
<div class="method-heading">
<a href="#M000202" class="method-signature">
<span class="method-name">add_expr_literal</span><span class="method-args">(str, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000202-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000202-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 673</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;\#{#{code}}&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000199" class="method-detail">
<a name="M000199"></a>
<div class="method-heading">
<a href="#M000199" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000199-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 652</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">text</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-comment cmt">#src &lt;&lt; &quot; _buf &lt;&lt; %Q`&quot; &lt;&lt; text &lt;&lt; &quot;`;&quot;</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">&quot;\\n&quot;</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; _buf &lt;&lt; %Q`&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;`\n&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot; _buf &lt;&lt; %Q`&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;`;&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000198" class="method-detail">
<a name="M000198"></a>
<div class="method-heading">
<a href="#M000198" class="method-signature">
<span class="method-name">convert_input</span><span class="method-args">(src, input)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000198-source">
<pre>
<span class="ruby-comment cmt"># File erubis/enhancer.rb, line 597</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">convert_input</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">input</span>)
<span class="ruby-identifier">pat</span> = <span class="ruby-ivar">@pattern</span>
<span class="ruby-identifier">regexp</span> = <span class="ruby-identifier">pat</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">pat</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'&lt;% %&gt;'</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Basic</span><span class="ruby-operator">::</span><span class="ruby-constant">Converter</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_REGEXP</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">pattern_regexp</span>(<span class="ruby-identifier">pat</span>)
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">is_bol</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-comment cmt"># is beginning of line</span>
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">input</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">regexp</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">tailch</span>, <span class="ruby-identifier">rspace</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">match</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>()
<span class="ruby-identifier">len</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>
<span class="ruby-identifier">text</span> = <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">len</span>]
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">match</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
<span class="ruby-identifier">ch</span> = <span class="ruby-identifier">indicator</span> <span class="ruby-value">? </span><span class="ruby-identifier">indicator</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
<span class="ruby-identifier">lspace</span> = <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">detect_spaces_at_bol</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">is_bol</span>)
<span class="ruby-identifier">is_bol</span> = <span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
<span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-comment cmt">## * when '&lt;%= %&gt;', do nothing</span>
<span class="ruby-comment cmt">## * when '&lt;% %&gt;' or '&lt;%# %&gt;', delete spaces iff only spaces are around '&lt;% %&gt;'</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?=</span> <span class="ruby-comment cmt"># &lt;%= %&gt;</span>
<span class="ruby-identifier">rspace</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tailch</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">tailch</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_expr</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">code</span>, <span class="ruby-identifier">indicator</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?\#</span> <span class="ruby-comment cmt"># &lt;%# %&gt;</span>
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">code</span>.<span class="ruby-identifier">count</span>(<span class="ruby-value str">&quot;\n&quot;</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">rspace</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt"># &lt;% %&gt;</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@trim</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-node">&quot;#{lspace}#{code}#{rspace}&quot;</span>)
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">lspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lspace</span>
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
<span class="ruby-identifier">str</span> = <span class="ruby-value str">''</span>
<span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">str</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">rspace</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rspace</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-comment cmt">#rest = $' || input # ruby1.8</span>
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">input</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">input</span>[<span class="ruby-identifier">pos</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-comment cmt"># ruby1.9</span>
<span class="ruby-identifier">_add_text_to_str</span>(<span class="ruby-identifier">str</span>, <span class="ruby-identifier">rest</span>)
<span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">str</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Class: Erubis::InterpolationEruby</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Class</strong></td>
<td class="class-name-in-header">Erubis::InterpolationEruby</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/enhanced_rb.html">
erubis/engine/enhanced.rb
</a>
<br />
</td>
</tr>
<tr class="top-aligned-row">
<td><strong>Parent:</strong></td>
<td>
<a href="Eruby.html">
Eruby
</a>
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="InterpolationEnhancer.html">InterpolationEnhancer</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,359 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::JavaGenerator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::JavaGenerator</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejava_rb.html">
erubis/engine/ejava.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000190">add_expr_debug</a>&nbsp;&nbsp;
<a href="#M000189">add_expr_escaped</a>&nbsp;&nbsp;
<a href="#M000188">add_expr_literal</a>&nbsp;&nbsp;
<a href="#M000191">add_postamble</a>&nbsp;&nbsp;
<a href="#M000184">add_preamble</a>&nbsp;&nbsp;
<a href="#M000187">add_stmt</a>&nbsp;&nbsp;
<a href="#M000186">add_text</a>&nbsp;&nbsp;
<a href="#M000185">escape_text</a>&nbsp;&nbsp;
<a href="#M000183">init_generator</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Generator.html">Generator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000190" class="method-detail">
<a name="M000190"></a>
<div class="method-heading">
<a href="#M000190" class="method-signature">
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000190-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; System.err.println(\&quot;*** debug: #{code}=\&quot;+(#{code}));&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000189" class="method-detail">
<a name="M000189"></a>
<div class="method-heading">
<a href="#M000189" class="method-signature">
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000189-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 64</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000188" class="method-detail">
<a name="M000188"></a>
<div class="method-heading">
<a href="#M000188" class="method-signature">
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000188-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000188-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 58</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; #{@buf}.append(#{code});&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000191" class="method-detail">
<a name="M000191"></a>
<div class="method-heading">
<a href="#M000191" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000191-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 74</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?;</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;return &quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;.toString();\n&quot;</span>
<span class="ruby-comment cmt">#src &lt;&lt; @indent &lt;&lt; &quot;System.out.print(&quot; &lt;&lt; @buf &lt;&lt; &quot;.toString());\n&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000184" class="method-detail">
<a name="M000184"></a>
<div class="method-heading">
<a href="#M000184" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000184-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000184-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 32</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@indent}#{@bufclass} #{@buf} = new #{@bufclass}();&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000187" class="method-detail">
<a name="M000187"></a>
<div class="method-heading">
<a href="#M000187" class="method-signature">
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000187-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000187-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 54</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000186" class="method-detail">
<a name="M000186"></a>
<div class="method-heading">
<a href="#M000186" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000186-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000186-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">:</span> <span class="ruby-value str">' '</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;.append(&quot;</span>
<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">' + '</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
<span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">line</span>) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&quot;'</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;);&quot;</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">text</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000185" class="method-detail">
<a name="M000185"></a>
<div class="method-heading">
<a href="#M000185" class="method-signature">
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000185-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000185-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 36</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
<span class="ruby-ivar">@@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">&quot;\r&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\r&quot;</span>, <span class="ruby-value str">&quot;\n&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\n&quot;</span>, <span class="ruby-value str">&quot;\t&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\t&quot;</span>, <span class="ruby-value str">'&quot;'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'\\&quot;'</span>, <span class="ruby-value str">&quot;\\&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\\\&quot;</span> }
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n\t&quot;\\]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@table_</span>[<span class="ruby-identifier">m</span>] } <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000183" class="method-detail">
<a name="M000183"></a>
<div class="method-heading">
<a href="#M000183" class="method-signature">
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000183-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000183-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejava.rb, line 24</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-keyword kw">super</span>
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'escape'</span>
<span class="ruby-ivar">@indent</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
<span class="ruby-ivar">@buf</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:buf</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'_buf'</span>
<span class="ruby-ivar">@bufclass</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:bufclass</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'StringBuffer'</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

View file

@ -0,0 +1,386 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Module: Erubis::JavascriptGenerator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
<script type="text/javascript">
// <![CDATA[
function popupCode( url ) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
function toggleCode( id ) {
if ( document.getElementById )
elem = document.getElementById( id );
else if ( document.all )
elem = eval( "document.all." + id );
else
return false;
elemStyle = elem.style;
if ( elemStyle.display != "block" ) {
elemStyle.display = "block"
} else {
elemStyle.display = "none"
}
return true;
}
// Make codeblocks hidden by default
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
// ]]>
</script>
</head>
<body>
<div id="classHeader">
<table class="header-table">
<tr class="top-aligned-row">
<td><strong>Module</strong></td>
<td class="class-name-in-header">Erubis::JavascriptGenerator</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
<a href="../../files/erubis/engine/ejavascript_rb.html">
erubis/engine/ejavascript.rb
</a>
<br />
</td>
</tr>
</table>
</div>
<!-- banner header -->
<div id="bodyContent">
<div id="contextContent">
</div>
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
<a href="#M000171">add_expr_debug</a>&nbsp;&nbsp;
<a href="#M000170">add_expr_escaped</a>&nbsp;&nbsp;
<a href="#M000169">add_expr_literal</a>&nbsp;&nbsp;
<a href="#M000166">add_indent</a>&nbsp;&nbsp;
<a href="#M000172">add_postamble</a>&nbsp;&nbsp;
<a href="#M000164">add_preamble</a>&nbsp;&nbsp;
<a href="#M000168">add_stmt</a>&nbsp;&nbsp;
<a href="#M000167">add_text</a>&nbsp;&nbsp;
<a href="#M000165">escape_text</a>&nbsp;&nbsp;
<a href="#M000163">init_generator</a>&nbsp;&nbsp;
</div>
</div>
</div>
<!-- if includes -->
<div id="includes">
<h3 class="section-bar">Included Modules</h3>
<div id="includes-list">
<span class="include-name"><a href="Generator.html">Generator</a></span>
</div>
</div>
<div id="section">
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
<div id="method-M000171" class="method-detail">
<a name="M000171"></a>
<div class="method-heading">
<a href="#M000171" class="method-signature">
<span class="method-name">add_expr_debug</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000171-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000171-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 72</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_debug</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;alert(\&quot;*** debug: #{code}=\&quot;+(#{code}));&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000170" class="method-detail">
<a name="M000170"></a>
<div class="method-heading">
<a href="#M000170" class="method-signature">
<span class="method-name">add_expr_escaped</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000170-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000170-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 68</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_escaped</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">escaped_expr</span>(<span class="ruby-identifier">code</span>))
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000169" class="method-detail">
<a name="M000169"></a>
<div class="method-heading">
<a href="#M000169" class="method-signature">
<span class="method-name">add_expr_literal</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000169-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000169-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 62</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expr_literal</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
<span class="ruby-identifier">code</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@buf}.push(#{code});&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000166" class="method-detail">
<a name="M000166"></a>
<div class="method-heading">
<a href="#M000166" class="method-signature">
<span class="method-name">add_indent</span><span class="method-args">(src, indent)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000166-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000166-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 41</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">indent</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">src</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">indent</span> <span class="ruby-operator">:</span> <span class="ruby-value str">' '</span>)
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000172" class="method-detail">
<a name="M000172"></a>
<div class="method-heading">
<a href="#M000172" class="method-signature">
<span class="method-name">add_postamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000172-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000172-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 78</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_postamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">src</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?;</span>
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@docwrite</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'document.write('</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;.join(\&quot;\&quot;));\n&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@indent</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;.join(\&quot;\&quot;);\n&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000164" class="method-detail">
<a name="M000164"></a>
<div class="method-heading">
<a href="#M000164" class="method-signature">
<span class="method-name">add_preamble</span><span class="method-args">(src)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000164-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000164-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 32</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_preamble</span>(<span class="ruby-identifier">src</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{@indent}var #{@buf} = [];&quot;</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000168" class="method-detail">
<a name="M000168"></a>
<div class="method-heading">
<a href="#M000168" class="method-signature">
<span class="method-name">add_stmt</span><span class="method-args">(src, code)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000168-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000168-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 58</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_stmt</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">code</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">code</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000167" class="method-detail">
<a name="M000167"></a>
<div class="method-heading">
<a href="#M000167" class="method-signature">
<span class="method-name">add_text</span><span class="method-args">(src, text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000167-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000167-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 45</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_text</span>(<span class="ruby-identifier">src</span>, <span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-identifier">add_indent</span>(<span class="ruby-identifier">src</span>, <span class="ruby-ivar">@indent</span>)
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@buf</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'.push(&quot;'</span>
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?\n</span>
<span class="ruby-identifier">s</span>[<span class="ruby-value">-2</span>, <span class="ruby-value">2</span>] = <span class="ruby-value str">''</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\&quot;);\n&quot;</span>
<span class="ruby-keyword kw">else</span>
<span class="ruby-identifier">src</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\&quot;);&quot;</span>
<span class="ruby-keyword kw">end</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000165" class="method-detail">
<a name="M000165"></a>
<div class="method-heading">
<a href="#M000165" class="method-signature">
<span class="method-name">escape_text</span><span class="method-args">(text)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000165-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000165-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 36</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_text</span>(<span class="ruby-identifier">text</span>)
<span class="ruby-ivar">@@table_</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">&quot;\r&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\r&quot;</span>, <span class="ruby-value str">&quot;\n&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\n\\\n&quot;</span>, <span class="ruby-value str">&quot;\t&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\t&quot;</span>, <span class="ruby-value str">'&quot;'</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">'\\&quot;'</span>, <span class="ruby-value str">&quot;\\&quot;</span>=<span class="ruby-operator">&gt;</span><span class="ruby-value str">&quot;\\\\&quot;</span> }
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">text</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[\r\n\t&quot;\\]/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@@table_</span>[<span class="ruby-identifier">m</span>] } <span class="ruby-operator">||</span> <span class="ruby-identifier">text</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
<div id="method-M000163" class="method-detail">
<a name="M000163"></a>
<div class="method-heading">
<a href="#M000163" class="method-signature">
<span class="method-name">init_generator</span><span class="method-args">(properties={})</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
onclick="toggleCode('M000163-source');return false;">[Source]</a></p>
<div class="method-source-code" id="M000163-source">
<pre>
<span class="ruby-comment cmt"># File erubis/engine/ejavascript.rb, line 24</span>
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">init_generator</span>(<span class="ruby-identifier">properties</span>={})
<span class="ruby-keyword kw">super</span>
<span class="ruby-ivar">@escapefunc</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">'escape'</span>
<span class="ruby-ivar">@indent</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:indent</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
<span class="ruby-ivar">@buf</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:out</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'_buf'</span>
<span class="ruby-ivar">@docwrite</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:docwrite</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">false</span> <span class="ruby-comment cmt"># '!= false' will be removed in the next release</span>
<span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more