Move first part of list in section splitting to section first part and remove SPB inserted in list splitter. Previous behaviour led to wrong pagination.
This commit is contained in:
parent
893e09c916
commit
001fbd2acc
3 changed files with 35 additions and 3 deletions
src/main/java/w2phtml/pageSplitters
|
@ -32,7 +32,7 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
|
|||
Element softPageBreak = document.createElement(TEXT_SOFT_PAGE_BREAK);
|
||||
Node nextPageItemPart = null;
|
||||
int i = 0;
|
||||
SplitResults results = new SplitResults(false);
|
||||
SplitResults results = new SplitResults(false,listFirstPart);
|
||||
while (listNodes.getLength() > i) {
|
||||
Node child = listNodes.item(i);
|
||||
if (child.getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
@ -79,6 +79,7 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
|
|||
((Element) list).setAttribute(TEXT_CONTINUE_NUMBERING, "true");
|
||||
parent.insertBefore(listFirstPart, list);
|
||||
parent.insertBefore(softPageBreak, list);
|
||||
results.setSPB(softPageBreak);
|
||||
// System.out.println("LIST FIRST PART");
|
||||
// Debug.printNode(listFirstPart);
|
||||
// TODO: Create dummy list style to override list item to not teleport
|
||||
|
|
|
@ -62,8 +62,14 @@ public class SectionSplitter extends BasicSplitter implements ISplitter {
|
|||
results.setDataMoved(true);
|
||||
}
|
||||
} else if (nodeName.equals(TEXT_LIST)) {
|
||||
if (factory.split(child).isDataMoved()){
|
||||
results.setDataMoved(true);
|
||||
SplitResults listSplitResults = factory.split(child);
|
||||
if (listSplitResults.isDataMoved()){
|
||||
results.setDataMoved(true);
|
||||
sectionFirstPart.appendChild(listSplitResults.getFirstPart());
|
||||
Node textListSpb = listSplitResults.getSPB();
|
||||
if (textListSpb != null) {
|
||||
textListSpb.getParentNode().removeChild(textListSpb);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Error. SPB in Section child node " + nodeName);
|
||||
|
|
|
@ -1,13 +1,23 @@
|
|||
package w2phtml.pageSplitters;
|
||||
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
public class SplitResults {
|
||||
|
||||
private boolean dataMoved;
|
||||
private Node firstPart;
|
||||
private Node SPB;
|
||||
|
||||
|
||||
public SplitResults(boolean dataMoved) {
|
||||
this.setDataMoved(dataMoved);
|
||||
this.firstPart = null;
|
||||
}
|
||||
public SplitResults(boolean dataMoved, Node firstPart) {
|
||||
this.setDataMoved(dataMoved);
|
||||
this.firstPart = firstPart;
|
||||
}
|
||||
|
||||
|
||||
public boolean isDataMoved() {
|
||||
return dataMoved;
|
||||
|
@ -16,4 +26,19 @@ public class SplitResults {
|
|||
public void setDataMoved(boolean dataMoved) {
|
||||
this.dataMoved = dataMoved;
|
||||
}
|
||||
|
||||
public Node getFirstPart() {
|
||||
return firstPart;
|
||||
}
|
||||
|
||||
public void setFirstPart(Node firstPart) {
|
||||
this.firstPart = firstPart;
|
||||
}
|
||||
public Node getSPB() {
|
||||
return SPB;
|
||||
}
|
||||
public void setSPB(Node sPB) {
|
||||
SPB = sPB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue