fix table rows parsing in case row count is more than 2

#WEB-2414 fixed
This commit is contained in:
Dennis Ushakov
2014-01-31 02:51:10 +04:00
parent 10758ff5e0
commit 5a27ed342b

View File

@@ -248,11 +248,15 @@ public class HtmlParsing {
if (isOptionalTagEnd) {
boolean foundMatch = childTerminatesParentInStack(childName, true);
if (foundMatch) {
myTagMarkersStack.pop();
myTagNamesStack.pop();
// allow only one promotion per tag, otherwise last row in table
// will make it up to the first one moving all tags in between under first node
if (!canTerminate(childName, tagName)) {
myTagMarkersStack.pop();
myTagNamesStack.pop();
myTagMarkersStack.push(childMarker);
myTagNamesStack.push(childName);
myTagMarkersStack.push(childMarker);
myTagNamesStack.push(childName);
}
tag.doneBefore(XmlElementType.HTML_TAG, childMarker);
return true;
@@ -378,7 +382,7 @@ public class HtmlParsing {
}
private static boolean canTerminate(final String childTagName,final String tagName) {
return HtmlUtil.canTerminate(childTagName, tagName);
return childTagName.equals(tagName) || HtmlUtil.canTerminate(childTagName, tagName);
}
private boolean childTerminatesParentInStack(final String childName, final boolean terminateOnNonOptionalTag) {
@@ -393,7 +397,7 @@ public class HtmlParsing {
return false;
}
if (childName.equals(parentName) || canTerminate(childName, parentName)) {
if (canTerminate(childName, parentName)) {
return true;
}
}