Removed page splitting via html comments
This commit is contained in:
parent
f95a208d08
commit
52875e6d5d
3 changed files with 10 additions and 32 deletions
|
@ -159,7 +159,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
private static final int DIRECTORY_ICON = 57;
|
||||
private static final int DOCUMENT_ICON = 58;
|
||||
private static final int HEADING_TAGS = 59;
|
||||
private static final int PAGE_TAGS = 60;
|
||||
private static final int PAGINATION = 60;
|
||||
private static final int MIN_LETTER_SPACING = 61;
|
||||
private static final int PAGE_BREAK_STYLE = 62;
|
||||
private static final int ALIGN_SPLITS_TO_PAGES = 63;
|
||||
|
@ -288,7 +288,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
options[DIRECTORY_ICON] = new Option("directory_icon","");
|
||||
options[DOCUMENT_ICON] = new Option("document_icon","");
|
||||
options[HEADING_TAGS] = new Option("heading_tags","sections");
|
||||
options[PAGE_TAGS] = new Option("page_tags","div");
|
||||
options[PAGINATION] = new BooleanOption("pagination","true");
|
||||
options[MIN_LETTER_SPACING] = new Option("min_letter_spacing","0.15");
|
||||
options[PAGE_BREAK_STYLE] = new Option("page_break_style","");
|
||||
options[CSS_INLINE] = new BooleanOption("css_inline","true");
|
||||
|
@ -443,7 +443,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
return options[HEADING_TAGS].getString(); }
|
||||
public boolean getAlignSplitsToPages() { return ((BooleanOption) options[ALIGN_SPLITS_TO_PAGES]).getValue(); }
|
||||
|
||||
public String getPageTags() { return options[PAGE_TAGS].getString(); }
|
||||
public boolean pagination() { return ((BooleanOption) options[PAGINATION]).getValue(); }
|
||||
public String getMinLetterSpacing() { return ( options[MIN_LETTER_SPACING]).getString(); }
|
||||
public String getPageBreakStyle() { return ( options[PAGE_BREAK_STYLE]).getString(); }
|
||||
|
||||
|
|
|
@ -32,17 +32,15 @@ public class Separator {
|
|||
//headings none
|
||||
private static String headingSeparation = "sections";
|
||||
//sections div none
|
||||
private static String pageSeparation = "sections";
|
||||
private static boolean pagination;
|
||||
private static Converter converter = null;
|
||||
private XhtmlConfig config = null;
|
||||
private Node prevPageContainer = null;
|
||||
private PageContainer pageContainer = null;
|
||||
|
||||
public Separator(XhtmlConfig config,Converter converter) {
|
||||
this.config = config;
|
||||
this.converter = converter;
|
||||
headingSeparation = config.getHeadingTags();
|
||||
pageSeparation = config.getPageTags();
|
||||
pagination = config.pagination();
|
||||
splitLevel = config.getXhtmlSplitLevel();
|
||||
alignSplitToPages = config.getAlignSplitsToPages();
|
||||
breakStyle = config.getPageBreakStyle();
|
||||
|
@ -262,14 +260,6 @@ public class Separator {
|
|||
return title;
|
||||
}
|
||||
|
||||
|
||||
private static void openPageComment(Node hnode, Integer pageNum){
|
||||
Document doc = hnode.getOwnerDocument();
|
||||
Node openSection = doc.createComment(openPageCommentText(pageNum));
|
||||
// insert open section comment before header node
|
||||
hnode.appendChild(openSection);
|
||||
}
|
||||
|
||||
private static void openCommentHeading(Node hnode, String title){
|
||||
Document doc = hnode.getOwnerDocument();
|
||||
Node openSection = doc.createComment(openHeadingCommentText(title));
|
||||
|
@ -302,15 +292,7 @@ public class Separator {
|
|||
return hnode;
|
||||
}
|
||||
hnode = exitPageContainer(hnode);
|
||||
if (pageSeparation.equals(SECTIONS)){
|
||||
//If section is empty. In case we are closing section
|
||||
// the last comment is opened page section
|
||||
if (hnode.getLastChild().getNodeType() == Node.COMMENT_NODE){
|
||||
hnode.removeChild(hnode.getLastChild());
|
||||
} else {
|
||||
addCloseComment(hnode);
|
||||
}
|
||||
} else if (pageSeparation.equals(DIV)){
|
||||
if (pagination){
|
||||
hnode = exitPageDiv(hnode);
|
||||
}
|
||||
pageOpened = false;
|
||||
|
@ -320,11 +302,7 @@ public class Separator {
|
|||
if (pageOpened == true) {
|
||||
return hnode;
|
||||
}
|
||||
if (pageSeparation.equals(SECTIONS)){
|
||||
openPageComment(hnode, pageNum);
|
||||
pageOpened = true;
|
||||
}
|
||||
else if (pageSeparation.equals(DIV)){
|
||||
if (pagination){
|
||||
hnode = openPageDiv(hnode, pageNum);
|
||||
pageOpened = true;
|
||||
}
|
||||
|
@ -363,7 +341,7 @@ public class Separator {
|
|||
return headingSeparation.equals(NONE);
|
||||
}
|
||||
private static boolean noPageSeparation() {
|
||||
return pageSeparation.equals(NONE);
|
||||
return !pagination;
|
||||
}
|
||||
private static String openHeadingCommentText(String title) {
|
||||
String comment = "<Section>\n<Description>\n<Metadata name=\"Title\">" + title
|
||||
|
|
|
@ -116,7 +116,7 @@ public class TextParser extends Parser {
|
|||
private String nextMasterPage = null;
|
||||
|
||||
private String headingTags = config.getHeadingTags();
|
||||
private String pageSeparator = config.getPageTags();
|
||||
private boolean pagination = config.pagination();
|
||||
private boolean breakBeforeNextNode = false;
|
||||
private boolean inTable = false;
|
||||
private boolean inList = false;
|
||||
|
@ -173,7 +173,7 @@ public class TextParser extends Parser {
|
|||
}
|
||||
//Split pages
|
||||
|
||||
if (!pageSeparator.equals("none")) {
|
||||
if (pagination) {
|
||||
onode = (Element) ODFPageSplitter.splitText(onode,ofr);
|
||||
}
|
||||
hnode = (Element)traverseBlockText(onode,hnode);
|
||||
|
|
Loading…
Add table
Reference in a new issue