Tweak logic for formatting reminder text in italics

This commit is contained in:
drdev
2013-11-23 06:39:42 +00:00
parent b2ecb3cb52
commit 800b3f8272

View File

@@ -1654,15 +1654,20 @@ public enum FSkin {
}
public static String encodeSymbols(String str) {
String pattern = "\\{([A-Z0-9]+)\\}|\\{([A-Z0-9]+)/([A-Z0-9]+)\\}"; //fancy pattern needed so "/" can be omitted from replacement
String replacement;
//format reminder text in italics
String pattern = "\\((.+)\\)";
String replacement = "<i>\\($1\\)</i>"; //TODO: Consider setting to hide reminder text, in which case replace with "" here
str = str.replaceAll(pattern, replacement);
//format mana symbols to display as icons
pattern = "\\{([A-Z0-9]+)\\}|\\{([A-Z0-9]+)/([A-Z0-9]+)\\}"; //fancy pattern needed so "/" can be omitted from replacement
try {
replacement = "<img src='" + new File(NewConstants.CACHE_SYMBOLS_DIR + "/$1$2$3.png").toURI().toURL().toString() + "'>";
str = str.replaceAll(pattern, replacement);
} catch (MalformedURLException e) {
e.printStackTrace();
}
str = str.replace("(", "<i>(").replace(")", ")</i>"); //format reminder text in italics
return "<html>" + str + "</html>"; //must wrap in <html> tag for images to appear
}