}
private boolean createBBCode(String bbStr, String bbAttr, String innerTag) {
if (bbStr.equals("code")) {
TagNode preTagNode = new TagNode("pre");
preTagNode.addAttribute("class", "code", true);
preTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(preTagNode);
return true;
} else if (bbStr.equals("color")) {
if (bbAttr == null) {
return false;
}
TagNode fontTagNode = new TagNode("font");
fontTagNode.addAttribute("color", bbAttr, true);
fontTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(fontTagNode);
return true;
} else if (bbStr.equals("email")) {
TagNode aTagNode = new TagNode("a");
aTagNode.addAttribute("href", "emailto:" + innerTag.trim(), true);
aTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(aTagNode);
return true;
} else if (bbStr.equals("list")) {
int listStart = 0;
int listEnd = 0;
TagNode listTagNode;
if (bbAttr != null) {
if (bbAttr.equals("a")) {
listTagNode = new TagNode("ul");
} else {
listTagNode = new TagNode("ol");
}
} else {
listTagNode = new TagNode("ul");
}
fWikiModel.pushNode(listTagNode);
try {
while (listEnd >= 0) {
listEnd = innerTag.indexOf("[*]", listStart);
if (listEnd > listStart) {
if (listStart == 0) {
parseNextPHPBBCode(innerTag.substring(0, listEnd));
// fWikiModel.append(new ContentToken(innerTag.substring(0,
// listEnd)));
} else {
listTagNode = new TagNode("li");
fWikiModel.pushNode(listTagNode);
try {
parseNextPHPBBCode(innerTag.substring(listStart, listEnd));
// listTagNode.addChild(new
// ContentToken(innerTag.substring(listStart, listEnd)));
} finally {
fWikiModel.popNode();
}
}
listStart = listEnd + 3;
}
}
if (listStart == 0) {
parseNextPHPBBCode(innerTag);
// fWikiModel.append(new ContentToken(innerTag));
} else {
if (listStart < innerTag.length()) {
listTagNode = new TagNode("li");
fWikiModel.pushNode(listTagNode);
try {
parseNextPHPBBCode(innerTag.substring(listStart, innerTag.length()));
// listTagNode.addChild(new
// ContentToken(innerTag.substring(listStart,
// innerTag.length())));
// fWikiModel.append(listTagNode);
} finally {
fWikiModel.popNode();
}
}
}
} finally {
fWikiModel.popNode();
}
return true;
} else if (bbStr.equals("img")) {
TagNode imgTagNode = new TagNode("img");
imgTagNode.addAttribute("src", innerTag.trim(), true);
imgTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(imgTagNode);
return true;
} else if (bbStr.equals("quote")) {
TagNode quoteTagNode = new TagNode("blockquote");
// quoteTagNode.addChild(new ContentToken(innerTag));
fWikiModel.pushNode(quoteTagNode);
try {
parseNextPHPBBCode(innerTag);
} finally {
fWikiModel.popNode();
}
return true;
} else if (bbStr.equals("size")) {
if (bbAttr == null) {
return false;
}
TagNode fontTagNode = new TagNode("font");
fontTagNode.addAttribute("size", bbAttr, true);
fontTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(fontTagNode);
return true;
} else if (bbStr.equals("url")) {
if (bbAttr != null) {
TagNode aTagNode = new TagNode("a");
aTagNode.addAttribute("href", bbAttr, true);
aTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(aTagNode);
return true;
} else {
TagNode aTagNode = new TagNode("a");
aTagNode.addAttribute("href", innerTag.trim(), true);
aTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(aTagNode);
return true;
}
} else if (bbStr.equals("b")) {
TagNode boldTagNode = new TagNode("b");
boldTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(boldTagNode);
return true;
} else if (bbStr.equals("i")) {
TagNode italicTagNode = new TagNode("i");
italicTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(italicTagNode);
return true;
} else if (bbStr.equals("u")) {
TagNode underlineTagNode = new TagNode("u");
underlineTagNode.addChild(new ContentToken(innerTag));
fWikiModel.append(underlineTagNode);
return true;
}
return false;