}
if (new_label != old_label) {
- label_->updateCommand(new_label);
+ label_->updateLabelAndRefs(new_label, &cur);
// the label might have been adapted (duplicate)
if (new_label != label_->getParam("name")) {
new_params.addParam("label", "{" +
LYXERR(Debug::LATEX, "exportfile:" << exportfile);
LYXERR(Debug::LATEX, "writefile:" << writefile);
- string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
- "latex" : "pdflatex";
+ 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
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
-
+
Buffer * tmp = loadIfNeeded();
if (!tmp) {
docstring text = bformat(_("Could not load included "
tmp->markDepClean(masterBuffer->temppath());
// Don't assume the child's format is latex
- string const inc_format = tmp->bufferFormat();
+ string const inc_format = tmp->params().bufferFormat();
FileName const tmpwritefile(changeExtension(writefile.absFileName(),
formats.extension(inc_format)));
"was not exported correctly.\nWarning: "
"LaTeX export is probably incomplete."),
included_file.displayName());
- ErrorList & el = tmp->errorList("Export");
+ ErrorList const & el = tmp->errorList("Export");
if (!el.empty())
msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
msg, el.begin()->error,
runparams.encoding = oldEnc;
runparams.master_language = oldLang;
- // Use converters to produce a latex file from the child
- ErrorList el;
- bool const success =
- theConverters().convert(tmp, tmpwritefile, writefile, included_file,
- inc_format, tex_format, el);
-
- if (!success) {
- docstring msg = bformat(_("Included file `%1$s' "
- "was not exported correctly.\nWarning: "
- "LaTeX export is probably incomplete."),
- included_file.displayName());
- if (!el.empty())
- msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
- msg, el.begin()->error,
- el.begin()->description);
- Alert::warning(_("Export failure"), msg);
+ // If needed, use converters to produce a latex file from the child
+ if (tmpwritefile != writefile) {
+ ErrorList el;
+ bool const success =
+ theConverters().convert(tmp, tmpwritefile, writefile,
+ included_file,
+ inc_format, tex_format, el);
+
+ if (!success) {
+ docstring msg = bformat(_("Included file `%1$s' "
+ "was not exported correctly.\nWarning: "
+ "LaTeX export is probably incomplete."),
+ included_file.displayName());
+ if (!el.empty())
+ msg = bformat(from_ascii("%1$s\n\n%2$s\n\n%3$s"),
+ msg, el.begin()->error,
+ el.begin()->description);
+ Alert::warning(_("Export failure"), msg);
+ }
}
} else {
// In this case, it's not a LyX file, so we copy the file
}
-docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const &rp) const
+docstring InsetInclude::xhtml(XHTMLStream & xs, OutputParams const & rp) const
{
if (rp.inComment)
return docstring();
Buffer const * const ibuf = loadIfNeeded();
if (!ibuf)
return docstring();
- ibuf->writeLyXHTMLSource(xs.os(), rp, true);
+
+ // are we generating only some paragraphs, or all of them?
+ bool const all_pars = !rp.dryrun ||
+ (rp.par_begin == 0 &&
+ rp.par_end == (int)buffer().text().paragraphs().size());
+
+ OutputParams op = rp;
+ if (all_pars) {
+ op.par_begin = 0;
+ op.par_end = 0;
+ ibuf->writeLyXHTMLSource(xs.os(), op, true);
+ } else
+ xs << XHTMLStream::ESCAPE_NONE
+ << "<!-- Included file: "
+ << from_utf8(included_file.absFileName())
+ << XHTMLStream::ESCAPE_NONE
+ << " -->";
return docstring();
}
return;
docstring old_label = label_->getParam("name");
- label_->updateCommand(old_label, false);
+ label_->updateLabel(old_label);
// the label might have been adapted (duplicate)
docstring new_label = label_->getParam("name");
if (old_label == new_label)
setParams(p);
}
+
void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype)
{
Buffer const * const childbuffer = getChildBuffer();