mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Prevent multiplication of preamble code
Fixes rest of #8229
(cherry picked from commit f51fa38123
)
This commit is contained in:
parent
f8eb3b9742
commit
019a4fa124
@ -944,11 +944,14 @@ void Preamble::handle_package(Parser &p, string const & name,
|
|||||||
// perhaps in future others.
|
// perhaps in future others.
|
||||||
// Therefore keep the babel call as it is as the user might have
|
// Therefore keep the babel call as it is as the user might have
|
||||||
// reasons for it.
|
// reasons for it.
|
||||||
h_preamble << "\\usepackage[" << opts << "]{babel}\n";
|
string const babelcall = "\\usepackage[" + opts + "]{babel}\n";
|
||||||
|
if (!contains(h_preamble.str(), babelcall))
|
||||||
|
h_preamble << babelcall;
|
||||||
}
|
}
|
||||||
delete_opt(options, known_languages);
|
delete_opt(options, known_languages);
|
||||||
} else {
|
} else {
|
||||||
h_preamble << "\\usepackage{babel}\n";
|
if (!contains(h_preamble.str(), "\\usepackage{babel}\n"))
|
||||||
|
h_preamble << "\\usepackage{babel}\n";
|
||||||
explicit_babel = true;
|
explicit_babel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1781,7 +1784,8 @@ void Preamble::parse(Parser & p, string const & forceclass,
|
|||||||
ss << '*';
|
ss << '*';
|
||||||
ss << '{' << name << '}' << opt1 << opt2
|
ss << '{' << name << '}' << opt1 << opt2
|
||||||
<< '{' << body << "}";
|
<< '{' << body << "}";
|
||||||
h_preamble << ss.str();
|
if (prefixIs(t.cs(), "renew") || !contains(h_preamble.str(), ss.str()))
|
||||||
|
h_preamble << ss.str();
|
||||||
/*
|
/*
|
||||||
ostream & out = in_preamble ? h_preamble : os;
|
ostream & out = in_preamble ? h_preamble : os;
|
||||||
out << "\\" << t.cs() << "{" << name << "}"
|
out << "\\" << t.cs() << "{" << name << "}"
|
||||||
|
@ -73,7 +73,7 @@ What's new
|
|||||||
|
|
||||||
* TEX2LYX
|
* TEX2LYX
|
||||||
|
|
||||||
|
- Prevent multiplication of preamble code on (re-)import (bug 8229).
|
||||||
|
|
||||||
|
|
||||||
* LYXHTML
|
* LYXHTML
|
||||||
|
Loading…
Reference in New Issue
Block a user