mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
fix preamble output in case child docs are present
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40362 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
528c984a57
commit
07b2ffa469
@ -815,7 +815,7 @@ void Preamble::handle_if(Parser & p, bool in_lyx_preamble)
|
||||
}
|
||||
|
||||
|
||||
bool Preamble::writeLyXHeader(ostream & os)
|
||||
bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
|
||||
{
|
||||
// translate from babel to LyX names
|
||||
h_language = babel2lyx(h_language);
|
||||
@ -858,7 +858,7 @@ bool Preamble::writeLyXHeader(ostream & os)
|
||||
<< "\\begin_document\n"
|
||||
<< "\\begin_header\n"
|
||||
<< "\\textclass " << h_textclass << "\n";
|
||||
string const raw = h_preamble.str();
|
||||
string const raw = subdoc ? empty_string() : h_preamble.str();
|
||||
if (!raw.empty()) {
|
||||
os << "\\begin_preamble\n";
|
||||
for (string::size_type i = 0; i < raw.size(); ++i) {
|
||||
@ -977,8 +977,6 @@ bool Preamble::writeLyXHeader(ostream & os)
|
||||
<< authors_
|
||||
<< "\\end_header\n\n"
|
||||
<< "\\begin_body\n";
|
||||
// clear preamble for subdocuments
|
||||
h_preamble.str("");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
void parse(Parser & p, std::string const & forceclass,
|
||||
TeX2LyXDocClass & tc);
|
||||
/// Writes the LyX file header from internal data
|
||||
bool writeLyXHeader(std::ostream & os);
|
||||
bool writeLyXHeader(std::ostream & os, bool subdoc);
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -685,7 +685,7 @@ bool tex2lyx(idocstream & is, ostream & os, string encoding)
|
||||
for (; it != end; it++)
|
||||
preamble.addModule(*it);
|
||||
}
|
||||
if (!preamble.writeLyXHeader(os)) {
|
||||
if (!preamble.writeLyXHeader(os, !active_environments.empty())) {
|
||||
cerr << "Could write LyX file header." << endl;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user