// if (fCurrentPosition > 1) {
// addParagraph();
// }
// }
} else {
TagToken tag = fWikiModel.peekNode();
if (tag instanceof WPPreTag) {
addPreformattedText();
// } else if (tag instanceof PTag) {
// createContentToken(fWhiteStart,
// fWhiteStartPosition, 2);
// reduceTokenStack(Configuration.HTML_PARAGRAPH_OPEN);
} else {
String allowedParents = Configuration.HTML_PARAGRAPH_OPEN
.getParents();
if (allowedParents != null) {
int index = -1;
index = allowedParents.indexOf("|"
+ tag.getName() + "|");
if (index >= 0) {
addParagraph();
}
}
}
}
}
}
// ---------Identify the next token-------------
switch (fCurrentCharacter) {
case '[':
if (parseWikiLink()) {
continue;
}
break;
case '\'':
if (getNextChar('\'')) {
if (getNextChar('\'')) {
if (getNextChar('\'')) {
if (getNextChar('\'')) {
createContentToken(5);
return TokenBOLDITALIC;
}
fCurrentPosition -= 1;
fWhiteStart = true;
createContentToken(3);
return TokenBOLD;
}
createContentToken(3);
return TokenBOLD;
}
createContentToken(2);
return TokenITALIC;
}
break;
case '<':
if (fHtmlCodes) {
int htmlStartPosition = fCurrentPosition;
// HTML tags are allowed
try {
switch (fStringSource.charAt(fCurrentPosition)) {
case '!': // <!-- HTML comment -->
if (parseHTMLCommentTags()) {
continue;
}
break;
default:
if (fSource[fCurrentPosition] != '/') {
// opening HTML tag
WikiTagNode tagNode = parseTag(fCurrentPosition);
if (tagNode != null) {
String tagName = tagNode.getTagName();
TagToken tag = fWikiModel.getTokenMap()
.get(tagName);
if (tag != null) {
tag = (TagToken) tag.clone();
if (tag instanceof TagNode) {
TagNode node = (TagNode) tag;
List<NodeAttribute> attributes = tagNode
.getAttributesEx();
Attribute attr;
String temp;
for (int i = 1; i < attributes
.size(); i++) {
attr = attributes.get(i);
temp = attr.getValue();
if (temp != null) {
temp = parseNowiki(temp);
}
node.addAttribute(
attr.getName(),
temp, true);
}
}
if (tag instanceof HTMLTag) {
((HTMLTag) tag)
.setTemplate(isTemplate());
}
createContentToken(1);
fCurrentPosition = fScannerPosition;
String allowedParents = tag
.getParents();
if (allowedParents != null) {
fWikiModel
.reduceTokenStack(tag);
}
createTag(tag, tagNode,
tagNode.getEndPosition());
return TokenIgnore;
} else {
fCurrentPosition = tagNode.getEndPosition();
// fWhiteStart = true;
// skipUntilEndOfTag(tagNode,
// tagNode.getEndPosition());
// createContentToken(0);
// return TokenIgnore;
}
// break;
}
} else {
// closing HTML tag
WikiTagNode tagNode = parseTag(++fCurrentPosition);
if (tagNode != null) {
String tagName = tagNode.getTagName();
TagToken tag = fWikiModel.getTokenMap()
.get(tagName);
if (tag != null) {
createContentToken(2);
fCurrentPosition = fScannerPosition;
if (fWikiModel.stackSize() > 0) {
TagToken topToken = fWikiModel
.peekNode();
if (topToken.getName().equals(
tag.getName())) {
fWikiModel.popNode();
return TokenIgnore;
} else {
if (tag.isReduceTokenStack()) {