Fixed lost heading sections

This commit is contained in:
Georgy Litvinov 2016-09-25 21:42:44 +03:00 committed by Georgy Litvinov
parent faee542d26
commit acd74dee18
2 changed files with 31 additions and 37 deletions

View file

@ -33,7 +33,6 @@ public class GreenstoneTags {
//Get outline level //Get outline level
String sLevel = Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL); String sLevel = Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL);
if (sLevel == null || sLevel.isEmpty()) { if (sLevel == null || sLevel.isEmpty()) {
System.out.println("Error occurred. Expected Outline level here!");
return hnode; return hnode;
} }
int nLevel = Integer.parseInt(sLevel); int nLevel = Integer.parseInt(sLevel);

View file

@ -1581,20 +1581,14 @@ public class TextConverter extends ConverterHelper {
} }
if (currentMasterPage == null && style != null) { if (currentMasterPage == null && style != null) {
hnode = StartMasterPage(hnode, style, newPageNumber); hnode = StartMasterPage(hnode, style, newPageNumber);
} else { } else if (checkMasterPageBreak(style) || checkHardBreakBefore(style) || breakBeforeNextNode) {
//If old master page was defined // Insert footnotes
//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); footCv.insertFootnotes(hnode, true);
//Add previous MP footer // Add previous MP footer
addFooter(hnode); addFooter(hnode);
//Update MP // Update MP
updateMasterPage(style); updateMasterPage(style);
//Set new page number if defined or increment if not // Set new page number if defined or increment if not
if (newPageNumber != null) { if (newPageNumber != null) {
pageNum = newPageNumber; pageNum = newPageNumber;
} else { } else {
@ -1602,23 +1596,24 @@ public class TextConverter extends ConverterHelper {
fitPageNumberToMasterPageStyle(); fitPageNumberToMasterPageStyle();
} }
if ( currentNode.getNodeType() == Node.ELEMENT_NODE if (currentNode.getNodeType() == Node.ELEMENT_NODE
&& Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null && Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL) != null
&& !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty() && !Misc.getAttribute(currentNode, XMLString.TEXT_OUTLINE_LEVEL).isEmpty()) {
){
hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum); hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum);
} else { } else {
hnode = GreenstoneTags.processPageBreak(currentNode, hnode, pageNum); hnode = GreenstoneTags.processPageBreak(currentNode, hnode, pageNum);
} }
//Print new header // Print new header
addHeader(hnode); addHeader(hnode);
breakBeforeNextNode = false; breakBeforeNextNode = false;
return hnode; return hnode;
} else {
hnode = GreenstoneTags.processHeading(currentNode, hnode, pageNum);
} }
}
//Create method to process Section -> Something -> Foo-break-before //Create method to process Section -> Something -> Foo-break-before
/*currentNode.getNextSibling() /*currentNode.getNextSibling()