mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +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()));
|
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)
|
if (!runparams.nice)
|
||||||
incfile = mangled;
|
incfile = mangled;
|
||||||
@ -548,11 +609,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
|
|||||||
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
|
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
|
||||||
LYXERR(Debug::LATEX, "writefile:" << writefile);
|
LYXERR(Debug::LATEX, "writefile:" << writefile);
|
||||||
|
|
||||||
string const tex_format = flavor2format(runparams.flavor);
|
if (isInputOrInclude(params()) &&
|
||||||
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()) &&
|
|
||||||
isLyXFileName(included_file.absFileName())) {
|
isLyXFileName(included_file.absFileName())) {
|
||||||
// if it's a LyX file and we're inputting or including,
|
// if it's a LyX file and we're inputting or including,
|
||||||
// try to load it so we can write the associated latex
|
// 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
|
- Do not create an empty environment variable LC_ALL when launching
|
||||||
external processes (bug 8537).
|
external processes (bug 8537).
|
||||||
|
|
||||||
|
- Do not try to process included files when viewing source (bug 8557).
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user