#define MAXOPENED 30
class Intervall {
+ bool isPatternString;
public:
- Intervall() : ignoreidx(-1), actualdeptindex(0) {};
+ Intervall(bool isPattern) : isPatternString(isPattern), ignoreidx(-1), actualdeptindex(0) {};
string par;
int ignoreidx;
int depts[MAXOPENED];
private:
int entidx;
Entries entries;
- KeyInfo analyze(string key);
Intervall interval;
void buildKeys(bool);
void buildEntries(bool);
IgnoreFormats f;
public:
- LatexInfo(string par, bool isPatternString) {
+ LatexInfo(string par, bool isPatternString) : interval(isPatternString) {
interval.par = par;
buildKeys(isPatternString);
entries = vector<KeyInfo>();
}
}
}
+ // Ignore language if there is math somewhere in pattern-string
if (isPatternString) {
if (! mi.empty()) {
// Disable language
}
else if (found.parenthesiscount == 2) {
found.head = sub.str(0) + "{";
- found._tokensize = found.head.length();
}
found._tokensize = found.head.length();
found._dataStart = found._tokenstart + found.head.length();
static bool keysBuilt = false;
if (keysBuilt && !isPatternString) return;
- // Know statdard keys with 1 parameter.
+ // Know standard keys with 1 parameter.
// Split is done, if not at start of region
makeKey("textsf|textss|texttt", KeyInfo(KeyInfo::isStandard, 1, f.getFamily()), isPatternString);
makeKey("textbf", KeyInfo(KeyInfo::isStandard, 1, f.getSeries()), isPatternString);
// Known macros to remove (including their parameter)
// No split
- makeKey("inputencoding|shortcut", KeyInfo(KeyInfo::doRemove, 1, false), isPatternString);
+ makeKey("inputencoding|shortcut|label|ref", KeyInfo(KeyInfo::doRemove, 1, false), isPatternString);
// Macros to remove, but let the parameter survive
// No split
makeKey("footnotesize|tiny|scriptsize|small|large|Large|LARGE|huge|Huge", KeyInfo(KeyInfo::isSize, 0, true), isPatternString);
// Survives, like known character
- makeKey("lyx", KeyInfo(KeyInfo::isIgnored, 0, false), isPatternString);
+ makeKey("lyx|latex|tex", KeyInfo(KeyInfo::isIgnored, 0, false), isPatternString);
makeKey("item", KeyInfo(KeyInfo::isChar, 0, false), isPatternString);
makeKey("begin|end", KeyInfo(KeyInfo::isMath, 1, false), isPatternString);
makeKey("[|]", KeyInfo(KeyInfo::isMath, 1, false), isPatternString);
makeKey("$", KeyInfo(KeyInfo::isMath, 1, false), isPatternString);
- makeKey("par|uldepth|ULdepth", KeyInfo(KeyInfo::doRemove, 0, true), isPatternString);
+ makeKey("par|uldepth|ULdepth|protect", KeyInfo(KeyInfo::doRemove, 0, true), isPatternString);
if (isPatternString) {
// Allow the first searched string to rebuild the keys too
for (int i = actualdeptindex; i > 0; --i) {
os << "}";
}
+ if (! isPatternString)
+ os << "\n";
handleParentheses(lastpos, true); /* extra closings '}' allowed here */
}
while ( regex_replace(par_as_string, par_as_string, "(.*)\\\\}$", "$1")) {
open_braces++;
}
+ /*
// save '\.'
regex_replace(par_as_string, par_as_string, "\\\\\\.", "_xxbdotxx_");
// handle '.' -> '[^]', replace later as '[^\}\{\\]'
regex_replace(par_as_string, par_as_string, "_xxbrrxx_", "]");
// restore '\.'
regex_replace(par_as_string, par_as_string, "_xxbdotxx_", "\\.");
+ */
}
LYXERR(Debug::FIND, "par_as_string now is '" << par_as_string << "'");
LYXERR(Debug::FIND, "Open braces: " << open_braces);
AS_STR_INSETS | AS_STR_SKIPDELETE | AS_STR_PLAINTEXT,
&runparams);
} else if (cur.inMathed()) {
- docstring s;
CursorSlice cs = cur.top();
MathData md = cs.cell();
MathData::const_iterator it_end =
(( len == -1 || cs.pos() + len > int(md.size()))
? md.end()
: md.begin() + cs.pos() + len );
+ MathData md2;
for (MathData::const_iterator it = md.begin() + cs.pos();
it != it_end; ++it)
- s = s + asString(*it);
+ md2.push_back(*it);
+ docstring s = asString(md2);
LYXERR(Debug::FIND, "Stringified math: '" << s << "'");
return s;
}
((len == -1 || cs.pos() + len > int(md.size()))
? md.end()
: md.begin() + cs.pos() + len);
+ MathData md2;
for (MathData::const_iterator it = md.begin() + cs.pos();
it != it_end; ++it)
- ods << asString(*it);
+ md2.push_back(*it);
+ ods << asString(md2);
// Retrieve the math environment type, and add '$' or '$]'
// or others (\end{equation}) accordingly
for (int s = cur.depth() - 1; s >= 0; --s) {