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
This commit is contained in:
henrikjust 2011-02-21 08:59:23 +00:00
parent a524ca933d
commit 78c773db26
2 changed files with 11 additions and 8 deletions

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-02-20) * Version 1.2 (2011-02-21)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.7"; 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 /** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/> * (major version).(minor version).(patch level)<br/>

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * 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 { 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 // Config
private XhtmlConfig config; private XhtmlConfig config;
@ -124,7 +127,7 @@ public class Converter extends ConverterBase {
@Override public void readStyleSheet(InputStream is) throws IOException { @Override public void readStyleSheet(InputStream is) throws IOException {
if (styleSheet==null) { if (styleSheet==null) {
styleSheet = new CssDocument("styles/styles.css"); styleSheet = new CssDocument(EPUB_CUSTOM_STYLESHEET);
} }
styleSheet.read(is); styleSheet.read(is);
} }
@ -419,8 +422,8 @@ public class Converter extends ConverterBase {
} }
// Export styles (EPUB) // Export styles (EPUB)
if (isOPS()) { if (isOPS() && config.xhtmlFormatting()>XhtmlConfig.IGNORE_STYLES) {
CssDocument cssDoc = new CssDocument("styles/styles1.css"); CssDocument cssDoc = new CssDocument(EPUB_STYLESHEET);
cssDoc.read(styleCv.exportStyles(false)); cssDoc.read(styleCv.exportStyles(false));
converterResult.addDocument(cssDoc); converterResult.addDocument(cssDoc);
} }
@ -650,7 +653,7 @@ public class Converter extends ConverterBase {
sty.setAttribute("rel", "stylesheet"); sty.setAttribute("rel", "stylesheet");
sty.setAttribute("type", "text/css"); sty.setAttribute("type", "text/css");
sty.setAttribute("media", "all"); sty.setAttribute("media", "all");
sty.setAttribute("href", "stylesheet/"+styleSheet.getFileName()); sty.setAttribute("href", EPUB_CUSTOM_STYLESHEET);
head.appendChild(sty); head.appendChild(sty);
} }
@ -660,7 +663,7 @@ public class Converter extends ConverterBase {
htmlStyle.setAttribute("rel","stylesheet"); htmlStyle.setAttribute("rel","stylesheet");
htmlStyle.setAttribute("type","text/css"); htmlStyle.setAttribute("type","text/css");
htmlStyle.setAttribute("media","all"); htmlStyle.setAttribute("media","all");
htmlStyle.setAttribute("href","styles/styles1.css"); htmlStyle.setAttribute("href",EPUB_STYLESHEET);
head.appendChild(htmlStyle); head.appendChild(htmlStyle);
} }
// Note: For XHTML, generated styles are exported to the doc at the end. // Note: For XHTML, generated styles are exported to the doc at the end.