w2l: Two minor changes to EPUB export to avoid validation errors from FlightCrew

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@134 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2012-02-26 13:58:27 +00:00
parent 90d1b47551
commit fdf0488bd7
6 changed files with 30 additions and 17 deletions

View file

@ -2,6 +2,10 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.9 ---------- ---------- version 1.1.9 ----------
[w2x] Export date only for dc:date attribute in EPUB meta data (not date+time)
[w2x] Leave out media attribute for style sheets in EPUB export (prevented validation with FlightCrew)
[w2x] The file containing the cover image in EPUB export is now created with a body margin of zero [w2x] The file containing the cover image in EPUB export is now created with a body margin of zero
[w2l] The StarMath converter now leaves out the \text command if the argument is a plain number [w2l] The StarMath converter now leaves out the \text command if the argument is a plain number

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2012-02-24) * Version 1.2 (2012-02-26)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.9"; private static final String VERSION = "1.1.9";
private static final String DATE = "2012-02-24"; private static final String DATE = "2012-02-26";
/** 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

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2001-2011 by Henrik Just * Copyright: 2001-2012 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* version 1.2 (2011-07-20) * version 1.2 (2012-02-26)
* *
*/ */
@ -204,7 +204,7 @@ public class OPFWriter extends NewDOMDocument {
} }
if (!bHasDate && cr.getMetaData().getDate().length()>0) { if (!bHasDate && cr.getMetaData().getDate().length()>0) {
// TODO: Support meta:creation-date? // TODO: Support meta:creation-date?
appendElement(contentDOM, metadata, "dc:date", cr.getMetaData().getDate()); appendElement(contentDOM, metadata, "dc:date", Misc.dateOnly(cr.getMetaData().getDate()));
} }
// Manifest must contain references to all the files in the XHTML converter result // Manifest must contain references to all the files in the XHTML converter result

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2011 by Henrik Just * Copyright: 2002-2012 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-05-07) * Version 1.2 (2012-02-26)
* *
*/ */
@ -238,10 +238,7 @@ public final class ConverterPalette extends ConverterBase {
// According to the spec, the date has the format YYYY-MM-DDThh:mm:ss // According to the spec, the date has the format YYYY-MM-DDThh:mm:ss
String sDate = metaData.getDate(); String sDate = metaData.getDate();
if (sDate!=null) { if (sDate!=null) {
if (sDate.length()==19 && sDate.charAt(10)=='T') { createMeta("date",Misc.dateOnly(sDate),declarations);
sDate = sDate.substring(0,10);
}
createMeta("date",sDate,declarations);
} }
} }

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2011 by Henrik Just * Copyright: 2002-2012 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-03-29) * Version 1.2 (2012-02-26)
* *
*/ */
@ -60,6 +60,20 @@ public class Misc{
return newArray; return newArray;
} }
// Truncate a date+time to the date only
public static final String dateOnly(String sDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = null;
try {
date = sdf.parse(sDate);
} catch (ParseException e) {
// If the date cannot be parsed according to the given pattern, return the original string
return sDate;
}
// Return using a default format for the given locale
return sDate.substring(0,10);
}
public static final String formatDate(String sDate, String sLanguage, String sCountry) { public static final String formatDate(String sDate, String sLanguage, String sCountry) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date = null; Date date = null;

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2011 by Henrik Just * Copyright: 2002-2012 by Henrik Just
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-08-05) * Version 1.2 (2012-02-26)
* *
*/ */
@ -718,7 +718,6 @@ public class Converter extends ConverterBase {
Element sty = htmlDOM.createElement("link"); Element sty = htmlDOM.createElement("link");
sty.setAttribute("rel", "stylesheet"); sty.setAttribute("rel", "stylesheet");
sty.setAttribute("type", "text/css"); sty.setAttribute("type", "text/css");
sty.setAttribute("media", "all");
sty.setAttribute("href", EPUB_CUSTOM_STYLESHEET); sty.setAttribute("href", EPUB_CUSTOM_STYLESHEET);
head.appendChild(sty); head.appendChild(sty);
} }
@ -728,7 +727,6 @@ public class Converter extends ConverterBase {
Element htmlStyle = htmlDOM.createElement("link"); Element htmlStyle = htmlDOM.createElement("link");
htmlStyle.setAttribute("rel","stylesheet"); htmlStyle.setAttribute("rel","stylesheet");
htmlStyle.setAttribute("type","text/css"); htmlStyle.setAttribute("type","text/css");
htmlStyle.setAttribute("media","all");
htmlStyle.setAttribute("href",EPUB_STYLESHEET); htmlStyle.setAttribute("href",EPUB_STYLESHEET);
head.appendChild(htmlStyle); head.appendChild(htmlStyle);
} }