mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Tweak logic for formatting reminder text in italics
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user