diff --git a/build.xml b/build.xml index 1069d70..f277207 100644 --- a/build.xml +++ b/build.xml @@ -2,7 +2,7 @@ ############################################################################ # This is the Ant build file for writer2latex # Original: Sep 2004 (mgn) - # version 1.6 (2015-05-28) + # version 1.6 (2015-07-22) ############################################################################ --> @@ -36,8 +36,8 @@ - - + + diff --git a/source/distro/Readme.txt b/source/distro/Readme.txt index 6bfa25a..32512aa 100644 --- a/source/distro/Readme.txt +++ b/source/distro/Readme.txt @@ -1,7 +1,7 @@ -Writer2LaTeX version 1.5.3 (alpha test release) -=============================================== +Writer2LaTeX version 1.6 (beta test release) +============================================ -This is the distribution of Writer2LaTeX version 1.5.3 alpha +This is the distribution of Writer2LaTeX version 1.6 beta Latest version can be found at the web site http://writer2latex.sourceforge.net @@ -14,5 +14,5 @@ Bugs and feature requests should be reported to writer2latex (at) gmail.com -May 2015 +July 2015 Henrik Just diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index 63d5dde..23dd444 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -1,5 +1,15 @@ Changelog for Writer2LaTeX version 1.4 -> 1.6 +---------- version 1.6 beta ---------- + +[w2l] Added support for non-ASCII BibTeX files. The new option bibtex_encoding is used to specify the encoding of + the BibTeX files loaded via the option external_bibtex_files. The default value is "document" which implies the + same encoding as the LaTeX document. Otherwise the same values as for inputencoding are supported. + In the UI, the encoding can be selected on the bibliography page of the toolbar settings. + The setting is ignored if the backend is XeTeX, in this case all files are assumed to be UTF-8. + Also, the default bibtex application has been changed to bibtex8 (but currently no attempt is made to select the + proper .csf file) + ---------- version 1.5.3 ---------- [w2l] The command \textsubscript is now defined with \providecommand to avoid problems with other packages that may diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt index 02352a7..c842029 100644 Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ diff --git a/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java b/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java index b8991f7..23db380 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java +++ b/source/java/org/openoffice/da/comp/writer2latex/BibTeXDialog.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-05-29) + * Version 1.6 (2015-07-24) * */ @@ -61,6 +61,7 @@ import com.sun.star.text.XTextViewCursor; import com.sun.star.text.XTextViewCursorSupplier; import com.sun.star.ui.dialogs.ExecutableDialogResults; import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; @@ -68,7 +69,10 @@ import org.jbibtex.ParseException; import org.openoffice.da.comp.w2lcommon.helper.DialogAccess; import org.openoffice.da.comp.w2lcommon.helper.DialogBase; import org.openoffice.da.comp.w2lcommon.helper.MessageBox; +import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper; +import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper; +import writer2latex.latex.i18n.ClassicI18n; import writer2latex.office.BibMark; import writer2latex.office.BibMark.EntryType; import writer2latex.util.Misc; @@ -95,6 +99,9 @@ public class BibTeXDialog extends DialogBase implements com.sun.star.lang.XIniti // The BibTeX directory (passed at initialization) File bibTeXDirectory = null; + // The encoding for BibTeX files (set in constructor from the registry) + String sBibTeXJavaEncoding = null; + // Cache of BibTeX files in the BibTeX directory File[] files = null; @@ -121,6 +128,22 @@ public class BibTeXDialog extends DialogBase implements com.sun.star.lang.XIniti /** Create a new BibTeXDialog */ public BibTeXDialog(XComponentContext xContext) { super(xContext); + sBibTeXJavaEncoding = getBibTeXJavaEncoding(); + } + + private String getBibTeXJavaEncoding() { + RegistryHelper registry = new RegistryHelper(xContext); + try { + Object view = registry.getRegistryView(BibliographyDialog.REGISTRY_PATH, false); + XPropertySet xProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,view); + int nBibTeXEncoding = XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXEncoding"); //$NON-NLS-1$ + registry.disposeRegistryView(view); + return ClassicI18n.writeJavaEncoding(nBibTeXEncoding); + } + catch (Exception e) { + // Failed to get registry view + } + return null; } /** Return the name of the library containing the dialog @@ -257,11 +280,12 @@ public class BibTeXDialog extends DialogBase implements com.sun.star.lang.XIniti int nFile = getListBoxSelectedItem("File"); //$NON-NLS-1$ if (nFile>=0) { try { - currentFile = new BibTeXReader(files[nFile]); + currentFile = new BibTeXReader(files[nFile],sBibTeXJavaEncoding); } catch (IOException e) { + System.err.println(e.getMessage()); currentFile = null; } catch (ParseException e) { - System.out.println(e.getMessage()); + System.err.println(e.getMessage()); currentFile = null; } @@ -502,10 +526,12 @@ public class BibTeXDialog extends DialogBase implements com.sun.star.lang.XIniti BibTeXReader[] readers = new BibTeXReader[nFiles]; for (int i=0; i entries; /** Construct a new BibTeXReader based on a file * * @param file the file to read + * @param sEncoding the character encoding of the file * @throws IOException if any error occurs reading the file * @throws ParseException if any error occurs interpreting the contents of the file */ - public BibTeXReader(File file) throws IOException, ParseException { + public BibTeXReader(File file, String sEncoding) throws IOException, ParseException { this.file = file; + this.sEncoding = sEncoding; reload(); } @@ -73,8 +78,8 @@ public class BibTeXReader { */ public void reload() throws IOException, ParseException { entries = new HashMap(); - BibTeXDatabase database = parseBibTeX(file); - readEntries(database); + BibTeXDatabase database = parseBibTeX(file,sEncoding); + readEntries(database); } /** Get the file associated with this BibTeXReader @@ -93,8 +98,9 @@ public class BibTeXReader { return entries; } - private static BibTeXDatabase parseBibTeX(File file) throws ParseException, IOException { - Reader reader = new FileReader(file); + private static BibTeXDatabase parseBibTeX(File file, String sEncoding) throws ParseException, IOException { + FileInputStream is = new FileInputStream(file); + Reader reader = new InputStreamReader(is,sEncoding); try { BibTeXParser parser = new BibTeXParser() { @Override @@ -114,7 +120,8 @@ public class BibTeXReader { }; return parser.parse(reader); } finally { - reader.close(); + if (reader!=null) { reader.close(); } + if (is!=null) { is.close(); } } } @@ -148,6 +155,9 @@ public class BibTeXReader { } catch (ParseException e) { // If parsing fails, return the original string return string; + } catch (TokenMgrException e) { + // If the string contains invalid characters, return the original string + return string; } finally { try { reader.close(); diff --git a/source/java/org/openoffice/da/comp/writer2latex/BibliographyDialog.java b/source/java/org/openoffice/da/comp/writer2latex/BibliographyDialog.java index e0579d1..1cf376e 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/BibliographyDialog.java +++ b/source/java/org/openoffice/da/comp/writer2latex/BibliographyDialog.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-05-29) + * Version 1.6 (2015-07-23) * */ @@ -179,6 +179,8 @@ public final class BibliographyDialog XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXLocation")); //$NON-NLS-1$ dlg.setTextFieldText("BibTeXDir", //$NON-NLS-1$ XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir")); //$NON-NLS-1$ + dlg.setListBoxSelectedItem("BibTeXEncoding", //$NON-NLS-1$ + XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXEncoding")); //$NON-NLS-1$ dlg.setCheckBoxStateAsBoolean("UseNatbib", //$NON-NLS-1$ XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseNatbib")); //$NON-NLS-1$ dlg.setTextFieldText("NatbibOptions", //$NON-NLS-1$ @@ -206,6 +208,7 @@ public final class BibliographyDialog XPropertySetHelper.setPropertyValue(xProps, "IncludeOriginalCitations", dlg.getCheckBoxStateAsBoolean("IncludeOriginalCitations")); //$NON-NLS-1$ //$NON-NLS-2$ XPropertySetHelper.setPropertyValue(xProps, "BibTeXLocation", dlg.getListBoxSelectedItem("BibTeXLocation")); //$NON-NLS-1$ //$NON-NLS-2$ XPropertySetHelper.setPropertyValue(xProps, "BibTeXDir", dlg.getTextFieldText("BibTeXDir")); //$NON-NLS-1$ //$NON-NLS-2$ + XPropertySetHelper.setPropertyValue(xProps, "BibTeXEncoding", dlg.getListBoxSelectedItem("BibTeXEncoding")); //$NON-NLS-1$ //$NON-NLS-2$ XPropertySetHelper.setPropertyValue(xProps, "UseNatbib", dlg.getCheckBoxStateAsBoolean("UseNatbib")); //$NON-NLS-1$ //$NON-NLS-2$ XPropertySetHelper.setPropertyValue(xProps, "NatbibOptions", dlg.getTextFieldText("NatbibOptions")); //$NON-NLS-1$ //$NON-NLS-2$ @@ -263,6 +266,8 @@ public final class BibliographyDialog dlg.setControlEnabled("BibTeXDirLabel", bEnableSettings && bEnableDir); //$NON-NLS-1$ dlg.setControlEnabled("BibTeXDir", bEnableSettings && bEnableDir); //$NON-NLS-1$ dlg.setControlEnabled("BibTeXDirButton", bEnableSettings && bEnableDir); //$NON-NLS-1$ + dlg.setControlEnabled("BibTeXEncodingLabel", bEnableSettings); //$NON-NLS-1$ + dlg.setControlEnabled("BibTeXEncoding", bEnableSettings); //$NON-NLS-1$ dlg.setControlEnabled("ConvertZoteroCitations", bEnableSettings); //$NON-NLS-1$ dlg.setControlEnabled("ConvertJabRefCitations", bEnableSettings); //$NON-NLS-1$ dlg.setControlEnabled("IncludeOriginalCitations", bEnableSettings && bEnableOriginalCitations); //$NON-NLS-1$ @@ -348,6 +353,3 @@ public final class BibliographyDialog } } - - - diff --git a/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java b/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java index b450887..86a818e 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java +++ b/source/java/org/openoffice/da/comp/writer2latex/LaTeXUNOPublisher.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-05-29) + * Version 1.6 (2015-07-23) * */ package org.openoffice.da.comp.writer2latex; @@ -34,6 +34,7 @@ import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper; import org.openoffice.da.comp.w2lcommon.helper.RegistryHelper; import org.openoffice.da.comp.w2lcommon.helper.XPropertySetHelper; +import writer2latex.latex.i18n.ClassicI18n; import writer2latex.util.CSVList; import writer2latex.util.Misc; @@ -107,6 +108,8 @@ public class LaTeXUNOPublisher extends UNOPublisher { XPropertySetHelper.getPropertyValueAsString(xProps, "BibTeXDir")); //$NON-NLS-1$ if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "UseExternalBibTeXFiles")) { //$NON-NLS-1$ filterHelper.put("external_bibtex_files", sBibTeXFiles); //$NON-NLS-1$ + filterHelper.put("bibtex_encoding", ClassicI18n.writeInputenc( //$NON-NLS-1$ + XPropertySetHelper.getPropertyValueAsShort(xProps, "BibTeXEncoding"))); //$NON-NLS-1$ if (XPropertySetHelper.getPropertyValueAsBoolean(xProps, "ConvertZoteroCitations")) { //$NON-NLS-1$ filterHelper.put("zotero_bibtex_files", sBibTeXFiles); //$NON-NLS-1$ } diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index 8708146..3350c79 100644 --- a/source/java/writer2latex/api/ConverterFactory.java +++ b/source/java/writer2latex/api/ConverterFactory.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-07-01) + * Version 1.6 (2015-07-27) * */ @@ -32,8 +32,8 @@ package writer2latex.api; public class ConverterFactory { // Version information - private static final String VERSION = "1.5.3"; - private static final String DATE = "2015-07-01"; + private static final String VERSION = "1.6"; + private static final String DATE = "2015-07-27"; /** Return the Writer2LaTeX version in the form * (major version).(minor version).(patch level)
diff --git a/source/java/writer2latex/latex/BibConverter.java b/source/java/writer2latex/latex/BibConverter.java index 1998676..16b2133 100644 --- a/source/java/writer2latex/latex/BibConverter.java +++ b/source/java/writer2latex/latex/BibConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-07-01) + * Version 1.6 (2015-07-27) * */ @@ -33,6 +33,7 @@ import org.w3c.dom.Element; import writer2latex.base.BibliographyGenerator; import writer2latex.bibtex.BibTeXDocument; +import writer2latex.latex.i18n.ClassicI18n; import writer2latex.latex.util.BeforeAfter; import writer2latex.latex.util.Context; @@ -60,6 +61,8 @@ class BibConverter extends ConverterHelper { private BibTeXDocument bibDoc = null; private boolean bUseBibTeX; + private String sBibTeXEncoding = null; + private String sDocumentEncoding = null; /** Construct a new BibConverter. * @@ -74,6 +77,16 @@ class BibConverter extends ConverterHelper { bibDoc = new BibTeXDocument(palette.getOutFileName(),false,ofr); } + // We need to use a different encoding for the BibTeX files + if (config.externalBibtexFiles().length()>0) { + int nBibTeXEncoding = config.getBibtexEncoding(); + int nDocumentEncoding = config.getInputencoding(); + if (config.getBackend()!=LaTeXConfig.XETEX && nBibTeXEncoding>-1 && nBibTeXEncoding!=nDocumentEncoding) { + sBibTeXEncoding = ClassicI18n.writeInputenc(nBibTeXEncoding); + sDocumentEncoding = ClassicI18n.writeInputenc(nDocumentEncoding); + } + } + // We need to export it bUseBibTeX = config.useBibtex(); } @@ -199,10 +212,17 @@ class BibConverter extends ConverterHelper { .append("}").nl(); // Use BibTeX file from configuration, or exported BibTeX file + // TODO: For XeTeX, probably use \XeTeXdefaultencoding? if (config.externalBibtexFiles().length()>0) { - ldp.append("\\bibliography{") + if (sBibTeXEncoding!=null) { + ldp.append("\\inputencoding{").append(sBibTeXEncoding).append("}").nl(); + } + ldp.append("\\bibliography{") .append(config.externalBibtexFiles()) .append("}").nl(); + if (sBibTeXEncoding!=null) { + ldp.append("\\inputencoding{").append(sDocumentEncoding).append("}").nl(); + } } else { ldp.append("\\bibliography{") diff --git a/source/java/writer2latex/latex/LaTeXConfig.java b/source/java/writer2latex/latex/LaTeXConfig.java index fae70a6..bfa9ed7 100644 --- a/source/java/writer2latex/latex/LaTeXConfig.java +++ b/source/java/writer2latex/latex/LaTeXConfig.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-06-23) + * Version 1.6 (2015-07-23) * */ @@ -49,7 +49,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { ///////////////////////////////////////////////////////////////////////// // I. Define items needed by ConfigBase - protected int getOptionCount() { return 72; } + protected int getOptionCount() { return 73; } protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; } ///////////////////////////////////////////////////////////////////////// @@ -144,45 +144,46 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { private static final int USE_BIBTEX = 30; private static final int BIBTEX_STYLE = 31; private static final int EXTERNAL_BIBTEX_FILES = 32; - private static final int ZOTERO_BIBTEX_FILES = 33; - private static final int JABREF_BIBTEX_FILES = 34; - private static final int INCLUDE_ORIGINAL_CITATIONS = 35; - private static final int USE_NATBIB = 36; - private static final int NATBIB_OPTIONS = 37; - private static final int FONT = 38; - private static final int FORMATTING = 39; - private static final int PAGE_FORMATTING = 40; - private static final int OTHER_STYLES = 41; - private static final int IMAGE_CONTENT = 42; - private static final int TABLE_CONTENT = 43; - private static final int TABLE_FIRST_HEAD_STYLE = 44; - private static final int TABLE_HEAD_STYLE = 45; - private static final int TABLE_FOOT_STYLE = 46; - private static final int TABLE_LAST_FOOT_STYLE = 47; - private static final int IGNORE_HARD_PAGE_BREAKS = 48; - private static final int IGNORE_HARD_LINE_BREAKS = 49; - private static final int IGNORE_EMPTY_PARAGRAPHS =50; - private static final int IGNORE_DOUBLE_SPACES = 51; - private static final int DISPLAY_HIDDEN_TEXT = 52; - private static final int ALIGN_FRAMES = 53; - private static final int FLOAT_FIGURES = 54; - private static final int FLOAT_TABLES = 55; - private static final int FLOAT_OPTIONS = 56; - private static final int FIGURE_SEQUENCE_NAME = 57; - private static final int TABLE_SEQUENCE_NAME = 58; - private static final int IMAGE_OPTIONS = 59; - private static final int REMOVE_GRAPHICS_EXTENSION = 60; - private static final int ORIGINAL_IMAGE_SIZE = 61; - private static final int SIMPLE_TABLE_LIMIT = 62; - private static final int NOTES = 63; - private static final int METADATA = 64; - private static final int TABSTOP = 65; - private static final int WRAP_LINES_AFTER = 66; - private static final int SPLIT_LINKED_SECTIONS = 67; - private static final int SPLIT_TOPLEVEL_SECTIONS = 68; - private static final int SAVE_IMAGES_IN_SUBDIR = 69; - private static final int OLD_MATH_COLORS = 70; - private static final int DEBUG = 71; + private static final int BIBTEX_ENCODING = 33; + private static final int ZOTERO_BIBTEX_FILES = 34; + private static final int JABREF_BIBTEX_FILES = 35; + private static final int INCLUDE_ORIGINAL_CITATIONS = 36; + private static final int USE_NATBIB = 37; + private static final int NATBIB_OPTIONS = 38; + private static final int FONT = 39; + private static final int FORMATTING = 40; + private static final int PAGE_FORMATTING = 41; + private static final int OTHER_STYLES = 42; + private static final int IMAGE_CONTENT = 43; + private static final int TABLE_CONTENT = 44; + private static final int TABLE_FIRST_HEAD_STYLE = 45; + private static final int TABLE_HEAD_STYLE = 46; + private static final int TABLE_FOOT_STYLE = 47; + private static final int TABLE_LAST_FOOT_STYLE = 48; + private static final int IGNORE_HARD_PAGE_BREAKS = 49; + private static final int IGNORE_HARD_LINE_BREAKS = 50; + private static final int IGNORE_EMPTY_PARAGRAPHS =51; + private static final int IGNORE_DOUBLE_SPACES = 52; + private static final int DISPLAY_HIDDEN_TEXT = 53; + private static final int ALIGN_FRAMES = 54; + private static final int FLOAT_FIGURES = 55; + private static final int FLOAT_TABLES = 56; + private static final int FLOAT_OPTIONS = 57; + private static final int FIGURE_SEQUENCE_NAME = 58; + private static final int TABLE_SEQUENCE_NAME = 59; + private static final int IMAGE_OPTIONS = 60; + private static final int REMOVE_GRAPHICS_EXTENSION = 61; + private static final int ORIGINAL_IMAGE_SIZE = 62; + private static final int SIMPLE_TABLE_LIMIT = 63; + private static final int NOTES = 64; + private static final int METADATA = 65; + private static final int TABSTOP = 66; + private static final int WRAP_LINES_AFTER = 67; + private static final int SPLIT_LINKED_SECTIONS = 68; + private static final int SPLIT_TOPLEVEL_SECTIONS = 69; + private static final int SAVE_IMAGES_IN_SUBDIR = 70; + private static final int OLD_MATH_COLORS = 71; + private static final int DEBUG = 72; ///////////////////////////////////////////////////////////////////////// // IV. Our options data @@ -254,6 +255,13 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { options[USE_BIBTEX] = new BooleanOption("use_bibtex","false"); options[BIBTEX_STYLE] = new Option("bibtex_style","plain"); options[EXTERNAL_BIBTEX_FILES] = new Option("external_bibtex_files",""); + options[BIBTEX_ENCODING] = new IntegerOption("bibtex_encoding","document") { + public void setString(String sValue) { + super.setString(sValue); + if ("document".equals(sValue)) { nValue = -1; } + else { nValue = ClassicI18n.readInputenc(sValue); } + } + }; options[ZOTERO_BIBTEX_FILES] = new Option("zotero_bibtex_files",""); options[JABREF_BIBTEX_FILES] = new Option("jabref_bibtex_files",""); options[INCLUDE_ORIGINAL_CITATIONS] = new BooleanOption("include_original_citations","false"); @@ -683,6 +691,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase { public boolean useBibtex() { return ((BooleanOption) options[USE_BIBTEX]).getValue(); } public String bibtexStyle() { return options[BIBTEX_STYLE].getString(); } public String externalBibtexFiles() { return options[EXTERNAL_BIBTEX_FILES].getString(); } + public int getBibtexEncoding() { return ((IntegerOption) options[BIBTEX_ENCODING]).getValue(); } public String zoteroBibtexFiles() { return options[ZOTERO_BIBTEX_FILES].getString(); } public String jabrefBibtexFiles() { return options[JABREF_BIBTEX_FILES].getString(); } public boolean includeOriginalCitations() { return ((BooleanOption) options[INCLUDE_ORIGINAL_CITATIONS]).getValue(); } diff --git a/source/java/writer2latex/xhtml/TOCConverter.java b/source/java/writer2latex/xhtml/TOCConverter.java index ff4ec66..e05f186 100644 --- a/source/java/writer2latex/xhtml/TOCConverter.java +++ b/source/java/writer2latex/xhtml/TOCConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-06-16) + * Version 1.6 (2015-07-23) * */ package writer2latex.xhtml; @@ -61,6 +61,8 @@ final class IndexData { */ class TOCConverter extends IndexConverterHelper { + private static final String TOC_LINK_PREFIX = "toc"; + private List indexes = new ArrayList(); // All tables of content private List tocEntries = new ArrayList(); // All potential(!) toc items private int nTocFileIndex = -1; // file index for main toc @@ -94,7 +96,7 @@ class TOCConverter extends IndexConverterHelper { */ void handleHeading(Element onode, Element heading, String sLabel) { int nLevel = getTextCv().getOutlineLevel(onode); - String sTarget = "toc"+(++nTocIndex); + String sTarget = TOC_LINK_PREFIX+(++nTocIndex); converter.addTarget(heading,sTarget); this.currentChapter = onode; @@ -126,7 +128,7 @@ class TOCConverter extends IndexConverterHelper { if (nLevel>config.getXhtmlSplitLevel()) { Element div = converter.createElement("div"); hnode.appendChild(div); - sTarget = "toc"+(++nTocIndex); + sTarget = TOC_LINK_PREFIX+(++nTocIndex); converter.addTarget(div,sTarget); } converter.addContentEntry(sLabel+converter.getPlainInlineText(onode), nLevel, sTarget); @@ -136,7 +138,7 @@ class TOCConverter extends IndexConverterHelper { void handleParagraph(Element onode, Element par, String sCurrentListLabel) { String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME); if (ofr.isIndexSourceStyle(getParSc().getRealParStyleName(sStyleName))) { - converter.addTarget(par,"toc"+(++nTocIndex)); + converter.addTarget(par,TOC_LINK_PREFIX+(++nTocIndex)); TocEntry entry = new TocEntry(); entry.onode = (Element) onode; entry.sLabel = sCurrentListLabel; @@ -151,7 +153,7 @@ class TOCConverter extends IndexConverterHelper { * @param hnode the link target will be added to this inline HTML node */ void handleTocMark(Node onode, Node hnode) { - hnode.appendChild(converter.createTarget("toc"+(++nTocIndex))); + hnode.appendChild(converter.createTarget(TOC_LINK_PREFIX+(++nTocIndex))); TocEntry entry = new TocEntry(); entry.onode = (Element) onode; entry.nFileIndex = converter.getOutFileIndex(); @@ -243,7 +245,7 @@ class TOCConverter extends IndexConverterHelper { span.setAttribute("class","SectionNumber"); span.appendChild(converter.createTextNode(entry.sLabel)); } - Element a = converter.createLink("toc"+i); + Element a = converter.createLink(TOC_LINK_PREFIX+i); p.appendChild(a); getTextCv().traverseInlineText(entry.onode,a); } @@ -255,7 +257,7 @@ class TOCConverter extends IndexConverterHelper { if (entry.sLabel!=null) { p.appendChild(converter.createTextNode(entry.sLabel)); } - Element a = converter.createLink("toc"+i); + Element a = converter.createLink(TOC_LINK_PREFIX+i); p.appendChild(a); getTextCv().traverseInlineText(entry.onode,a); } @@ -269,7 +271,7 @@ class TOCConverter extends IndexConverterHelper { if (entry.sLabel!=null) { p.appendChild(converter.createTextNode(entry.sLabel)); } - Element a = converter.createLink("toc"+i); + Element a = converter.createLink(TOC_LINK_PREFIX+i); p.appendChild(a); getTextCv().traverseInlineText(entry.onode,a); } @@ -278,7 +280,7 @@ class TOCConverter extends IndexConverterHelper { int nLevel = Misc.getPosInteger(entry.onode.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1); if (tocReader.useIndexMarks() && nLevel<=tocReader.getOutlineLevel()) { Element p = getTextCv().createParagraph(li,sEntryStyleName[nLevel]); - Element a = converter.createLink("toc"+i); + Element a = converter.createLink(TOC_LINK_PREFIX+i); p.appendChild(a); a.appendChild(converter.createTextNode(IndexMark.getIndexValue(entry.onode))); } @@ -287,7 +289,7 @@ class TOCConverter extends IndexConverterHelper { int nLevel = Misc.getPosInteger(entry.onode.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1); if (tocReader.useIndexMarks() && nLevel<=tocReader.getOutlineLevel()) { Element p = getTextCv().createParagraph(li,sEntryStyleName[nLevel]); - Element a = converter.createLink("toc"+i); + Element a = converter.createLink(TOC_LINK_PREFIX+i); p.appendChild(a); a.appendChild(converter.createTextNode(IndexMark.getIndexValue(entry.onode))); } @@ -353,7 +355,7 @@ class TOCConverter extends IndexConverterHelper { String sNodeName = entry.onode.getTagName(); if (XMLString.TEXT_H.equals(sNodeName)) { - // Determine wether or not to include this heading + // Determine whether or not to include this heading // Note that this condition misses the case where // a heading of level n is followed by a heading of // level n+2. This is considered a bug in the document! diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index 2bdbcf6..8c8a8a8 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.6 (2015-06-16) + * Version 1.6 (2015-07-23) * */ @@ -50,7 +50,7 @@ public class TextConverter extends ConverterHelper { // TODO: Accessor methods for sections // Some (Sony?) EPUB readers have a limit on the file size of individual files // In any case very large files could be a performance problem, hence we do automatic splitting - // after this number of characters. TODO: Make configurable. + // after this number of characters. private int nSplitAfter = 150000; private int nPageBreakSplit = XhtmlConfig.NONE; // Should we split at page breaks? // TODO: Collect soft page breaks between table rows diff --git a/source/oxt/w2lconfig/description.xml b/source/oxt/w2lconfig/description.xml index 7658468..f7a0292 100644 --- a/source/oxt/w2lconfig/description.xml +++ b/source/oxt/w2lconfig/description.xml @@ -4,7 +4,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink"> - + diff --git a/source/oxt/writer2latex/ToolbarOptions.xcs b/source/oxt/writer2latex/ToolbarOptions.xcs index c90c8d3..62c62e1 100644 --- a/source/oxt/writer2latex/ToolbarOptions.xcs +++ b/source/oxt/writer2latex/ToolbarOptions.xcs @@ -33,6 +33,7 @@ + diff --git a/source/oxt/writer2latex/ToolbarOptions.xcu b/source/oxt/writer2latex/ToolbarOptions.xcu index 81f1b2c..401ecac 100644 --- a/source/oxt/writer2latex/ToolbarOptions.xcu +++ b/source/oxt/writer2latex/ToolbarOptions.xcu @@ -46,7 +46,7 @@ false - bibtex + bibtex8 %s @@ -138,6 +138,9 @@ + + 0 + false diff --git a/source/oxt/writer2latex/W2LDialogs2/Bibliography.xdl b/source/oxt/writer2latex/W2LDialogs2/Bibliography.xdl index 8f927d7..b9e3a14 100644 --- a/source/oxt/writer2latex/W2LDialogs2/Bibliography.xdl +++ b/source/oxt/writer2latex/W2LDialogs2/Bibliography.xdl @@ -3,13 +3,11 @@ - - - + @@ -17,31 +15,36 @@ - - + - - + - - + - - - - - - + + + - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/description.xml b/source/oxt/writer2latex/description.xml index 2887156..1c4b97f 100644 --- a/source/oxt/writer2latex/description.xml +++ b/source/oxt/writer2latex/description.xml @@ -5,7 +5,7 @@ - + diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp index ce4be01..2540c50 100644 --- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp +++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/bibliography.xhp @@ -73,6 +73,11 @@ Click to select the path to the folder containing the BibTeX files + + File encoding + Select the encoding of the BibTeX files (this will depend on your + BibTeX editor). If you use XeTeX as a backend, you should always use UTF-8. + Convert Zotero citations Zotero diff --git a/source/oxt/writer2xhtml/description.xml b/source/oxt/writer2xhtml/description.xml index 2493b33..9cd2fa7 100644 --- a/source/oxt/writer2xhtml/description.xml +++ b/source/oxt/writer2xhtml/description.xml @@ -5,7 +5,7 @@ - + diff --git a/source/oxt/xhtml-config-sample/description.xml b/source/oxt/xhtml-config-sample/description.xml index 5bd1d4e..5dff1a1 100644 --- a/source/oxt/xhtml-config-sample/description.xml +++ b/source/oxt/xhtml-config-sample/description.xml @@ -2,5 +2,5 @@ - + diff --git a/source/readme-source.txt b/source/readme-source.txt index 628fe99..fe65fad 100644 --- a/source/readme-source.txt +++ b/source/readme-source.txt @@ -1,5 +1,5 @@ -Writer2LaTeX source version 1.5.3 alpha -======================================= +Writer2LaTeX source version 1.6 beta +==================================== Writer2LaTeX is (c) 2002-2015 by Henrik Just. The source is available under the terms and conditions of the @@ -49,8 +49,8 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRA CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -Third-party software: ---------------------------- +Third-party software: BibTeX API +-------------------------------- Villu Ruusmanns Java BibTeX API is included in binary form as jbibtex-1.0.14.jar. The source code is available from https://code.google.com/p/java-bibtex/ @@ -124,7 +124,7 @@ In addition to oxt, the build file supports the following targets: clean -Henrik Just, May 2015 +Henrik Just, July 2015 Thanks to Michael Niedermair for writing the original ant build file