mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Support for automatic curly quotes
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@375 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -265,7 +265,8 @@ init script:
|
||||
replace_rule(
|
||||
match: "[a-z]",
|
||||
in_context: "[(](<param-[a-z]*>)?<match>|[ ]*: <param-cost><match>|—<match>| — <match>",
|
||||
replace: { to_upper() })
|
||||
replace: { to_upper() }) +
|
||||
curly_quotes
|
||||
|
||||
#character filter for title line
|
||||
name_filter :=
|
||||
@@ -309,7 +310,9 @@ init script:
|
||||
# step 1 : remove italic tags
|
||||
tag_remove_rule(tag: "<i-flavor>") +
|
||||
# step 2 : surround by <i> tags
|
||||
{ "<i-flavor>" + input + "</i-flavor>" }
|
||||
{ "<i-flavor>" + input + "</i-flavor>" } +
|
||||
# curly quotes
|
||||
curly_quotes
|
||||
# Used in FPM and Future Sight
|
||||
brush_context :=
|
||||
"(?ix) # case insensitive, ignore whitespace
|
||||
@@ -1210,6 +1213,9 @@ keyword mode:
|
||||
keyword mode:
|
||||
name: pseudo
|
||||
description: Pseudo keyword / named ability (Hellbent, Threshold, etc.)
|
||||
keyword mode:
|
||||
name: inline
|
||||
description: Inline keyword, reminder text at end of line (Scry, Regenerate, etc.)
|
||||
keyword mode:
|
||||
is default: true
|
||||
name: custom
|
||||
@@ -1643,8 +1649,12 @@ keyword:
|
||||
keyword:
|
||||
keyword: Fateseal
|
||||
match: Fateseal <atom-param>number</atom-param>
|
||||
mode: expert
|
||||
reminder: Look at the top {english_number_multiple(param1)} card(s) of an opponent's library, then put any number of them on the bottom of that player's library and the rest on top in any order.
|
||||
mode: inline
|
||||
reminder:
|
||||
Look at the top {
|
||||
if param1.value==1 then "card of an opponent's library, then you may put it on the bottom of that player's library."
|
||||
else "{english_number(param1)} cards of an opponent's library, then put any number of them on the bottom of that player's library and the rest on top in any order."
|
||||
}
|
||||
keyword:
|
||||
keyword: Transfigure
|
||||
match: Transfigure <atom-param>cost</atom-param>
|
||||
|
||||
@@ -75,6 +75,26 @@ SCRIPT_RULE_1(format, String, format) {
|
||||
}
|
||||
}
|
||||
|
||||
SCRIPT_FUNCTION(curly_quotes) {
|
||||
SCRIPT_PARAM(String, input);
|
||||
bool open = true, in_tag = false;
|
||||
FOR_EACH(c, input) {
|
||||
if (c == _('\'') || c == LEFT_SINGLE_QUOTE || c == RIGHT_SINGLE_QUOTE) {
|
||||
c = open ? LEFT_SINGLE_QUOTE : RIGHT_SINGLE_QUOTE;
|
||||
} else if (c == _('\"') || c == LEFT_DOUBLE_QUOTE || c == RIGHT_DOUBLE_QUOTE) {
|
||||
c = open ? LEFT_DOUBLE_QUOTE : RIGHT_DOUBLE_QUOTE;
|
||||
}
|
||||
if (c == _('<')) {
|
||||
in_tag = true;
|
||||
} else if (c == _('>')) {
|
||||
in_tag = false;
|
||||
} else if (!in_tag) {
|
||||
open = isSpace(c);
|
||||
}
|
||||
}
|
||||
SCRIPT_RETURN(input);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : Tagged string
|
||||
|
||||
@@ -576,6 +596,7 @@ void init_script_basic_functions(Context& ctx) {
|
||||
ctx.setVariable(_("contains"), script_contains);
|
||||
ctx.setVariable(_("format"), script_format);
|
||||
ctx.setVariable(_("format rule"), script_format_rule);
|
||||
ctx.setVariable(_("curly quotes"), script_curly_quotes);
|
||||
// tagged string
|
||||
ctx.setVariable(_("tag contents"), script_tag_contents);
|
||||
ctx.setVariable(_("remove tag"), script_tag_remove);
|
||||
|
||||
@@ -64,9 +64,17 @@ void writeUTF8(wxTextOutputStream& stream, const String& str);
|
||||
#ifdef UNICODE
|
||||
#define LEFT_ANGLE_BRACKET _("\x2039")
|
||||
#define RIGHT_ANGLE_BRACKET _("\x203A")
|
||||
#define LEFT_SINGLE_QUOTE _('\x2018')
|
||||
#define RIGHT_SINGLE_QUOTE _('\x2019')
|
||||
#define LEFT_DOUBLE_QUOTE _('\x201C')
|
||||
#define RIGHT_DOUBLE_QUOTE _('\x201D')
|
||||
#else
|
||||
#define LEFT_ANGLE_BRACKET _("<")
|
||||
#define RIGHT_ANGLE_BRACKET _(">")
|
||||
#define LEFT_SINGLE_QUOTE _('\'')
|
||||
#define RIGHT_SINGLE_QUOTE _('\'')
|
||||
#define LEFT_DOUBLE_QUOTE _('\"')
|
||||
#define RIGHT_DOUBLE_QUOTE _('\"')
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------- : Char functions
|
||||
|
||||
Reference in New Issue
Block a user