mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +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
fa4cbf9fb4
commit
f6f4a8ddf8
@ -528,6 +528,67 @@ 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: {
|
||||
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;
|
||||
@ -548,11 +609,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
|
||||
@ -676,61 +733,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: {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -142,6 +142,8 @@ What's new
|
||||
- Do not create an empty environment variable LC_ALL when launching
|
||||
external processes (bug 8537).
|
||||
|
||||
- Do not try to process included files when viewing source (bug 8557).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user