From bb545bd4ff50f5a23d416dbcc2fa81c231921dd0 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Sun, 25 Sep 2016 17:51:54 +0300 Subject: [PATCH] Hack fix for div tags inside sections --- .../java/writer2latex/xhtml/GreenstoneTags.java | 4 ++-- source/java/writer2latex/xhtml/TextConverter.java | 15 ++++++++++++++- source/java/writer2latex/xhtml/XhtmlConfig.java | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/source/java/writer2latex/xhtml/GreenstoneTags.java b/source/java/writer2latex/xhtml/GreenstoneTags.java index df8afd9..74b8e8d 100644 --- a/source/java/writer2latex/xhtml/GreenstoneTags.java +++ b/source/java/writer2latex/xhtml/GreenstoneTags.java @@ -199,7 +199,7 @@ public class GreenstoneTags { } } } - private static Node closePage(Node hnode){ + protected static Node closePage(Node hnode){ if (pageTags.equals(SECTIONS)){ closeSection(hnode); } @@ -209,7 +209,7 @@ public class GreenstoneTags { pageOpened = false; return hnode; } - private static Node openPage(Node hnode, Integer pageNum){ + protected static Node openPage(Node hnode, Integer pageNum){ if (pageTags.equals(SECTIONS)){ openPageSection(hnode, pageNum); pageOpened = true; diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index fc53e39..f7a5a1b 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -427,16 +427,29 @@ public class TextConverter extends ConverterHelper { if (!bDisplayHiddenText && "none".equals(Misc.getAttribute(onode,XMLString.TEXT_DISPLAY))) { return hnode; } String sName = Misc.getAttribute(onode,XMLString.TEXT_NAME); String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME); + ////closePageSection Element div = converter.createElement("div"); + //close page before enter + hnode = GreenstoneTags.closePage(hnode); + hnode.appendChild(div); converter.addTarget(div,sName+"|region"); StyleInfo sectionInfo = new StyleInfo(); getSectionSc().applyStyle(sStyleName,sectionInfo); applyStyle(sectionInfo,div); sections.push(onode); + //open page after enter + div = (Element) GreenstoneTags.openPage(div, pageNum); Node newhnode = traverseBlockText(onode, div); + //close page before exit + newhnode = GreenstoneTags.closePage(newhnode); + + Node result = newhnode.getParentNode(); + //Open page after exit + result = (Element) GreenstoneTags.openPage(result, pageNum); + sections.pop(); - return newhnode.getParentNode(); + return result; } private void handleHeading(Element onode, Element hnode, boolean bAfterSplit) { diff --git a/source/java/writer2latex/xhtml/XhtmlConfig.java b/source/java/writer2latex/xhtml/XhtmlConfig.java index 52f0585..e91855f 100644 --- a/source/java/writer2latex/xhtml/XhtmlConfig.java +++ b/source/java/writer2latex/xhtml/XhtmlConfig.java @@ -293,7 +293,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase { options[UPLINK] = new Option("uplink",""); options[DIRECTORY_ICON] = new Option("directory_icon",""); options[DOCUMENT_ICON] = new Option("document_icon",""); - options[HEADING_TAGS] = new Option("heading_tags","none"); + options[HEADING_TAGS] = new Option("heading_tags","sections"); options[PAGE_TAGS] = new Option("page_tags","div"); }