* tex2lyx/preamble.cpp:

- fix thinko that caused tex2lyx to silently drop custom preamble entries in non-LyX-generated tex files.
	  (bug 5788). Patch from Jean-Marc.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28567 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2009-02-20 09:46:03 +00:00
parent 5a46619354
commit 3ccf39a084

View File

@ -397,10 +397,10 @@ void handle_package(Parser &p, string const & name, string const & opts,
h_cite_engine = "jurabib";
else if (!in_lyx_preamble) {
if (options.empty())
h_preamble << "\\usepackage{" << name << "}\n";
h_preamble << "\\usepackage{" << name << "}";
else {
h_preamble << "\\usepackage[" << opts << "]{"
<< name << "}\n";
<< name << "}";
options.clear();
}
}
@ -469,7 +469,7 @@ void parse_preamble(Parser & p, ostream & os,
special_columns['D'] = 3;
bool is_full_document = false;
bool is_lyx_file = false;
bool in_lyx_preamble = true;
bool in_lyx_preamble = false;
// determine whether this is a full document or a fragment for inclusion
while (p.good()) {
@ -527,10 +527,11 @@ void parse_preamble(Parser & p, ostream & os,
}
smatch sub;
if (regex_search(comment, sub, islyxfile))
if (regex_search(comment, sub, islyxfile)) {
is_lyx_file = true;
else if (is_lyx_file
&& regex_search(comment, sub, usercommands))
in_lyx_preamble = true;
} else if (is_lyx_file
&& regex_search(comment, sub, usercommands))
in_lyx_preamble = false;
else if (!in_lyx_preamble)
h_preamble << t.asInput();