mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Do not try to load or copy included files when we are in a comment
or doing a dryrun. We skipped some of this before, but not all of it, which led to bug #8557.
This commit is contained in:
parent
28104a7496
commit
eb90ac0988
@ -535,6 +535,70 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
||||
|
||||
FileName const writefile(makeAbsPath(mangled, masterBuffer->temppath()));
|
||||
|
||||
string const tex_format = flavor2format(runparams.flavor);
|
||||
|
||||
switch (type(params())) {
|
||||
case VERB:
|
||||
case VERBAST: {
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName()) << '{'
|
||||
<< from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case INPUT: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
|
||||
// \input wants file with extension (default is .tex)
|
||||
if (!isLyXFileName(included_file.absFileName())) {
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName())
|
||||
<< '{' << from_utf8(incfile) << '}';
|
||||
} else {
|
||||
incfile = changeExtension(incfile, ".tex");
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName())
|
||||
<< '{' << from_utf8(incfile) << '}';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LISTINGS: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
os << '\\' << from_ascii(params().getCmdName());
|
||||
string const opt = to_utf8(params()["lstparams"]);
|
||||
// opt is set in QInclude dialog and should have passed validation.
|
||||
InsetListingsParams params(opt);
|
||||
if (!params.params().empty())
|
||||
os << "[" << from_utf8(params.params()) << "]";
|
||||
os << '{' << from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case INCLUDE: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
|
||||
// \include don't want extension and demands that the
|
||||
// file really have .tex
|
||||
incfile = changeExtension(incfile, string());
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName()) << '{'
|
||||
<< from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
if (runparams.inComment || runparams.dryrun)
|
||||
// Don't try to load or copy the file if we're
|
||||
// in a comment or doing a dryrun
|
||||
return;
|
||||
|
||||
if (!runparams.nice)
|
||||
incfile = mangled;
|
||||
else if (!isValidLaTeXFileName(incfile)) {
|
||||
@ -554,11 +618,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
||||
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
|
||||
LYXERR(Debug::LATEX, "writefile:" << writefile);
|
||||
|
||||
string const tex_format = flavor2format(runparams.flavor);
|
||||
if (runparams.inComment || runparams.dryrun) {
|
||||
//Don't try to load or copy the file if we're
|
||||
//in a comment or doing a dryrun
|
||||
} else if (isInputOrInclude(params()) &&
|
||||
if (isInputOrInclude(params()) &&
|
||||
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
|
||||
@ -682,63 +742,6 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (type(params())) {
|
||||
case VERB:
|
||||
case VERBAST: {
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName()) << '{'
|
||||
<< from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case INPUT: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
|
||||
// \input wants file with extension (default is .tex)
|
||||
if (!isLyXFileName(included_file.absFileName())) {
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName())
|
||||
<< '{' << from_utf8(incfile) << '}';
|
||||
} else {
|
||||
incfile = changeExtension(incfile, ".tex");
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName())
|
||||
<< '{' << from_utf8(incfile) << '}';
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LISTINGS: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
os << '\\' << from_ascii(params().getCmdName());
|
||||
string const opt = to_utf8(params()["lstparams"]);
|
||||
// opt is set in QInclude dialog and should have passed validation.
|
||||
InsetListingsParams params(opt);
|
||||
if (!params.params().empty())
|
||||
os << "[" << from_utf8(params.params()) << "]";
|
||||
os << '{' << from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case INCLUDE: {
|
||||
runparams.exportdata->addExternalFile(tex_format, writefile,
|
||||
exportfile);
|
||||
|
||||
// \include don't want extension and demands that the
|
||||
// file really have .tex
|
||||
incfile = changeExtension(incfile, string());
|
||||
incfile = latex_path(incfile);
|
||||
// FIXME UNICODE
|
||||
os << '\\' << from_ascii(params().getCmdName()) << '{'
|
||||
<< from_utf8(incfile) << '}';
|
||||
break;
|
||||
}
|
||||
case NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user