fix: Store break before next node for nested nodes processing
This commit is contained in:
parent
34fc3f506c
commit
a43e8803cb
1 changed files with 7 additions and 2 deletions
|
@ -28,6 +28,7 @@ package w2phtml.xhtml.content;
|
|||
import static w2phtml.office.XMLString.*;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
@ -111,6 +112,7 @@ public class TextParser extends Parser {
|
|||
|
||||
private boolean pagination = config.pagination();
|
||||
private boolean breakPageBeforeNextNode = false;
|
||||
private Stack<Boolean> breakBeforeStack = null;
|
||||
private boolean inTable = false;
|
||||
private boolean inList = false;
|
||||
private boolean inFootnote = false;
|
||||
|
@ -142,6 +144,7 @@ public class TextParser extends Parser {
|
|||
applyAnnotationMetadata = config.useAnnotationMetadata();
|
||||
pageContainer = converter.pageContainer;
|
||||
docSep = new Separator(config, converter);
|
||||
breakBeforeStack = new Stack<Boolean>();
|
||||
}
|
||||
|
||||
/** Converts an office node as a complete text document
|
||||
|
@ -262,8 +265,9 @@ public class TextParser extends Parser {
|
|||
NodeList nList = onode.getChildNodes();
|
||||
int nLen = nList.getLength();
|
||||
int i = 0;
|
||||
//hard Break after marker
|
||||
breakPageBeforeNextNode = false;
|
||||
//hard Break after marker
|
||||
breakBeforeStack.push(breakPageBeforeNextNode);
|
||||
breakPageBeforeNextNode = false;
|
||||
while (i < nLen) {
|
||||
Node child = nList.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
@ -390,6 +394,7 @@ public class TextParser extends Parser {
|
|||
}
|
||||
i++;
|
||||
}
|
||||
breakPageBeforeNextNode = breakBeforeStack.pop();
|
||||
return hnode;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue