#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 "sgml.h"
#include "TexRow.h"
#include "texstream.h"
#include "TextClass.h"
#include "frontends/alert.h"
#include "frontends/Painter.h"
-#include "support/bind.h"
#include "support/convert.h"
#include "support/debug.h"
#include "support/gettext.h"
/////////////////////////////////////////////////////////////////////
InsetText::InsetText(Buffer * buf, UsePlain type)
- : Inset(buf), drawFrame_(false), is_changed_(false), frame_color_(Color_insetframe),
+ : Inset(buf), drawFrame_(false), is_changed_(false), intitle_context_(false),
+ frame_color_(Color_insetframe),
text_(this, type == DefaultLayout)
{
}
InsetText::InsetText(InsetText const & in)
: Inset(in), drawFrame_(in.drawFrame_), is_changed_(in.is_changed_),
- frame_color_(in.frame_color_),
+ intitle_context_(false), frame_color_(in.frame_color_),
text_(this, in.text_)
{
}
runparams.encoding = rp.encoding;
// Pass the post_macros upstream
runparams.post_macro = rp.post_macro;
+ // These need to be passed upstream as well
+ runparams.need_maketitle = rp.need_maketitle;
+ runparams.have_maketitle = rp.have_maketitle;
if (!il.rightdelim().empty())
os << il.rightdelim();
for (; it != end; ++it) {
if (it != beg) {
os << '\n';
- if (runparams.linelen > 0)
+ if (runparams.linelen > 0 && !getLayout().parbreakIsNewline())
os << '\n';
}
odocstringstream oss;
}
-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;
+ }
- if (!undefined())
- sgml::openTag(os, getLayout().latexname(),
- beg->getID(buffer(), runparams) + getLayout().latexparam());
+ 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);
+ }
- docbookParagraphs(text_, buffer(), os, runparams);
+ // No need for labels that are generated from counters.
- if (!undefined())
- sgml::closeTag(os, getLayout().latexname());
+ // With respect to XHTML, paragraphs are still allowed here.
+ if (!allowMultiPar())
+ runparams.docbook_make_pars = false;
+ if (il.isPassThru())
+ runparams.pass_thru = true;
+
+ xs.startDivision(false);
+ docbookParagraphs(text_, buffer(), xs, runparams);
+ xs.endDivision();
- return 0;
+ if (opts & WriteOuterTag)
+ xs << xml::EndTag(il.docbooktag());
}
-docstring InsetText::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
+docstring InsetText::xhtml(XMLStream & xs, OutputParams const & runparams) const
{
return insetAsXHTML(xs, runparams, WriteEverything);
}
// if so, try to close fonts, etc.
// There are probably limits to how well we can do here, though, and we will
// have to rely upon users not putting footnotes inside noun-type insets.
-docstring InsetText::insetAsXHTML(XHTMLStream & xs, OutputParams const & rp,
+docstring InsetText::insetAsXHTML(XMLStream & xs, OutputParams const & rp,
XHTMLOptions opts) const
{
// we will always want to output all our paragraphs when we are
InsetLayout const & il = getLayout();
if (opts & WriteOuterTag)
- xs << html::StartTag(il.htmltag(), il.htmlattr());
+ xs << xml::StartTag(il.htmltag(), il.htmlattr());
if ((opts & WriteLabel) && !il.counter().empty()) {
BufferParams const & bp = buffer().masterBuffer()->params();
cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
// FIXME is this check necessary?
if (!lbl.empty()) {
- xs << html::StartTag(il.htmllabeltag(), il.htmllabelattr());
+ xs << xml::StartTag(il.htmllabeltag(), il.htmllabelattr());
xs << lbl;
- xs << html::EndTag(il.htmllabeltag());
+ xs << xml::EndTag(il.htmllabeltag());
}
}
}
if (opts & WriteInnerTag)
- xs << html::StartTag(il.htmlinnertag(), il.htmlinnerattr());
+ xs << xml::StartTag(il.htmlinnertag(), il.htmlinnerattr());
// we will eventually lose information about the containing inset
if (!allowMultiPar() || opts == JustText)
xs.endDivision();
if (opts & WriteInnerTag)
- xs << html::EndTag(il.htmlinnertag());
+ xs << xml::EndTag(il.htmlinnertag());
if (opts & WriteOuterTag)
- xs << html::EndTag(il.htmltag());
+ xs << xml::EndTag(il.htmltag());
return docstring();
}
cnt.restoreLastLayout();
// FIXME cnt.restoreLastCounter()?
}
+ // 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;
} else {
DocumentClass const & tclass = buffer().masterBuffer()->params().documentClass();
// Note that we do not need to call: