diff --git a/source/java/writer2latex/xhtml/GreenstoneTags.java b/source/java/writer2latex/xhtml/GreenstoneTags.java index e588dbf..7c4b665 100644 --- a/source/java/writer2latex/xhtml/GreenstoneTags.java +++ b/source/java/writer2latex/xhtml/GreenstoneTags.java @@ -33,7 +33,6 @@ public class GreenstoneTags { //Get outline level String sLevel = Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL); if (sLevel == null || sLevel.isEmpty()) { - System.out.println("Error occurred. Expected Outline level here!"); return hnode; } int nLevel = Integer.parseInt(sLevel); diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index f7a5a1b..a427e30 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -1581,44 +1581,39 @@ public class TextConverter extends ConverterHelper { } if (currentMasterPage == null && style != null) { hnode = StartMasterPage(hnode, style, newPageNumber); - } else { - //If old master page was defined - - //If new master page definition found - //Or if fo:break-before found - //Or if soft-page-break or fo:break-after appeared before this node - if (checkMasterPageBreak(style) || checkHardBreakBefore(style) || breakBeforeNextNode) { - //Insert footnotes - footCv.insertFootnotes(hnode, true); - //Add previous MP footer - addFooter(hnode); - //Update MP - updateMasterPage(style); - //Set new page number if defined or increment if not - if (newPageNumber != null) { - pageNum = newPageNumber; - } else { - pageNum++; - fitPageNumberToMasterPageStyle(); - } - - if ( currentNode.getNodeType() == Node.ELEMENT_NODE - && Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null - && !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty() - ){ - hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum); - } else { - hnode = GreenstoneTags.processPageBreak(currentNode, hnode, pageNum); - } - - //Print new header - addHeader(hnode); - breakBeforeNextNode = false; - return hnode; - + } else if (checkMasterPageBreak(style) || checkHardBreakBefore(style) || breakBeforeNextNode) { + // Insert footnotes + footCv.insertFootnotes(hnode, true); + // Add previous MP footer + addFooter(hnode); + // Update MP + updateMasterPage(style); + // Set new page number if defined or increment if not + if (newPageNumber != null) { + pageNum = newPageNumber; + } else { + pageNum++; + fitPageNumberToMasterPageStyle(); } - + + if (currentNode.getNodeType() == Node.ELEMENT_NODE + && Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null + && !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty()) { + hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum); + } else { + hnode = GreenstoneTags.processPageBreak(currentNode, hnode, pageNum); + } + + // Print new header + addHeader(hnode); + breakBeforeNextNode = false; + return hnode; + + } else { + hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum); } + + //Create method to process Section -> Something -> Foo-break-before /*currentNode.getNextSibling()