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
54
vendor/plugins/erubis/examples/pi/Makefile
vendored
Normal file
54
vendor/plugins/erubis/examples/pi/Makefile
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
all = example.rb example.php example.c example.java example.scm example.pl example.js
|
||||
|
||||
all: $(all)
|
||||
|
||||
example.rb: example.eruby
|
||||
erubis --pi -l ruby example.eruby > example.rb
|
||||
|
||||
|
||||
example.php: example.ephp
|
||||
erubis --pi -l php example.ephp > example.php
|
||||
|
||||
example.c: example.ec
|
||||
erubis --pi -bl c example.ec > example.c
|
||||
|
||||
example.java: example.ejava
|
||||
erubis --pi -bl java example.ejava > example.java
|
||||
|
||||
example.scm: example.escheme
|
||||
erubis --pi -l scheme --func=display example.escheme > example.scm
|
||||
# erubis --pi -l scheme example.escheme > example.scm
|
||||
|
||||
example.pl: example.eperl
|
||||
erubis --pi -l perl example.eperl > example.pl
|
||||
|
||||
example.js: example.ejs
|
||||
erubis --pi -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 --pi example.eruby > example.ruby.result
|
||||
#ruby example.rb > example.ruby.result
|
||||
php example.php > example.php.result
|
||||
./example.bin '<aaa>' 'b&b' '"ccc"' > example.c.result
|
||||
java example > example.java.result
|
||||
gosh example.scm > example.scm.result
|
||||
#guile example.scm > example.scm.result
|
||||
perl example.pl > example.pl.result
|
||||
|
42
vendor/plugins/erubis/examples/pi/example.ec
vendored
Normal file
42
vendor/plugins/erubis/examples/pi/example.ec
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?c
|
||||
#include <stdio.h>
|
||||
|
||||
void escape(char *str, FILE *out);
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
?>
|
||||
<p>Hello @!{argv[0]}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?c for (i = 1; i < argc; i++) { ?>
|
||||
<tr bgcolor="@{i % 2 == 0 ? "#FFCCCC" : "#CCCCFF"}@">
|
||||
<td>@!{"%d", i}@</td>
|
||||
<td>@{argv[i]}@</td>
|
||||
</tr>
|
||||
<?c } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?c
|
||||
|
||||
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/pi/example.ejava
vendored
Normal file
45
vendor/plugins/erubis/examples/pi/example.ejava
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?java
|
||||
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>
|
||||
<?java for (int i = 0; i < list.length; i++) { ?>
|
||||
<tr bgcolor="@{i % 2 == 0 ? "#FFCCCC" : "#CCCCFF"}@">
|
||||
<td>@!{i + 1}@</td>
|
||||
<td>@{list[i]}@</td>
|
||||
</tr>
|
||||
<?java } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?java
|
||||
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/pi/example.ejs
vendored
Normal file
16
vendor/plugins/erubis/examples/pi/example.ejs
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?js
|
||||
var user = 'Erubis';
|
||||
var list = ['<aaa>', 'b&b', '"ccc"'];
|
||||
?>
|
||||
<p>Hello @{user}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?js var i; ?>
|
||||
<?js for (i = 0; i < list.length; i++) { ?>
|
||||
<tr bgcolor="@{i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'}@">
|
||||
<td>@{i + 1}@</td>
|
||||
<td>@{list[i]}@</td>
|
||||
</tr>
|
||||
<?js } ?>
|
||||
</tbody>
|
||||
</table>
|
16
vendor/plugins/erubis/examples/pi/example.eperl
vendored
Normal file
16
vendor/plugins/erubis/examples/pi/example.eperl
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?perl
|
||||
my $user = 'Erubis';
|
||||
my @list = ('<aaa>', 'b&b', '"ccc"');
|
||||
?>
|
||||
<p>Hello @{$user}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?perl $i = 0; ?>
|
||||
<?perl for $item (@list) { ?>
|
||||
<tr bgcolor=@!{++$i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'}@">
|
||||
<td>@!{$i}@</td>
|
||||
<td>@{$item}@</td>
|
||||
</tr>
|
||||
<?perl } ?>
|
||||
</tbody>
|
||||
</table>
|
17
vendor/plugins/erubis/examples/pi/example.ephp
vendored
Normal file
17
vendor/plugins/erubis/examples/pi/example.ephp
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
$user = "World";
|
||||
$list = array('<aaa>', 'b&b', '"ccc"');
|
||||
?>
|
||||
<p>Hello @{$user}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?php $i = 0 ?>
|
||||
<?php foreach ($list as $item) { ?>
|
||||
<?php $i++; ?>
|
||||
<tr bgcolor="@!{$i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'}@">
|
||||
<td>@!{$i}@</td>
|
||||
<td>@{$item}@</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
15
vendor/plugins/erubis/examples/pi/example.eruby
vendored
Normal file
15
vendor/plugins/erubis/examples/pi/example.eruby
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?rb
|
||||
user = 'Erubis'
|
||||
list = ['<aaa>', 'b&b', '"ccc"']
|
||||
?>
|
||||
<p>Hello @{user}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?rb list.each_with_index do |item, i| ?>
|
||||
<tr bgcolor="@!{i % 2 == 0 ? '#FFCCCC' : '#CCCCFF'}@">
|
||||
<td>@!{i + 1}@</td>
|
||||
<td>@{item}@</td>
|
||||
</tr>
|
||||
<?rb end ?>
|
||||
</tbody>
|
||||
</table>
|
26
vendor/plugins/erubis/examples/pi/example.escheme
vendored
Normal file
26
vendor/plugins/erubis/examples/pi/example.escheme
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?scheme
|
||||
(let ((user "Erubis")
|
||||
(items '("<aaa>" "b&b" "\"ccc\""))
|
||||
(i 0))
|
||||
?>
|
||||
<p>Hello @!{user}@!</p>
|
||||
<table>
|
||||
<tbody>
|
||||
<?scheme
|
||||
(for-each
|
||||
(lambda (item)
|
||||
(set! i (+ i 1))
|
||||
?>
|
||||
<tr bgcolor="@!{(if (= (modulo i 2) 0) "#FFCCCC" "#CCCCFF")}@">
|
||||
<td>@!{i}@</td>
|
||||
<td>@!{item}@</td>
|
||||
</tr>
|
||||
<?scheme
|
||||
) ; lambda end
|
||||
items) ; for-each end
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?scheme
|
||||
) ; let end
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue