/*
* Public Methods
*/
public static HtmlPage decorate(BufferedReader in, HtmlContentGenerator contentPrinters) throws org.dbwiki.exception.WikiException {
HtmlPage page = new HtmlPage();
boolean skipping = false;
String line;
try {
while ((line = in.readLine()) != null) {
if ((!skipping) && (line.trim().startsWith(ContentIndicator))) {
String indention = line.substring(0, line.indexOf(ContentIndicator));
String key = line.trim().substring(ContentIndicator.length());
Vector<String> args = null;
int pos = key.indexOf("(");
if (pos != -1) {
args = getArguments(key, pos);
key = key.substring(0, pos).trim();
}
contentPrinters.print(key, args, page, indention);
} else if ((!skipping) && (line.trim().startsWith(ConditionIndicator)) && (line.trim().endsWith(ConditionStart))) {
String condition = line.trim().substring(ConditionIndicator.length()).trim();
if (condition.startsWith(ContentIndicator)) {
String key = condition.substring(ContentIndicator.length(), condition.length() - ConditionStart.length()).trim();
skipping = !contentPrinters.contains(key);
}
} else if (line.trim().equals(ConditionEnd)) {
skipping = false;
} else if (!skipping) {
page.add(line);
}
}
in.close();
} catch (java.io.IOException ioException) {
throw new WikiFatalException(ioException);