Refactoring Separator

This commit is contained in:
Georgy Litvinov 2021-03-13 16:10:36 +01:00
parent 29d275e26d
commit f223b2ef9b

View file

@ -4,6 +4,8 @@ import static w2phtml.util.Misc.*;
import java.util.LinkedList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@ -39,6 +41,7 @@ public class Separator {
private static Converter converter = null;
private Node prevPageContainer = null;
private PageContainer pageContainer = null;
private static final Logger logger = LoggerFactory.getLogger(Separator.class);
public Separator(XhtmlConfig config, Converter converter) {
this.converter = converter;
@ -157,9 +160,27 @@ public class Separator {
}
private boolean noSplitNeeded(int pageNum, int curLevel) {
return !greenstoneSeparation && !pagination && !isSplitTime(curLevel,pageNum);
return !greenstoneSeparation && !needPageSplits() && !isSplitTime(curLevel,pageNum);
}
private boolean needChapterSplits() {
if (greenstoneSeparation) {
return true;
}
if (rdfSeparation) {
return true;
}
return false;
}
private boolean needPageSplits() {
if (pagination) {
return true;
}
return false;
}
private void addToCommentStack(String sLevel) {
greenstoneStack.offerFirst(Integer.parseInt(sLevel));
}