mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
FindAdv: Amend 58f70b9d
Consider plain-quotes, inner-quotes 1 independent if in regex or text 2 independent of quote style 3 independent of using dynamic marks
This commit is contained in:
parent
58f70b9da1
commit
aa66663364
@ -942,12 +942,21 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
|
|
||||||
|
|
||||||
int InsetQuotes::plaintext(odocstringstream & os,
|
int InsetQuotes::plaintext(odocstringstream & os,
|
||||||
OutputParams const &, size_t) const
|
OutputParams const & op, size_t) const
|
||||||
{
|
{
|
||||||
|
if (op.for_searchAdv == OutputParams::NoSearch) {
|
||||||
docstring const str = displayString();
|
docstring const str = displayString();
|
||||||
os << str;
|
os << str;
|
||||||
return str.size();
|
return str.size();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (level_ == QuoteLevel::Primary)
|
||||||
|
os << from_ascii("\"");
|
||||||
|
else
|
||||||
|
os << from_ascii("'");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetQuotes::getQuoteEntity(bool isHTML) const {
|
docstring InsetQuotes::getQuoteEntity(bool isHTML) const {
|
||||||
|
@ -909,9 +909,16 @@ string correctRegex(string t, bool withformat)
|
|||||||
lastpos = sub.position(2) + sub.length(2);
|
lastpos = sub.position(2) + sub.length(2);
|
||||||
}
|
}
|
||||||
if (lastpos == 0)
|
if (lastpos == 0)
|
||||||
return t;
|
s = t;
|
||||||
else if (lastpos < t.length())
|
else if (lastpos < t.length())
|
||||||
s += t.substr(lastpos, t.length() - lastpos);
|
s += t.substr(lastpos, t.length() - lastpos);
|
||||||
|
// Handle quotes in regex
|
||||||
|
// substitute all '„', '“' with '"'
|
||||||
|
// and all '‚', '‘' with "\'"
|
||||||
|
static std::regex plainquotes { R"(„|“)" };
|
||||||
|
static std::regex innerquotes { R"(‚|‘)" };
|
||||||
|
t = std::regex_replace(s, plainquotes, R"(")");
|
||||||
|
s = std::regex_replace(t, innerquotes, R"(')");
|
||||||
//LYXERR0("correctRegex output '" << s << "'");
|
//LYXERR0("correctRegex output '" << s << "'");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user