diff --git a/source/java/writer2latex/xhtml/GreenstoneTags.java b/source/java/writer2latex/xhtml/GreenstoneTags.java index 8184512..cda1a81 100644 --- a/source/java/writer2latex/xhtml/GreenstoneTags.java +++ b/source/java/writer2latex/xhtml/GreenstoneTags.java @@ -62,6 +62,40 @@ public class GreenstoneTags { } return false; } + protected static void processPageBreak(Node currentNode, Node hnode, Integer pageNum){ + + + if ( !( currentNode.getNodeType() == Node.ELEMENT_NODE + && currentNode.getNodeName().equals(XMLString.TEXT_H) + && Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null + && !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty() + ) + && !headerStack.isEmpty() + ) { + if (pageSection) { + closeSection(hnode); + pageSection = false; + + } + if (pageNum != null) { + openSection(hnode, pageNum); + + } + } + } + //Method to open main document tag + protected static void StartDocument(Node hnode, String title){ + openSection(hnode, title); + } + //Method to close open tags at the end of the document + protected static void endDocument(Node hnode){ + if (pageSection){ + closeSection(hnode); + pageSection = false; + } + closeSection(hnode); + } + private static String getTitle(Node currentNode) { Node content = currentNode.cloneNode(true); NodeList contentNodes = content.getChildNodes(); @@ -86,39 +120,8 @@ public class GreenstoneTags { return title; } - static void processPageBreak(Node currentNode, Node hnode, Integer pageNum){ - - - if ( !( currentNode.getNodeType() == Node.ELEMENT_NODE - && currentNode.getNodeName().equals(XMLString.TEXT_H) - && Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null - && !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty() - ) - && !headerStack.isEmpty() - ) { - if (pageSection) { - closeSection(hnode); - pageSection = false; - } - if (pageNum != null) { - openSection(hnode, pageNum); - - } - } - } - //Method to open main document tag - static void StartDocument(Node hnode, String title){ - openSection(hnode, title); - } - //Method to close open tags at the end of the document - static void endDocument(Node hnode){ - if (pageSection){ - closeSection(hnode); - pageSection = false; - } - closeSection(hnode); - } + private static void openSection(Node hnode, Integer pageNum){ Document doc = hnode.getOwnerDocument(); String commentText = "
\n\n" + pageNum