///
bool getLanguage() { return ignoreLanguage_; };
///
- void setIgnoreFormat(string type, bool value);
+ void setIgnoreFormat(string const & type, bool value);
private:
///
};
-void IgnoreFormats::setIgnoreFormat(string type, bool value)
+void IgnoreFormats::setIgnoreFormat(string const & type, bool value)
{
if (type == "color") {
ignoreColor_ = value;
IgnoreFormats ignoreFormats;
-void setIgnoreFormat(string type, bool value)
+void setIgnoreFormat(string const & type, bool value)
{
ignoreFormats.setIgnoreFormat(type, value);
}
class MatchString : public binary_function<Paragraph, pos_type, int>
{
public:
- MatchString(docstring const & str, bool cs, bool mw)
- : str(str), case_sens(cs), whole_words(mw)
+ MatchString(docstring const & s, bool cs, bool mw)
+ : str(s), case_sens(cs), whole_words(mw)
{}
// returns true if the specified string is at the specified position
bool isPatternString_;
public:
explicit Intervall(bool isPattern, string const & p) :
- isPatternString_(isPattern), par(p), ignoreidx(-1), actualdeptindex(0),
- hasTitle(false)
+ isPatternString_(isPattern), par(p), ignoreidx(-1), actualdeptindex(0),
+ hasTitle(false), langcount(0)
{
depts[0] = 0;
closes[0] = 0;
int findclosing(int start, int end, char up, char down, int repeat);
void handleParentheses(int lastpos, bool closingAllowed);
bool hasTitle;
+ int langcount; // Number of disabled language specs up to current position in actual interval
int isOpeningPar(int pos);
string titleValue;
void output(ostringstream &os, int lastpos);
accents["lyxmathsym{ß}"] = "ß";
accents["text{ß}"] = "ß";
accents["ddot{\\imath}"] = "ï";
- buildaccent("ddot", "aAeEiIioOuUyY",
- "äÄëËïÏïöÖüÜÿŸ"); // umlaut
- buildaccent("dot|.", "cCeEGgIizZaAoObBdDfFyY",
- "ċĊėĖĠġİİżŻȧȦȯȮḃḂḋḊḟḞẏẎ"); // dot{i} can only happen if ignoring case, but there is no lowercase of 'İ'
+ buildaccent("ddot", "aAeEhHiIioOtuUwWxXyY",
+ "äÄëËḧḦïÏïöÖẗüÜẅẄẍẌÿŸ"); // umlaut
+ buildaccent("dot|.", "aAbBcCdDeEfFGghHIimMnNoOpPrRsStTwWxXyYzZ",
+ "ȧȦḃḂċĊḋḊėĖḟḞĠġḣḢİİṁṀṅṄȯȮṗṖṙṘṡṠṫṪẇẆẋẊẏẎżŻ"); // dot{i} can only happen if ignoring case, but there is no lowercase of 'İ'
accents["acute{\\imath}"] = "í";
- buildaccent("acute", "aAcCeElLoOnNrRsSuUyYzZiI",
- "áÁćĆéÉĺĹóÓńŃŕŔśŚúÚýÝźŹíÍ");
+ buildaccent("acute", "aAcCeEgGkKlLmMoOnNpPrRsSuUwWyYzZiI",
+ "áÁćĆéÉǵǴḱḰĺĹḿḾóÓńŃṕṔŕŔśŚúÚẃẂýÝźŹíÍ");
buildaccent("dacute|H|h", "oOuU", "őŐűŰ"); // double acute
buildaccent("mathring|r", "aAuUwy",
"åÅůŮẘẙ"); // ring
"čČďĎǎǍěĚǐǏǒǑǔǓǧǦǩǨȟȞľĽňŇřŘšŠŤťžŽ"); // caron
accents["hat{\\imath}"] = "î";
accents["hat{\\jmath}"] = "ĵ";
- buildaccent("hat|^", "aAeEiIcCgGhHjJsSwWyYzZoOuU",
- "âÂêÊîÎĉĈĝĜĥĤĵĴŝŜŵŴŷŶẑẐôÔûÛ"); // circ
+ buildaccent("hat|^", "aAcCeEgGhHiIjJoOsSuUwWyYzZ",
+ "âÂĉĈêÊĝĜĥĤîÎĵĴôÔŝŜûÛŵŴŷŶẑẐ"); // circ
accents["bar{\\imath}"] = "ī";
buildaccent("bar|=", "aAeEiIoOuUyY",
"āĀēĒīĪōŌūŪȳȲ"); // macron
accents["tilde{\\imath}"] = "ĩ";
- buildaccent("tilde", "aAnNoOiIuU",
- "ãÃñÑõÕĩĨũŨ"); // tilde
+ buildaccent("tilde", "aAeEiInNoOuUvVyY",
+ "ãÃẽẼĩĨñÑõÕũŨṽṼỹỸ"); // tilde
accents["breve{\\imath}"] = "ĭ";
buildaccent("breve|u", "aAeEgGiIoOuU",
"ăĂĕĔğĞĭĬŏŎŭŬ"); // breve
accents["textroundcap{\\i}"] = "ȉ";
buildaccent("rcap|textroundcap", "AaEeIiOoRrUu",
"ȂȃȆȇȊȋȎȏȒȓȖȗ"); // inverted breve
+ buildaccent("slashed", "oO",
+ "øØ"); // slashed
}
/*
{
if (accents.empty())
buildAccentsMap();
- static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
+ static regex const accre("\\\\(([\\S]|grave|breve|lyxmathsym|text|ddot|dot|acute|dacute|mathring|check|hat|bar|tilde|subdot|ogonek|cedilla|subring|textsubring|subhat|textsubcircum|subtilde|textsubtilde|dgrave|textdoublegrave|rcap|textroundcap|slashed)\\{[^\\{\\}]+\\}|(i|imath|jmath)(?![a-zA-Z]))");
smatch sub;
for (sregex_iterator itacc(par.begin(), par.end(), accre), end; itacc != end; ++itacc) {
sub = *itacc;
void removeHead(KeyInfo&, int count=0);
public:
- LatexInfo(string par, bool isPatternString) : entidx_(-1), interval_(isPatternString, par)
+ LatexInfo(string const & par, bool isPatternString)
+ : entidx_(-1), interval_(isPatternString, par)
{
buildKeys(isPatternString);
entries_ = vector<KeyInfo>();
{
int skip = 0;
int depth = 0;
- repeat--;
for (int i = start; i < end; i += 1 + skip) {
char c;
c = par[i];
}
else if (c == down) {
if (depth == 0) {
+ repeat--;
if ((repeat <= 0) || (par[i+1] != up))
return i;
}
MathInfo() {
actualIdx_ = 0;
}
- void insert(string wait, size_t start, size_t end) {
+ void insert(string const & wait, size_t start, size_t end) {
MathEntry m = MathEntry();
m.wait = wait;
m.mathStart = start;
}
found._tokensize = found.head.length();
found._dataStart = found._tokenstart + found.head.length();
+ if (found.keytype == KeyInfo::doRemove) {
+ int endpar = 2 + interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
+ found._dataStart = endpar;
+ found._tokensize = found._dataStart - found._tokenstart;
+ closings = 0;
+ }
if (interval_.par.substr(found._dataStart-1, 15).compare("\\endarguments{}") == 0) {
found._dataStart += 15;
}
- size_t endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
+ size_t endpos;
+ if (closings < 1)
+ endpos = found._dataStart - 1;
+ else
+ endpos = interval_.findclosing(found._dataStart, interval_.par.length(), '{', '}', closings);
if (found.keytype == KeyInfo::isList) {
// Check if it really is list env
static regex const listre("^([a-z]+)$");
// handle like standard keys with 1 parameter.
makeKey("url|href|vref|thanks", KeyInfo(KeyInfo::isStandard, 1, false), isPatternString);
+ // Ignore deleted text
+ makeKey("lyxdeleted", KeyInfo(KeyInfo::doRemove, 3, false), isPatternString);
+ // but preserve added text
+ makeKey("lyxadded", KeyInfo(KeyInfo::doRemove, 2, false), isPatternString);
+
// Macros to remove, but let the parameter survive
// No split
makeKey("menuitem|textmd|textrm", KeyInfo(KeyInfo::isStandard, 1, true), isPatternString);
printed += lastpos-i;
}
handleParentheses(lastpos, false);
- for (int i = actualdeptindex; i > 0; --i) {
+ int startindex;
+ if (keys["foreignlanguage"].disabled)
+ startindex = actualdeptindex-langcount;
+ else
+ startindex = actualdeptindex;
+ for (int i = startindex; i > 0; --i) {
os << "}";
}
if (hasTitle && (printed > 0))
if ((interval_.par[pos] != ' ') && (interval_.par[pos] != '%'))
break;
}
- interval_.addIntervall(actual._tokenstart, pos);
+ // Remove also enclosing parentheses [] and {}
+ int numpars = 0;
+ int spaces = 0;
+ while (actual._tokenstart > numpars) {
+ if (interval_.par[pos+numpars] == ']' && interval_.par[actual._tokenstart-numpars-1] == '[')
+ numpars++;
+ else if (interval_.par[pos+numpars] == '}' && interval_.par[actual._tokenstart-numpars-1] == '{')
+ numpars++;
+ else
+ break;
+ }
+ if (numpars > 0) {
+ if (interval_.par[pos+numpars] == ' ')
+ spaces++;
+ }
+
+ interval_.addIntervall(actual._tokenstart-numpars, pos+numpars+spaces);
nextKeyIdx = getNextKey();
break;
}
}
if (actual.disabled) {
removeHead(actual);
+ interval_.langcount++;
if ((interval_.par.substr(actual._dataStart, 3) == " \\[") ||
(interval_.par.substr(actual._dataStart, 8) == " \\begin{")) {
// Discard also the space before math-equation
if (m.size() > 1)
leadingsize = m[1].second - m[1].first;
int result;
- for (size_t i = 0; i < m.size(); i++) {
- LYXERR(Debug::FIND, "Match " << i << " is " << m[i].second - m[i].first << " long");
- }
+ for (size_t i = 0; i < m.size(); i++) {
+ LYXERR(Debug::FIND, "Match " << i << " is " << m[i].second - m[i].first << " long");
+ }
if (close_wildcards == 0)
result = m[0].second - m[0].first;
FindAndReplaceOptions::FindAndReplaceOptions(
- docstring const & find_buf_name, bool casesensitive,
- bool matchword, bool forward, bool expandmacros, bool ignoreformat,
- docstring const & repl_buf_name, bool keep_case,
- SearchScope scope, SearchRestriction restr, bool replace_all)
- : find_buf_name(find_buf_name), casesensitive(casesensitive), matchword(matchword),
- forward(forward), expandmacros(expandmacros), ignoreformat(ignoreformat),
- repl_buf_name(repl_buf_name), keep_case(keep_case), scope(scope), restr(restr), replace_all(replace_all)
+ docstring const & _find_buf_name, bool _casesensitive,
+ bool _matchword, bool _forward, bool _expandmacros, bool _ignoreformat,
+ docstring const & _repl_buf_name, bool _keep_case,
+ SearchScope _scope, SearchRestriction _restr, bool _replace_all)
+ : find_buf_name(_find_buf_name), casesensitive(_casesensitive), matchword(_matchword),
+ forward(_forward), expandmacros(_expandmacros), ignoreformat(_ignoreformat),
+ repl_buf_name(_repl_buf_name), keep_case(_keep_case), scope(_scope), restr(_restr), replace_all(_replace_all)
{
}