2 * \file InsetInclude.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Richard Heck (conversion to InsetCommand)
8 * \author Bo Peng (embedding stuff)
10 * Full author contact details are available in file CREDITS.
15 #include "InsetInclude.h"
17 #include "LayoutFile.h"
19 #include "buffer_funcs.h"
20 #include "BufferList.h"
21 #include "BufferParams.h"
22 #include "BufferView.h"
24 #include "DispatchResult.h"
25 #include "ErrorList.h"
27 #include "FuncRequest.h"
28 #include "FuncStatus.h"
29 #include "LaTeXFeatures.h"
33 #include "MetricsInfo.h"
34 #include "OutputParams.h"
35 #include "TextClass.h"
36 #include "TocBackend.h"
38 #include "frontends/alert.h"
39 #include "frontends/Painter.h"
41 #include "graphics/PreviewImage.h"
42 #include "graphics/PreviewLoader.h"
44 #include "insets/InsetLabel.h"
45 #include "insets/InsetListingsParams.h"
46 #include "insets/RenderPreview.h"
48 #include "support/debug.h"
49 #include "support/docstream.h"
50 #include "support/FileNameList.h"
51 #include "support/filetools.h"
52 #include "support/gettext.h"
53 #include "support/lstrings.h" // contains
54 #include "support/lyxalgo.h"
55 #include "support/convert.h"
57 #include <boost/bind.hpp>
60 using namespace lyx::support;
64 namespace Alert = frontend::Alert;
69 docstring const uniqueID()
71 static unsigned int seed = 1000;
72 return "file" + convert<docstring>(++seed);
76 /// the type of inclusion
78 INCLUDE, VERB, INPUT, VERBAST, LISTINGS, NONE
82 Types type(string const & s)
86 if (s == "verbatiminput")
88 if (s == "verbatiminput*")
90 if (s == "lstinputlisting")
98 Types type(InsetCommandParams const & params)
100 return type(params.getCmdName());
104 bool isListings(InsetCommandParams const & params)
106 return type(params) == LISTINGS;
110 bool isVerbatim(InsetCommandParams const & params)
112 Types const t = type(params);
113 return t == VERB || t == VERBAST;
117 bool isInputOrInclude(InsetCommandParams const & params)
119 Types const t = type(params);
120 return t == INPUT || t == INCLUDE;
124 FileName const masterFileName(Buffer const & buffer)
126 return buffer.masterBuffer()->fileName();
130 void add_preview(RenderMonitoredPreview &, InsetInclude const &, Buffer const &);
133 string const parentFilename(Buffer const & buffer)
135 return buffer.absFileName();
139 EmbeddedFile const includedFilename(Buffer const & buffer,
140 InsetCommandParams const & params)
142 // it is not a good idea to create this EmbeddedFile object
143 // each time, but there seems to be no easy way around.
144 EmbeddedFile file(to_utf8(params["filename"]),
145 onlyPath(parentFilename(buffer)));
146 file.setEmbed(!params["embed"].empty());
147 file.setInzipName(to_utf8(params["embed"]));
148 file.enable(buffer.embedded(), &buffer, false);
152 InsetLabel * createLabel(docstring const & label_str)
154 if (label_str.empty())
156 InsetCommandParams icp(LABEL_CODE);
157 icp["name"] = label_str;
158 return new InsetLabel(icp);
164 InsetInclude::InsetInclude(InsetCommandParams const & p)
165 : InsetCommand(p, "include"), include_label(uniqueID()),
166 preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
168 preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
170 if (isListings(params())) {
171 InsetListingsParams listing_params(to_utf8(p["lstparams"]));
172 label_ = createLabel(from_utf8(listing_params.getParamValue("label")));
177 InsetInclude::InsetInclude(InsetInclude const & other)
178 : InsetCommand(other), include_label(other.include_label),
179 preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
181 preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
184 label_ = new InsetLabel(*other.label_);
188 InsetInclude::~InsetInclude()
191 if (isVerbatim(params()) || isListings(params()))
195 string const parent_filename = buffer().absFileName();
196 FileName const included_file = makeAbsPath(to_utf8(params()["filename"]),
197 onlyPath(parent_filename));
199 if (!isLyXFilename(included_file.absFilename()))
202 Buffer * child = theBufferList().getBuffer(included_file.absFilename());
203 // File not opened, nothing to close.
207 // Child document has a different parent, don't close it.
208 if (child->parent() != &buffer())
212 theBufferList().release(child);
216 void InsetInclude::setBuffer(Buffer & buffer)
219 EmbeddedFile file_from = includedFilename(*buffer_, params());
220 EmbeddedFile file_to = file_from.copyTo(&buffer);
221 if (file_to.embedded())
222 setParam("embed", from_utf8(file_to.inzipName()));
226 label_->setBuffer(buffer);
231 ParamInfo const & InsetInclude::findInfo(string const & /* cmdName */)
234 // This is only correct for the case of listings, but it'll do for now.
235 // In the other cases, this second parameter should just be empty.
236 static ParamInfo param_info_;
237 if (param_info_.empty()) {
238 param_info_.add("filename", ParamInfo::LATEX_REQUIRED);
239 param_info_.add("lstparams", ParamInfo::LATEX_OPTIONAL);
240 param_info_.add("embed", ParamInfo::LYX_INTERNAL);
246 bool InsetInclude::isCompatibleCommand(string const & s)
248 return type(s) != NONE;
252 void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
254 BOOST_ASSERT(&cur.buffer() == &buffer());
255 switch (cmd.action) {
257 case LFUN_INSET_MODIFY: {
258 InsetCommandParams p(INCLUDE_CODE);
259 InsetCommandMailer::string2params("include", to_utf8(cmd.argument()), p);
260 if (!p.getCmdName().empty()) {
262 InsetListingsParams new_params(to_utf8(p["lstparams"]));
263 docstring const label_str = from_utf8(new_params.getParamValue("label"));
264 if (label_str.empty())
267 label_->updateCommand(label_str);
269 label_ = createLabel(label_str);
270 label_->setBuffer(buffer());
275 buffer().updateBibfilesCache();
281 //pass everything else up the chain
283 InsetCommand::doDispatch(cur, cmd);
289 void InsetInclude::setParams(InsetCommandParams const & p)
291 InsetCommand::setParams(p);
294 if (preview_->monitoring())
295 preview_->stopMonitoring();
297 if (type(params()) == INPUT)
298 add_preview(*preview_, *this, buffer());
302 docstring InsetInclude::screenLabel() const
306 switch (type(params())) {
308 temp = buffer().B_("Input");
311 temp = buffer().B_("Verbatim Input");
314 temp = buffer().B_("Verbatim Input*");
317 temp = buffer().B_("Include");
320 temp = listings_label_;
328 if (params()["filename"].empty())
331 temp += from_utf8(onlyFilename(to_utf8(params()["filename"])));
333 if (!params()["embed"].empty())
334 temp += _(" (embedded)");
339 /// return the child buffer if the file is a LyX doc and is loaded
340 Buffer * getChildBuffer(Buffer const & buffer, InsetCommandParams const & params)
342 if (isVerbatim(params) || isListings(params))
345 string const included_file = includedFilename(buffer, params).absFilename();
346 if (!isLyXFilename(included_file))
349 Buffer * childBuffer = loadIfNeeded(buffer, params);
351 // FIXME: recursive includes
352 return (childBuffer == &buffer) ? 0 : childBuffer;
356 /// return true if the file is or got loaded.
357 Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params)
359 if (isVerbatim(params) || isListings(params))
362 string const parent_filename = parent.absFileName();
363 FileName const included_file = makeAbsPath(to_utf8(params["filename"]),
364 onlyPath(parent_filename));
366 if (!isLyXFilename(included_file.absFilename()))
369 Buffer * child = theBufferList().getBuffer(included_file.absFilename());
371 // the readonly flag can/will be wrong, not anymore I think.
372 if (!included_file.exists())
375 child = theBufferList().newBuffer(included_file.absFilename());
377 // Buffer creation is not possible.
380 if (!child->loadLyXFile(included_file)) {
381 //close the buffer we just opened
382 theBufferList().release(child);
386 if (!child->errorList("Parse").empty()) {
387 // FIXME: Do something.
390 child->setParent(&parent);
395 int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
397 string incfile = to_utf8(params()["filename"]);
399 // Do nothing if no file name has been specified
403 FileName const included_file =
404 includedFilename(buffer(), params()).availableFile();
406 // Check we're not trying to include ourselves.
407 // FIXME RECURSIVE INCLUDE
408 // This isn't sufficient, as the inclusion could be downstream.
409 // But it'll have to do for now.
410 if (isInputOrInclude(params()) &&
411 buffer().absFileName() == included_file.absFilename())
413 Alert::error(_("Recursive input"),
414 bformat(_("Attempted to include file %1$s in itself! "
415 "Ignoring inclusion."), from_utf8(incfile)));
419 Buffer const * const masterBuffer = buffer().masterBuffer();
421 // if incfile is relative, make it relative to the master
423 if (!FileName(incfile).isAbsolute()) {
425 incfile = to_utf8(makeRelPath(from_utf8(included_file.absFilename()),
426 from_utf8(masterBuffer->filePath())));
429 // write it to a file (so far the complete file)
430 string const exportfile = changeExtension(incfile, ".tex");
431 string const mangled =
432 DocFileName(changeExtension(included_file.absFilename(),".tex")).
434 FileName const writefile(makeAbsPath(mangled, masterBuffer->temppath()));
438 else if (!isValidLaTeXFilename(incfile)) {
439 frontend::Alert::warning(_("Invalid filename"),
440 _("The following filename is likely to cause trouble "
441 "when running the exported file through LaTeX: ") +
444 LYXERR(Debug::LATEX, "incfile:" << incfile);
445 LYXERR(Debug::LATEX, "exportfile:" << exportfile);
446 LYXERR(Debug::LATEX, "writefile:" << writefile);
448 if (runparams.inComment || runparams.dryrun) {
449 //Don't try to load or copy the file if we're
450 //in a comment or doing a dryrun
451 } else if (isInputOrInclude(params()) &&
452 isLyXFilename(included_file.absFilename())) {
453 //if it's a LyX file and we're inputting or including,
454 //try to load it so we can write the associated latex
455 if (!loadIfNeeded(buffer(), params()))
458 Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
460 if (tmp->params().baseClass() != masterBuffer->params().baseClass()) {
462 docstring text = bformat(_("Included file `%1$s'\n"
463 "has textclass `%2$s'\n"
464 "while parent file has textclass `%3$s'."),
465 included_file.displayName(),
466 from_utf8(tmp->params().documentClass().name()),
467 from_utf8(masterBuffer->params().documentClass().name()));
468 Alert::warning(_("Different textclasses"), text);
471 // Make sure modules used in child are all included in master
472 //FIXME It might be worth loading the children's modules into the master
473 //over in BufferParams rather than doing this check.
474 vector<string> const masterModules = masterBuffer->params().getModules();
475 vector<string> const childModules = tmp->params().getModules();
476 vector<string>::const_iterator it = childModules.begin();
477 vector<string>::const_iterator end = childModules.end();
478 for (; it != end; ++it) {
479 string const module = *it;
480 vector<string>::const_iterator found =
481 find(masterModules.begin(), masterModules.end(), module);
482 if (found != masterModules.end()) {
483 docstring text = bformat(_("Included file `%1$s'\n"
484 "uses module `%2$s'\n"
485 "which is not used in parent file."),
486 included_file.displayName(), from_utf8(module));
487 Alert::warning(_("Module not found"), text);
491 tmp->markDepClean(masterBuffer->temppath());
493 // FIXME: handle non existing files
494 // FIXME: Second argument is irrelevant!
495 // since only_body is true, makeLaTeXFile will not look at second
496 // argument. Should we set it to string(), or should makeLaTeXFile
497 // make use of it somehow? (JMarc 20031002)
498 // The included file might be written in a different encoding
499 Encoding const * const oldEnc = runparams.encoding;
500 runparams.encoding = &tmp->params().encoding();
501 tmp->makeLaTeXFile(writefile,
502 masterFileName(buffer()).onlyPath().absFilename(),
504 runparams.encoding = oldEnc;
506 // In this case, it's not a LyX file, so we copy the file
507 // to the temp dir, so that .aux files etc. are not created
508 // in the original dir. Files included by this file will be
509 // found via input@path, see ../Buffer.cpp.
510 unsigned long const checksum_in = included_file.checksum();
511 unsigned long const checksum_out = writefile.checksum();
513 if (checksum_in != checksum_out) {
514 if (!included_file.copyTo(writefile)) {
517 to_utf8(bformat(_("Could not copy the file\n%1$s\n"
518 "into the temporary directory."),
519 from_utf8(included_file.absFilename()))));
525 string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
526 "latex" : "pdflatex";
527 if (isVerbatim(params())) {
528 incfile = latex_path(incfile);
530 os << '\\' << from_ascii(params().getCmdName()) << '{'
531 << from_utf8(incfile) << '}';
532 } else if (type(params()) == INPUT) {
533 runparams.exportdata->addExternalFile(tex_format, writefile,
536 // \input wants file with extension (default is .tex)
537 if (!isLyXFilename(included_file.absFilename())) {
538 incfile = latex_path(incfile);
540 os << '\\' << from_ascii(params().getCmdName())
541 << '{' << from_utf8(incfile) << '}';
543 incfile = changeExtension(incfile, ".tex");
544 incfile = latex_path(incfile);
546 os << '\\' << from_ascii(params().getCmdName())
547 << '{' << from_utf8(incfile) << '}';
549 } else if (type(params()) == LISTINGS) {
550 os << '\\' << from_ascii(params().getCmdName());
551 string const opt = to_utf8(params()["lstparams"]);
552 // opt is set in QInclude dialog and should have passed validation.
553 InsetListingsParams params(opt);
554 if (!params.params().empty())
555 os << "[" << from_utf8(params.params()) << "]";
556 os << '{' << from_utf8(incfile) << '}';
558 runparams.exportdata->addExternalFile(tex_format, writefile,
561 // \include don't want extension and demands that the
562 // file really have .tex
563 incfile = changeExtension(incfile, string());
564 incfile = latex_path(incfile);
566 os << '\\' << from_ascii(params().getCmdName()) << '{'
567 << from_utf8(incfile) << '}';
574 int InsetInclude::plaintext(odocstream & os, OutputParams const &) const
576 if (isVerbatim(params()) || isListings(params())) {
577 os << '[' << screenLabel() << '\n';
578 // FIXME: We don't know the encoding of the file, default to UTF-8.
579 os << includedFilename(buffer(), params()).fileContents("UTF-8");
581 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
583 docstring const str = '[' + screenLabel() + ']';
590 int InsetInclude::docbook(odocstream & os, OutputParams const & runparams) const
592 string incfile = to_utf8(params()["filename"]);
594 // Do nothing if no file name has been specified
598 string const included_file = includedFilename(buffer(), params()).absFilename();
600 // Check we're not trying to include ourselves.
601 // FIXME RECURSIVE INCLUDE
602 // This isn't sufficient, as the inclusion could be downstream.
603 // But it'll have to do for now.
604 if (buffer().absFileName() == included_file) {
605 Alert::error(_("Recursive input"),
606 bformat(_("Attempted to include file %1$s in itself! "
607 "Ignoring inclusion."), from_utf8(incfile)));
611 // write it to a file (so far the complete file)
612 string const exportfile = changeExtension(incfile, ".sgml");
613 DocFileName writefile(changeExtension(included_file, ".sgml"));
615 if (loadIfNeeded(buffer(), params())) {
616 Buffer * tmp = theBufferList().getBuffer(included_file);
618 string const mangled = writefile.mangledFilename();
619 writefile = makeAbsPath(mangled,
620 buffer().masterBuffer()->temppath());
624 LYXERR(Debug::LATEX, "incfile:" << incfile);
625 LYXERR(Debug::LATEX, "exportfile:" << exportfile);
626 LYXERR(Debug::LATEX, "writefile:" << writefile);
628 tmp->makeDocBookFile(writefile, runparams, true);
631 runparams.exportdata->addExternalFile("docbook", writefile,
633 runparams.exportdata->addExternalFile("docbook-xml", writefile,
636 if (isVerbatim(params()) || isListings(params())) {
637 os << "<inlinegraphic fileref=\""
638 << '&' << include_label << ';'
639 << "\" format=\"linespecific\">";
641 os << '&' << include_label << ';';
647 void InsetInclude::validate(LaTeXFeatures & features) const
649 string incfile = to_utf8(params()["filename"]);
652 BOOST_ASSERT(&buffer() == &features.buffer());
654 string const included_file =
655 includedFilename(buffer(), params()).availableFile().absFilename();
657 if (isLyXFilename(included_file))
658 writefile = changeExtension(included_file, ".sgml");
660 writefile = included_file;
662 if (!features.runparams().nice && !isVerbatim(params()) && !isListings(params())) {
663 incfile = DocFileName(writefile).mangledFilename();
664 writefile = makeAbsPath(incfile,
665 buffer().masterBuffer()->temppath()).absFilename();
668 features.includeFile(include_label, writefile);
670 if (isVerbatim(params()))
671 features.require("verbatim");
672 else if (isListings(params()))
673 features.require("listings");
675 // Here we must do the fun stuff...
676 // Load the file in the include if it needs
678 if (loadIfNeeded(buffer(), params())) {
680 Buffer * const tmp = theBufferList().getBuffer(included_file);
681 // make sure the buffer isn't us
682 // FIXME RECURSIVE INCLUDES
683 // This is not sufficient, as recursive includes could be
684 // more than a file away. But it will do for now.
685 if (tmp && tmp != &buffer()) {
686 // We must temporarily change features.buffer,
687 // otherwise it would always be the master buffer,
688 // and nested includes would not work.
689 features.setBuffer(*tmp);
690 tmp->validate(features);
691 features.setBuffer(buffer());
697 void InsetInclude::fillWithBibKeys(BiblioInfo & keys,
698 InsetIterator const & /*di*/) const
700 if (loadIfNeeded(buffer(), params())) {
701 string const included_file = includedFilename(buffer(), params()).absFilename();
702 Buffer * tmp = theBufferList().getBuffer(included_file);
703 //FIXME This is kind of a dirty hack and should be made reasonable.
705 keys.fillWithBibKeys(tmp);
706 tmp->setParent(&buffer());
711 void InsetInclude::updateBibfilesCache()
713 Buffer * const tmp = getChildBuffer(buffer(), params());
716 tmp->updateBibfilesCache();
717 tmp->setParent(&buffer());
722 EmbeddedFileList const &
723 InsetInclude::getBibfilesCache(Buffer const & buffer) const
725 Buffer * const tmp = getChildBuffer(buffer, params());
728 EmbeddedFileList const & cache = tmp->getBibfilesCache();
729 tmp->setParent(&buffer);
732 static EmbeddedFileList const empty;
737 void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
739 BOOST_ASSERT(mi.base.bv);
741 bool use_preview = false;
742 if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
743 graphics::PreviewImage const * pimage =
744 preview_->getPreviewImage(mi.base.bv->buffer());
745 use_preview = pimage && pimage->image();
749 preview_->metrics(mi, dim);
753 button_.update(screenLabel(), true);
755 button_.metrics(mi, dim);
758 Box b(0, dim.wid, -dim.asc, dim.des);
763 void InsetInclude::draw(PainterInfo & pi, int x, int y) const
765 BOOST_ASSERT(pi.base.bv);
767 bool use_preview = false;
768 if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
769 graphics::PreviewImage const * pimage =
770 preview_->getPreviewImage(pi.base.bv->buffer());
771 use_preview = pimage && pimage->image();
775 preview_->draw(pi, x, y);
777 button_.draw(pi, x, y);
781 Inset::DisplayType InsetInclude::display() const
783 return type(params()) == INPUT ? Inline : AlignCenter;
792 void InsetInclude::fileChanged() const
794 Buffer const * const buffer = updateFrontend();
798 preview_->removePreview(*buffer);
799 add_preview(*preview_.get(), *this, *buffer);
800 preview_->startLoading(*buffer);
806 bool preview_wanted(InsetCommandParams const & params, Buffer const & buffer)
808 FileName const included_file = includedFilename(buffer, params);
810 return type(params) == INPUT && params.preview() &&
811 included_file.isReadableFile();
815 docstring latexString(InsetInclude const & inset)
818 // We don't need to set runparams.encoding since this will be done
819 // by latex() anyway.
820 OutputParams runparams(0);
821 runparams.flavor = OutputParams::LATEX;
822 inset.latex(os, runparams);
828 void add_preview(RenderMonitoredPreview & renderer, InsetInclude const & inset,
829 Buffer const & buffer)
831 InsetCommandParams const & params = inset.params();
832 if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
833 preview_wanted(params, buffer)) {
834 renderer.setAbsFile(includedFilename(buffer, params));
835 docstring const snippet = latexString(inset);
836 renderer.addPreview(snippet, buffer);
843 void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const
845 Buffer const & buffer = ploader.buffer();
846 if (!preview_wanted(params(), buffer))
848 preview_->setAbsFile(includedFilename(buffer, params()));
849 docstring const snippet = latexString(*this);
850 preview_->addPreview(snippet, ploader);
854 void InsetInclude::addToToc(ParConstIterator const & cpit) const
856 bool const embedded_status = !params()["embed"].empty();
857 TocBackend & backend = buffer().tocBackend();
859 if (isListings(params())) {
861 label_->addToToc(cpit);
863 InsetListingsParams p(to_utf8(params()["lstparams"]));
864 string caption = p.getParamValue("caption");
867 Toc & toc = backend.toc("listing");
868 docstring str = convert<docstring>(toc.size() + 1)
869 + ". " + from_utf8(caption);
870 if (embedded_status) {
871 backend.toc("embedded").push_back(TocItem(cpit, 0, str));
872 str += _(" (embedded)");
874 ParConstIterator pit = cpit;
875 pit.push_back(*this);
876 toc.push_back(TocItem(pit, 0, str));
879 Buffer const * const childbuffer = getChildBuffer(buffer(), params());
882 // Add it to the embedded list nonetheless.
883 backend.toc("embedded").push_back(TocItem(cpit, 0,
884 params()["filename"]));
888 Toc & toc = backend.toc("child");
889 docstring str = childbuffer->fileName().displayName();
890 if (embedded_status) {
891 backend.toc("embedded").push_back(TocItem(cpit, 0, str));
892 str += _(" (embedded)");
894 toc.push_back(TocItem(cpit, 0, str));
896 TocList & toclist = backend.tocs();
897 TocList const & childtoclist = childbuffer->tocBackend().tocs();
898 TocList::const_iterator it = childtoclist.begin();
899 TocList::const_iterator const end = childtoclist.end();
900 for(; it != end; ++it)
901 toclist[it->first].insert(toclist[it->first].end(),
902 it->second.begin(), it->second.end());
906 void InsetInclude::updateLabels(ParIterator const & it)
908 Buffer const * const childbuffer = getChildBuffer(buffer(), params());
910 lyx::updateLabels(*childbuffer, true);
913 if (!isListings(params()))
917 label_->updateLabels(it);
919 InsetListingsParams const par(to_utf8(params()["lstparams"]));
920 if (par.getParamValue("caption").empty()) {
921 listings_label_.clear();
924 Counters & counters = buffer().params().documentClass().counters();
925 docstring const cnt = from_ascii("listing");
926 listings_label_ = buffer().B_("Program Listing");
927 if (counters.hasCounter(cnt)) {
929 listings_label_ += " " + convert<docstring>(counters.value(cnt));
934 void InsetInclude::registerEmbeddedFiles(EmbeddedFileList & files) const
936 files.registerFile(includedFilename(buffer(), params()), this, buffer());
940 void InsetInclude::updateEmbeddedFile(EmbeddedFile const & file)
942 InsetCommandParams p = params();
943 p["filename"] = from_utf8(file.outputFilename());
944 p["embed"] = file.embedded() ? from_utf8(file.inzipName()) : docstring();