Refactoring separator

This commit is contained in:
Georgy Litvinov 2021-03-13 15:38:54 +01:00
parent c2953f7f68
commit 9a66e68dca

View file

@ -2,7 +2,6 @@ package w2phtml.xhtml.content;
import static w2phtml.util.Misc.*; import static w2phtml.util.Misc.*;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import org.w3c.dom.Document; import org.w3c.dom.Document;
@ -22,7 +21,6 @@ public class Separator {
private static final String COMMENT_END = "</Description>"; private static final String COMMENT_END = "</Description>";
public Node currentComment = null; public Node currentComment = null;
private static final String NONE = "none"; private static final String NONE = "none";
private static final String SECTIONS = "sections";
private static final String DIV = "div"; private static final String DIV = "div";
private int splitLevel = 0; private int splitLevel = 0;
private boolean alignSplitToPages; private boolean alignSplitToPages;
@ -41,7 +39,6 @@ public class Separator {
private static Converter converter = null; private static Converter converter = null;
private Node prevPageContainer = null; private Node prevPageContainer = null;
private PageContainer pageContainer = null; private PageContainer pageContainer = null;
private Node metadataComment = null;
public Separator(XhtmlConfig config, Converter converter) { public Separator(XhtmlConfig config, Converter converter) {
this.converter = converter; this.converter = converter;
@ -264,7 +261,7 @@ public class Separator {
if (prevPageContainer != null && alignSplitToPages) { if (prevPageContainer != null && alignSplitToPages) {
alignFilesByHeadings(node, curPageNum); alignFilesByHeadings(node, curPageNum);
} }
breakPage(node, curPageNum); insertPageBreak(node, curPageNum);
Document doc = node.getOwnerDocument(); Document doc = node.getOwnerDocument();
Element openBlock = (Element) doc.createElement(DIV); Element openBlock = (Element) doc.createElement(DIV);
openBlock.setAttribute("class", "pageNum"); openBlock.setAttribute("class", "pageNum");
@ -275,7 +272,7 @@ public class Separator {
return openBlock; return openBlock;
} }
private void breakPage(Node node, int curPageNum) { private void insertPageBreak(Node node, int curPageNum) {
if (pageNumber != null && pageNumber != curPageNum) { if (pageNumber != null && pageNumber != curPageNum) {
Document doc = node.getOwnerDocument(); Document doc = node.getOwnerDocument();
Element pageBreak = (Element) doc.createElement(DIV); Element pageBreak = (Element) doc.createElement(DIV);