From 717c4176f54450a361f786f14b86a20088dbe5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 29 Mar 2011 08:35:37 +0000 Subject: [PATCH] * InsetInclude.cpp: another follow-up to r38025: do not attempt to convert a child document to LaTeX if it is already LaTeX. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38118 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetInclude.cpp | 39 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index c5d8c3d000..35f2d25830 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -556,7 +556,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const isLyXFileName(included_file.absFileName())) { // if it's a LyX file and we're inputting or including, // try to load it so we can write the associated latex - + Buffer * tmp = loadIfNeeded(); if (!tmp) { docstring text = bformat(_("Could not load included " @@ -601,9 +601,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const tmp->markDepClean(masterBuffer->temppath()); // Don't assume the child's format is latex - string const inc_format = - (tmp->bufferFormat() == "latex" && tex_format == "pdflatex") ? - "pdflatex" : tmp->bufferFormat(); + string const inc_format = tmp->bufferFormat(); FileName const tmpwritefile(changeExtension(writefile.absFileName(), formats.extension(inc_format))); @@ -640,22 +638,25 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const runparams.encoding = oldEnc; runparams.master_language = oldLang; - // Use converters to produce a latex file from the child - ErrorList el; - bool const success = - theConverters().convert(tmp, tmpwritefile, writefile, included_file, - inc_format, tex_format, el); + // I needed, use converters to produce a latex file from the child + if (!tmp->isLatex()) { + ErrorList el; + bool const success = + theConverters().convert(tmp, tmpwritefile, writefile, + included_file, + inc_format, tex_format, el); - if (!success) { - docstring msg = bformat(_("Included file `%1$s' " - "was not exported correctly.\nWarning: " - "LaTeX export is probably incomplete."), - included_file.displayName()); - if (!el.empty()) - msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"), - msg, el.begin()->error, - el.begin()->description); - Alert::warning(_("Export failure"), msg); + if (!success) { + docstring msg = bformat(_("Included file `%1$s' " + "was not exported correctly.\nWarning: " + "LaTeX export is probably incomplete."), + included_file.displayName()); + if (!el.empty()) + msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"), + msg, el.begin()->error, + el.begin()->description); + Alert::warning(_("Export failure"), msg); + } } } else { // In this case, it's not a LyX file, so we copy the file