Update Vendored Erubis to 2.6.6
This commit is contained in:
parent
c18c2f988d
commit
39c2138f88
300 changed files with 207 additions and 171 deletions
53
vendor/plugins/erubis/examples/basic/Makefile
vendored
Normal file
53
vendor/plugins/erubis/examples/basic/Makefile
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
all = example.rb example.php example.c example.java example.scm example.pl example.js
|
||||
|
||||
all: $(all)
|
||||
|
||||
example.rb: example.eruby
|
||||
erubis -l ruby example.eruby > example.rb
|
||||
|
||||
|
||||
example.php: example.ephp
|
||||
erubis -l php example.ephp > example.php
|
||||
|
||||
example.c: example.ec
|
||||
erubis -bl c example.ec > example.c
|
||||
|
||||
example.java: example.ejava
|
||||
erubis -bl java example.ejava > example.java
|
||||
|
||||
example.scm: example.escheme
|
||||
erubis -l scheme --func=display example.escheme > example.scm
|
||||
# erubis -l scheme example.escheme > example.scm
|
||||
|
||||
example.pl: example.eperl
|
||||
erubis -l perl example.eperl > example.pl
|
||||
|
||||
example.js: example.ejs
|
||||
erubis -l javascript example.ejs > example.js
|
||||
|
||||
|
||||
###----------
|
||||
|
||||
src = example.eruby example.ephp example.ec example.ejava example.escheme example.eperl example.ejs Makefile
|
||||
|
||||
clean:
|
||||
rm -f `ruby -e 'puts(Dir.glob("*.*") - %w[$(src)])'`
|
||||
# rm -f $(all)
|
||||
|
||||
compile: example.bin example.class
|
||||
|
||||
example.bin: example.c
|
||||
cc -o example.bin example.c
|
||||
|
||||
example.class: example.java
|
||||
jikes example.java
|
||||
|
||||
output: $(all) example.bin example.class
|
||||
erubis example.eruby > example.ruby.out
|
||||
php example.php > example.php.out
|
||||
./example.bin '<aaa>' 'b&b' '"ccc"' > example.c.out
|
||||
java example > example.javexample.bin
|
||||
gosh example.scm > example.scm.out
|
||||
# guile example.scm > example.scm.out
|
||||
perl example.pl > example.pl.out
|
||||
|
42
vendor/plugins/erubis/examples/basic/example.ec
vendored
Normal file
42
vendor/plugins/erubis/examples/basic/example.ec
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<%
|
||||
#include <stdio.h>
|
||||
|
||||
void escape(char *str, FILE *out);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
%>
|
||||
<p>Hello <%== argv[0] %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% for (i = 1; i < argc; i++) { %>
|
||||
<tr bgcolor="<%= i % 2 == 0 ? "#FFCCCC" : "#CCCCFF" %>">
|
||||
<td><%= "%d", i %></td>
|
||||
<td><%== argv[i] %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void escape(char *str, FILE *out)
|
||||
{
|
||||
char *pch;
|
||||
for (pch = str; *pch != '\0'; pch++) {
|
||||
switch (*pch) {
|
||||
case '&': fputs("&", out); break;
|
||||
case '>': fputs(">", out); break;
|
||||
case '<': fputs("<", out); break;
|
||||
case '"': fputs(""", out); break;
|
||||
case '\'': fputs("'", out); break;
|
||||
default: fputc(*pch, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
%>
|
45
vendor/plugins/erubis/examples/basic/example.ejava
vendored
Normal file
45
vendor/plugins/erubis/examples/basic/example.ejava
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<%
|
||||
import java.util.*;
|
||||
|
||||
public class example {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String user = "Erubis";
|
||||
String[] list = { "<aaa>", "b&b", "\"ccc\"" };
|
||||
StringBuffer _buf = new StringBuffer();
|
||||
%>
|
||||
<p>Hello <%== user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% for (int i = 0; i < list.length; i++) { %>
|
||||
<tr bgcolor="<%= i % 2 == 0 ? "#FFCCCC" : "#CCCCFF" %>">
|
||||
<td><%= i + 1 %></td>
|
||||
<td><%== list[i] %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%
|
||||
System.out.print(_buf.toString());
|
||||
}
|
||||
|
||||
public static String escape(String s) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
switch (ch) {
|
||||
case '<': sb.append("<"); break;
|
||||
case '>': sb.append(">"); break;
|
||||
case '&': sb.append("&"); break;
|
||||
case '"': sb.append("""); break;
|
||||
default: sb.append(ch);
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String escape(int i) {
|
||||
return Integer.toString(i);
|
||||
}
|
||||
}
|
||||
%>
|
16
vendor/plugins/erubis/examples/basic/example.ejs
vendored
Normal file
16
vendor/plugins/erubis/examples/basic/example.ejs
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<%
|
||||
var user = 'Erubis';
|
||||
var list = ['<aaa>', 'b&b', '"ccc"'];
|
||||
%>
|
||||
<p>Hello <%= user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% var i; %>
|
||||
<% for (i = 0; i < list.length; i++) { %>
|
||||
<tr bgcolor="<%= i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
|
||||
<td><%= i + 1 %></td>
|
||||
<td><%= list[i] %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
16
vendor/plugins/erubis/examples/basic/example.eperl
vendored
Normal file
16
vendor/plugins/erubis/examples/basic/example.eperl
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<%
|
||||
my $user = 'Erubis';
|
||||
my @list = ('<aaa>', 'b&b', '"ccc"');
|
||||
%>
|
||||
<p>Hello <%== $user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% $i = 0; %>
|
||||
<% for $item (@list) { %>
|
||||
<tr bgcolor=<%= ++$i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
|
||||
<td><%= $i %></td>
|
||||
<td><%== $item %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
17
vendor/plugins/erubis/examples/basic/example.ephp
vendored
Normal file
17
vendor/plugins/erubis/examples/basic/example.ephp
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<%
|
||||
$user = "World";
|
||||
$list = array('<aaa>', 'b&b', '"ccc"');
|
||||
%>
|
||||
<p>Hello <%= $user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% $i = 0 %>
|
||||
<% foreach ($list as $item) { %>
|
||||
<% $i++; %>
|
||||
<tr bgcolor="<%= $i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
|
||||
<td><%= $i %></td>
|
||||
<td><%== $item %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
15
vendor/plugins/erubis/examples/basic/example.eruby
vendored
Normal file
15
vendor/plugins/erubis/examples/basic/example.eruby
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<%
|
||||
user = 'Erubis'
|
||||
list = ['<aaa>', 'b&b', '"ccc"']
|
||||
%>
|
||||
<p>Hello <%= user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<% list.each_with_index do |item, i| %>
|
||||
<tr bgcolor="<%= i % 2 == 0 ? '#FFCCCC' : '#CCCCFF' %>">
|
||||
<td><%= i + 1 %></td>
|
||||
<td><%== item %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
26
vendor/plugins/erubis/examples/basic/example.escheme
vendored
Normal file
26
vendor/plugins/erubis/examples/basic/example.escheme
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%
|
||||
(let ((user "Erubis")
|
||||
(items '("<aaa>" "b&b" "\"ccc\""))
|
||||
(i 0))
|
||||
%>
|
||||
<p>Hello <%= user %>!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<%
|
||||
(for-each
|
||||
(lambda (item)
|
||||
(set! i (+ i 1))
|
||||
%>
|
||||
<tr bgcolor="<%= (if (= (modulo i 2) 0) "#FFCCCC" "#CCCCFF") %>">
|
||||
<td><%= i %></td>
|
||||
<td><%= item %></td>
|
||||
</tr>
|
||||
<%
|
||||
) ; lambda end
|
||||
items) ; for-each end
|
||||
%>
|
||||
</tbody>
|
||||
</table>
|
||||
<%
|
||||
) ; let end
|
||||
%>
|
Loading…
Add table
Add a link
Reference in a new issue