");
out.println("Oh .. i like these so much that i have read these episodes several times,");
out.println("and everytime i enjoy the philosophy of The Simpsons and skill of the narrator.");
out.println("
The following links bring up pages with script (dialogues and story) for some episodes.");
out.println("The original plain text scripts are written by Matt Groening.");
out.println("I have written a small program to convert the scripts into html pages.");
out.println("
");
out.println("
");
out.println("
");
out.println("");
Simpsons2 s = new Simpsons2();
for (String line;(line = br.readLine()) != null;) {
// trace ("processsing:"+line);
int i = line.lastIndexOf("\\");
int k = line.indexOf(".");
String base = line.substring(i+1, k);
String title = s.process(base);
out.println("
");
out.close();
br.close();
}
public String process (String file) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(file +".txt"));
PrintWriter out = new PrintWriter (new FileWriter (file+".htm"));
out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
// title
String line = br.readLine();
Pattern p = Pattern.compile("\\[.*\\]\\s");
Matcher m = p.matcher(line);
String title = "No Title";
if(m.find()) {
title = line.substring(m.end());
}
out.println("
");
for (;(line = br.readLine()) != null;) {
if (line.startsWith("> Quotes")||line.startsWith("> Dialogue")) {
break;
}
}
line = br.readLine();
line = br.readLine(); // % H = Homer, M = Marge, B = Bart, L = Lisa, A = Maggie
p = Pattern.compile(", ");
if (line== null) {
trace("line=null");
}
String[] actors = p.split(line.substring(2));
HashMap map = new HashMap();
for(int i=0; i
");
for (;(line = br.readLine()) != null;) {
if (line.startsWith("====")) {
break;
} else if (line.trim().length() < 2) {
continue;
} else if(line.startsWith("% [End of Act") || line.startsWith("% [End Act")) {
out.println("
");
} else if (line.startsWith("%")) {
out.println("
"+line.substring(1).trim()+"
");
} else if (line.charAt(1) == ':') {
String actor = (String) map.get(""+line.charAt(0));
out.println("