diff --git a/src/main/java/net/sf/jabref/BibtexFields.java b/src/main/java/net/sf/jabref/BibtexFields.java index b6ca5e6f0ad..def975cc5d5 100644 --- a/src/main/java/net/sf/jabref/BibtexFields.java +++ b/src/main/java/net/sf/jabref/BibtexFields.java @@ -41,8 +41,7 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; -public class BibtexFields -{ +public class BibtexFields { public static final String KEY_FIELD = "bibtexkey"; @@ -53,7 +52,12 @@ public class BibtexFields public static final String MARKED = "__markedentry"; public static final String OWNER = "owner"; public static final String TIMESTAMP = "timestamp"; // it's also definied at the JabRefPreferences class - private static final String ENTRYTYPE = "entrytype"; + private static final String ENTRYTYPE = "entrytype"; + + /* + * some extra field definitions + */ + private static final String ADDITIONAL_FIELDS = "/resource/fields/fields.xml"; public static final String// Using this when I have no database open or when I read // non bibtex file formats (used by the ImportFormatReader.java) @@ -241,7 +245,7 @@ private BibtexFields() add(dummy); // read external field definitions - readXML(Globals.additionalFields); + readXML(ADDITIONAL_FIELDS); // collect all public fields for the PUBLIC_FIELDS array Vector pFields = new Vector(fieldSet.size()); diff --git a/src/main/java/net/sf/jabref/Globals.java b/src/main/java/net/sf/jabref/Globals.java index 278e198982d..1821971100a 100644 --- a/src/main/java/net/sf/jabref/Globals.java +++ b/src/main/java/net/sf/jabref/Globals.java @@ -15,7 +15,6 @@ */ package net.sf.jabref; -import java.awt.Toolkit; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -50,14 +49,12 @@ public class Globals { - - public static final String JOURNALS_IEEE_INTERNAL_LIST = "/resource/IEEEJournalList.txt"; - public static RemoteListenerServerLifecycle remoteListener = new RemoteListenerServerLifecycle(); - /** * {@link Control} class allowing properties bundles to be in different encodings. * - * @see utf-8 and property files + * @see utf-8 + * and property files */ private static class EncodingControl extends Control { @@ -103,24 +100,14 @@ public ResourceBundle newBundle(String baseName, Locale locale, } - private static int SHORTCUT_MASK = -1; - - public static int STANDARD_EXPORT_COUNT = 5; // The number of standard export formats. - public static final int METADATA_LINE_LENGTH = 70; // The line length used to wrap metadata. - - // used at highlighting in preview area. - // Color chosen similar to JTextComponent.getSelectionColor(), which is - // used at highlighting words at the editor - public static final String highlightColor = "#3399FF"; + public static RemoteListenerServerLifecycle remoteListener = new RemoteListenerServerLifecycle(); private static final String RESOURCE_PREFIX = "resource/JabRef", MENU_RESOURCE_PREFIX = "resource/Menu", INTEGRITY_RESOURCE_PREFIX = "resource/IntegrityMessage"; public static final String JOURNALS_FILE_BUILTIN = "/resource/journalList.txt"; - /* - * some extra field definitions - */ - public static final String additionalFields = "/resource/fields/fields.xml"; + + public static final String JOURNALS_IEEE_INTERNAL_LIST = "/resource/IEEEJournalList.txt"; private static ResourceBundle messages; private static ResourceBundle menuTitles; @@ -135,25 +122,22 @@ public ResourceBundle newBundle(String baseName, Locale locale, public static final BuildInfo BUILD_INFO = new BuildInfo(); - private static Locale locale; - public static final String FILETYPE_PREFS_EXT = "_dir", SELECTOR_META_PREFIX = "selector_", PROTECTED_FLAG_META = "protectedFlag", - LAYOUT_PREFIX = "/resource/layout/", MAC = "Mac OS X", + MAC = "Mac OS X", DOI_LOOKUP_PREFIX = "http://dx.doi.org/", NONE = "_non__", - ARXIV_LOOKUP_PREFIX = "http://arxiv.org/abs/", FORMATTER_PACKAGE = "net.sf.jabref.export.layout.format."; public static final String[] ENCODINGS; private static final String[] ALL_ENCODINGS = // (String[]) - // Charset.availableCharsets().keySet().toArray(new - // String[]{}); - new String[] {"ISO8859_1", "UTF8", "UTF-16", "ASCII", "Cp1250", "Cp1251", "Cp1252", - "Cp1253", "Cp1254", "Cp1257", "SJIS", - "KOI8_R", // Cyrillic - "EUC_JP", // Added Japanese encodings. - "Big5", "Big5_HKSCS", "GBK", "ISO8859_2", "ISO8859_3", "ISO8859_4", "ISO8859_5", - "ISO8859_6", "ISO8859_7", "ISO8859_8", "ISO8859_9", "ISO8859_13", "ISO8859_15"}; + // Charset.availableCharsets().keySet().toArray(new + // String[]{}); + new String[] {"ISO8859_1", "UTF8", "UTF-16", "ASCII", "Cp1250", "Cp1251", "Cp1252", + "Cp1253", "Cp1254", "Cp1257", "SJIS", + "KOI8_R", // Cyrillic + "EUC_JP", // Added Japanese encodings. + "Big5", "Big5_HKSCS", "GBK", "ISO8859_2", "ISO8859_3", "ISO8859_4", "ISO8859_5", + "ISO8859_6", "ISO8859_7", "ISO8859_8", "ISO8859_9", "ISO8859_13", "ISO8859_15"}; public static final Map ENCODING_NAMES_LOOKUP; static { @@ -208,14 +192,10 @@ public ResourceBundle newBundle(String baseName, Locale locale, public static final String osName = System.getProperty("os.name", "def"); - public static final boolean ON_MAC = (Globals.osName.equals(Globals.MAC)), ON_WIN = Globals.osName.startsWith("Windows"), + public static final boolean ON_MAC = (Globals.osName.equals(Globals.MAC)), + ON_WIN = Globals.osName.startsWith("Windows"), ON_LINUX = Globals.osName.startsWith("Linux"); - public static final String[] SKIP_WORDS = {"a", "an", "the", "for", "on", "of"}; - - public static final String SEPARATING_CHARS = ";,\n "; - public static final String SEPARATING_CHARS_NOSPACE = ";,\n"; - public static SidePaneManager sidePaneManager; // will be overridden in initialization due to feature #857 @@ -224,15 +204,11 @@ public ResourceBundle newBundle(String baseName, Locale locale, // Instantiate logger: private static final Log LOGGER = LogFactory.getLog(Globals.class); - - /** - * true if we have unix newlines - */ - public static final boolean UNIX_NEWLINE = Globals.NEWLINE.equals("\n"); + + public static JournalAbbreviationRepository journalAbbrev; /** - * "Fieldname" to indicate that a field should be treated as a bibtex - * string. Used when writing database to file. + * "Fieldname" to indicate that a field should be treated as a bibtex string. Used when writing database to file. */ public static final String BIBTEX_STRING = "__string"; @@ -248,6 +224,7 @@ public static void startBackgroundTasks() { /** * Initialize and start the autosave manager. + * * @param frame The main frame. */ public static void startAutoSaveManager(JabRefFrame frame) { @@ -267,18 +244,15 @@ public static void stopAutoSaveManager() { } public static void setLanguage(String language, String country) { - Globals.locale = new Locale(language, country); - Globals.messages = ResourceBundle.getBundle(Globals.RESOURCE_PREFIX, Globals.locale, new EncodingControl("UTF-8")); - Globals.menuTitles = ResourceBundle.getBundle(Globals.MENU_RESOURCE_PREFIX, Globals.locale, new EncodingControl("UTF-8")); - Globals.intMessages = ResourceBundle.getBundle(Globals.INTEGRITY_RESOURCE_PREFIX, Globals.locale, new EncodingControl("UTF-8")); - Locale.setDefault(Globals.locale); - javax.swing.JComponent.setDefaultLocale(Globals.locale); + Locale locale = new Locale(language, country); + Globals.messages = ResourceBundle.getBundle(Globals.RESOURCE_PREFIX, locale, new EncodingControl("UTF-8")); + Globals.menuTitles = ResourceBundle.getBundle(Globals.MENU_RESOURCE_PREFIX, locale, new EncodingControl("UTF-8")); + Globals.intMessages = ResourceBundle.getBundle(Globals.INTEGRITY_RESOURCE_PREFIX, locale, new EncodingControl("UTF-8")); + Locale.setDefault(locale); + javax.swing.JComponent.setDefaultLocale(locale); } - - public static JournalAbbreviationRepository journalAbbrev; - - public static String lang(String key, String[] params) { + public static String lang(String key, String... params) { String translation = null; try { if (Globals.messages != null) { @@ -336,18 +310,6 @@ public static String lang(String key) { return Globals.lang(key, (String[]) null); } - public static String lang(String key, String s1) { - return Globals.lang(key, new String[] {s1}); - } - - public static String lang(String key, String s1, String s2) { - return Globals.lang(key, new String[] {s1, s2}); - } - - public static String lang(String key, String s1, String s2, String s3) { - return Globals.lang(key, new String[] {s1, s2, s3}); - } - public static String menuTitle(String key) { String translation = null; try { @@ -406,859 +368,6 @@ public static BibtexEntryType getEntryType(String type) { public static final String SPECIAL_COMMAND_CHARS = "\"`^~'c="; - public static final HashMap HTMLCHARS = new HashMap(); - public static final HashMap XML_CHARS = new HashMap(); - public static final HashMap ASCII2XML_CHARS = new HashMap(); - public static final HashMap UNICODE_CHARS = new HashMap(); - public static final HashMap RTFCHARS = new HashMap(); - private static final HashMap URL_CHARS = new HashMap(); - - - public static int getShortcutMask() { - if (Globals.SHORTCUT_MASK == -1) { - try { - Globals.SHORTCUT_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); - } catch (Throwable ignored) { - - } - } - - return Globals.SHORTCUT_MASK; - } - - - static { - - // Special characters in URLs need to be replaced to ensure that the URL - // opens properly on all platforms: - Globals.URL_CHARS.put("<", "%3c"); - Globals.URL_CHARS.put(">", "%3e"); - Globals.URL_CHARS.put("(", "%28"); - Globals.URL_CHARS.put(")", "%29"); - Globals.URL_CHARS.put(" ", "%20"); - Globals.URL_CHARS.put("&", "%26"); - Globals.URL_CHARS.put("$", "%24"); - - // Following character definitions contributed by Ervin Kolenovic: - // HTML named entities from #192 - #255 (UNICODE Latin-1) - Globals.HTMLCHARS.put("`A", "À"); // #192 - Globals.HTMLCHARS.put("'A", "Á"); // #193 - Globals.HTMLCHARS.put("^A", "Â"); // #194 - Globals.HTMLCHARS.put("~A", "Ã"); // #195 - Globals.HTMLCHARS.put("\"A", "Ä"); // #196 - Globals.HTMLCHARS.put("AA", "Å"); // #197 - Globals.HTMLCHARS.put("AE", "Æ"); // #198 - Globals.HTMLCHARS.put("cC", "Ç"); // #199 - Globals.HTMLCHARS.put("`E", "È"); // #200 - Globals.HTMLCHARS.put("'E", "É"); // #201 - Globals.HTMLCHARS.put("^E", "Ê"); // #202 - Globals.HTMLCHARS.put("\"E", "Ë"); // #203 - Globals.HTMLCHARS.put("`I", "Ì"); // #204 - Globals.HTMLCHARS.put("'I", "Í"); // #205 - Globals.HTMLCHARS.put("^I", "Î"); // #206 - Globals.HTMLCHARS.put("\"I", "Ï"); // #207 - Globals.HTMLCHARS.put("DH", "Ð"); // #208 - Globals.HTMLCHARS.put("~N", "Ñ"); // #209 - Globals.HTMLCHARS.put("`O", "Ò"); // #210 - Globals.HTMLCHARS.put("'O", "Ó"); // #211 - Globals.HTMLCHARS.put("^O", "Ô"); // #212 - Globals.HTMLCHARS.put("~O", "Õ"); // #213 - Globals.HTMLCHARS.put("\"O", "Ö"); // #214 - // According to ISO 8859-1 the "\times" symbol should be placed here - // (#215). - // Omitting this, because it is a mathematical symbol. - Globals.HTMLCHARS.put("O", "Ø"); // #216 - Globals.HTMLCHARS.put("`U", "Ù"); // #217 - Globals.HTMLCHARS.put("'U", "Ú"); // #218 - Globals.HTMLCHARS.put("^U", "Û"); // #219 - Globals.HTMLCHARS.put("\"U", "Ü"); // #220 - Globals.HTMLCHARS.put("'Y", "Ý"); // #221 - Globals.HTMLCHARS.put("TH", "Þ"); // #222 - Globals.HTMLCHARS.put("ss", "ß"); // #223 - Globals.HTMLCHARS.put("`a", "à"); // #224 - Globals.HTMLCHARS.put("'a", "á"); // #225 - Globals.HTMLCHARS.put("^a", "â"); // #226 - Globals.HTMLCHARS.put("~a", "ã"); // #227 - Globals.HTMLCHARS.put("\"a", "ä"); // #228 - Globals.HTMLCHARS.put("aa", "å"); // #229 - Globals.HTMLCHARS.put("ae", "æ"); // #230 - Globals.HTMLCHARS.put("cc", "ç"); // #231 - Globals.HTMLCHARS.put("`e", "è"); // #232 - Globals.HTMLCHARS.put("'e", "é"); // #233 - Globals.HTMLCHARS.put("^e", "ê"); // #234 - Globals.HTMLCHARS.put("\"e", "ë"); // #235 - Globals.HTMLCHARS.put("`i", "ì"); // #236 - Globals.HTMLCHARS.put("'i", "í"); // #237 - Globals.HTMLCHARS.put("^i", "î"); // #238 - Globals.HTMLCHARS.put("\"i", "ï"); // #239 - Globals.HTMLCHARS.put("dh", "ð"); // #240 - Globals.HTMLCHARS.put("~n", "ñ"); // #241 - Globals.HTMLCHARS.put("`o", "ò"); // #242 - Globals.HTMLCHARS.put("'o", "ó"); // #243 - Globals.HTMLCHARS.put("^o", "ô"); // #244 - Globals.HTMLCHARS.put("~o", "õ"); // #245 - Globals.HTMLCHARS.put("\"o", "ö"); // #246 - // According to ISO 8859-1 the "\div" symbol should be placed here - // (#247). - // Omitting this, because it is a mathematical symbol. - Globals.HTMLCHARS.put("o", "ø"); // #248 - Globals.HTMLCHARS.put("`u", "ù"); // #249 - Globals.HTMLCHARS.put("'u", "ú"); // #250 - Globals.HTMLCHARS.put("^u", "û"); // #251 - Globals.HTMLCHARS.put("\"u", "ü"); // #252 - Globals.HTMLCHARS.put("'y", "ý"); // #253 - Globals.HTMLCHARS.put("th", "þ"); // #254 - Globals.HTMLCHARS.put("\"y", "ÿ"); // #255 - - // HTML special characters without names (UNICODE Latin Extended-A), - // indicated by UNICODE number - Globals.HTMLCHARS.put("=A", "Ā"); // "Amacr" - Globals.HTMLCHARS.put("=a", "ā"); // "amacr" - Globals.HTMLCHARS.put("uA", "Ă"); // "Abreve" - Globals.HTMLCHARS.put("ua", "ă"); // "abreve" - Globals.HTMLCHARS.put("kA", "Ą"); // "Aogon" - Globals.HTMLCHARS.put("ka", "ą"); // "aogon" - Globals.HTMLCHARS.put("'C", "Ć"); // "Cacute" - Globals.HTMLCHARS.put("'c", "ć"); // "cacute" - Globals.HTMLCHARS.put("^C", "Ĉ"); // "Ccirc" - Globals.HTMLCHARS.put("^c", "ĉ"); // "ccirc" - Globals.HTMLCHARS.put(".C", "Ċ"); // "Cdot" - Globals.HTMLCHARS.put(".c", "ċ"); // "cdot" - Globals.HTMLCHARS.put("vC", "Č"); // "Ccaron" - Globals.HTMLCHARS.put("vc", "č"); // "ccaron" - Globals.HTMLCHARS.put("vD", "Ď"); // "Dcaron" - // Symbol #271 (d) has no special Latex command - Globals.HTMLCHARS.put("DJ", "Đ"); // "Dstrok" - Globals.HTMLCHARS.put("dj", "đ"); // "dstrok" - Globals.HTMLCHARS.put("=E", "Ē"); // "Emacr" - Globals.HTMLCHARS.put("=e", "ē"); // "emacr" - Globals.HTMLCHARS.put("uE", "Ĕ"); // "Ebreve" - Globals.HTMLCHARS.put("ue", "ĕ"); // "ebreve" - Globals.HTMLCHARS.put(".E", "Ė"); // "Edot" - Globals.HTMLCHARS.put(".e", "ė"); // "edot" - Globals.HTMLCHARS.put("kE", "Ę"); // "Eogon" - Globals.HTMLCHARS.put("ke", "ę"); // "eogon" - Globals.HTMLCHARS.put("vE", "Ě"); // "Ecaron" - Globals.HTMLCHARS.put("ve", "ě"); // "ecaron" - Globals.HTMLCHARS.put("^G", "Ĝ"); // "Gcirc" - Globals.HTMLCHARS.put("^g", "ĝ"); // "gcirc" - Globals.HTMLCHARS.put("uG", "Ğ"); // "Gbreve" - Globals.HTMLCHARS.put("ug", "ğ"); // "gbreve" - Globals.HTMLCHARS.put(".G", "Ġ"); // "Gdot" - Globals.HTMLCHARS.put(".g", "ġ"); // "gdot" - Globals.HTMLCHARS.put("cG", "Ģ"); // "Gcedil" - Globals.HTMLCHARS.put("'g", "ģ"); // "gacute" - Globals.HTMLCHARS.put("^H", "Ĥ"); // "Hcirc" - Globals.HTMLCHARS.put("^h", "ĥ"); // "hcirc" - Globals.HTMLCHARS.put("Hstrok", "Ħ"); // "Hstrok" - Globals.HTMLCHARS.put("hstrok", "ħ"); // "hstrok" - Globals.HTMLCHARS.put("~I", "Ĩ"); // "Itilde" - Globals.HTMLCHARS.put("~i", "ĩ"); // "itilde" - Globals.HTMLCHARS.put("=I", "Ī"); // "Imacr" - Globals.HTMLCHARS.put("=i", "ī"); // "imacr" - Globals.HTMLCHARS.put("uI", "Ĭ"); // "Ibreve" - Globals.HTMLCHARS.put("ui", "ĭ"); // "ibreve" - Globals.HTMLCHARS.put("kI", "Į"); // "Iogon" - Globals.HTMLCHARS.put("ki", "į"); // "iogon" - Globals.HTMLCHARS.put(".I", "İ"); // "Idot" - Globals.HTMLCHARS.put("i", "ı"); // "inodot" - // Symbol #306 (IJ) has no special Latex command - // Symbol #307 (ij) has no special Latex command - Globals.HTMLCHARS.put("^J", "Ĵ"); // "Jcirc" - Globals.HTMLCHARS.put("^j", "ĵ"); // "jcirc" - Globals.HTMLCHARS.put("cK", "Ķ"); // "Kcedil" - Globals.HTMLCHARS.put("ck", "ķ"); // "kcedil" - // Symbol #312 (k) has no special Latex command - Globals.HTMLCHARS.put("'L", "Ĺ"); // "Lacute" - Globals.HTMLCHARS.put("'l", "ĺ"); // "lacute" - Globals.HTMLCHARS.put("cL", "Ļ"); // "Lcedil" - Globals.HTMLCHARS.put("cl", "ļ"); // "lcedil" - // Symbol #317 (L) has no special Latex command - // Symbol #318 (l) has no special Latex command - Globals.HTMLCHARS.put("Lmidot", "Ŀ"); // "Lmidot" - Globals.HTMLCHARS.put("lmidot", "ŀ"); // "lmidot" - Globals.HTMLCHARS.put("L", "Ł"); // "Lstrok" - Globals.HTMLCHARS.put("l", "ł"); // "lstrok" - Globals.HTMLCHARS.put("'N", "Ń"); // "Nacute" - Globals.HTMLCHARS.put("'n", "ń"); // "nacute" - Globals.HTMLCHARS.put("cN", "Ņ"); // "Ncedil" - Globals.HTMLCHARS.put("cn", "ņ"); // "ncedil" - Globals.HTMLCHARS.put("vN", "Ň"); // "Ncaron" - Globals.HTMLCHARS.put("vn", "ň"); // "ncaron" - // Symbol #329 (n) has no special Latex command - Globals.HTMLCHARS.put("NG", "Ŋ"); // "ENG" - Globals.HTMLCHARS.put("ng", "ŋ"); // "eng" - Globals.HTMLCHARS.put("=O", "Ō"); // "Omacr" - Globals.HTMLCHARS.put("=o", "ō"); // "omacr" - Globals.HTMLCHARS.put("uO", "Ŏ"); // "Obreve" - Globals.HTMLCHARS.put("uo", "ŏ"); // "obreve" - Globals.HTMLCHARS.put("HO", "Ő"); // "Odblac" - Globals.HTMLCHARS.put("Ho", "ő"); // "odblac" - Globals.HTMLCHARS.put("OE", "Œ"); // "OElig" - Globals.HTMLCHARS.put("oe", "œ"); // "oelig" - Globals.HTMLCHARS.put("'R", "Ŕ"); // "Racute" - Globals.HTMLCHARS.put("'r", "ŕ"); // "racute" - Globals.HTMLCHARS.put("cR", "Ŗ"); // "Rcedil" - Globals.HTMLCHARS.put("cr", "ŗ"); // "rcedil" - Globals.HTMLCHARS.put("vR", "Ř"); // "Rcaron" - Globals.HTMLCHARS.put("vr", "ř"); // "rcaron" - Globals.HTMLCHARS.put("'S", "Ś"); // "Sacute" - Globals.HTMLCHARS.put("'s", "ś"); // "sacute" - Globals.HTMLCHARS.put("^S", "Ŝ"); // "Scirc" - Globals.HTMLCHARS.put("^s", "ŝ"); // "scirc" - Globals.HTMLCHARS.put("cS", "Ş"); // "Scedil" - Globals.HTMLCHARS.put("cs", "ş"); // "scedil" - Globals.HTMLCHARS.put("vS", "Š"); // "Scaron" - Globals.HTMLCHARS.put("vs", "š"); // "scaron" - Globals.HTMLCHARS.put("cT", "Ţ"); // "Tcedil" - Globals.HTMLCHARS.put("ct", "ţ"); // "tcedil" - Globals.HTMLCHARS.put("vT", "Ť"); // "Tcaron" - // Symbol #357 (t) has no special Latex command - Globals.HTMLCHARS.put("Tstrok", "Ŧ"); // "Tstrok" - Globals.HTMLCHARS.put("tstrok", "ŧ"); // "tstrok" - Globals.HTMLCHARS.put("~U", "Ũ"); // "Utilde" - Globals.HTMLCHARS.put("~u", "ũ"); // "utilde" - Globals.HTMLCHARS.put("=U", "Ū"); // "Umacr" - Globals.HTMLCHARS.put("=u", "ū"); // "umacr" - Globals.HTMLCHARS.put("uU", "Ŭ"); // "Ubreve" - Globals.HTMLCHARS.put("uu", "ŭ"); // "ubreve" - Globals.HTMLCHARS.put("rU", "Ů"); // "Uring" - Globals.HTMLCHARS.put("ru", "ů"); // "uring" - Globals.HTMLCHARS.put("HU", "Ű"); // "Odblac" - Globals.HTMLCHARS.put("Hu", "ű"); // "odblac" - Globals.HTMLCHARS.put("kU", "Ų"); // "Uogon" - Globals.HTMLCHARS.put("ku", "ų"); // "uogon" - Globals.HTMLCHARS.put("^W", "Ŵ"); // "Wcirc" - Globals.HTMLCHARS.put("^w", "ŵ"); // "wcirc" - Globals.HTMLCHARS.put("^Y", "Ŷ"); // "Ycirc" - Globals.HTMLCHARS.put("^y", "ŷ"); // "ycirc" - Globals.HTMLCHARS.put("\"Y", "Ÿ"); // "Yuml" - Globals.HTMLCHARS.put("'Z", "Ź"); // "Zacute" - Globals.HTMLCHARS.put("'z", "ź"); // "zacute" - Globals.HTMLCHARS.put(".Z", "Ż"); // "Zdot" - Globals.HTMLCHARS.put(".z", "ż"); // "zdot" - Globals.HTMLCHARS.put("vZ", "Ž"); // "Zcaron" - Globals.HTMLCHARS.put("vz", "ž"); // "zcaron" - // Symbol #383 (f) has no special Latex command - Globals.HTMLCHARS.put("%", "%"); // percent sign - - Globals.XML_CHARS.put("\\{\\\\\\\"\\{a\\}\\}", "ä"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{A\\}\\}", "Ä"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{e\\}\\}", "ë"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{E\\}\\}", "Ë"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{i\\}\\}", "ï"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{I\\}\\}", "Ï"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{o\\}\\}", "ö"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{O\\}\\}", "Ö"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{u\\}\\}", "ü"); - Globals.XML_CHARS.put("\\{\\\\\\\"\\{U\\}\\}", "Ü"); - - //next 2 rows were missing... - Globals.XML_CHARS.put("\\{\\\\\\`\\{a\\}\\}", "à"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{A\\}\\}", "À"); - - Globals.XML_CHARS.put("\\{\\\\\\`\\{e\\}\\}", "è"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{E\\}\\}", "È"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{i\\}\\}", "ì"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{I\\}\\}", "Ì"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{o\\}\\}", "ò"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{O\\}\\}", "Ò"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{u\\}\\}", "ù"); - Globals.XML_CHARS.put("\\{\\\\\\`\\{U\\}\\}", "Ù"); - - //corrected these 10 lines below... - Globals.XML_CHARS.put("\\{\\\\\\'\\{a\\}\\}", "á"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{A\\}\\}", "Á"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{e\\}\\}", "é"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{E\\}\\}", "É"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{i\\}\\}", "í"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{I\\}\\}", "Í"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{o\\}\\}", "ó"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{O\\}\\}", "Ó"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{u\\}\\}", "ú"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{U\\}\\}", "Ú"); - //added next four chars... - Globals.XML_CHARS.put("\\{\\\\\\'\\{c\\}\\}", "ć"); - Globals.XML_CHARS.put("\\{\\\\\\'\\{C\\}\\}", "Ć"); - Globals.XML_CHARS.put("\\{\\\\c\\{c\\}\\}", "ç"); - Globals.XML_CHARS.put("\\{\\\\c\\{C\\}\\}", "Ç"); - - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{E\\}\\}", "É"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{i\\}\\}", "í"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{I\\}\\}", "Í"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{o\\}\\}", "ó"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{O\\}\\}", "Ó"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{u\\}\\}", "ú"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{U\\}\\}", "Ú"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{a\\}\\}", "á"); - Globals.XML_CHARS.put("\\{\\\\\\\uFFFD\\{A\\}\\}", "Á"); - - //next 2 rows were missing... - Globals.XML_CHARS.put("\\{\\\\\\^\\{a\\}\\}", "â"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{A\\}\\}", "Â"); - - Globals.XML_CHARS.put("\\{\\\\\\^\\{o\\}\\}", "ô"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{O\\}\\}", "Ô"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{u\\}\\}", "ù"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{U\\}\\}", "Ù"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{e\\}\\}", "ê"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{E\\}\\}", "Ê"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{i\\}\\}", "î"); - Globals.XML_CHARS.put("\\{\\\\\\^\\{I\\}\\}", "Î"); - - Globals.XML_CHARS.put("\\{\\\\\\~\\{o\\}\\}", "õ"); - Globals.XML_CHARS.put("\\{\\\\\\~\\{O\\}\\}", "Õ"); - Globals.XML_CHARS.put("\\{\\\\\\~\\{n\\}\\}", "ñ"); - Globals.XML_CHARS.put("\\{\\\\\\~\\{N\\}\\}", "Ñ"); - Globals.XML_CHARS.put("\\{\\\\\\~\\{a\\}\\}", "ã"); - Globals.XML_CHARS.put("\\{\\\\\\~\\{A\\}\\}", "Ã"); - - Globals.XML_CHARS.put("\\{\\\\\\\"a\\}", "ä"); - Globals.XML_CHARS.put("\\{\\\\\\\"A\\}", "Ä"); - Globals.XML_CHARS.put("\\{\\\\\\\"e\\}", "ë"); - Globals.XML_CHARS.put("\\{\\\\\\\"E\\}", "Ë"); - Globals.XML_CHARS.put("\\{\\\\\\\"i\\}", "ï"); - Globals.XML_CHARS.put("\\{\\\\\\\"I\\}", "Ï"); - Globals.XML_CHARS.put("\\{\\\\\\\"o\\}", "ö"); - Globals.XML_CHARS.put("\\{\\\\\\\"O\\}", "Ö"); - Globals.XML_CHARS.put("\\{\\\\\\\"u\\}", "ü"); - Globals.XML_CHARS.put("\\{\\\\\\\"U\\}", "Ü"); - - //next 2 rows were missing... - Globals.XML_CHARS.put("\\{\\\\\\`a\\}", "à"); - Globals.XML_CHARS.put("\\{\\\\\\`A\\}", "À"); - - Globals.XML_CHARS.put("\\{\\\\\\`e\\}", "è"); - Globals.XML_CHARS.put("\\{\\\\\\`E\\}", "È"); - Globals.XML_CHARS.put("\\{\\\\\\`i\\}", "ì"); - Globals.XML_CHARS.put("\\{\\\\\\`I\\}", "Ì"); - Globals.XML_CHARS.put("\\{\\\\\\`o\\}", "ò"); - Globals.XML_CHARS.put("\\{\\\\\\`O\\}", "Ò"); - Globals.XML_CHARS.put("\\{\\\\\\`u\\}", "ù"); - Globals.XML_CHARS.put("\\{\\\\\\`U\\}", "Ù"); - Globals.XML_CHARS.put("\\{\\\\\\'e\\}", "é"); - Globals.XML_CHARS.put("\\{\\\\\\'E\\}", "É"); - Globals.XML_CHARS.put("\\{\\\\\\'i\\}", "í"); - Globals.XML_CHARS.put("\\{\\\\\\'I\\}", "Í"); - Globals.XML_CHARS.put("\\{\\\\\\'o\\}", "ó"); - Globals.XML_CHARS.put("\\{\\\\\\'O\\}", "Ó"); - Globals.XML_CHARS.put("\\{\\\\\\'u\\}", "ú"); - Globals.XML_CHARS.put("\\{\\\\\\'U\\}", "Ú"); - Globals.XML_CHARS.put("\\{\\\\\\'a\\}", "á"); - Globals.XML_CHARS.put("\\{\\\\\\'A\\}", "Á"); - //added next two chars... - Globals.XML_CHARS.put("\\{\\\\\\'c\\}", "ć"); - Globals.XML_CHARS.put("\\{\\\\\\'C\\}", "Ć"); - - //next two lines were wrong... - Globals.XML_CHARS.put("\\{\\\\\\^a\\}", "â"); - Globals.XML_CHARS.put("\\{\\\\\\^A\\}", "Â"); - - Globals.XML_CHARS.put("\\{\\\\\\^o\\}", "ô"); - Globals.XML_CHARS.put("\\{\\\\\\^O\\}", "Ô"); - Globals.XML_CHARS.put("\\{\\\\\\^u\\}", "ù"); - Globals.XML_CHARS.put("\\{\\\\\\^U\\}", "Ù"); - Globals.XML_CHARS.put("\\{\\\\\\^e\\}", "ê"); - Globals.XML_CHARS.put("\\{\\\\\\^E\\}", "Ê"); - Globals.XML_CHARS.put("\\{\\\\\\^i\\}", "î"); - Globals.XML_CHARS.put("\\{\\\\\\^I\\}", "Î"); - Globals.XML_CHARS.put("\\{\\\\\\~o\\}", "õ"); - Globals.XML_CHARS.put("\\{\\\\\\~O\\}", "Õ"); - Globals.XML_CHARS.put("\\{\\\\\\~n\\}", "ñ"); - Globals.XML_CHARS.put("\\{\\\\\\~N\\}", "Ñ"); - Globals.XML_CHARS.put("\\{\\\\\\~a\\}", "ã"); - Globals.XML_CHARS.put("\\{\\\\\\~A\\}", "Ã"); - - Globals.ASCII2XML_CHARS.put("<", "<"); - Globals.ASCII2XML_CHARS.put("\"", """); - Globals.ASCII2XML_CHARS.put(">", ">"); - - Globals.UNICODE_CHARS.put("\u00C0", "A"); - Globals.UNICODE_CHARS.put("\u00C1", "A"); - Globals.UNICODE_CHARS.put("\u00C2", "A"); - Globals.UNICODE_CHARS.put("\u00C3", "A"); - Globals.UNICODE_CHARS.put("\u00C4", "Ae"); - Globals.UNICODE_CHARS.put("\u00C5", "Aa"); - Globals.UNICODE_CHARS.put("\u00C6", "Ae"); - Globals.UNICODE_CHARS.put("\u00C7", "C"); - Globals.UNICODE_CHARS.put("\u00C8", "E"); - Globals.UNICODE_CHARS.put("\u00C9", "E"); - Globals.UNICODE_CHARS.put("\u00CA", "E"); - Globals.UNICODE_CHARS.put("\u00CB", "E"); - Globals.UNICODE_CHARS.put("\u00CC", "I"); - Globals.UNICODE_CHARS.put("\u00CD", "I"); - Globals.UNICODE_CHARS.put("\u00CE", "I"); - Globals.UNICODE_CHARS.put("\u00CF", "I"); - Globals.UNICODE_CHARS.put("\u00D0", "D"); - Globals.UNICODE_CHARS.put("\u00D1", "N"); - Globals.UNICODE_CHARS.put("\u00D2", "O"); - Globals.UNICODE_CHARS.put("\u00D3", "O"); - Globals.UNICODE_CHARS.put("\u00D4", "O"); - Globals.UNICODE_CHARS.put("\u00D5", "O"); - Globals.UNICODE_CHARS.put("\u00D6", "Oe"); - Globals.UNICODE_CHARS.put("\u00D8", "Oe"); - Globals.UNICODE_CHARS.put("\u00D9", "U"); - Globals.UNICODE_CHARS.put("\u00DA", "U"); - Globals.UNICODE_CHARS.put("\u00DB", "U"); - Globals.UNICODE_CHARS.put("\u00DC", "Ue"); // U umlaut .. - Globals.UNICODE_CHARS.put("\u00DD", "Y"); - Globals.UNICODE_CHARS.put("\u00DF", "ss"); - Globals.UNICODE_CHARS.put("\u00E0", "a"); - Globals.UNICODE_CHARS.put("\u00E1", "a"); - Globals.UNICODE_CHARS.put("\u00E2", "a"); - Globals.UNICODE_CHARS.put("\u00E3", "a"); - Globals.UNICODE_CHARS.put("\u00E4", "ae"); - Globals.UNICODE_CHARS.put("\u00E5", "aa"); - Globals.UNICODE_CHARS.put("\u00E6", "ae"); - Globals.UNICODE_CHARS.put("\u00E7", "c"); - Globals.UNICODE_CHARS.put("\u00E8", "e"); - Globals.UNICODE_CHARS.put("\u00E9", "e"); - Globals.UNICODE_CHARS.put("\u00EA", "e"); - Globals.UNICODE_CHARS.put("\u00EB", "e"); - Globals.UNICODE_CHARS.put("\u00EC", "i"); - Globals.UNICODE_CHARS.put("\u00ED", "i"); - Globals.UNICODE_CHARS.put("\u00EE", "i"); - Globals.UNICODE_CHARS.put("\u00EF", "i"); - Globals.UNICODE_CHARS.put("\u00F0", "o"); - Globals.UNICODE_CHARS.put("\u00F1", "n"); - Globals.UNICODE_CHARS.put("\u00F2", "o"); - Globals.UNICODE_CHARS.put("\u00F3", "o"); - Globals.UNICODE_CHARS.put("\u00F4", "o"); - Globals.UNICODE_CHARS.put("\u00F5", "o"); - Globals.UNICODE_CHARS.put("\u00F6", "oe"); - Globals.UNICODE_CHARS.put("\u00F8", "oe"); - Globals.UNICODE_CHARS.put("\u00F9", "u"); - Globals.UNICODE_CHARS.put("\u00FA", "u"); - Globals.UNICODE_CHARS.put("\u00FB", "u"); - Globals.UNICODE_CHARS.put("\u00FC", "ue"); // u umlaut... - Globals.UNICODE_CHARS.put("\u00FD", "y"); - Globals.UNICODE_CHARS.put("\u00FF", "y"); - Globals.UNICODE_CHARS.put("\u0100", "A"); - Globals.UNICODE_CHARS.put("\u0101", "a"); - Globals.UNICODE_CHARS.put("\u0102", "A"); - Globals.UNICODE_CHARS.put("\u0103", "a"); - Globals.UNICODE_CHARS.put("\u0104", "A"); - Globals.UNICODE_CHARS.put("\u0105", "a"); - Globals.UNICODE_CHARS.put("\u0106", "C"); - Globals.UNICODE_CHARS.put("\u0107", "c"); - Globals.UNICODE_CHARS.put("\u0108", "C"); - Globals.UNICODE_CHARS.put("\u0109", "c"); - Globals.UNICODE_CHARS.put("\u010A", "C"); - Globals.UNICODE_CHARS.put("\u010B", "c"); - Globals.UNICODE_CHARS.put("\u010C", "C"); - Globals.UNICODE_CHARS.put("\u010D", "c"); - Globals.UNICODE_CHARS.put("\u010E", "D"); - Globals.UNICODE_CHARS.put("\u010F", "d"); - Globals.UNICODE_CHARS.put("\u0110", "D"); - Globals.UNICODE_CHARS.put("\u0111", "d"); - Globals.UNICODE_CHARS.put("\u0112", "E"); - Globals.UNICODE_CHARS.put("\u0113", "e"); - Globals.UNICODE_CHARS.put("\u0114", "E"); - Globals.UNICODE_CHARS.put("\u0115", "e"); - Globals.UNICODE_CHARS.put("\u0116", "E"); - Globals.UNICODE_CHARS.put("\u0117", "e"); - Globals.UNICODE_CHARS.put("\u0118", "E"); - Globals.UNICODE_CHARS.put("\u0119", "e"); - Globals.UNICODE_CHARS.put("\u011A", "E"); - Globals.UNICODE_CHARS.put("\u011B", "e"); - Globals.UNICODE_CHARS.put("\u011C", "G"); - Globals.UNICODE_CHARS.put("\u011D", "g"); - Globals.UNICODE_CHARS.put("\u011E", "G"); - Globals.UNICODE_CHARS.put("\u011F", "g"); - Globals.UNICODE_CHARS.put("\u0120", "G"); - Globals.UNICODE_CHARS.put("\u0121", "g"); - Globals.UNICODE_CHARS.put("\u0122", "G"); - Globals.UNICODE_CHARS.put("\u0123", "g"); - Globals.UNICODE_CHARS.put("\u0124", "H"); - Globals.UNICODE_CHARS.put("\u0125", "h"); - Globals.UNICODE_CHARS.put("\u0127", "h"); - Globals.UNICODE_CHARS.put("\u0128", "I"); - Globals.UNICODE_CHARS.put("\u0129", "i"); - Globals.UNICODE_CHARS.put("\u012A", "I"); - Globals.UNICODE_CHARS.put("\u012B", "i"); - Globals.UNICODE_CHARS.put("\u012C", "I"); - Globals.UNICODE_CHARS.put("\u012D", "i"); - Globals.UNICODE_CHARS.put("\u012E", "I"); - Globals.UNICODE_CHARS.put("\u012F", "i"); - Globals.UNICODE_CHARS.put("\u0130", "I"); - Globals.UNICODE_CHARS.put("\u0131", "i"); - Globals.UNICODE_CHARS.put("\u0132", "IJ"); - Globals.UNICODE_CHARS.put("\u0133", "ij"); - Globals.UNICODE_CHARS.put("\u0134", "J"); - Globals.UNICODE_CHARS.put("\u0135", "j"); - Globals.UNICODE_CHARS.put("\u0136", "K"); - Globals.UNICODE_CHARS.put("\u0137", "k"); - Globals.UNICODE_CHARS.put("\u0138", "k"); - Globals.UNICODE_CHARS.put("\u0139", "L"); - Globals.UNICODE_CHARS.put("\u013A", "l"); - Globals.UNICODE_CHARS.put("\u013B", "L"); - Globals.UNICODE_CHARS.put("\u013C", "l"); - Globals.UNICODE_CHARS.put("\u013D", "L"); - Globals.UNICODE_CHARS.put("\u013E", "l"); - Globals.UNICODE_CHARS.put("\u013F", "L"); - Globals.UNICODE_CHARS.put("\u0140", "l"); - Globals.UNICODE_CHARS.put("\u0141", "L"); - Globals.UNICODE_CHARS.put("\u0142", "l"); - Globals.UNICODE_CHARS.put("\u0143", "N"); - Globals.UNICODE_CHARS.put("\u0144", "n"); - Globals.UNICODE_CHARS.put("\u0145", "N"); - Globals.UNICODE_CHARS.put("\u0146", "n"); - Globals.UNICODE_CHARS.put("\u0147", "N"); - Globals.UNICODE_CHARS.put("\u0148", "n"); - Globals.UNICODE_CHARS.put("\u0149", "n"); - Globals.UNICODE_CHARS.put("\u014A", "N"); - Globals.UNICODE_CHARS.put("\u014B", "n"); - Globals.UNICODE_CHARS.put("\u014C", "O"); - Globals.UNICODE_CHARS.put("\u014D", "o"); - Globals.UNICODE_CHARS.put("\u014E", "O"); - Globals.UNICODE_CHARS.put("\u014F", "o"); - Globals.UNICODE_CHARS.put("\u0150", "Oe"); - Globals.UNICODE_CHARS.put("\u0151", "oe"); - Globals.UNICODE_CHARS.put("\u0152", "OE"); - Globals.UNICODE_CHARS.put("\u0153", "oe"); - Globals.UNICODE_CHARS.put("\u0154", "R"); - Globals.UNICODE_CHARS.put("\u0155", "r"); - Globals.UNICODE_CHARS.put("\u0156", "R"); - Globals.UNICODE_CHARS.put("\u0157", "r"); - Globals.UNICODE_CHARS.put("\u0158", "R"); - Globals.UNICODE_CHARS.put("\u0159", "r"); - Globals.UNICODE_CHARS.put("\u015A", "S"); - Globals.UNICODE_CHARS.put("\u015B", "s"); - Globals.UNICODE_CHARS.put("\u015C", "S"); - Globals.UNICODE_CHARS.put("\u015D", "s"); - Globals.UNICODE_CHARS.put("\u015E", "S"); - Globals.UNICODE_CHARS.put("\u015F", "s"); - Globals.UNICODE_CHARS.put("\u0160", "S"); - Globals.UNICODE_CHARS.put("\u0161", "s"); - Globals.UNICODE_CHARS.put("\u0162", "T"); - Globals.UNICODE_CHARS.put("\u0163", "t"); - Globals.UNICODE_CHARS.put("\u0164", "T"); - Globals.UNICODE_CHARS.put("\u0165", "t"); - Globals.UNICODE_CHARS.put("\u0166", "T"); - Globals.UNICODE_CHARS.put("\u0167", "t"); - Globals.UNICODE_CHARS.put("\u0168", "U"); - Globals.UNICODE_CHARS.put("\u0169", "u"); - Globals.UNICODE_CHARS.put("\u016A", "U"); - Globals.UNICODE_CHARS.put("\u016B", "u"); - Globals.UNICODE_CHARS.put("\u016C", "U"); - Globals.UNICODE_CHARS.put("\u016D", "u"); - Globals.UNICODE_CHARS.put("\u016E", "UU"); - Globals.UNICODE_CHARS.put("\u016F", "uu"); - Globals.UNICODE_CHARS.put("\u0170", "Ue"); - Globals.UNICODE_CHARS.put("\u0171", "ue"); - Globals.UNICODE_CHARS.put("\u0172", "U"); - Globals.UNICODE_CHARS.put("\u0173", "u"); - Globals.UNICODE_CHARS.put("\u0174", "W"); - Globals.UNICODE_CHARS.put("\u0175", "w"); - Globals.UNICODE_CHARS.put("\u0176", "Y"); - Globals.UNICODE_CHARS.put("\u0177", "y"); - Globals.UNICODE_CHARS.put("\u0178", "Y"); - Globals.UNICODE_CHARS.put("\u0179", "Z"); - Globals.UNICODE_CHARS.put("\u017A", "z"); - Globals.UNICODE_CHARS.put("\u017B", "Z"); - Globals.UNICODE_CHARS.put("\u017C", "z"); - Globals.UNICODE_CHARS.put("\u017D", "Z"); - Globals.UNICODE_CHARS.put("\u017E", "z"); - Globals.UNICODE_CHARS.put("\u1EBC", "E"); - Globals.UNICODE_CHARS.put("\u1EBD", "e"); - Globals.UNICODE_CHARS.put("\u1EF8", "Y"); - Globals.UNICODE_CHARS.put("\u1EF9", "y"); - Globals.UNICODE_CHARS.put("\u01CD", "A"); - Globals.UNICODE_CHARS.put("\u01CE", "a"); - Globals.UNICODE_CHARS.put("\u01CF", "I"); - Globals.UNICODE_CHARS.put("\u01D0", "i"); - Globals.UNICODE_CHARS.put("\u01D1", "O"); - Globals.UNICODE_CHARS.put("\u01D2", "o"); - Globals.UNICODE_CHARS.put("\u01D3", "U"); - Globals.UNICODE_CHARS.put("\u01D4", "u"); - Globals.UNICODE_CHARS.put("\u0232", "Y"); - Globals.UNICODE_CHARS.put("\u0233", "y"); - Globals.UNICODE_CHARS.put("\u01EA", "O"); - Globals.UNICODE_CHARS.put("\u01EB", "o"); - Globals.UNICODE_CHARS.put("\u1E0C", "D"); - Globals.UNICODE_CHARS.put("\u1E0D", "d"); - Globals.UNICODE_CHARS.put("\u1E24", "H"); - Globals.UNICODE_CHARS.put("\u1E25", "h"); - Globals.UNICODE_CHARS.put("\u1E36", "L"); - Globals.UNICODE_CHARS.put("\u1E37", "l"); - Globals.UNICODE_CHARS.put("\u1E38", "L"); - Globals.UNICODE_CHARS.put("\u1E39", "l"); - Globals.UNICODE_CHARS.put("\u1E42", "M"); - Globals.UNICODE_CHARS.put("\u1E43", "m"); - Globals.UNICODE_CHARS.put("\u1E46", "N"); - Globals.UNICODE_CHARS.put("\u1E47", "n"); - Globals.UNICODE_CHARS.put("\u1E5A", "R"); - Globals.UNICODE_CHARS.put("\u1E5B", "r"); - Globals.UNICODE_CHARS.put("\u1E5C", "R"); - Globals.UNICODE_CHARS.put("\u1E5D", "r"); - Globals.UNICODE_CHARS.put("\u1E62", "S"); - Globals.UNICODE_CHARS.put("\u1E63", "s"); - Globals.UNICODE_CHARS.put("\u1E6C", "T"); - Globals.UNICODE_CHARS.put("\u1E6D", "t"); - Globals.UNICODE_CHARS.put("\u00CF", "I"); - - Globals.UNICODE_CHARS.put("\u008C", "AE"); // doesn't work? - Globals.UNICODE_CHARS.put("\u016E", "U"); - Globals.UNICODE_CHARS.put("\u016F", "u"); - - Globals.UNICODE_CHARS.put("\u0178", "Y"); - Globals.UNICODE_CHARS.put("\u00FE", ""); // thorn character - - // UNICODE_CHARS.put("\u0100", ""); - - Globals.RTFCHARS.put("`a", "\\'e0"); - Globals.RTFCHARS.put("`e", "\\'e8"); - Globals.RTFCHARS.put("`i", "\\'ec"); - Globals.RTFCHARS.put("`o", "\\'f2"); - Globals.RTFCHARS.put("`u", "\\'f9"); - Globals.RTFCHARS.put("?a", "\\'e1"); - Globals.RTFCHARS.put("?e", "\\'e9"); - Globals.RTFCHARS.put("?i", "\\'ed"); - Globals.RTFCHARS.put("?o", "\\'f3"); - Globals.RTFCHARS.put("?u", "\\'fa"); - Globals.RTFCHARS.put("^a", "\\'e2"); - Globals.RTFCHARS.put("^e", "\\'ea"); - Globals.RTFCHARS.put("^i", "\\'ee"); - Globals.RTFCHARS.put("^o", "\\'f4"); - Globals.RTFCHARS.put("^u", "\\'fa"); - Globals.RTFCHARS.put("\"a", "\\'e4"); - Globals.RTFCHARS.put("\"e", "\\'eb"); - Globals.RTFCHARS.put("\"i", "\\'ef"); - Globals.RTFCHARS.put("\"o", "\\'f6"); - Globals.RTFCHARS.put("\"u", "\\u252u"); - Globals.RTFCHARS.put("~n", "\\'f1"); - Globals.RTFCHARS.put("`A", "\\'c0"); - Globals.RTFCHARS.put("`E", "\\'c8"); - Globals.RTFCHARS.put("`I", "\\'cc"); - Globals.RTFCHARS.put("`O", "\\'d2"); - Globals.RTFCHARS.put("`U", "\\'d9"); - Globals.RTFCHARS.put("?A", "\\'c1"); - Globals.RTFCHARS.put("?E", "\\'c9"); - Globals.RTFCHARS.put("?I", "\\'cd"); - Globals.RTFCHARS.put("?O", "\\'d3"); - Globals.RTFCHARS.put("?U", "\\'da"); - Globals.RTFCHARS.put("^A", "\\'c2"); - Globals.RTFCHARS.put("^E", "\\'ca"); - Globals.RTFCHARS.put("^I", "\\'ce"); - Globals.RTFCHARS.put("^O", "\\'d4"); - Globals.RTFCHARS.put("^U", "\\'db"); - Globals.RTFCHARS.put("\"A", "\\'c4"); - Globals.RTFCHARS.put("\"E", "\\'cb"); - Globals.RTFCHARS.put("\"I", "\\'cf"); - Globals.RTFCHARS.put("\"O", "\\'d6"); - Globals.RTFCHARS.put("\"U", "\\'dc"); - - // Use UNICODE characters for RTF-Chars which can not be found in the - // standard codepage - - Globals.RTFCHARS.put("`A", "\\u192A"); // "Agrave" - Globals.RTFCHARS.put("'A", "\\u193A"); // "Aacute" - Globals.RTFCHARS.put("^A", "\\u194A"); // "Acirc" - Globals.RTFCHARS.put("~A", "\\u195A"); // "Atilde" - Globals.RTFCHARS.put("\"A", "\\u196A"); // "Auml" - Globals.RTFCHARS.put("AA", "\\u197A"); // "Aring" - // RTFCHARS.put("AE", "{\\uc2\\u198AE}"); // "AElig" -Globals.RTFCHARS.put("AE", "{\\u198A}"); // "AElig" - Globals.RTFCHARS.put("cC", "\\u199C"); // "Ccedil" - Globals.RTFCHARS.put("`E", "\\u200E"); // "Egrave" - Globals.RTFCHARS.put("'E", "\\u201E"); // "Eacute" - Globals.RTFCHARS.put("^E", "\\u202E"); // "Ecirc" - Globals.RTFCHARS.put("\"E", "\\u203E"); // "Euml" - Globals.RTFCHARS.put("`I", "\\u204I"); // "Igrave - Globals.RTFCHARS.put("'I", "\\u205I"); // "Iacute" - Globals.RTFCHARS.put("^I", "\\u206I"); // "Icirc" - Globals.RTFCHARS.put("\"I", "\\u207I"); // "Iuml" - Globals.RTFCHARS.put("DH", "\\u208D"); // "ETH" - Globals.RTFCHARS.put("~N", "\\u209N"); // "Ntilde" - Globals.RTFCHARS.put("`O", "\\u210O"); // "Ograve" - Globals.RTFCHARS.put("'O", "\\u211O"); // "Oacute" - Globals.RTFCHARS.put("^O", "\\u212O"); // "Ocirc" - Globals.RTFCHARS.put("~O", "\\u213O"); // "Otilde" - Globals.RTFCHARS.put("\"O", "\\u214O"); // "Ouml" - // According to ISO 8859-1 the "\times" symbol should be placed here - // (#215). - // Omitting this, because it is a mathematical symbol. - Globals.RTFCHARS.put("O", "\\u216O"); // "Oslash" - // RTFCHARS.put("O", "\\'d8"); - Globals.RTFCHARS.put("o", "\\'f8"); - Globals.RTFCHARS.put("`U", "\\u217U"); // "Ugrave" - Globals.RTFCHARS.put("'U", "\\u218U"); // "Uacute" - Globals.RTFCHARS.put("^U", "\\u219U"); // "Ucirc" - Globals.RTFCHARS.put("\"U", "\\u220U"); // "Uuml" - Globals.RTFCHARS.put("'Y", "\\u221Y"); // "Yacute" - Globals.RTFCHARS.put("TH", "{\\uc2\\u222TH}"); // "THORN" - Globals.RTFCHARS.put("ss", "{\\uc2\\u223ss}"); // "szlig" - //RTFCHARS.put("ss", "AFFEN"); // "szlig" - Globals.RTFCHARS.put("`a", "\\u224a"); // "agrave" - Globals.RTFCHARS.put("'a", "\\u225a"); // "aacute" - Globals.RTFCHARS.put("^a", "\\u226a"); // "acirc" - Globals.RTFCHARS.put("~a", "\\u227a"); // "atilde" - Globals.RTFCHARS.put("\"a", "\\u228a"); // "auml" - Globals.RTFCHARS.put("aa", "\\u229a"); // "aring" - // RTFCHARS.put("ae", "{\\uc2\\u230ae}"); // "aelig" \\u230e6 -Globals.RTFCHARS.put("ae", "{\\u230a}"); // "aelig" \\u230e6 - Globals.RTFCHARS.put("cc", "\\u231c"); // "ccedil" - Globals.RTFCHARS.put("`e", "\\u232e"); // "egrave" - Globals.RTFCHARS.put("'e", "\\u233e"); // "eacute" - Globals.RTFCHARS.put("^e", "\\u234e"); // "ecirc" - Globals.RTFCHARS.put("\"e", "\\u235e"); // "euml" - Globals.RTFCHARS.put("`i", "\\u236i"); // "igrave" - Globals.RTFCHARS.put("'i", "\\u237i"); // "iacute" - Globals.RTFCHARS.put("^i", "\\u238i"); // "icirc" - Globals.RTFCHARS.put("\"i", "\\u239i"); // "iuml" - Globals.RTFCHARS.put("dh", "\\u240d"); // "eth" - Globals.RTFCHARS.put("~n", "\\u241n"); // "ntilde" - Globals.RTFCHARS.put("`o", "\\u242o"); // "ograve" - Globals.RTFCHARS.put("'o", "\\u243o"); // "oacute" - Globals.RTFCHARS.put("^o", "\\u244o"); // "ocirc" - Globals.RTFCHARS.put("~o", "\\u245o"); // "otilde" - Globals.RTFCHARS.put("\"o", "\\u246o"); // "ouml" - // According to ISO 8859-1 the "\div" symbol should be placed here - // (#247). - // Omitting this, because it is a mathematical symbol. - Globals.RTFCHARS.put("o", "\\u248o"); // "oslash" - Globals.RTFCHARS.put("`u", "\\u249u"); // "ugrave" - Globals.RTFCHARS.put("'u", "\\u250u"); // "uacute" - Globals.RTFCHARS.put("^u", "\\u251u"); // "ucirc" - // RTFCHARS.put("\"u", "\\u252"); // "uuml" exists in standard -// codepage - Globals.RTFCHARS.put("'y", "\\u253y"); // "yacute" - Globals.RTFCHARS.put("th", "{\\uc2\\u254th}"); // "thorn" - Globals.RTFCHARS.put("\"y", "\\u255y"); // "yuml" - - Globals.RTFCHARS.put("=A", "\\u256A"); // "Amacr" - Globals.RTFCHARS.put("=a", "\\u257a"); // "amacr" - Globals.RTFCHARS.put("uA", "\\u258A"); // "Abreve" - Globals.RTFCHARS.put("ua", "\\u259a"); // "abreve" - Globals.RTFCHARS.put("kA", "\\u260A"); // "Aogon" - Globals.RTFCHARS.put("ka", "\\u261a"); // "aogon" - Globals.RTFCHARS.put("'C", "\\u262C"); // "Cacute" - Globals.RTFCHARS.put("'c", "\\u263c"); // "cacute" - Globals.RTFCHARS.put("^C", "\\u264C"); // "Ccirc" - Globals.RTFCHARS.put("^c", "\\u265c"); // "ccirc" - Globals.RTFCHARS.put(".C", "\\u266C"); // "Cdot" - Globals.RTFCHARS.put(".c", "\\u267c"); // "cdot" - Globals.RTFCHARS.put("vC", "\\u268C"); // "Ccaron" - Globals.RTFCHARS.put("vc", "\\u269c"); // "ccaron" - Globals.RTFCHARS.put("vD", "\\u270D"); // "Dcaron" - // Symbol #271 (d) has no special Latex command - Globals.RTFCHARS.put("DJ", "\\u272D"); // "Dstrok" - Globals.RTFCHARS.put("dj", "\\u273d"); // "dstrok" - Globals.RTFCHARS.put("=E", "\\u274E"); // "Emacr" - Globals.RTFCHARS.put("=e", "\\u275e"); // "emacr" - Globals.RTFCHARS.put("uE", "\\u276E"); // "Ebreve" - Globals.RTFCHARS.put("ue", "\\u277e"); // "ebreve" - Globals.RTFCHARS.put(".E", "\\u278E"); // "Edot" - Globals.RTFCHARS.put(".e", "\\u279e"); // "edot" - Globals.RTFCHARS.put("kE", "\\u280E"); // "Eogon" - Globals.RTFCHARS.put("ke", "\\u281e"); // "eogon" - Globals.RTFCHARS.put("vE", "\\u282E"); // "Ecaron" - Globals.RTFCHARS.put("ve", "\\u283e"); // "ecaron" - Globals.RTFCHARS.put("^G", "\\u284G"); // "Gcirc" - Globals.RTFCHARS.put("^g", "\\u285g"); // "gcirc" - Globals.RTFCHARS.put("uG", "\\u286G"); // "Gbreve" - Globals.RTFCHARS.put("ug", "\\u287g"); // "gbreve" - Globals.RTFCHARS.put(".G", "\\u288G"); // "Gdot" - Globals.RTFCHARS.put(".g", "\\u289g"); // "gdot" - Globals.RTFCHARS.put("cG", "\\u290G"); // "Gcedil" - Globals.RTFCHARS.put("'g", "\\u291g"); // "gacute" - Globals.RTFCHARS.put("^H", "\\u292H"); // "Hcirc" - Globals.RTFCHARS.put("^h", "\\u293h"); // "hcirc" - Globals.RTFCHARS.put("Hstrok", "\\u294H"); // "Hstrok" - Globals.RTFCHARS.put("hstrok", "\\u295h"); // "hstrok" - Globals.RTFCHARS.put("~I", "\\u296I"); // "Itilde" - Globals.RTFCHARS.put("~i", "\\u297i"); // "itilde" - Globals.RTFCHARS.put("=I", "\\u298I"); // "Imacr" - Globals.RTFCHARS.put("=i", "\\u299i"); // "imacr" - Globals.RTFCHARS.put("uI", "\\u300I"); // "Ibreve" - Globals.RTFCHARS.put("ui", "\\u301i"); // "ibreve" - Globals.RTFCHARS.put("kI", "\\u302I"); // "Iogon" - Globals.RTFCHARS.put("ki", "\\u303i"); // "iogon" - Globals.RTFCHARS.put(".I", "\\u304I"); // "Idot" - Globals.RTFCHARS.put("i", "\\u305i"); // "inodot" - // Symbol #306 (IJ) has no special Latex command - // Symbol #307 (ij) has no special Latex command - Globals.RTFCHARS.put("^J", "\\u308J"); // "Jcirc" - Globals.RTFCHARS.put("^j", "\\u309j"); // "jcirc" - Globals.RTFCHARS.put("cK", "\\u310K"); // "Kcedil" - Globals.RTFCHARS.put("ck", "\\u311k"); // "kcedil" - // Symbol #312 (k) has no special Latex command - Globals.RTFCHARS.put("'L", "\\u313L"); // "Lacute" - Globals.RTFCHARS.put("'l", "\\u314l"); // "lacute" - Globals.RTFCHARS.put("cL", "\\u315L"); // "Lcedil" - Globals.RTFCHARS.put("cl", "\\u316l"); // "lcedil" - // Symbol #317 (L) has no special Latex command - // Symbol #318 (l) has no special Latex command - Globals.RTFCHARS.put("Lmidot", "\\u319L"); // "Lmidot" - Globals.RTFCHARS.put("lmidot", "\\u320l"); // "lmidot" - Globals.RTFCHARS.put("L", "\\u321L"); // "Lstrok" - Globals.RTFCHARS.put("l", "\\u322l"); // "lstrok" - Globals.RTFCHARS.put("'N", "\\u323N"); // "Nacute" - Globals.RTFCHARS.put("'n", "\\u324n"); // "nacute" - Globals.RTFCHARS.put("cN", "\\u325N"); // "Ncedil" - Globals.RTFCHARS.put("cn", "\\u326n"); // "ncedil" - Globals.RTFCHARS.put("vN", "\\u327N"); // "Ncaron" - Globals.RTFCHARS.put("vn", "\\u328n"); // "ncaron" - // Symbol #329 (n) has no special Latex command - Globals.RTFCHARS.put("NG", "\\u330G"); // "ENG" - Globals.RTFCHARS.put("ng", "\\u331g"); // "eng" - Globals.RTFCHARS.put("=O", "\\u332O"); // "Omacr" - Globals.RTFCHARS.put("=o", "\\u333o"); // "omacr" - Globals.RTFCHARS.put("uO", "\\u334O"); // "Obreve" - Globals.RTFCHARS.put("uo", "\\u335o"); // "obreve" - Globals.RTFCHARS.put("HO", "\\u336?"); // "Odblac" - Globals.RTFCHARS.put("Ho", "\\u337?"); // "odblac" - Globals.RTFCHARS.put("OE", "{\\uc2\\u338OE}"); // "OElig" - Globals.RTFCHARS.put("oe", "{\\uc2\\u339oe}"); // "oelig" - Globals.RTFCHARS.put("'R", "\\u340R"); // "Racute" - Globals.RTFCHARS.put("'r", "\\u341r"); // "racute" - Globals.RTFCHARS.put("cR", "\\u342R"); // "Rcedil" - Globals.RTFCHARS.put("cr", "\\u343r"); // "rcedil" - Globals.RTFCHARS.put("vR", "\\u344R"); // "Rcaron" - Globals.RTFCHARS.put("vr", "\\u345r"); // "rcaron" - Globals.RTFCHARS.put("'S", "\\u346S"); // "Sacute" - Globals.RTFCHARS.put("'s", "\\u347s"); // "sacute" - Globals.RTFCHARS.put("^S", "\\u348S"); // "Scirc" - Globals.RTFCHARS.put("^s", "\\u349s"); // "scirc" - Globals.RTFCHARS.put("cS", "\\u350S"); // "Scedil" - Globals.RTFCHARS.put("cs", "\\u351s"); // "scedil" - Globals.RTFCHARS.put("vS", "\\u352S"); // "Scaron" - Globals.RTFCHARS.put("vs", "\\u353s"); // "scaron" - Globals.RTFCHARS.put("cT", "\\u354T"); // "Tcedil" - Globals.RTFCHARS.put("ct", "\\u355t"); // "tcedil" - Globals.RTFCHARS.put("vT", "\\u356T"); // "Tcaron" - // Symbol #357 (t) has no special Latex command - Globals.RTFCHARS.put("Tstrok", "\\u358T"); // "Tstrok" - Globals.RTFCHARS.put("tstrok", "\\u359t"); // "tstrok" - Globals.RTFCHARS.put("~U", "\\u360U"); // "Utilde" - Globals.RTFCHARS.put("~u", "\\u361u"); // "utilde" - Globals.RTFCHARS.put("=U", "\\u362U"); // "Umacr" - Globals.RTFCHARS.put("=u", "\\u363u"); // "umacr" - Globals.RTFCHARS.put("uU", "\\u364U"); // "Ubreve" - Globals.RTFCHARS.put("uu", "\\u365u"); // "ubreve" - Globals.RTFCHARS.put("rU", "\\u366U"); // "Uring" - Globals.RTFCHARS.put("ru", "\\u367u"); // "uring" - Globals.RTFCHARS.put("HU", "\\u368?"); // "Odblac" - Globals.RTFCHARS.put("Hu", "\\u369?"); // "odblac" - Globals.RTFCHARS.put("kU", "\\u370U"); // "Uogon" - Globals.RTFCHARS.put("ku", "\\u371u"); // "uogon" - Globals.RTFCHARS.put("^W", "\\u372W"); // "Wcirc" - Globals.RTFCHARS.put("^w", "\\u373w"); // "wcirc" - Globals.RTFCHARS.put("^Y", "\\u374Y"); // "Ycirc" - Globals.RTFCHARS.put("^y", "\\u375y"); // "ycirc" - Globals.RTFCHARS.put("\"Y", "\\u376Y"); // "Yuml" - Globals.RTFCHARS.put("'Z", "\\u377Z"); // "Zacute" - Globals.RTFCHARS.put("'z", "\\u378z"); // "zacute" - Globals.RTFCHARS.put(".Z", "\\u379Z"); // "Zdot" - Globals.RTFCHARS.put(".z", "\\u380z"); // "zdot" - Globals.RTFCHARS.put("vZ", "\\u381Z"); // "Zcaron" - Globals.RTFCHARS.put("vz", "\\u382z"); // "zcaron" - // Symbol #383 (f) has no special Latex command - - // XML_CHARS.put("\\u00E1", "á"); - } - - public static void initializeJournalNames() { // Read internal lists: @@ -1295,8 +404,7 @@ public static void initializeJournalNames() { } /** - * Returns a reg exp pattern in the form (w1)|(w2)| ... - * wi are escaped if no regex search is enabled + * Returns a reg exp pattern in the form (w1)|(w2)| ... wi are escaped if no regex search is enabled */ public static Pattern getPatternForWords(ArrayList words) { if ((words == null) || (words.isEmpty()) || (words.get(0).isEmpty())) { @@ -1321,5 +429,4 @@ public static Pattern getPatternForWords(ArrayList words) { return pattern; } - } diff --git a/src/main/java/net/sf/jabref/JabRefPreferences.java b/src/main/java/net/sf/jabref/JabRefPreferences.java index dff5856301c..1917c34da17 100644 --- a/src/main/java/net/sf/jabref/JabRefPreferences.java +++ b/src/main/java/net/sf/jabref/JabRefPreferences.java @@ -16,6 +16,7 @@ package net.sf.jabref; import java.awt.Color; +import java.awt.Toolkit; import java.awt.event.InputEvent; import java.io.File; import java.io.FileInputStream; @@ -346,6 +347,8 @@ public class JabRefPreferences { public String WRAPPED_USERNAME; public final String MARKING_WITH_NUMBER_PATTERN; + + private int SHORTCUT_MASK = -1; private final Preferences prefs; @@ -1147,8 +1150,20 @@ private KeyStroke getKeyForMac(KeyStroke ks) { modifiers = modifiers | InputEvent.ALT_MASK; } - return KeyStroke.getKeyStroke(keyCode, Globals.getShortcutMask() + modifiers); + return KeyStroke.getKeyStroke(keyCode, getShortcutMask() + modifiers); + } + } + + private int getShortcutMask() { + if (SHORTCUT_MASK == -1) { + try { + SHORTCUT_MASK = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); + } catch (Throwable ignored) { + + } } + + return SHORTCUT_MASK; } /** diff --git a/src/main/java/net/sf/jabref/MetaData.java b/src/main/java/net/sf/jabref/MetaData.java index 4dfa8090834..14a1b330cb3 100644 --- a/src/main/java/net/sf/jabref/MetaData.java +++ b/src/main/java/net/sf/jabref/MetaData.java @@ -29,6 +29,8 @@ public class MetaData implements Iterable { private static final String PREFIX_KEYPATTERN = "keypattern_"; private static final String KEYPATTERNDEFAULT = "keypatterndefault"; + + private static final int METADATA_LINE_LENGTH = 70; // The line length used to wrap metadata. private final HashMap> metaData = new HashMap>(); private GroupTreeNode groupsRoot = null; @@ -263,7 +265,7 @@ public void writeMetaData(Writer out) throws IOException { sb.append(StringUtil.quote(orderedData.elementAt(j), ";", '\\')).append(";"); } sb.append("}"); - wrapStringBuffer(sb, Globals.METADATA_LINE_LENGTH); + wrapStringBuffer(sb, METADATA_LINE_LENGTH); sb.append(Globals.NEWLINE); sb.append(Globals.NEWLINE); @@ -290,7 +292,7 @@ public void writeMetaData(Writer out) throws IOException { while (tok.hasMoreTokens()) { StringBuffer s = new StringBuffer(StringUtil.quote(tok.nextToken(), ";", '\\') + ";"); - wrapStringBuffer(s, Globals.METADATA_LINE_LENGTH); + wrapStringBuffer(s, METADATA_LINE_LENGTH); sb.append(s); sb.append(Globals.NEWLINE); } diff --git a/src/main/java/net/sf/jabref/autocompleter/DefaultAutoCompleter.java b/src/main/java/net/sf/jabref/autocompleter/DefaultAutoCompleter.java index e2fdfc8523e..d77d802b0a8 100644 --- a/src/main/java/net/sf/jabref/autocompleter/DefaultAutoCompleter.java +++ b/src/main/java/net/sf/jabref/autocompleter/DefaultAutoCompleter.java @@ -29,6 +29,8 @@ class DefaultAutoCompleter extends AbstractAutoCompleter { private final String fieldName; + + private final String SEPARATING_CHARS = ";,\n "; /** * @see AutoCompleterFactory @@ -50,7 +52,7 @@ public void addBibtexEntry(BibtexEntry entry) { String fieldValue = entry.getField(fieldName); if (fieldValue != null) { - StringTokenizer tok = new StringTokenizer(fieldValue, Globals.SEPARATING_CHARS); + StringTokenizer tok = new StringTokenizer(fieldValue, SEPARATING_CHARS); while (tok.hasMoreTokens()) { String word = tok.nextToken(); addWordToIndex(word); diff --git a/src/main/java/net/sf/jabref/export/ExportFormat.java b/src/main/java/net/sf/jabref/export/ExportFormat.java index 1a0b9e1d105..05bb1bb376a 100644 --- a/src/main/java/net/sf/jabref/export/ExportFormat.java +++ b/src/main/java/net/sf/jabref/export/ExportFormat.java @@ -45,7 +45,7 @@ public class ExportFormat implements IExportFormat { private FileFilter fileFilter; private boolean customExport = false; - + private final String LAYOUT_PREFIX = "/resource/layout/"; /** * Initialize another export format based on templates stored in dir with @@ -136,7 +136,7 @@ Reader getReader(String filename) throws IOException { if (customExport) { dir = ""; } else { - dir = Globals.LAYOUT_PREFIX + dir = LAYOUT_PREFIX + (directory == null ? "" : directory + '/'); } return FileActions.getReader(dir + filename); diff --git a/src/main/java/net/sf/jabref/export/layout/LayoutEntry.java b/src/main/java/net/sf/jabref/export/layout/LayoutEntry.java index 95dc1baf8b9..b876e1b15b9 100644 --- a/src/main/java/net/sf/jabref/export/layout/LayoutEntry.java +++ b/src/main/java/net/sf/jabref/export/layout/LayoutEntry.java @@ -46,7 +46,11 @@ class LayoutEntry { private final String classPrefix; private ArrayList invalidFormatter = null; - + + // used at highlighting in preview area. + // Color chosen similar to JTextComponent.getSelectionColor(), which is + // used at highlighting words at the editor + public static final String HIGHLIGHT_COLOR = "#3399FF"; public LayoutEntry(StringInt si, String classPrefix_) throws Exception { type = si.i; @@ -536,7 +540,7 @@ private String highlightWords(String text, ArrayList toHighlight) { Matcher matcher = Globals.getPatternForWords(toHighlight).matcher(text); if (Character.isLetterOrDigit(text.charAt(0))) { - String hlColor = Globals.highlightColor; + String hlColor = HIGHLIGHT_COLOR; StringBuffer sb = new StringBuffer(); boolean foundSomething = false; diff --git a/src/main/java/net/sf/jabref/export/layout/format/HTMLChars.java b/src/main/java/net/sf/jabref/export/layout/format/HTMLChars.java index ccb513f06f8..b93612120da 100644 --- a/src/main/java/net/sf/jabref/export/layout/format/HTMLChars.java +++ b/src/main/java/net/sf/jabref/export/layout/format/HTMLChars.java @@ -16,13 +16,15 @@ package net.sf.jabref.export.layout.format; import net.sf.jabref.Globals; -import net.sf.jabref.util.StringUtil; import net.sf.jabref.export.layout.LayoutFormatter; +import net.sf.jabref.util.StringUtil; /** * This formatter escapes characters so they are suitable for HTML. */ public class HTMLChars implements LayoutFormatter { + + private static final HtmlCharsMap HTML_CHARS = new HtmlCharsMap(); @Override public String format(String field) { @@ -45,7 +47,7 @@ public String format(String field) { if (incommand) { /* Close Command */ String command = currentCommand.toString(); - Object result = Globals.HTMLCHARS.get(command); + Object result = HTML_CHARS.get(command); if (result != null) { sb.append((String) result); } else { @@ -86,7 +88,7 @@ public String format(String field) { combody = field.substring(i, i + 1); // System.out.println("... "+combody); } - Object result = Globals.HTMLCHARS.get(command + combody); + Object result = HTML_CHARS.get(command + combody); if (result != null) { sb.append((String) result); @@ -98,7 +100,7 @@ public String format(String field) { // Are we already at the end of the string? if ((i + 1) == field.length()) { String command = currentCommand.toString(); - Object result = Globals.HTMLCHARS.get(command); + Object result = HTML_CHARS.get(command); /* If found, then use translated version. If not, * then keep * the text of the parameter intact. @@ -142,7 +144,7 @@ public String format(String field) { argument = part; if (argument != null) { // handle common case of general latex command - Object result = Globals.HTMLCHARS.get(command + argument); + Object result = HTML_CHARS.get(command + argument); // System.out.print("command: "+command+", arg: "+argument); // System.out.print(", result: "); // If found, then use translated version. If not, then keep @@ -158,7 +160,7 @@ public String format(String field) { // This end brace terminates a command. This can be the case in // constructs like {\aa}. The correct behaviour should be to // substitute the evaluated command and swallow the brace: - Object result = Globals.HTMLCHARS.get(command); + Object result = HTML_CHARS.get(command); if (result != null) { sb.append((String) result); } else { @@ -166,7 +168,7 @@ public String format(String field) { sb.append(command); } } else { - Object result = Globals.HTMLCHARS.get(command); + Object result = HTML_CHARS.get(command); if (result != null) { sb.append((String) result); } else { diff --git a/src/main/java/net/sf/jabref/export/layout/format/HtmlCharsMap.java b/src/main/java/net/sf/jabref/export/layout/format/HtmlCharsMap.java new file mode 100644 index 00000000000..881e639d51d --- /dev/null +++ b/src/main/java/net/sf/jabref/export/layout/format/HtmlCharsMap.java @@ -0,0 +1,213 @@ +package net.sf.jabref.export.layout.format; + +import java.util.HashMap; + +class HtmlCharsMap extends HashMap { + + private static final long serialVersionUID = 1L; + + public HtmlCharsMap() { + // HTML named entities from #192 - #255 (UNICODE Latin-1) + put("`A", "À"); // #192 + put("'A", "Á"); // #193 + put("^A", "Â"); // #194 + put("~A", "Ã"); // #195 + put("\"A", "Ä"); // #196 + put("AA", "Å"); // #197 + put("AE", "Æ"); // #198 + put("cC", "Ç"); // #199 + put("`E", "È"); // #200 + put("'E", "É"); // #201 + put("^E", "Ê"); // #202 + put("\"E", "Ë"); // #203 + put("`I", "Ì"); // #204 + put("'I", "Í"); // #205 + put("^I", "Î"); // #206 + put("\"I", "Ï"); // #207 + put("DH", "Ð"); // #208 + put("~N", "Ñ"); // #209 + put("`O", "Ò"); // #210 + put("'O", "Ó"); // #211 + put("^O", "Ô"); // #212 + put("~O", "Õ"); // #213 + put("\"O", "Ö"); // #214 + // According to ISO 8859-1 the "\times" symbol should be placed here + // (#215). + // Omitting this, because it is a mathematical symbol. + put("O", "Ø"); // #216 + put("`U", "Ù"); // #217 + put("'U", "Ú"); // #218 + put("^U", "Û"); // #219 + put("\"U", "Ü"); // #220 + put("'Y", "Ý"); // #221 + put("TH", "Þ"); // #222 + put("ss", "ß"); // #223 + put("`a", "à"); // #224 + put("'a", "á"); // #225 + put("^a", "â"); // #226 + put("~a", "ã"); // #227 + put("\"a", "ä"); // #228 + put("aa", "å"); // #229 + put("ae", "æ"); // #230 + put("cc", "ç"); // #231 + put("`e", "è"); // #232 + put("'e", "é"); // #233 + put("^e", "ê"); // #234 + put("\"e", "ë"); // #235 + put("`i", "ì"); // #236 + put("'i", "í"); // #237 + put("^i", "î"); // #238 + put("\"i", "ï"); // #239 + put("dh", "ð"); // #240 + put("~n", "ñ"); // #241 + put("`o", "ò"); // #242 + put("'o", "ó"); // #243 + put("^o", "ô"); // #244 + put("~o", "õ"); // #245 + put("\"o", "ö"); // #246 + // According to ISO 8859-1 the "\div" symbol should be placed here + // (#247). + // Omitting this, because it is a mathematical symbol. + put("o", "ø"); // #248 + put("`u", "ù"); // #249 + put("'u", "ú"); // #250 + put("^u", "û"); // #251 + put("\"u", "ü"); // #252 + put("'y", "ý"); // #253 + put("th", "þ"); // #254 + put("\"y", "ÿ"); // #255 + + // HTML special characters without names (UNICODE Latin Extended-A), + // indicated by UNICODE number + put("=A", "Ā"); // "Amacr" + put("=a", "ā"); // "amacr" + put("uA", "Ă"); // "Abreve" + put("ua", "ă"); // "abreve" + put("kA", "Ą"); // "Aogon" + put("ka", "ą"); // "aogon" + put("'C", "Ć"); // "Cacute" + put("'c", "ć"); // "cacute" + put("^C", "Ĉ"); // "Ccirc" + put("^c", "ĉ"); // "ccirc" + put(".C", "Ċ"); // "Cdot" + put(".c", "ċ"); // "cdot" + put("vC", "Č"); // "Ccaron" + put("vc", "č"); // "ccaron" + put("vD", "Ď"); // "Dcaron" + // Symbol #271 (d) has no special Latex command + put("DJ", "Đ"); // "Dstrok" + put("dj", "đ"); // "dstrok" + put("=E", "Ē"); // "Emacr" + put("=e", "ē"); // "emacr" + put("uE", "Ĕ"); // "Ebreve" + put("ue", "ĕ"); // "ebreve" + put(".E", "Ė"); // "Edot" + put(".e", "ė"); // "edot" + put("kE", "Ę"); // "Eogon" + put("ke", "ę"); // "eogon" + put("vE", "Ě"); // "Ecaron" + put("ve", "ě"); // "ecaron" + put("^G", "Ĝ"); // "Gcirc" + put("^g", "ĝ"); // "gcirc" + put("uG", "Ğ"); // "Gbreve" + put("ug", "ğ"); // "gbreve" + put(".G", "Ġ"); // "Gdot" + put(".g", "ġ"); // "gdot" + put("cG", "Ģ"); // "Gcedil" + put("'g", "ģ"); // "gacute" + put("^H", "Ĥ"); // "Hcirc" + put("^h", "ĥ"); // "hcirc" + put("Hstrok", "Ħ"); // "Hstrok" + put("hstrok", "ħ"); // "hstrok" + put("~I", "Ĩ"); // "Itilde" + put("~i", "ĩ"); // "itilde" + put("=I", "Ī"); // "Imacr" + put("=i", "ī"); // "imacr" + put("uI", "Ĭ"); // "Ibreve" + put("ui", "ĭ"); // "ibreve" + put("kI", "Į"); // "Iogon" + put("ki", "į"); // "iogon" + put(".I", "İ"); // "Idot" + put("i", "ı"); // "inodot" + // Symbol #306 (IJ) has no special Latex command + // Symbol #307 (ij) has no special Latex command + put("^J", "Ĵ"); // "Jcirc" + put("^j", "ĵ"); // "jcirc" + put("cK", "Ķ"); // "Kcedil" + put("ck", "ķ"); // "kcedil" + // Symbol #312 (k) has no special Latex command + put("'L", "Ĺ"); // "Lacute" + put("'l", "ĺ"); // "lacute" + put("cL", "Ļ"); // "Lcedil" + put("cl", "ļ"); // "lcedil" + // Symbol #317 (L) has no special Latex command + // Symbol #318 (l) has no special Latex command + put("Lmidot", "Ŀ"); // "Lmidot" + put("lmidot", "ŀ"); // "lmidot" + put("L", "Ł"); // "Lstrok" + put("l", "ł"); // "lstrok" + put("'N", "Ń"); // "Nacute" + put("'n", "ń"); // "nacute" + put("cN", "Ņ"); // "Ncedil" + put("cn", "ņ"); // "ncedil" + put("vN", "Ň"); // "Ncaron" + put("vn", "ň"); // "ncaron" + // Symbol #329 (n) has no special Latex command + put("NG", "Ŋ"); // "ENG" + put("ng", "ŋ"); // "eng" + put("=O", "Ō"); // "Omacr" + put("=o", "ō"); // "omacr" + put("uO", "Ŏ"); // "Obreve" + put("uo", "ŏ"); // "obreve" + put("HO", "Ő"); // "Odblac" + put("Ho", "ő"); // "odblac" + put("OE", "Œ"); // "OElig" + put("oe", "œ"); // "oelig" + put("'R", "Ŕ"); // "Racute" + put("'r", "ŕ"); // "racute" + put("cR", "Ŗ"); // "Rcedil" + put("cr", "ŗ"); // "rcedil" + put("vR", "Ř"); // "Rcaron" + put("vr", "ř"); // "rcaron" + put("'S", "Ś"); // "Sacute" + put("'s", "ś"); // "sacute" + put("^S", "Ŝ"); // "Scirc" + put("^s", "ŝ"); // "scirc" + put("cS", "Ş"); // "Scedil" + put("cs", "ş"); // "scedil" + put("vS", "Š"); // "Scaron" + put("vs", "š"); // "scaron" + put("cT", "Ţ"); // "Tcedil" + put("ct", "ţ"); // "tcedil" + put("vT", "Ť"); // "Tcaron" + // Symbol #357 (t) has no special Latex command + put("Tstrok", "Ŧ"); // "Tstrok" + put("tstrok", "ŧ"); // "tstrok" + put("~U", "Ũ"); // "Utilde" + put("~u", "ũ"); // "utilde" + put("=U", "Ū"); // "Umacr" + put("=u", "ū"); // "umacr" + put("uU", "Ŭ"); // "Ubreve" + put("uu", "ŭ"); // "ubreve" + put("rU", "Ů"); // "Uring" + put("ru", "ů"); // "uring" + put("HU", "Ű"); // "Odblac" + put("Hu", "ű"); // "odblac" + put("kU", "Ų"); // "Uogon" + put("ku", "ų"); // "uogon" + put("^W", "Ŵ"); // "Wcirc" + put("^w", "ŵ"); // "wcirc" + put("^Y", "Ŷ"); // "Ycirc" + put("^y", "ŷ"); // "ycirc" + put("\"Y", "Ÿ"); // "Yuml" + put("'Z", "Ź"); // "Zacute" + put("'z", "ź"); // "zacute" + put(".Z", "Ż"); // "Zdot" + put(".z", "ż"); // "zdot" + put("vZ", "Ž"); // "Zcaron" + put("vz", "ž"); // "zcaron" + // Symbol #383 (f) has no special Latex command + put("%", "%"); // percent sign + } + +} diff --git a/src/main/java/net/sf/jabref/export/layout/format/RTFChars.java b/src/main/java/net/sf/jabref/export/layout/format/RTFChars.java index 31bd5523368..4d754241cc7 100644 --- a/src/main/java/net/sf/jabref/export/layout/format/RTFChars.java +++ b/src/main/java/net/sf/jabref/export/layout/format/RTFChars.java @@ -39,6 +39,8 @@ public class RTFChars implements LayoutFormatter { // Instantiate logger: private static final Log LOGGER = LogFactory.getLog(LayoutFormatter.class); + + private static final RtfCharMap RTF_CHARS = new RtfCharMap(); @Override @@ -96,7 +98,7 @@ else if (c == '\\') { combody = field.substring(i, i + 1); } - String result = Globals.RTFCHARS.get(command + combody); + String result = RTF_CHARS.get(command + combody); if (result != null) { sb.append(result); @@ -125,7 +127,7 @@ else if (c == '\\') { } else if ((c == '}') && (currentCommand.length() > 0)) { // Seems to be the end of a command like \{aa}. Look it up: String command = currentCommand.toString(); - String result = Globals.RTFCHARS.get(command); + String result = RTF_CHARS.get(command); if (result != null) { sb.append(result); } diff --git a/src/main/java/net/sf/jabref/export/layout/format/RtfCharMap.java b/src/main/java/net/sf/jabref/export/layout/format/RtfCharMap.java new file mode 100644 index 00000000000..ad7abf02aee --- /dev/null +++ b/src/main/java/net/sf/jabref/export/layout/format/RtfCharMap.java @@ -0,0 +1,263 @@ +package net.sf.jabref.export.layout.format; + +import java.util.HashMap; + + +class RtfCharMap extends HashMap { + + private static final long serialVersionUID = 1L; + + public RtfCharMap () { + + + put("`a", "\\'e0"); + put("`e", "\\'e8"); + put("`i", "\\'ec"); + put("`o", "\\'f2"); + put("`u", "\\'f9"); + put("?a", "\\'e1"); + put("?e", "\\'e9"); + put("?i", "\\'ed"); + put("?o", "\\'f3"); + put("?u", "\\'fa"); + put("^a", "\\'e2"); + put("^e", "\\'ea"); + put("^i", "\\'ee"); + put("^o", "\\'f4"); + put("^u", "\\'fa"); + put("\"a", "\\'e4"); + put("\"e", "\\'eb"); + put("\"i", "\\'ef"); + put("\"o", "\\'f6"); + put("\"u", "\\u252u"); + put("~n", "\\'f1"); + put("`A", "\\'c0"); + put("`E", "\\'c8"); + put("`I", "\\'cc"); + put("`O", "\\'d2"); + put("`U", "\\'d9"); + put("?A", "\\'c1"); + put("?E", "\\'c9"); + put("?I", "\\'cd"); + put("?O", "\\'d3"); + put("?U", "\\'da"); + put("^A", "\\'c2"); + put("^E", "\\'ca"); + put("^I", "\\'ce"); + put("^O", "\\'d4"); + put("^U", "\\'db"); + put("\"A", "\\'c4"); + put("\"E", "\\'cb"); + put("\"I", "\\'cf"); + put("\"O", "\\'d6"); + put("\"U", "\\'dc"); + + // Use UNICODE characters for RTF-Chars which can not be found in the + // standard codepage + + put("`A", "\\u192A"); // "Agrave" + put("'A", "\\u193A"); // "Aacute" + put("^A", "\\u194A"); // "Acirc" + put("~A", "\\u195A"); // "Atilde" + put("\"A", "\\u196A"); // "Auml" + put("AA", "\\u197A"); // "Aring" + // RTFCHARS.put("AE", "{\\uc2\\u198AE}"); // "AElig" +put("AE", "{\\u198A}"); // "AElig" + put("cC", "\\u199C"); // "Ccedil" + put("`E", "\\u200E"); // "Egrave" + put("'E", "\\u201E"); // "Eacute" + put("^E", "\\u202E"); // "Ecirc" + put("\"E", "\\u203E"); // "Euml" + put("`I", "\\u204I"); // "Igrave + put("'I", "\\u205I"); // "Iacute" + put("^I", "\\u206I"); // "Icirc" + put("\"I", "\\u207I"); // "Iuml" + put("DH", "\\u208D"); // "ETH" + put("~N", "\\u209N"); // "Ntilde" + put("`O", "\\u210O"); // "Ograve" + put("'O", "\\u211O"); // "Oacute" + put("^O", "\\u212O"); // "Ocirc" + put("~O", "\\u213O"); // "Otilde" + put("\"O", "\\u214O"); // "Ouml" + // According to ISO 8859-1 the "\times" symbol should be placed here + // (#215). + // Omitting this, because it is a mathematical symbol. + put("O", "\\u216O"); // "Oslash" + // RTFCHARS.put("O", "\\'d8"); + put("o", "\\'f8"); + put("`U", "\\u217U"); // "Ugrave" + put("'U", "\\u218U"); // "Uacute" + put("^U", "\\u219U"); // "Ucirc" + put("\"U", "\\u220U"); // "Uuml" + put("'Y", "\\u221Y"); // "Yacute" + put("TH", "{\\uc2\\u222TH}"); // "THORN" + put("ss", "{\\uc2\\u223ss}"); // "szlig" + //RTFCHARS.put("ss", "AFFEN"); // "szlig" + put("`a", "\\u224a"); // "agrave" + put("'a", "\\u225a"); // "aacute" + put("^a", "\\u226a"); // "acirc" + put("~a", "\\u227a"); // "atilde" + put("\"a", "\\u228a"); // "auml" + put("aa", "\\u229a"); // "aring" + // RTFCHARS.put("ae", "{\\uc2\\u230ae}"); // "aelig" \\u230e6 +put("ae", "{\\u230a}"); // "aelig" \\u230e6 + put("cc", "\\u231c"); // "ccedil" + put("`e", "\\u232e"); // "egrave" + put("'e", "\\u233e"); // "eacute" + put("^e", "\\u234e"); // "ecirc" + put("\"e", "\\u235e"); // "euml" + put("`i", "\\u236i"); // "igrave" + put("'i", "\\u237i"); // "iacute" + put("^i", "\\u238i"); // "icirc" + put("\"i", "\\u239i"); // "iuml" + put("dh", "\\u240d"); // "eth" + put("~n", "\\u241n"); // "ntilde" + put("`o", "\\u242o"); // "ograve" + put("'o", "\\u243o"); // "oacute" + put("^o", "\\u244o"); // "ocirc" + put("~o", "\\u245o"); // "otilde" + put("\"o", "\\u246o"); // "ouml" + // According to ISO 8859-1 the "\div" symbol should be placed here + // (#247). + // Omitting this, because it is a mathematical symbol. + put("o", "\\u248o"); // "oslash" + put("`u", "\\u249u"); // "ugrave" + put("'u", "\\u250u"); // "uacute" + put("^u", "\\u251u"); // "ucirc" + // RTFCHARS.put("\"u", "\\u252"); // "uuml" exists in standard +// codepage + put("'y", "\\u253y"); // "yacute" + put("th", "{\\uc2\\u254th}"); // "thorn" + put("\"y", "\\u255y"); // "yuml" + + put("=A", "\\u256A"); // "Amacr" + put("=a", "\\u257a"); // "amacr" + put("uA", "\\u258A"); // "Abreve" + put("ua", "\\u259a"); // "abreve" + put("kA", "\\u260A"); // "Aogon" + put("ka", "\\u261a"); // "aogon" + put("'C", "\\u262C"); // "Cacute" + put("'c", "\\u263c"); // "cacute" + put("^C", "\\u264C"); // "Ccirc" + put("^c", "\\u265c"); // "ccirc" + put(".C", "\\u266C"); // "Cdot" + put(".c", "\\u267c"); // "cdot" + put("vC", "\\u268C"); // "Ccaron" + put("vc", "\\u269c"); // "ccaron" + put("vD", "\\u270D"); // "Dcaron" + // Symbol #271 (d) has no special Latex command + put("DJ", "\\u272D"); // "Dstrok" + put("dj", "\\u273d"); // "dstrok" + put("=E", "\\u274E"); // "Emacr" + put("=e", "\\u275e"); // "emacr" + put("uE", "\\u276E"); // "Ebreve" + put("ue", "\\u277e"); // "ebreve" + put(".E", "\\u278E"); // "Edot" + put(".e", "\\u279e"); // "edot" + put("kE", "\\u280E"); // "Eogon" + put("ke", "\\u281e"); // "eogon" + put("vE", "\\u282E"); // "Ecaron" + put("ve", "\\u283e"); // "ecaron" + put("^G", "\\u284G"); // "Gcirc" + put("^g", "\\u285g"); // "gcirc" + put("uG", "\\u286G"); // "Gbreve" + put("ug", "\\u287g"); // "gbreve" + put(".G", "\\u288G"); // "Gdot" + put(".g", "\\u289g"); // "gdot" + put("cG", "\\u290G"); // "Gcedil" + put("'g", "\\u291g"); // "gacute" + put("^H", "\\u292H"); // "Hcirc" + put("^h", "\\u293h"); // "hcirc" + put("Hstrok", "\\u294H"); // "Hstrok" + put("hstrok", "\\u295h"); // "hstrok" + put("~I", "\\u296I"); // "Itilde" + put("~i", "\\u297i"); // "itilde" + put("=I", "\\u298I"); // "Imacr" + put("=i", "\\u299i"); // "imacr" + put("uI", "\\u300I"); // "Ibreve" + put("ui", "\\u301i"); // "ibreve" + put("kI", "\\u302I"); // "Iogon" + put("ki", "\\u303i"); // "iogon" + put(".I", "\\u304I"); // "Idot" + put("i", "\\u305i"); // "inodot" + // Symbol #306 (IJ) has no special Latex command + // Symbol #307 (ij) has no special Latex command + put("^J", "\\u308J"); // "Jcirc" + put("^j", "\\u309j"); // "jcirc" + put("cK", "\\u310K"); // "Kcedil" + put("ck", "\\u311k"); // "kcedil" + // Symbol #312 (k) has no special Latex command + put("'L", "\\u313L"); // "Lacute" + put("'l", "\\u314l"); // "lacute" + put("cL", "\\u315L"); // "Lcedil" + put("cl", "\\u316l"); // "lcedil" + // Symbol #317 (L) has no special Latex command + // Symbol #318 (l) has no special Latex command + put("Lmidot", "\\u319L"); // "Lmidot" + put("lmidot", "\\u320l"); // "lmidot" + put("L", "\\u321L"); // "Lstrok" + put("l", "\\u322l"); // "lstrok" + put("'N", "\\u323N"); // "Nacute" + put("'n", "\\u324n"); // "nacute" + put("cN", "\\u325N"); // "Ncedil" + put("cn", "\\u326n"); // "ncedil" + put("vN", "\\u327N"); // "Ncaron" + put("vn", "\\u328n"); // "ncaron" + // Symbol #329 (n) has no special Latex command + put("NG", "\\u330G"); // "ENG" + put("ng", "\\u331g"); // "eng" + put("=O", "\\u332O"); // "Omacr" + put("=o", "\\u333o"); // "omacr" + put("uO", "\\u334O"); // "Obreve" + put("uo", "\\u335o"); // "obreve" + put("HO", "\\u336?"); // "Odblac" + put("Ho", "\\u337?"); // "odblac" + put("OE", "{\\uc2\\u338OE}"); // "OElig" + put("oe", "{\\uc2\\u339oe}"); // "oelig" + put("'R", "\\u340R"); // "Racute" + put("'r", "\\u341r"); // "racute" + put("cR", "\\u342R"); // "Rcedil" + put("cr", "\\u343r"); // "rcedil" + put("vR", "\\u344R"); // "Rcaron" + put("vr", "\\u345r"); // "rcaron" + put("'S", "\\u346S"); // "Sacute" + put("'s", "\\u347s"); // "sacute" + put("^S", "\\u348S"); // "Scirc" + put("^s", "\\u349s"); // "scirc" + put("cS", "\\u350S"); // "Scedil" + put("cs", "\\u351s"); // "scedil" + put("vS", "\\u352S"); // "Scaron" + put("vs", "\\u353s"); // "scaron" + put("cT", "\\u354T"); // "Tcedil" + put("ct", "\\u355t"); // "tcedil" + put("vT", "\\u356T"); // "Tcaron" + // Symbol #357 (t) has no special Latex command + put("Tstrok", "\\u358T"); // "Tstrok" + put("tstrok", "\\u359t"); // "tstrok" + put("~U", "\\u360U"); // "Utilde" + put("~u", "\\u361u"); // "utilde" + put("=U", "\\u362U"); // "Umacr" + put("=u", "\\u363u"); // "umacr" + put("uU", "\\u364U"); // "Ubreve" + put("uu", "\\u365u"); // "ubreve" + put("rU", "\\u366U"); // "Uring" + put("ru", "\\u367u"); // "uring" + put("HU", "\\u368?"); // "Odblac" + put("Hu", "\\u369?"); // "odblac" + put("kU", "\\u370U"); // "Uogon" + put("ku", "\\u371u"); // "uogon" + put("^W", "\\u372W"); // "Wcirc" + put("^w", "\\u373w"); // "wcirc" + put("^Y", "\\u374Y"); // "Ycirc" + put("^y", "\\u375y"); // "ycirc" + put("\"Y", "\\u376Y"); // "Yuml" + put("'Z", "\\u377Z"); // "Zacute" + put("'z", "\\u378z"); // "zacute" + put(".Z", "\\u379Z"); // "Zdot" + put(".z", "\\u380z"); // "zdot" + put("vZ", "\\u381Z"); // "Zcaron" + put("vz", "\\u382z"); // "zcaron" + // Symbol #383 (f) has no special Latex command + } + +} diff --git a/src/main/java/net/sf/jabref/export/layout/format/XMLChars.java b/src/main/java/net/sf/jabref/export/layout/format/XMLChars.java index e169b0ea7de..1996576e420 100644 --- a/src/main/java/net/sf/jabref/export/layout/format/XMLChars.java +++ b/src/main/java/net/sf/jabref/export/layout/format/XMLChars.java @@ -37,9 +37,9 @@ package net.sf.jabref.export.layout.format; +import java.util.HashMap; import java.util.Map; -import net.sf.jabref.Globals; import net.sf.jabref.export.layout.LayoutFormatter; /** @@ -47,12 +47,22 @@ */ public class XMLChars implements LayoutFormatter { + private final static XmlCharsMap XML_CHARS = new XmlCharsMap(); + + private final static Map ASCII_TO_XML_CHARS = new HashMap(); + + static { + ASCII_TO_XML_CHARS.put("<", "<"); + ASCII_TO_XML_CHARS.put("\"", """); + ASCII_TO_XML_CHARS.put(">", ">"); + } + @Override public String format(String fieldText) { fieldText = firstFormat(fieldText); - for (Map.Entry entry : Globals.XML_CHARS.entrySet()) { + for (Map.Entry entry : XML_CHARS.entrySet()) { String s = entry.getKey(); String repl = entry.getValue(); if (repl != null) { @@ -113,7 +123,7 @@ private String restFormat(String toFormat) { fieldText = buffer.toString(); // use common abbreviations for <, > instead of code - for (Map.Entry entry : Globals.ASCII2XML_CHARS.entrySet()) { + for (Map.Entry entry : ASCII_TO_XML_CHARS.entrySet()) { String s = entry.getKey(); String repl = entry.getValue(); diff --git a/src/main/java/net/sf/jabref/export/layout/format/XmlCharsMap.java b/src/main/java/net/sf/jabref/export/layout/format/XmlCharsMap.java new file mode 100644 index 00000000000..77e8bf8541f --- /dev/null +++ b/src/main/java/net/sf/jabref/export/layout/format/XmlCharsMap.java @@ -0,0 +1,138 @@ +package net.sf.jabref.export.layout.format; + +import java.util.HashMap; + +class XmlCharsMap extends HashMap { + + private static final long serialVersionUID = 1L; + + public XmlCharsMap() { + put("\\{\\\\\\\"\\{a\\}\\}", "ä"); + put("\\{\\\\\\\"\\{A\\}\\}", "Ä"); + put("\\{\\\\\\\"\\{e\\}\\}", "ë"); + put("\\{\\\\\\\"\\{E\\}\\}", "Ë"); + put("\\{\\\\\\\"\\{i\\}\\}", "ï"); + put("\\{\\\\\\\"\\{I\\}\\}", "Ï"); + put("\\{\\\\\\\"\\{o\\}\\}", "ö"); + put("\\{\\\\\\\"\\{O\\}\\}", "Ö"); + put("\\{\\\\\\\"\\{u\\}\\}", "ü"); + put("\\{\\\\\\\"\\{U\\}\\}", "Ü"); + + //next 2 rows were missing... + put("\\{\\\\\\`\\{a\\}\\}", "à"); + put("\\{\\\\\\`\\{A\\}\\}", "À"); + + put("\\{\\\\\\`\\{e\\}\\}", "è"); + put("\\{\\\\\\`\\{E\\}\\}", "È"); + put("\\{\\\\\\`\\{i\\}\\}", "ì"); + put("\\{\\\\\\`\\{I\\}\\}", "Ì"); + put("\\{\\\\\\`\\{o\\}\\}", "ò"); + put("\\{\\\\\\`\\{O\\}\\}", "Ò"); + put("\\{\\\\\\`\\{u\\}\\}", "ù"); + put("\\{\\\\\\`\\{U\\}\\}", "Ù"); + + //corrected these 10 lines below... + put("\\{\\\\\\'\\{a\\}\\}", "á"); + put("\\{\\\\\\'\\{A\\}\\}", "Á"); + put("\\{\\\\\\'\\{e\\}\\}", "é"); + put("\\{\\\\\\'\\{E\\}\\}", "É"); + put("\\{\\\\\\'\\{i\\}\\}", "í"); + put("\\{\\\\\\'\\{I\\}\\}", "Í"); + put("\\{\\\\\\'\\{o\\}\\}", "ó"); + put("\\{\\\\\\'\\{O\\}\\}", "Ó"); + put("\\{\\\\\\'\\{u\\}\\}", "ú"); + put("\\{\\\\\\'\\{U\\}\\}", "Ú"); + //added next four chars... + put("\\{\\\\\\'\\{c\\}\\}", "ć"); + put("\\{\\\\\\'\\{C\\}\\}", "Ć"); + put("\\{\\\\c\\{c\\}\\}", "ç"); + put("\\{\\\\c\\{C\\}\\}", "Ç"); + + put("\\{\\\\\\\uFFFD\\{E\\}\\}", "É"); + put("\\{\\\\\\\uFFFD\\{i\\}\\}", "í"); + put("\\{\\\\\\\uFFFD\\{I\\}\\}", "Í"); + put("\\{\\\\\\\uFFFD\\{o\\}\\}", "ó"); + put("\\{\\\\\\\uFFFD\\{O\\}\\}", "Ó"); + put("\\{\\\\\\\uFFFD\\{u\\}\\}", "ú"); + put("\\{\\\\\\\uFFFD\\{U\\}\\}", "Ú"); + put("\\{\\\\\\\uFFFD\\{a\\}\\}", "á"); + put("\\{\\\\\\\uFFFD\\{A\\}\\}", "Á"); + + //next 2 rows were missing... + put("\\{\\\\\\^\\{a\\}\\}", "â"); + put("\\{\\\\\\^\\{A\\}\\}", "Â"); + + put("\\{\\\\\\^\\{o\\}\\}", "ô"); + put("\\{\\\\\\^\\{O\\}\\}", "Ô"); + put("\\{\\\\\\^\\{u\\}\\}", "ù"); + put("\\{\\\\\\^\\{U\\}\\}", "Ù"); + put("\\{\\\\\\^\\{e\\}\\}", "ê"); + put("\\{\\\\\\^\\{E\\}\\}", "Ê"); + put("\\{\\\\\\^\\{i\\}\\}", "î"); + put("\\{\\\\\\^\\{I\\}\\}", "Î"); + + put("\\{\\\\\\~\\{o\\}\\}", "õ"); + put("\\{\\\\\\~\\{O\\}\\}", "Õ"); + put("\\{\\\\\\~\\{n\\}\\}", "ñ"); + put("\\{\\\\\\~\\{N\\}\\}", "Ñ"); + put("\\{\\\\\\~\\{a\\}\\}", "ã"); + put("\\{\\\\\\~\\{A\\}\\}", "Ã"); + + put("\\{\\\\\\\"a\\}", "ä"); + put("\\{\\\\\\\"A\\}", "Ä"); + put("\\{\\\\\\\"e\\}", "ë"); + put("\\{\\\\\\\"E\\}", "Ë"); + put("\\{\\\\\\\"i\\}", "ï"); + put("\\{\\\\\\\"I\\}", "Ï"); + put("\\{\\\\\\\"o\\}", "ö"); + put("\\{\\\\\\\"O\\}", "Ö"); + put("\\{\\\\\\\"u\\}", "ü"); + put("\\{\\\\\\\"U\\}", "Ü"); + + //next 2 rows were missing... + put("\\{\\\\\\`a\\}", "à"); + put("\\{\\\\\\`A\\}", "À"); + + put("\\{\\\\\\`e\\}", "è"); + put("\\{\\\\\\`E\\}", "È"); + put("\\{\\\\\\`i\\}", "ì"); + put("\\{\\\\\\`I\\}", "Ì"); + put("\\{\\\\\\`o\\}", "ò"); + put("\\{\\\\\\`O\\}", "Ò"); + put("\\{\\\\\\`u\\}", "ù"); + put("\\{\\\\\\`U\\}", "Ù"); + put("\\{\\\\\\'e\\}", "é"); + put("\\{\\\\\\'E\\}", "É"); + put("\\{\\\\\\'i\\}", "í"); + put("\\{\\\\\\'I\\}", "Í"); + put("\\{\\\\\\'o\\}", "ó"); + put("\\{\\\\\\'O\\}", "Ó"); + put("\\{\\\\\\'u\\}", "ú"); + put("\\{\\\\\\'U\\}", "Ú"); + put("\\{\\\\\\'a\\}", "á"); + put("\\{\\\\\\'A\\}", "Á"); + //added next two chars... + put("\\{\\\\\\'c\\}", "ć"); + put("\\{\\\\\\'C\\}", "Ć"); + + //next two lines were wrong... + put("\\{\\\\\\^a\\}", "â"); + put("\\{\\\\\\^A\\}", "Â"); + + put("\\{\\\\\\^o\\}", "ô"); + put("\\{\\\\\\^O\\}", "Ô"); + put("\\{\\\\\\^u\\}", "ù"); + put("\\{\\\\\\^U\\}", "Ù"); + put("\\{\\\\\\^e\\}", "ê"); + put("\\{\\\\\\^E\\}", "Ê"); + put("\\{\\\\\\^i\\}", "î"); + put("\\{\\\\\\^I\\}", "Î"); + put("\\{\\\\\\~o\\}", "õ"); + put("\\{\\\\\\~O\\}", "Õ"); + put("\\{\\\\\\~n\\}", "ñ"); + put("\\{\\\\\\~N\\}", "Ñ"); + put("\\{\\\\\\~a\\}", "ã"); + put("\\{\\\\\\~A\\}", "Ã"); + } + +} diff --git a/src/main/java/net/sf/jabref/labelPattern/LabelPatternUtil.java b/src/main/java/net/sf/jabref/labelPattern/LabelPatternUtil.java index 3f1c69b75b9..fff3e66b080 100644 --- a/src/main/java/net/sf/jabref/labelPattern/LabelPatternUtil.java +++ b/src/main/java/net/sf/jabref/labelPattern/LabelPatternUtil.java @@ -44,6 +44,8 @@ public class LabelPatternUtil { private static final String CHARS = "abcdefghijklmnopqrstuvwxyz"; private static final Log LOGGER = LogFactory.getLog(LabelPatternUtil.class); + + private static final String[] SKIP_WORDS = {"a", "an", "the", "for", "on", "of"}; public static ArrayList DEFAULT_LABELPATTERN; @@ -864,8 +866,8 @@ private static String getTitleWords(int number, BibtexEntry _entry) { if (word.length() == 0) { continue; } - for (int _i = 0; _i < Globals.SKIP_WORDS.length; _i++) { - if (word.equalsIgnoreCase(Globals.SKIP_WORDS[_i])) { + for (int _i = 0; _i < SKIP_WORDS.length; _i++) { + if (word.equalsIgnoreCase(SKIP_WORDS[_i])) { continue mainl; } } diff --git a/src/main/java/net/sf/jabref/util/UnicodeCharMap.java b/src/main/java/net/sf/jabref/util/UnicodeCharMap.java new file mode 100644 index 00000000000..cbe06b207f0 --- /dev/null +++ b/src/main/java/net/sf/jabref/util/UnicodeCharMap.java @@ -0,0 +1,245 @@ +package net.sf.jabref.util; + +import java.util.HashMap; + +public class UnicodeCharMap extends HashMap { + + private static final long serialVersionUID = 1L; + + + public UnicodeCharMap() { + put("\u00C0", "A"); + put("\u00C1", "A"); + put("\u00C2", "A"); + put("\u00C3", "A"); + put("\u00C4", "Ae"); + put("\u00C5", "Aa"); + put("\u00C6", "Ae"); + put("\u00C7", "C"); + put("\u00C8", "E"); + put("\u00C9", "E"); + put("\u00CA", "E"); + put("\u00CB", "E"); + put("\u00CC", "I"); + put("\u00CD", "I"); + put("\u00CE", "I"); + put("\u00CF", "I"); + put("\u00D0", "D"); + put("\u00D1", "N"); + put("\u00D2", "O"); + put("\u00D3", "O"); + put("\u00D4", "O"); + put("\u00D5", "O"); + put("\u00D6", "Oe"); + put("\u00D8", "Oe"); + put("\u00D9", "U"); + put("\u00DA", "U"); + put("\u00DB", "U"); + put("\u00DC", "Ue"); // U umlaut .. + put("\u00DD", "Y"); + put("\u00DF", "ss"); + put("\u00E0", "a"); + put("\u00E1", "a"); + put("\u00E2", "a"); + put("\u00E3", "a"); + put("\u00E4", "ae"); + put("\u00E5", "aa"); + put("\u00E6", "ae"); + put("\u00E7", "c"); + put("\u00E8", "e"); + put("\u00E9", "e"); + put("\u00EA", "e"); + put("\u00EB", "e"); + put("\u00EC", "i"); + put("\u00ED", "i"); + put("\u00EE", "i"); + put("\u00EF", "i"); + put("\u00F0", "o"); + put("\u00F1", "n"); + put("\u00F2", "o"); + put("\u00F3", "o"); + put("\u00F4", "o"); + put("\u00F5", "o"); + put("\u00F6", "oe"); + put("\u00F8", "oe"); + put("\u00F9", "u"); + put("\u00FA", "u"); + put("\u00FB", "u"); + put("\u00FC", "ue"); // u umlaut... + put("\u00FD", "y"); + put("\u00FF", "y"); + put("\u0100", "A"); + put("\u0101", "a"); + put("\u0102", "A"); + put("\u0103", "a"); + put("\u0104", "A"); + put("\u0105", "a"); + put("\u0106", "C"); + put("\u0107", "c"); + put("\u0108", "C"); + put("\u0109", "c"); + put("\u010A", "C"); + put("\u010B", "c"); + put("\u010C", "C"); + put("\u010D", "c"); + put("\u010E", "D"); + put("\u010F", "d"); + put("\u0110", "D"); + put("\u0111", "d"); + put("\u0112", "E"); + put("\u0113", "e"); + put("\u0114", "E"); + put("\u0115", "e"); + put("\u0116", "E"); + put("\u0117", "e"); + put("\u0118", "E"); + put("\u0119", "e"); + put("\u011A", "E"); + put("\u011B", "e"); + put("\u011C", "G"); + put("\u011D", "g"); + put("\u011E", "G"); + put("\u011F", "g"); + put("\u0120", "G"); + put("\u0121", "g"); + put("\u0122", "G"); + put("\u0123", "g"); + put("\u0124", "H"); + put("\u0125", "h"); + put("\u0127", "h"); + put("\u0128", "I"); + put("\u0129", "i"); + put("\u012A", "I"); + put("\u012B", "i"); + put("\u012C", "I"); + put("\u012D", "i"); + put("\u012E", "I"); + put("\u012F", "i"); + put("\u0130", "I"); + put("\u0131", "i"); + put("\u0132", "IJ"); + put("\u0133", "ij"); + put("\u0134", "J"); + put("\u0135", "j"); + put("\u0136", "K"); + put("\u0137", "k"); + put("\u0138", "k"); + put("\u0139", "L"); + put("\u013A", "l"); + put("\u013B", "L"); + put("\u013C", "l"); + put("\u013D", "L"); + put("\u013E", "l"); + put("\u013F", "L"); + put("\u0140", "l"); + put("\u0141", "L"); + put("\u0142", "l"); + put("\u0143", "N"); + put("\u0144", "n"); + put("\u0145", "N"); + put("\u0146", "n"); + put("\u0147", "N"); + put("\u0148", "n"); + put("\u0149", "n"); + put("\u014A", "N"); + put("\u014B", "n"); + put("\u014C", "O"); + put("\u014D", "o"); + put("\u014E", "O"); + put("\u014F", "o"); + put("\u0150", "Oe"); + put("\u0151", "oe"); + put("\u0152", "OE"); + put("\u0153", "oe"); + put("\u0154", "R"); + put("\u0155", "r"); + put("\u0156", "R"); + put("\u0157", "r"); + put("\u0158", "R"); + put("\u0159", "r"); + put("\u015A", "S"); + put("\u015B", "s"); + put("\u015C", "S"); + put("\u015D", "s"); + put("\u015E", "S"); + put("\u015F", "s"); + put("\u0160", "S"); + put("\u0161", "s"); + put("\u0162", "T"); + put("\u0163", "t"); + put("\u0164", "T"); + put("\u0165", "t"); + put("\u0166", "T"); + put("\u0167", "t"); + put("\u0168", "U"); + put("\u0169", "u"); + put("\u016A", "U"); + put("\u016B", "u"); + put("\u016C", "U"); + put("\u016D", "u"); + put("\u016E", "UU"); + put("\u016F", "uu"); + put("\u0170", "Ue"); + put("\u0171", "ue"); + put("\u0172", "U"); + put("\u0173", "u"); + put("\u0174", "W"); + put("\u0175", "w"); + put("\u0176", "Y"); + put("\u0177", "y"); + put("\u0178", "Y"); + put("\u0179", "Z"); + put("\u017A", "z"); + put("\u017B", "Z"); + put("\u017C", "z"); + put("\u017D", "Z"); + put("\u017E", "z"); + put("\u1EBC", "E"); + put("\u1EBD", "e"); + put("\u1EF8", "Y"); + put("\u1EF9", "y"); + put("\u01CD", "A"); + put("\u01CE", "a"); + put("\u01CF", "I"); + put("\u01D0", "i"); + put("\u01D1", "O"); + put("\u01D2", "o"); + put("\u01D3", "U"); + put("\u01D4", "u"); + put("\u0232", "Y"); + put("\u0233", "y"); + put("\u01EA", "O"); + put("\u01EB", "o"); + put("\u1E0C", "D"); + put("\u1E0D", "d"); + put("\u1E24", "H"); + put("\u1E25", "h"); + put("\u1E36", "L"); + put("\u1E37", "l"); + put("\u1E38", "L"); + put("\u1E39", "l"); + put("\u1E42", "M"); + put("\u1E43", "m"); + put("\u1E46", "N"); + put("\u1E47", "n"); + put("\u1E5A", "R"); + put("\u1E5B", "r"); + put("\u1E5C", "R"); + put("\u1E5D", "r"); + put("\u1E62", "S"); + put("\u1E63", "s"); + put("\u1E6C", "T"); + put("\u1E6D", "t"); + put("\u00CF", "I"); + + put("\u008C", "AE"); // doesn't work? + put("\u016E", "U"); + put("\u016F", "u"); + + put("\u0178", "Y"); + put("\u00FE", ""); // thorn character + + // UNICODE_CHARS.put("\u0100", ""); + } + +} diff --git a/src/main/java/net/sf/jabref/util/Util.java b/src/main/java/net/sf/jabref/util/Util.java index 85bc01fbb75..91c6ee57dab 100644 --- a/src/main/java/net/sf/jabref/util/Util.java +++ b/src/main/java/net/sf/jabref/util/Util.java @@ -118,6 +118,12 @@ public class Util { private static final EasyDateFormat dateFormatter = new EasyDateFormat(); private static final Log LOGGER = LogFactory.getLog(Util.class); + + private static final String ARXIV_LOOKUP_PREFIX = "http://arxiv.org/abs/"; + + private static final String SEPARATING_CHARS_NOSPACE = ";,\n"; + + private static final UnicodeCharMap UNICODE_CHAR_MAP = new UnicodeCharMap(); /** * This method sets the location of a Dialog such that it is centered with @@ -248,7 +254,7 @@ public static String checkLegalKey(String key) { * is the HashMap GLobals.UNICODE_CHARS. */ public static String replaceSpecialCharacters(String s) { - for (Map.Entry chrAndReplace : Globals.UNICODE_CHARS.entrySet()) { + for (Map.Entry chrAndReplace : UNICODE_CHAR_MAP.entrySet()) { s = s.replaceAll(chrAndReplace.getKey(), chrAndReplace.getValue()); } return s; @@ -373,7 +379,7 @@ public static void openExternalViewer(MetaData metaData, String link, String fie // Check to see if link field already contains a well formated URL if (!link.startsWith("http://")) { - link = Globals.ARXIV_LOOKUP_PREFIX + link; + link = ARXIV_LOOKUP_PREFIX + link; } } @@ -1595,7 +1601,7 @@ public static ArrayList getSeparatedKeywords(String keywords) { // a more intelligent algorithm would check for the separator chosen (SEPARATING_CHARS_NOSPACE) // if nothing is found, " " is likely to be the separating char. // solution by RisKeywords.java: s.split(",[ ]*") - StringTokenizer tok = new StringTokenizer(keywords, Globals.SEPARATING_CHARS_NOSPACE); + StringTokenizer tok = new StringTokenizer(keywords, SEPARATING_CHARS_NOSPACE); while (tok.hasMoreTokens()) { String word = tok.nextToken().trim(); res.add(word);