Split internal sections added.

This commit is contained in:
George Litvinov 2017-06-22 15:20:45 +03:00 committed by Georgy Litvinov
parent a3c3aa095d
commit 1c4f21c8f0
3 changed files with 19 additions and 25 deletions

View file

@ -1,34 +1,22 @@
package writer2latex.xhtml;
import java.io.StringWriter;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;
public class Debug {
public static void printNode(Node node){
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer;
try {
transformer = transFactory.newTransformer();
StringWriter buffer = new StringWriter();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(new DOMSource(node), new StreamResult(buffer));
String str = buffer.toString();
System.out.println(str);
} catch (TransformerConfigurationException e1) {
e1.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
}
Document document = node.getOwnerDocument();
DOMImplementationLS domImplLS = (DOMImplementationLS) document
.getImplementation();
LSSerializer serializer = domImplLS.createLSSerializer();
String str = serializer.writeToString(node);
System.out.println(str);
}

View file

@ -484,7 +484,13 @@ public class PageSplitter {
removeSPB(sectionNode);
i++;
continue;
}
} else if (nodeName.equals(XMLString.TEXT_SECTION)) {
if (handleSection(sectionChildFirstPart, sectionChildNode)){
sectionFirstPart.appendChild(sectionChildFirstPart);
dataMoved=true;
}
}
//split node with spb and exit
break;
} else {
sectionFirstPart.appendChild(sectionChildNode);

View file

@ -154,7 +154,7 @@ public class TextConverter extends ConverterHelper {
}
//Split pages
onode = (Element) PageSplitter.splitSoftPageBreak(onode,ofr);
//Debug.printNode(onode);
// Convert content
hnode = (Element)traverseBlockText(onode,hnode);