mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
FindAdv: Added handling for latex environments
1.) Make sure the environment is mentioned in the string for search (Added the keyword \latexenvironment{...}) 2.) Handle it similar to \textcolor{} That way we can also search for 'conclusion*' or 'summary' etc in Additional.lyx.
This commit is contained in:
parent
0a2dda0904
commit
a298fc55d9
@ -951,7 +951,7 @@ static size_t identifyLeading(string const & s)
|
||||
// @TODO Support \item[text]
|
||||
// Kornel: Added textsl, textsf, textit, texttt and noun
|
||||
// + allow to search for colored text too
|
||||
while (regex_replace(t, t, REGEX_BOS "\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage)\\{[a-z]+\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "")
|
||||
while (regex_replace(t, t, REGEX_BOS "\\\\(((footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|emph|noun|minisec|text(bf|md|sl|sf|it|tt))|((textcolor|foreignlanguage|latexenvironment)\\{[a-z]+\\*?\\})|(u|uu)line|(s|x)out|uwave)|((sub)?(((sub)?section)|paragraph)|part|chapter)\\*?)\\{", "")
|
||||
|| regex_replace(t, t, REGEX_BOS "\\$", "")
|
||||
|| regex_replace(t, t, REGEX_BOS "\\\\\\[ ", "")
|
||||
|| regex_replace(t, t, REGEX_BOS " ?\\\\item\\{[a-z]+\\}", "")
|
||||
@ -972,12 +972,12 @@ typedef map<string, bool> Features;
|
||||
|
||||
static Features identifyFeatures(string const & s)
|
||||
{
|
||||
static regex const feature("\\\\(([a-zA-Z]+(\\{([a-z]+)\\}|\\*)?))\\{");
|
||||
static regex const feature("\\\\(([a-zA-Z]+(\\{([a-z]+\\*?)\\}|\\*)?))\\{");
|
||||
static regex const valid("^("
|
||||
"("
|
||||
"(footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge|"
|
||||
"emph|noun|text(bf|md|sl|sf|it|tt)|"
|
||||
"(textcolor|foreignlanguage|item|listitem)\\{[a-z]+\\})|"
|
||||
"(textcolor|foreignlanguage|item|listitem|latexenvironment)\\{[a-z]+\\*?\\})|"
|
||||
"(u|uu)line|(s|x)out|uwave|"
|
||||
"(sub|extra)?title|author|subject|publishers|dedication|(upper|lower)titleback|lyx(right)?address)|"
|
||||
"((sub)?(((sub)?section)|paragraph)|part|chapter|lyxslide)\\*?)$");
|
||||
@ -1796,6 +1796,7 @@ void LatexInfo::buildKeys(bool isPatternString)
|
||||
|
||||
// Split is done, if not at start of region
|
||||
makeKey("textcolor", KeyInfo(KeyInfo::isStandard, 2, ignoreFormats.getColor()), isPatternString);
|
||||
makeKey("latexenvironment", KeyInfo(KeyInfo::isStandard, 2, false), isPatternString);
|
||||
|
||||
// Split is done always.
|
||||
makeKey("foreignlanguage", KeyInfo(KeyInfo::isMain, 2, ignoreFormats.getLanguage()), isPatternString);
|
||||
|
@ -697,6 +697,11 @@ void parStartCommand(Paragraph const & par, otexstream & os,
|
||||
os << " ";
|
||||
}
|
||||
break;
|
||||
case LATEX_ENVIRONMENT:
|
||||
if (runparams.for_search) {
|
||||
os << "\\latexenvironment{" << style.latexname() << "}{";
|
||||
}
|
||||
break;
|
||||
case LATEX_BIB_ENVIRONMENT:
|
||||
// ignore this, the inset will write itself
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user