Commit 18d144a3 authored by twanvl's avatar twanvl

curly_quotes now considers EM_DASH to be a space, so it uses an open quote after it.

Fixes #33
parent ce96cadd
...@@ -453,22 +453,8 @@ text_filter := ...@@ -453,22 +453,8 @@ text_filter :=
replace@( replace@(
match: "\\[[SCTQXYZIWUBRG0-9/|]+\\]", match: "\\[[SCTQXYZIWUBRG0-9/|]+\\]",
replace: {"<sym>" + mana_filter_t() + "</sym>"} ) + replace: {"<sym>" + mana_filter_t() + "</sym>"} ) +
# step 6a : curly double quotes # step 6 : curly quotes
replace@( curly_quotes +
match: "[[.quotation-mark.]]|“",
in_context: "[“][A-Za-z,.!?+$<>:;-— 0-9\\\\]*<match>",
replace: "”" )+
replace@(
match: "[[.quotation-mark.]]",
replace: "“" )+
# step 6b : curly single quotes
replace@(
match: "' |‘ ",
in_context: "[‘][A-Za-z,.!?+$<>:;-— 0-9\\\\]*<match>",
replace: "’ " )+
replace@(
match: " '",
replace: " ‘" )+
# step 7 : ??? # step 7 : ???
replace@( replace@(
match: "[(]([^)\n]|[(][^)\n]*[)])*[)]?", match: "[(]([^)\n]|[(][^)\n]*[)])*[)]?",
...@@ -480,7 +466,6 @@ text_filter := ...@@ -480,7 +466,6 @@ text_filter :=
+ "([[:lower:]])" # match this + "([[:lower:]])" # match this
+ "(?![)])", # not followed by this + "(?![)])", # not followed by this
replace: { _1 + to_upper(_2) }) + replace: { _1 + to_upper(_2) }) +
#curly_quotes +
# step 9 : spellcheck # step 9 : spellcheck
{ if set.mark_errors then { if set.mark_errors then
check_spelling( check_spelling(
......
...@@ -607,6 +607,10 @@ void check_tagged(const String& str, bool check_balance) { ...@@ -607,6 +607,10 @@ void check_tagged(const String& str, bool check_balance) {
// ----------------------------------------------------------------------------- : Other utilities // ----------------------------------------------------------------------------- : Other utilities
bool is_space_like(Char c) {
return isSpace(c) || c == _('(') || c == _('[') || c == _('{') || c == EN_DASH || c == EM_DASH;
}
String curly_quotes(String str, bool curl) { String curly_quotes(String str, bool curl) {
bool open = true, in_tag = false; bool open = true, in_tag = false;
FOR_EACH(c, str) { FOR_EACH(c, str) {
...@@ -620,7 +624,7 @@ String curly_quotes(String str, bool curl) { ...@@ -620,7 +624,7 @@ String curly_quotes(String str, bool curl) {
in_tag = false; in_tag = false;
} else if (!in_tag) { } else if (!in_tag) {
// Also allow double-nesting of quotes // Also allow double-nesting of quotes
open = isSpace(c) || c == _('(') || c == _('['); open = is_space_like(c);
} }
} }
return str; return str;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment