fix: correct splitting of nested lists with soft page breaks
This commit is contained in:
parent
5f1b0bd3d8
commit
253007416e
5 changed files with 74 additions and 3 deletions
|
@ -38,8 +38,11 @@ public class ListItemSplitter extends BasicSplitter implements ISplitter {
|
|||
listItem.removeChild(listItemChild);
|
||||
//System.out.println("LIST ITEM SPLITTER REMOVE SPB");
|
||||
} else if (nodeName.equals(TEXT_LIST)) {
|
||||
factory.split(listItemChild);
|
||||
|
||||
SplitResults listSplitResults = factory.split(listItemChild);
|
||||
if (listSplitResults.isDataMoved()) {
|
||||
listItemFirstPart.appendChild(listSplitResults.getFirstPart());
|
||||
results.setDataMoved(true);
|
||||
}
|
||||
} else if (nodeName.equals(TEXT_H) || nodeName.equals(TEXT_P)) {
|
||||
if (factory.split(listItemChild).isDataMoved()){
|
||||
listItemFirstPart.appendChild(listItemChild.getPreviousSibling());
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package w2phtml.regressionTests.html5;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SoftPageBreakInListTest {
|
||||
@Test
|
||||
@DisplayName("Soft page break in list")
|
||||
void testExample() throws Exception {
|
||||
String name = "spb_in_list";
|
||||
File input = new File("./testdocuments/input/" + name + ".odt");
|
||||
assertTrue(input.exists());
|
||||
List<String> arguments = new ArrayList<String>();
|
||||
arguments.add("-page_break_style");
|
||||
arguments.add("height:3em;margin-top:1em;margin-bottom:1em;background-color:red;");
|
||||
arguments.add("-html5");
|
||||
arguments.add("./testdocuments/input/" + name + ".odt");
|
||||
arguments.add("./testdocuments/output/" + name + ".html");
|
||||
w2phtml.Application.main(arguments.toArray(new String[0]));
|
||||
File result = new File("./testdocuments/output/" + name + ".html");
|
||||
File model = new File("./testdocuments/model/" + name + ".html");
|
||||
assertTrue(FileUtils.contentEquals(result, model), "The files differ!");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue