Jean-Marc Lasgouttes wrote:
> I have not followed the discussion well enough, but somehow I do not 
> like to hard-code the format name in there. Unfortunately I do not have 
> time to look at it seriously, just to send annoying emails.

Julien, am I right that we need this conversion only if the child is literate? 
If so, can' we just check for Buffer::isLiterate() and do the conversion if 
this returns true? Or, if a more broad scope is desired, check for 
Buffer::isLatex() like in the attached patch?

Jürgen
Index: src/insets/InsetInclude.cpp
===================================================================
--- src/insets/InsetInclude.cpp	(Revision 38092)
+++ src/insets/InsetInclude.cpp	(Arbeitskopie)
@@ -601,9 +601,8 @@
 		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();
+		bool const child_is_latex = tmp->isLatex();
 		FileName const tmpwritefile(changeExtension(writefile.absFileName(),
 			formats.extension(inc_format)));
 
@@ -640,22 +639,25 @@
 		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 (!child_is_latex) {
+			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

Reply via email to