w2l: Do not use string substitution or writing direction in math mode for XeTeX backend.Support cross references to list items.
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@135 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
fdf0488bd7
commit
9cb0e43ef2
5 changed files with 49 additions and 19 deletions
source
distro
java/writer2latex
|
@ -2,6 +2,10 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
|
|||
|
||||
---------- version 1.1.9 ----------
|
||||
|
||||
[w2l] Added support for cross references to list items
|
||||
|
||||
[w2l] Do not use string replace or writing direction in math mode for XeTeX backend
|
||||
|
||||
[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)
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2011 by Henrik Just
|
||||
* Copyright: 2002-2012 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2012-02-26)
|
||||
* Version 1.2 (2012-02-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -33,7 +33,7 @@ public class ConverterFactory {
|
|||
|
||||
// Version information
|
||||
private static final String VERSION = "1.1.9";
|
||||
private static final String DATE = "2012-02-26";
|
||||
private static final String DATE = "2012-02-27";
|
||||
|
||||
/** Return the Writer2LaTeX version in the form
|
||||
* (major version).(minor version).(patch level)<br/>
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2011 by Henrik Just
|
||||
* Copyright: 2002-2012 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2011-07-25)
|
||||
* Version 1.2 (2012-02-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -788,6 +788,10 @@ public class FieldConverter extends ConverterHelper {
|
|||
// This is safe if the bookmark is contained in a heading
|
||||
ldp.append("\\ref{bkm:"+bookmarknames.getExportName(sName)+"}");
|
||||
}
|
||||
else if (("number".equals(sFormat) || "number-no-superior".equals(sFormat) || "number-all-superior".equals(sFormat)) &&
|
||||
ofr.bookmarkInList(sName)) {
|
||||
ldp.append("\\ref{bkm:"+bookmarknames.getExportName(sName)+"}");
|
||||
}
|
||||
else { // use current value
|
||||
palette.getInlineCv().traversePCDATA(node,ldp,oc);
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2011 by Henrik Just
|
||||
* Copyright: 2002-2012 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2011-05-06)
|
||||
* Version 1.2 (2012-02-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -134,11 +134,16 @@ public class XeTeXI18n extends I18n {
|
|||
* @return the LaTeX string
|
||||
*/
|
||||
public String convert(String s, boolean bMathMode, String sLang){
|
||||
// TODO: Do we need anything special for math mode?
|
||||
StringBuffer buf = new StringBuffer();
|
||||
int nLen = s.length();
|
||||
char c;
|
||||
if (bUsePolyglossia) {
|
||||
if (bMathMode) {
|
||||
// No string replace or writing direction in math mode
|
||||
for (int i=0; i<nLen; i++) {
|
||||
convert(s.charAt(i),buf);
|
||||
}
|
||||
}
|
||||
else if (bUsePolyglossia) {
|
||||
int i = 0;
|
||||
while (i<nLen) {
|
||||
ReplacementTrieNode node = stringReplace.get(s,i,nLen);
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2011 by Henrik Just
|
||||
* Copyright: 2002-2012 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2011-06-16)
|
||||
* Version 1.2 (2012-02-27)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -296,9 +296,10 @@ public class OfficeReader {
|
|||
private HashSet<String> bookmarkRef = new HashSet<String>();
|
||||
private HashSet<String> sequenceRef = new HashSet<String>();
|
||||
|
||||
// Reference marks and bookmarks contained in headings
|
||||
// Reference marks and bookmarks contained in headings or lists
|
||||
private HashSet<String> referenceHeading = new HashSet<String>();
|
||||
private HashSet<String> bookmarkHeading = new HashSet<String>();
|
||||
private HashSet<String> bookmarkList = new HashSet<String>();
|
||||
|
||||
// All internal hyperlinks
|
||||
private HashSet<String> links = new HashSet<String>();
|
||||
|
@ -640,6 +641,14 @@ public class OfficeReader {
|
|||
public boolean bookmarkInHeading(String sName) {
|
||||
return bookmarkHeading.contains(sName);
|
||||
}
|
||||
|
||||
/** Is this bookmark contained in a list?
|
||||
* @param sName the name of the bookmark
|
||||
* @return true if so
|
||||
*/
|
||||
public boolean bookmarkInList(String sName) {
|
||||
return bookmarkList.contains(sName);
|
||||
}
|
||||
|
||||
/** <p>Is there a reference to this bookmark?
|
||||
* @param sName the name of the bookmark
|
||||
|
@ -1085,19 +1094,19 @@ public class OfficeReader {
|
|||
else if ("endnote".equals(sClass)) { collectRefName(endnoteRef,node); }
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK)) {
|
||||
collectMarkInHeading(referenceHeading,node);
|
||||
collectMarkByPosition(referenceHeading,null,node);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_START)) {
|
||||
collectMarkInHeading(referenceHeading,node);
|
||||
collectMarkByPosition(referenceHeading,null,node);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_REFERENCE_REF)) {
|
||||
collectRefName(referenceRef,node);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK)) {
|
||||
collectMarkInHeading(bookmarkHeading,node);
|
||||
collectMarkByPosition(bookmarkHeading,bookmarkList,node);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_START)) {
|
||||
collectMarkInHeading(bookmarkHeading,node);
|
||||
collectMarkByPosition(bookmarkHeading,bookmarkList,node);
|
||||
}
|
||||
else if (sName.equals(XMLString.TEXT_BOOKMARK_REF)) {
|
||||
collectRefName(bookmarkRef,node);
|
||||
|
@ -1173,12 +1182,20 @@ public class OfficeReader {
|
|||
}
|
||||
}
|
||||
|
||||
private void collectMarkInHeading(HashSet<String> marks, Element node) {
|
||||
private void collectMarkByPosition(HashSet<String> headingmarks, HashSet<String> listmarks, Element node) {
|
||||
String sName = node.getAttribute(XMLString.TEXT_NAME);
|
||||
if (sName!=null && sName.length()>0) {
|
||||
Element par = getParagraph(node);
|
||||
if (XMLString.TEXT_H.equals(par.getTagName())) {
|
||||
marks.add(sName);
|
||||
if (XMLString.TEXT_H.equals(par.getTagName())) { // Mark contained in a heading
|
||||
headingmarks.add(sName);
|
||||
}
|
||||
else if (listmarks!=null && XMLString.TEXT_P.equals(par.getTagName())) {
|
||||
Element parent = (Element) par.getParentNode();
|
||||
if (XMLString.TEXT_LIST_ITEM.equals(parent.getTagName())) { // Mark contained in a list
|
||||
// Note: text:list-header is not relevant here (no number to refer to!)
|
||||
// TODO: Collect style name and level (necessary to add text before/after)
|
||||
listmarks.add(sName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue