From 78c773db2675973fe454fd80cd32c1da2162dfd7 Mon Sep 17 00:00:00 2001 From: henrikjust Date: Mon, 21 Feb 2011 08:59:23 +0000 Subject: [PATCH] EPUB bugfix: Do not include empty generated stylesheet git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@90 f0f2a975-2e09-46c8-9428-3b39399b9f3c --- .../java/writer2latex/api/ConverterFactory.java | 4 ++-- source/java/writer2latex/xhtml/Converter.java | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index cdd7019..9c70cc7 100644 --- a/source/java/writer2latex/api/ConverterFactory.java +++ b/source/java/writer2latex/api/ConverterFactory.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2011-02-20) + * Version 1.2 (2011-02-21) * */ @@ -33,7 +33,7 @@ public class ConverterFactory { // Version information private static final String VERSION = "1.1.7"; - private static final String DATE = "2011-02-20"; + private static final String DATE = "2011-02-21"; /** Return the Writer2LaTeX version in the form * (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/xhtml/Converter.java b/source/java/writer2latex/xhtml/Converter.java index 3d8c549..7249c6a 100644 --- a/source/java/writer2latex/xhtml/Converter.java +++ b/source/java/writer2latex/xhtml/Converter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2011-02-19) + * Version 1.2 (2011-02-21) * */ @@ -64,6 +64,9 @@ import writer2latex.util.Misc; * */ public class Converter extends ConverterBase { + private static final String EPUB_STYLESHEET = "styles/styles1.css"; + private static final String EPUB_CUSTOM_STYLESHEET = "styles/styles.css"; + // Config private XhtmlConfig config; @@ -124,7 +127,7 @@ public class Converter extends ConverterBase { @Override public void readStyleSheet(InputStream is) throws IOException { if (styleSheet==null) { - styleSheet = new CssDocument("styles/styles.css"); + styleSheet = new CssDocument(EPUB_CUSTOM_STYLESHEET); } styleSheet.read(is); } @@ -419,8 +422,8 @@ public class Converter extends ConverterBase { } // Export styles (EPUB) - if (isOPS()) { - CssDocument cssDoc = new CssDocument("styles/styles1.css"); + if (isOPS() && config.xhtmlFormatting()>XhtmlConfig.IGNORE_STYLES) { + CssDocument cssDoc = new CssDocument(EPUB_STYLESHEET); cssDoc.read(styleCv.exportStyles(false)); converterResult.addDocument(cssDoc); } @@ -650,7 +653,7 @@ public class Converter extends ConverterBase { sty.setAttribute("rel", "stylesheet"); sty.setAttribute("type", "text/css"); sty.setAttribute("media", "all"); - sty.setAttribute("href", "stylesheet/"+styleSheet.getFileName()); + sty.setAttribute("href", EPUB_CUSTOM_STYLESHEET); head.appendChild(sty); } @@ -660,7 +663,7 @@ public class Converter extends ConverterBase { htmlStyle.setAttribute("rel","stylesheet"); htmlStyle.setAttribute("type","text/css"); htmlStyle.setAttribute("media","all"); - htmlStyle.setAttribute("href","styles/styles1.css"); + htmlStyle.setAttribute("href",EPUB_STYLESHEET); head.appendChild(htmlStyle); } // Note: For XHTML, generated styles are exported to the doc at the end.