W2X: New option separate_stylesheet

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@122 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-08-05 07:48:15 +00:00
parent 498aded635
commit 5dc6aed004
4 changed files with 28 additions and 11 deletions

View file

@ -2,6 +2,8 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.8 ---------- ---------- version 1.1.8 ----------
[w2x] Implemented the option separate_stylesheet to separate the style sheet from the XHTML files (has no effect on EPUB export)
[all] Added Catalan translation from Martí Ruiz-Altaba [all] Added Catalan translation from Martí Ruiz-Altaba
[all] Image files are now extracted with proper file extension, even if the ODF manifest contains no media type [all] Image files are now extracted with proper file extension, even if the ODF manifest contains no media type

Binary file not shown.

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-07-29) * Version 1.2 (2011-08-05)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.8"; private static final String VERSION = "1.1.8";
private static final String DATE = "2011-07-29"; private static final String DATE = "2011-08-05";
/** 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-07-20) * Version 1.2 (2011-08-05)
* *
*/ */
@ -328,7 +328,6 @@ public class Converter extends ConverterBase {
// Add included style sheet, if any - and we are creating OPS content // Add included style sheet, if any - and we are creating OPS content
if (bOPS && styleSheet!=null) { if (bOPS && styleSheet!=null) {
// TODO: Move to subfolder
converterResult.addDocument(styleSheet); converterResult.addDocument(styleSheet);
for (ResourceDocument doc : resources) { for (ResourceDocument doc : resources) {
converterResult.addDocument(doc); converterResult.addDocument(doc);
@ -336,7 +335,7 @@ public class Converter extends ConverterBase {
} }
// Export styles (XHTML) // Export styles (XHTML)
if (!isOPS()) { if (!isOPS() && !config.separateStylesheet()) {
for (int i=0; i<=nOutFileIndex; i++) { for (int i=0; i<=nOutFileIndex; i++) {
Element head = outFiles.get(i).getHeadNode(); Element head = outFiles.get(i).getHeadNode();
if (head!=null) { if (head!=null) {
@ -472,11 +471,18 @@ public class Converter extends ConverterBase {
} }
} }
// Export styles (EPUB) // Export styles
if (isOPS() && config.xhtmlFormatting()>XhtmlConfig.IGNORE_STYLES) { if (config.xhtmlFormatting()>XhtmlConfig.IGNORE_STYLES) {
CssDocument cssDoc = new CssDocument(EPUB_STYLESHEET); if (isOPS()) { // EPUB
cssDoc.read(styleCv.exportStyles(false)); CssDocument cssDoc = new CssDocument(EPUB_STYLESHEET);
converterResult.addDocument(cssDoc); cssDoc.read(styleCv.exportStyles(false));
converterResult.addDocument(cssDoc);
}
else if (config.separateStylesheet()) { // XHTML
CssDocument cssDoc = new CssDocument(sTargetFileName+"-styles.css");
cssDoc.read(styleCv.exportStyles(false));
converterResult.addDocument(cssDoc);
}
} }
} }
@ -697,6 +703,16 @@ public class Converter extends ConverterBase {
head.appendChild(htmlStyle); head.appendChild(htmlStyle);
} }
// Add link to generated stylesheet if producing normal XHTML and the user wants separate css
if (!bOPS && config.separateStylesheet() && config.xhtmlFormatting()>XhtmlConfig.IGNORE_STYLES) {
Element htmlStyle = htmlDOM.createElement("link");
htmlStyle.setAttribute("rel","stylesheet");
htmlStyle.setAttribute("type","text/css");
htmlStyle.setAttribute("media","all");
htmlStyle.setAttribute("href",sTargetFileName+"-styles.css");
head.appendChild(htmlStyle);
}
// Add link to included style sheet if producing OPS content // Add link to included style sheet if producing OPS content
if (bOPS && styleSheet!=null) { if (bOPS && styleSheet!=null) {
Element sty = htmlDOM.createElement("link"); Element sty = htmlDOM.createElement("link");
@ -716,7 +732,6 @@ public class Converter extends ConverterBase {
htmlStyle.setAttribute("href",EPUB_STYLESHEET); htmlStyle.setAttribute("href",EPUB_STYLESHEET);
head.appendChild(htmlStyle); head.appendChild(htmlStyle);
} }
// Note: For XHTML, generated styles are exported to the doc at the end.
} }