W2L custom config ui refactoring + some LaTeX and EPUB fixes
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@78 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
a3a6b0befc
commit
84f4d5cb20
12 changed files with 834 additions and 917 deletions
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
* Copyright: 2002-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-12-03)
|
||||
* Version 1.2 (2010-11-28)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -97,6 +97,8 @@ public class CharStyleConverter extends StyleConverter {
|
|||
StyleMap sm = config.getTextStyleMap();
|
||||
if (sm.contains(sDisplayName)) {
|
||||
ba.add(sm.getBefore(sDisplayName),sm.getAfter(sDisplayName));
|
||||
context.setVerbatim(sm.getVerbatim(sDisplayName));
|
||||
context.setNoLineBreaks(sm.getVerbatim(sDisplayName));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-11-21)
|
||||
* Version 1.2 (2010-11-30)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -85,32 +85,43 @@ public class XeTeXI18n extends I18n {
|
|||
/** Convert a string of characters into LaTeX
|
||||
* @param s the source string
|
||||
* @param bMathMode true if the string should be rendered in math mode
|
||||
* @param sLang the iso language of the string
|
||||
* @param sLang the ISO language of the string
|
||||
* @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;
|
||||
for (int i=0; i<nLen; i++) {
|
||||
c = s.charAt(i);
|
||||
switch (c) {
|
||||
case '#' : buf.append("\\#"); break; // Parameter
|
||||
case '$' : buf.append("\\$"); break; // Math shift
|
||||
case '%' : buf.append("\\%"); break; // Comment
|
||||
case '&' : buf.append("\\&"); break; // Alignment tab
|
||||
case '\\' : buf.append("\\textbackslash{}"); break; // Escape
|
||||
case '^' : buf.append("\\^{}"); break; // Superscript
|
||||
case '_' : buf.append("\\_"); break; // Subscript
|
||||
case '{' : buf.append("\\{"); break; // Begin group
|
||||
case '}' : buf.append("\\}"); break; // End group
|
||||
case '~' : buf.append("\\textasciitilde{}"); break; // Active (non-breaking space)
|
||||
case '\u00A0' : buf.append('~'); break; // Make non-breaking spaces visible
|
||||
default: buf.append(c);
|
||||
}
|
||||
}
|
||||
char c;
|
||||
int nLen = s.length();
|
||||
int i = 0;
|
||||
while (i<nLen) {
|
||||
ReplacementTrieNode node = stringReplace.get(s,i,nLen);
|
||||
if (node!=null) {
|
||||
buf.append(node.getLaTeXCode());
|
||||
i += node.getInputLength();
|
||||
}
|
||||
else {
|
||||
c = s.charAt(i++);
|
||||
switch (c) {
|
||||
case '#' : buf.append("\\#"); break; // Parameter
|
||||
case '$' : buf.append("\\$"); break; // Math shift
|
||||
case '%' : buf.append("\\%"); break; // Comment
|
||||
case '&' : buf.append("\\&"); break; // Alignment tab
|
||||
case '\\' : buf.append("\\textbackslash{}"); break; // Escape
|
||||
case '^' : buf.append("\\^{}"); break; // Superscript
|
||||
case '_' : buf.append("\\_"); break; // Subscript
|
||||
case '{' : buf.append("\\{"); break; // Begin group
|
||||
case '}' : buf.append("\\}"); break; // End group
|
||||
case '~' : buf.append("\\textasciitilde{}"); break; // Active (non-breaking space)
|
||||
case '\u00A0' : buf.append('~'); break; // Make non-breaking spaces visible
|
||||
default: buf.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue