TempName::TempName()
{
- string const tempname = support::tempName(string(), "lyxext");
+ support::FileName const tempname(support::tempName(support::FileName(), "lyxext"));
// FIXME: This is unsafe
- support::unlink(support::FileName(tempname));
+ support::unlink(tempname);
// must have an extension for the converter code to work correctly.
- tempname_ = support::FileName(tempname + ".tmp");
+ tempname_ = support::FileName(tempname.absFilename() + ".tmp");
}
break;
case EX_FILENAME: {
- lex.next();
+ lex.eatLine();
string const name = lex.getString();
filename.set(name, buffer.filePath());
break;
int InsetExternal::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
if (params_.draft) {
// FIXME UNICODE
// "nice" means that the buffer is exported to LaTeX format but not
// run through the LaTeX compiler.
// If we're running through the LaTeX compiler, we should write the
- // generated files in the bufer's temporary directory.
- bool const external_in_tmpdir = !runparams.nice && !runparams.dryrun;
+ // generated files in the buffer's temporary directory.
+ bool const external_in_tmpdir = !runparams.nice;
+ bool const dryrun = runparams.dryrun || runparams.inComment;
// If the template has specified a PDFLaTeX output, then we try and
// use that.
buf, os,
*(runparams.exportdata),
external_in_tmpdir,
- runparams.inComment);
+ dryrun);
}
-
}
-
+
return external::writeExternal(params_, "LaTeX", buf, os,
*(runparams.exportdata),
external_in_tmpdir,
- runparams.inComment);
+ dryrun);
}
int InsetExternal::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- return external::writeExternal(params_, "Ascii", buf, os,
- *(runparams.exportdata), false,
- runparams.inComment);
+ os << '\n'; // output external material on a new line
+ external::writeExternal(params_, "Ascii", buf, os,
+ *(runparams.exportdata), false,
+ runparams.dryrun || runparams.inComment);
+ return PLAINTEXT_NEWLINE;
}
int InsetExternal::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
return external::writeExternal(params_, "DocBook", buf, os,
*(runparams.exportdata), false,
- runparams.inComment);
+ runparams.dryrun || runparams.inComment);
}
for (; it != end; ++it) {
string const preamble = etm.getPreambleDefByName(*it);
if (!preamble.empty())
- features.addExternalPreamble(preamble);
+ features.addPreambleSnippet(preamble);
}
}
docstring const latex_string(InsetExternal const & inset, Buffer const & buffer)
{
odocstringstream os;
- OutputParams runparams;
+ // We don't need to set runparams.encoding since it is not used by
+ // latex().
+ OutputParams runparams(0);
runparams.flavor = OutputParams::LATEX;
inset.latex(buffer, os, runparams);
return os.str();