#include "MetricsInfo.h"
#include "output_docbook.h"
#include "output_latex.h"
+#include "output_plaintext.h"
#include "output_xhtml.h"
#include "OutputParams.h"
-#include "output_plaintext.h"
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "Row.h"
-#include "xml.h"
#include "TexRow.h"
#include "texstream.h"
#include "TextClass.h"
#include "Text.h"
#include "TextMetrics.h"
#include "TocBackend.h"
+#include "TocBuilder.h"
#include "frontends/alert.h"
#include "frontends/Painter.h"
#include "support/RefChanger.h"
#include <algorithm>
+#include <stack>
using namespace std;
}
cur.top().setPitPos(pit, pos);
+ cur.setCurrentFont();
cur.finishUndo();
}
{
LYXERR(Debug::ACTION, "InsetText::doDispatch(): cmd: " << cmd);
+#if 0
// See bug #9042, for instance.
if (isPassThru()) {
// Force any new text to latex_language FIXME: This
cur.current_font.setLanguage(latex_language);
cur.real_current_font.setLanguage(latex_language);
}
+#endif
switch (cmd.action()) {
case LFUN_PASTE:
}
-int InsetText::docbook(odocstream & os, OutputParams const & runparams) const
+
+void InsetText::docbook(XMLStream & xs, OutputParams const & rp) const
+{
+ docbook(xs, rp, WriteEverything);
+}
+
+
+void InsetText::docbook(XMLStream & xs, OutputParams const & rp, XHTMLOptions opts) const
{
- ParagraphList::const_iterator const beg = paragraphs().begin();
+ // we will always want to output all our paragraphs when we are
+ // called this way.
+ OutputParams runparams = rp;
+ runparams.par_begin = 0;
+ runparams.par_end = text().paragraphs().size();
+
+ if (undefined()) {
+ xs.startDivision(false);
+ docbookParagraphs(text_, buffer(), xs, runparams);
+ xs.endDivision();
+ return;
+ }
+
+ InsetLayout const & il = getLayout();
+ if (opts & WriteOuterTag && !il.docbooktag().empty() && il.docbooktag() != "NONE") {
+ docstring attrs = docstring();
+ if (!il.docbookattr().empty())
+ attrs += from_ascii(il.docbookattr());
+ if (il.docbooktag() == "link")
+ attrs += from_ascii(" xlink:href=\"") + text_.asString() + from_ascii("\"");
+ xs << xml::StartTag(il.docbooktag(), attrs);
+ }
- if (!undefined())
- xml::openTag(os, getLayout().latexname(),
- beg->getID(buffer(), runparams) + getLayout().latexparam());
+ // No need for labels that are generated from counters.
- docbookParagraphs(text_, buffer(), os, runparams);
+ // With respect to XHTML, paragraphs are still allowed here.
+ if (!allowMultiPar())
+ runparams.docbook_make_pars = false;
+ if (il.isPassThru())
+ runparams.pass_thru = true;
- if (!undefined())
- xml::closeTag(os, getLayout().latexname());
+ xs.startDivision(false);
+ docbookParagraphs(text_, buffer(), xs, runparams);
+ xs.endDivision();
- return 0;
+ if (opts & WriteOuterTag)
+ xs << xml::EndTag(il.docbooktag());
}
// Record in this inset is embedded in a title layout
// This is needed to decide when \maketitle is output.
intitle_context_ = it.paragraph().layout().intitle;
+ // Also check embedding layouts
+ size_t const n = it.depth();
+ for (size_t i = 0; i < n; ++i) {
+ if (it[i].paragraph().layout().intitle) {
+ intitle_context_ = true;
+ break;
+ }
+ }
} else {
DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
// Note that we do not need to call:
{
Paragraph const & par = paragraphs()[pit];
TocBuilder & b = backend.builder(par.layout().tocType());
- docstring const label = par.labelString();
+ docstring const & label = par.labelString();
b.pushItem(dit, label + (label.empty() ? "" : " "), output_active);
return text().lastInSequence(pit);
}
}
-docstring InsetText::toolTipText(docstring prefix, size_t const len) const
+docstring InsetText::toolTipText(docstring const & prefix, size_t const len) const
{
OutputParams rp(&buffer().params().encoding());
rp.for_tooltip = true;