char_type c = d->text_[i];
if (c == ' ')
break;
- xs << html::escapeChar(c);
+ xs << c;
}
}
return i;
XHTMLStream & xs,
OutputParams const & runparams,
Font const & outerfont,
+ bool fortoc,
pos_type initial) const
{
docstring retval;
std::string closing_tag;
Layout const & style = *d->layout_;
+
+ if (!fortoc) {
+ // generate a magic label for this paragraph
+ string const attr = "id='" + magicLabel() + "'";
+ xs << CompTag("a", attr);
+ }
+
FontInfo font_old =
style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
Inset const * inset = getInset(i);
if (inset) {
+ InsetCommand const * ic = inset->asInsetCommand();
InsetLayout const & il = inset->getLayout();
- OutputParams np = runparams;
- if (!il.htmlisblock())
- np.html_in_par = true;
- retval += inset->xhtml(xs, np);
+ if (!fortoc || il.isInToc() || (ic && ic->isInToc())) {
+ OutputParams np = runparams;
+ if (!il.htmlisblock())
+ np.html_in_par = true;
+ retval += inset->xhtml(xs, np);
+ }
} else {
char_type c = d->text_[i];
}
+string Paragraph::magicLabel() const
+{
+ stringstream ss;
+ ss << "magicparlabel-" << id();
+ return ss.str();
+}
+
+
} // namespace lyx