Fixed opened page divs and sections
This commit is contained in:
parent
bb545bd4ff
commit
8547521ccd
2 changed files with 15 additions and 11 deletions
|
@ -121,17 +121,16 @@ public class GreenstoneTags {
|
||||||
hnode.getNodeType() == Node.ELEMENT_NODE
|
hnode.getNodeType() == Node.ELEMENT_NODE
|
||||||
&&
|
&&
|
||||||
((Element) hnode).getTagName().equals("div")
|
((Element) hnode).getTagName().equals("div")
|
||||||
//&&
|
|
||||||
//((Element) hnode).getAttribute("class").equals("pageNum")
|
|
||||||
)
|
)
|
||||||
){
|
){
|
||||||
System.out.println("TAG " + ((Element) hnode).getTagName());
|
|
||||||
System.out.println("class " + ((Element) hnode).getAttribute("class"));
|
|
||||||
hnode = hnode.getParentNode();
|
hnode = hnode.getParentNode();
|
||||||
}
|
}
|
||||||
hnode = hnode.getParentNode();
|
Node result = hnode.getParentNode();
|
||||||
System.out.println(((Element) hnode).getTagName());
|
if (hnode.getChildNodes().getLength() == 0){
|
||||||
return hnode;
|
result.removeChild(hnode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getTitle(Node currentNode) {
|
private static String getTitle(Node currentNode) {
|
||||||
|
@ -201,9 +200,14 @@ public class GreenstoneTags {
|
||||||
}
|
}
|
||||||
protected static Node closePage(Node hnode){
|
protected static Node closePage(Node hnode){
|
||||||
if (pageTags.equals(SECTIONS)){
|
if (pageTags.equals(SECTIONS)){
|
||||||
closeSection(hnode);
|
//If section is empty. In case we are closing section
|
||||||
}
|
// the last comment is opened page section
|
||||||
else if (pageTags.equals(DIV)){
|
if (hnode.getLastChild().getNodeType() == Node.COMMENT_NODE){
|
||||||
|
hnode.removeChild(hnode.getLastChild());
|
||||||
|
} else {
|
||||||
|
closeSection(hnode);
|
||||||
|
}
|
||||||
|
} else if (pageTags.equals(DIV)){
|
||||||
hnode = exitPageDiv(hnode);
|
hnode = exitPageDiv(hnode);
|
||||||
}
|
}
|
||||||
pageOpened = false;
|
pageOpened = false;
|
||||||
|
|
|
@ -294,7 +294,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
||||||
options[DIRECTORY_ICON] = new Option("directory_icon","");
|
options[DIRECTORY_ICON] = new Option("directory_icon","");
|
||||||
options[DOCUMENT_ICON] = new Option("document_icon","");
|
options[DOCUMENT_ICON] = new Option("document_icon","");
|
||||||
options[HEADING_TAGS] = new Option("heading_tags","sections");
|
options[HEADING_TAGS] = new Option("heading_tags","sections");
|
||||||
options[PAGE_TAGS] = new Option("page_tags","div");
|
options[PAGE_TAGS] = new Option("page_tags","sections");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void readInner(Element elm) {
|
protected void readInner(Element elm) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue