/usr/share/doc/ruby-erubis/examples/pi/example.ejava is in ruby-erubis 2.7.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 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);
}
}
?>
|