Fix bug 3240

* src/insets/ExternalSupport.C
	(updateExternal): Add new dryrun flag and only record updated files
	for the exporter if that flag is false
	(writeExternal): Call updateExternal also if dryrun is true and the
	product contains the $$Contents placeholder. In this case we need to
	run the conversion(s) even in dryrun mode, because we would not
	output the right stuff to the .tex file otherwise.

	* src/insets/ExternalSupport.[Ch]
	(writeExternal): rename external_in_comment flag to dryrun


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17204 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-02-15 21:22:40 +00:00
parent 4b449892e1
commit e1efef8a60
2 changed files with 35 additions and 32 deletions

View File

@ -197,7 +197,8 @@ void updateExternal(InsetExternalParams const & params,
string const & format,
Buffer const & buffer,
ExportData & exportdata,
bool external_in_tmpdir)
bool external_in_tmpdir,
bool dryrun)
{
Template const * const et_ptr = getTemplatePtr(params);
if (!et_ptr)
@ -274,6 +275,7 @@ void updateExternal(InsetExternalParams const & params,
FileName const abs_to_file(
support::makeAbsPath(to_file, m_buffer->temppath()));
if (!dryrun) {
// Record the referenced files for the exporter.
// The exporter will copy them to the export dir.
typedef Template::Format::FileMap FileMap;
@ -303,6 +305,7 @@ void updateExternal(InsetExternalParams const & params,
exportdata.addExternalFile(rit->first, source, file);
}
}
}
// Do we need to perform the conversion?
// Yes if to_file does not exist or if from_file is newer than to_file
@ -333,7 +336,7 @@ int writeExternal(InsetExternalParams const & params,
Buffer const & buffer, odocstream & os,
ExportData & exportdata,
bool external_in_tmpdir,
bool external_in_comment)
bool dryrun)
{
Template const * const et_ptr = getTemplatePtr(params);
if (!et_ptr)
@ -349,9 +352,9 @@ int writeExternal(InsetExternalParams const & params,
return 0;
}
if (!external_in_comment)
if (!dryrun || support::contains(cit->second.product, "$$Contents"))
updateExternal(params, format, buffer, exportdata,
external_in_tmpdir);
external_in_tmpdir, dryrun);
bool const use_latex_path = format == "LaTeX";
string str = doSubstitution(params, buffer, cit->second.product,

View File

@ -66,7 +66,7 @@ int writeExternal(InsetExternalParams const &,
odocstream &,
ExportData &,
bool external_in_tmpdir,
bool external_in_comment);
bool dryrun);
} // namespace external
} // namespace lyx