diff --git a/src/main/java/writer2latex/xhtml/content/Separator.java b/src/main/java/writer2latex/xhtml/content/Separator.java index 68d0e6a..f8f17d3 100644 --- a/src/main/java/writer2latex/xhtml/content/Separator.java +++ b/src/main/java/writer2latex/xhtml/content/Separator.java @@ -59,7 +59,7 @@ public class Separator { if (sLevel == null || sLevel.isEmpty()) { return hnode; } - String title = getTitle(currentNode).trim(); + String title = getTitle(currentNode); if (title == null || title.isEmpty()) { return hnode; } @@ -90,6 +90,10 @@ public class Separator { if (isSplitTime(curLevel, pageNum)) { hnode = splitFiles(hnode); + if (rdfSeparation) { + setContentPath(hnode,curLevel); + setContentName(hnode,title); + } lastSplitPageNum = pageNum; } if (greenstoneSeparation) { @@ -104,6 +108,11 @@ public class Separator { return hnode; } + private void setContentName(Node hnode, String title) { + ((Element) hnode).setAttribute("name", title); + + } + private boolean noSplitNeeded(int pageNum, int curLevel) { return !greenstoneSeparation && !isSplitTime(curLevel,pageNum); } @@ -123,15 +132,22 @@ public class Separator { } private Node splitFiles(Node hnode) { - String path = ""; - for (int i = 0; i < 10; i++) { - path = path + " " + headingPath[i]; - } hnode = converter.nextOutFile(); - ((Element) hnode).setAttribute("path", path.trim()); + return hnode; } + private void setContentPath(Node hnode, int curLevel) { + StringBuilder path = new StringBuilder(); + for (int i = 0; i < curLevel; i++) { + if (path.length() != 0 ) { + path.append(" "); + } + path.append(headingPath[i]); + } + ((Element) hnode).setAttribute("path", path.toString()); + } + private boolean isSplitTime(int curLevel, int pageNum) { if ((rdfSeparation || splitLevel >= curLevel ) && converter.outFileHasContent()) { if (alignSplitToPages) { @@ -281,7 +297,7 @@ public class Separator { replaceWithSpaces(lineBreaks); replaceWithSpaces(textTabs); deleteNotesIn(content); - title = content.getTextContent(); + title = content.getTextContent().trim(); return title; }