diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index ccb017c..efcb75f 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -1,8 +1,17 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2 - ---------- version 1.1.7 ---------- +[w2l] Polyglossia bugfix: Now sets the default language correctly + +[w2l] Babel bugfix: No language is now ignored rather than exported as English + +[w2x] Bugfix: No language is now exported as zxx rather than zxx-none + +[w2l] Added support for unnumbered headings + +[w2x] Bugfix: Unnumbered headings are now exported correctly + [w2x] Bugfix: Do not add space to empty labels (e.g. heading numbering) [w2x] Export line breaks as spaces in annotations and EPUB table of content diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index c745e05..e402f36 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-03-05) + * Version 1.2 (2011-03-10) * */ @@ -33,7 +33,7 @@ public class ConverterFactory { // Version information private static final String VERSION = "1.1.7"; - private static final String DATE = "2011-03-05"; + private static final String DATE = "2011-03-10"; /** Return the Writer2LaTeX version in the form * (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/latex/HeadingConverter.java b/source/java/writer2latex/latex/HeadingConverter.java index 8f1b70e..f2b8f62 100644 --- a/source/java/writer2latex/latex/HeadingConverter.java +++ b/source/java/writer2latex/latex/HeadingConverter.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2009 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2009-04-30) + * Version 1.2 (2011-03-10) * */ @@ -74,6 +74,8 @@ public class HeadingConverter extends ConverterHelper { int nLevel = ofr.isOpenDocument() ? Misc.getPosInteger(Misc.getAttribute(node, XMLString.TEXT_OUTLINE_LEVEL),1) : Misc.getPosInteger(Misc.getAttribute(node, XMLString.TEXT_LEVEL),1); + boolean bUnNumbered = "true".equals(Misc.getAttribute(node,XMLString.TEXT_IS_LIST_HEADER)); + HeadingMap hm = config.getHeadingMap(); String sStyleName = node.getAttribute(XMLString.TEXT_STYLE_NAME); @@ -96,6 +98,7 @@ public class HeadingConverter extends ConverterHelper { // Export the heading ldp.append(baHardPage.getBefore()); ldp.append("\\"+hm.getName(nLevel)); + if (bUnNumbered) { ldp.append("*"); } // If this heading contains formatting, add optional argument: if (baHardChar.getBefore().length()>0 || containsElements(node)) { ldp.append("["); diff --git a/source/java/writer2latex/latex/i18n/ClassicI18n.java b/source/java/writer2latex/latex/i18n/ClassicI18n.java index 00f57a0..b029b5c 100644 --- a/source/java/writer2latex/latex/i18n/ClassicI18n.java +++ b/source/java/writer2latex/latex/i18n/ClassicI18n.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2010 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2010-12-15) + * Version 1.2 (2011-03-10) * */ @@ -181,11 +181,44 @@ public class ClassicI18n extends I18n { default: return null; } } - - // End of static part of I18n! + private static Hashtable babelLanguages; // mappings iso->babel language + + static { + babelLanguages = new Hashtable(); + babelLanguages.put("en", "english"); // latin1 + babelLanguages.put("bg", "bulgarian"); // cp1251? + babelLanguages.put("cs", "czech"); // latin2 + babelLanguages.put("da", "danish"); // latin1 + babelLanguages.put("de", "ngerman"); // latin1 + babelLanguages.put("el", "greek"); // iso-8859-7 + babelLanguages.put("es", "spanish"); // latin1 + babelLanguages.put("fi", "finnish"); // latin1 (latin9?) + babelLanguages.put("fr", "french"); // latin1 (latin9?) + babelLanguages.put("ga", "irish"); // latin1 + babelLanguages.put("hr", "croatian"); // latin2 + babelLanguages.put("hu", "magyar"); // latin2 + babelLanguages.put("la", "latin"); // ascii + babelLanguages.put("is", "icelandic"); // latin1 + babelLanguages.put("it", "italian"); // latin1 + babelLanguages.put("nl", "dutch"); // latin1 + babelLanguages.put("nb", "norsk"); // latin1 + babelLanguages.put("nn", "nynorsk"); // latin1 + babelLanguages.put("pl", "polish"); // latin2 + babelLanguages.put("pt", "portuges"); // latin1 + babelLanguages.put("ro", "romanian"); // latin2 + babelLanguages.put("ru", "russian"); // cp1251? + babelLanguages.put("sk", "slovak"); // latin2 + babelLanguages.put("sl", "slovene"); // latin2 + babelLanguages.put("sr", "serbian"); // cp1251? + babelLanguages.put("sv", "swedish"); // latin1 + babelLanguages.put("tr", "turkish"); + babelLanguages.put("uk", "ukrainian"); // cp1251? + } + + // End of static part of I18n! + // **** Global variables **** - private Hashtable babelLanguages; // mappings iso->babel language // Unicode translation private Hashtable tableSet; // all tables @@ -211,9 +244,6 @@ public class ClassicI18n extends I18n { // We don't need the palette and the office reader is only used to // identify the default language - // Set up table for iso->babel translation - prepareBabelLanguages(); - nDefaultFontenc = getFontenc(sDefaultLanguage); // Unicode stuff @@ -294,7 +324,10 @@ public class ClassicI18n extends I18n { babelopt.addValue("polutonikogreek"); } else { - babelopt.addValue(getBabelLanguage(sLang)); + String sBabelLang = getBabelLanguage(sLang); + if (sBabelLang!=null) { + babelopt.addValue(sBabelLang); + } } } } @@ -305,7 +338,10 @@ public class ClassicI18n extends I18n { babelopt.addValue("polutonikogreek"); } else { - babelopt.addValue(getBabelLanguage(sDefaultLanguage)); + String sBabelLang = getBabelLanguage(sDefaultLanguage); + if (sBabelLang!=null) { + babelopt.addValue(sBabelLang); + } } } @@ -640,42 +676,10 @@ public class ClassicI18n extends I18n { return babelLanguages.get(sLang); } else { - return "english"; // interpret unknown languages as English + return null; // Unknown language } } - private void prepareBabelLanguages() { - babelLanguages = new Hashtable(); - babelLanguages.put("en", "english"); // latin1 - babelLanguages.put("bg", "bulgarian"); // cp1251? - babelLanguages.put("cs", "czech"); // latin2 - babelLanguages.put("da", "danish"); // latin1 - babelLanguages.put("de", "ngerman"); // latin1 - babelLanguages.put("el", "greek"); // iso-8859-7 - babelLanguages.put("es", "spanish"); // latin1 - babelLanguages.put("fi", "finnish"); // latin1 (latin9?) - babelLanguages.put("fr", "french"); // latin1 (latin9?) - babelLanguages.put("ga", "irish"); // latin1 - babelLanguages.put("hr", "croatian"); // latin2 - babelLanguages.put("hu", "magyar"); // latin2 - babelLanguages.put("la", "latin"); // ascii - babelLanguages.put("is", "icelandic"); // latin1 - babelLanguages.put("it", "italian"); // latin1 - babelLanguages.put("nl", "dutch"); // latin1 - babelLanguages.put("nb", "norsk"); // latin1 - babelLanguages.put("nn", "nynorsk"); // latin1 - babelLanguages.put("pl", "polish"); // latin2 - babelLanguages.put("pt", "portuges"); // latin1 - babelLanguages.put("ro", "romanian"); // latin2 - babelLanguages.put("ru", "russian"); // cp1251? - babelLanguages.put("sk", "slovak"); // latin2 - babelLanguages.put("sl", "slovene"); // latin2 - babelLanguages.put("sr", "serbian"); // cp1251? - babelLanguages.put("sv", "swedish"); // latin1 - babelLanguages.put("tr", "turkish"); - babelLanguages.put("uk", "ukrainian"); // cp1251? - } - // **** Helpers to collect various information **** // Did we use cyrillic? diff --git a/source/java/writer2latex/latex/i18n/I18n.java b/source/java/writer2latex/latex/i18n/I18n.java index 6bf7f5a..953eb11 100644 --- a/source/java/writer2latex/latex/i18n/I18n.java +++ b/source/java/writer2latex/latex/i18n/I18n.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2010 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2010-12-14) + * Version 1.2 (2011-03-10) * */ @@ -49,6 +49,7 @@ public abstract class I18n { // Collected data protected String sDefaultLanguage; // The default ISO language to use + protected String sDefaultCountry; // The default ISO country to use protected HashSet languages = new HashSet(); // All languages used // **** Constructors **** @@ -75,6 +76,7 @@ public abstract class I18n { StyleWithProperties style = ofr.getDefaultParStyle(); if (style!=null) { sDefaultLanguage = style.getProperty(XMLString.FO_LANGUAGE); + sDefaultCountry = style.getProperty(XMLString.FO_COUNTRY); } } else { @@ -123,4 +125,12 @@ public abstract class I18n { public String getDefaultLanguage() { return sDefaultLanguage; } + + /** Get the default country + * + * @return the default country + */ + public String getDefaultCountry() { + return sDefaultCountry; + } } diff --git a/source/java/writer2latex/latex/i18n/XeTeXI18n.java b/source/java/writer2latex/latex/i18n/XeTeXI18n.java index 4a85a10..af163c1 100644 --- a/source/java/writer2latex/latex/i18n/XeTeXI18n.java +++ b/source/java/writer2latex/latex/i18n/XeTeXI18n.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2010 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.2 (2010-12-15) + * Version 1.2 (2011-03-10) * */ @@ -46,6 +46,7 @@ public class XeTeXI18n extends I18n { public XeTeXI18n(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette) { super(ofr,config,palette); polyglossia = new Polyglossia(); + polyglossia.applyLanguage(sDefaultLanguage, sDefaultCountry); } /** Add declarations to the preamble to load the required packages diff --git a/source/java/writer2latex/xhtml/StyleConverterHelper.java b/source/java/writer2latex/xhtml/StyleConverterHelper.java index 4f1ce4f..d958188 100644 --- a/source/java/writer2latex/xhtml/StyleConverterHelper.java +++ b/source/java/writer2latex/xhtml/StyleConverterHelper.java @@ -16,11 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * Copyright: 2002-2008 by Henrik Just + * Copyright: 2002-2011 by Henrik Just * * All Rights Reserved. * - * Version 1.0 (2008-09-08) + * Version 1.2 (2011-03-10) * */ @@ -102,7 +102,7 @@ public abstract class StyleConverterHelper extends ConverterHelper { String sLang = style.getProperty(XMLString.FO_LANGUAGE); String sCountry = style.getProperty(XMLString.FO_COUNTRY); if (sLang!=null) { - if (sCountry==null) { info.sLang = sLang; } + if (sCountry==null || sCountry.equals("none")) { info.sLang = sLang; } else { info.sLang = sLang+"-"+sCountry; } } } diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index 0c0f1b3..f9b3154 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -1,5 +1,6 @@ /************************************************************************ * + * TextConverter.java * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -596,11 +597,11 @@ public class TextConverter extends ConverterHelper { private void handleHeading(Element onode, Node hnode, boolean bAfterSplit) { int nListLevel = getOutlineLevel((Element)onode); - //boolean bUnNumbered = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_IS_LIST_HEADER)); + boolean bUnNumbered = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_IS_LIST_HEADER)); boolean bRestart = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_RESTART_NUMBERING)); int nStartValue = Misc.getPosInteger(Misc.getAttribute(onode,XMLString.TEXT_START_VALUE),1)-1; handleHeading(onode, hnode, bAfterSplit, ofr.getOutlineStyle(), - nListLevel, false, bRestart, nStartValue); + nListLevel, bUnNumbered, bRestart, nStartValue); } /*