mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
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:
parent
4b449892e1
commit
e1efef8a60
@ -197,7 +197,8 @@ void updateExternal(InsetExternalParams const & params,
|
|||||||
string const & format,
|
string const & format,
|
||||||
Buffer const & buffer,
|
Buffer const & buffer,
|
||||||
ExportData & exportdata,
|
ExportData & exportdata,
|
||||||
bool external_in_tmpdir)
|
bool external_in_tmpdir,
|
||||||
|
bool dryrun)
|
||||||
{
|
{
|
||||||
Template const * const et_ptr = getTemplatePtr(params);
|
Template const * const et_ptr = getTemplatePtr(params);
|
||||||
if (!et_ptr)
|
if (!et_ptr)
|
||||||
@ -274,33 +275,35 @@ void updateExternal(InsetExternalParams const & params,
|
|||||||
FileName const abs_to_file(
|
FileName const abs_to_file(
|
||||||
support::makeAbsPath(to_file, m_buffer->temppath()));
|
support::makeAbsPath(to_file, m_buffer->temppath()));
|
||||||
|
|
||||||
// Record the referenced files for the exporter.
|
if (!dryrun) {
|
||||||
// The exporter will copy them to the export dir.
|
// Record the referenced files for the exporter.
|
||||||
typedef Template::Format::FileMap FileMap;
|
// The exporter will copy them to the export dir.
|
||||||
FileMap::const_iterator rit = outputFormat.referencedFiles.begin();
|
typedef Template::Format::FileMap FileMap;
|
||||||
FileMap::const_iterator rend = outputFormat.referencedFiles.end();
|
FileMap::const_iterator rit = outputFormat.referencedFiles.begin();
|
||||||
for (; rit != rend; ++rit) {
|
FileMap::const_iterator rend = outputFormat.referencedFiles.end();
|
||||||
vector<string>::const_iterator fit = rit->second.begin();
|
for (; rit != rend; ++rit) {
|
||||||
vector<string>::const_iterator fend = rit->second.end();
|
vector<string>::const_iterator fit = rit->second.begin();
|
||||||
for (; fit != fend; ++fit) {
|
vector<string>::const_iterator fend = rit->second.end();
|
||||||
FileName const source(support::makeAbsPath(
|
for (; fit != fend; ++fit) {
|
||||||
doSubstitution(params, buffer, *fit,
|
FileName const source(support::makeAbsPath(
|
||||||
false, true),
|
doSubstitution(params, buffer, *fit,
|
||||||
m_buffer->temppath()));
|
false, true),
|
||||||
// The path of the referenced file is never the
|
m_buffer->temppath()));
|
||||||
// temp path, but the filename may be the mangled
|
// The path of the referenced file is never the
|
||||||
// or the real name. Therefore we substitute the
|
// temp path, but the filename may be the mangled
|
||||||
// paths and names separately.
|
// or the real name. Therefore we substitute the
|
||||||
string file = support::subst(*fit, "$$FName",
|
// paths and names separately.
|
||||||
"$$FPath$$Basename$$Extension");
|
string file = support::subst(*fit, "$$FName",
|
||||||
file = doSubstitution(params, buffer, file, false, false,
|
"$$FPath$$Basename$$Extension");
|
||||||
PATHS);
|
file = doSubstitution(params, buffer, file, false, false,
|
||||||
file = doSubstitution(params, buffer, file,
|
PATHS);
|
||||||
false, external_in_tmpdir,
|
file = doSubstitution(params, buffer, file,
|
||||||
ALL_BUT_PATHS);
|
false, external_in_tmpdir,
|
||||||
// if file is a relative name, it is interpreted
|
ALL_BUT_PATHS);
|
||||||
// relative to the master document.
|
// if file is a relative name, it is interpreted
|
||||||
exportdata.addExternalFile(rit->first, source, file);
|
// relative to the master document.
|
||||||
|
exportdata.addExternalFile(rit->first, source, file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +336,7 @@ int writeExternal(InsetExternalParams const & params,
|
|||||||
Buffer const & buffer, odocstream & os,
|
Buffer const & buffer, odocstream & os,
|
||||||
ExportData & exportdata,
|
ExportData & exportdata,
|
||||||
bool external_in_tmpdir,
|
bool external_in_tmpdir,
|
||||||
bool external_in_comment)
|
bool dryrun)
|
||||||
{
|
{
|
||||||
Template const * const et_ptr = getTemplatePtr(params);
|
Template const * const et_ptr = getTemplatePtr(params);
|
||||||
if (!et_ptr)
|
if (!et_ptr)
|
||||||
@ -349,9 +352,9 @@ int writeExternal(InsetExternalParams const & params,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!external_in_comment)
|
if (!dryrun || support::contains(cit->second.product, "$$Contents"))
|
||||||
updateExternal(params, format, buffer, exportdata,
|
updateExternal(params, format, buffer, exportdata,
|
||||||
external_in_tmpdir);
|
external_in_tmpdir, dryrun);
|
||||||
|
|
||||||
bool const use_latex_path = format == "LaTeX";
|
bool const use_latex_path = format == "LaTeX";
|
||||||
string str = doSubstitution(params, buffer, cit->second.product,
|
string str = doSubstitution(params, buffer, cit->second.product,
|
||||||
|
@ -66,7 +66,7 @@ int writeExternal(InsetExternalParams const &,
|
|||||||
odocstream &,
|
odocstream &,
|
||||||
ExportData &,
|
ExportData &,
|
||||||
bool external_in_tmpdir,
|
bool external_in_tmpdir,
|
||||||
bool external_in_comment);
|
bool dryrun);
|
||||||
|
|
||||||
} // namespace external
|
} // namespace external
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
Loading…
Reference in New Issue
Block a user