]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
Fix crash after undo following replacement of a multicell selection (#8973).
[lyx.git] / src / insets / InsetTOC.cpp
index 6e0a3c0e64d276b2b665a5c202c720fc47ce6587..fc1f42bcae86ab8c3cb0d41e136d1e62bea65b48 100644 (file)
@@ -144,16 +144,7 @@ void InsetTOC::makeTOCEntry(XHTMLStream & xs,
        Font const dummy;
        par.simpleLyXHTMLOnePar(buffer(), xs, ours, dummy);
 
-       xs << html::EndTag("a") << " ";
-
-       // Now a link to the paragraph
-       string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'";
-       xs << html::StartTag("a", parattr);
-       // FIXME XHTML 
-       // There ought to be a simple way to customize this.
-       // Maybe if we had an InsetLayout for TOC...
-       xs << XHTMLStream::ESCAPE_NONE << "&gt;";
-       xs << html::EndTag("a");                
+       xs << html::EndTag("a") << html::CR();
 }
 
 
@@ -241,11 +232,10 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
        string const & command = getCmdName();
        if (command != "tableofcontents" && command != "lstlistoflistings") {
                LYXERR0("TOC type " << command << " not yet implemented.");
-               LASSERT(false, /* */);
-               return docstring();
+               LASSERT(false, return docstring());
        }
 
-       Toc const & toc = buffer().tocBackend().toc(cmd2type(command));
+       Toc const & toc = buffer().masterBuffer()->tocBackend().toc(cmd2type(command));
        if (toc.empty())
                return docstring();
 
@@ -258,13 +248,15 @@ docstring InsetTOC::xhtml(XHTMLStream &, OutputParams const & op) const
        xs << html::StartTag("div", "class='toc'");
 
        // Title of TOC
+       InsetLayout const & il = getLayout();
+       string const & tag = il.htmltag();
        docstring title = screenLabel();
        Layout const & lay = buffer().params().documentClass().htmlTOCLayout();
        string const & tocclass = lay.defaultCSSClass();
        string const tocattr = "class='tochead " + tocclass + "'";
-       xs << html::StartTag("div", tocattr)
+       xs << html::StartTag(tag, tocattr)
                 << title
-                << html::EndTag("div");
+                << html::EndTag(tag);
 
        // with lists of listings, at least, there is no depth
        // to worry about. so the code can be simpler.