commit ac61683d6c166d980536fabb04489323c8671a42
Author: Juergen Spitzmueller <[email protected]>
Date:   Fri Jul 25 10:43:39 2025 +0200

    Show BiBTeX bibliography in XHTML TOC if "Add to TOC" is set (part of 
#13189)
---
 src/insets/InsetTOC.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp
index 7cea902175..21587345ce 100644
--- a/src/insets/InsetTOC.cpp
+++ b/src/insets/InsetTOC.cpp
@@ -169,7 +169,9 @@ void InsetTOC::makeTOCWithDepth(XMLStream & xs,
                if (!tocitem.isOutput())
                        continue;
 
-               if (!tocitem.dit().paragraph().layout().htmlintoc())
+               bool const is_bibtex = tocitem.dit().nextInset()
+                               && tocitem.dit().nextInset()->lyxCode() == 
BIBTEX_CODE;
+               if (!tocitem.dit().paragraph().layout().htmlintoc() && 
!is_bibtex)
                        continue;
 
                // First, we need to manage increases and decreases of depth
@@ -211,7 +213,13 @@ void InsetTOC::makeTOCWithDepth(XMLStream & xs,
 
                // Now output TOC info for this entry
                Paragraph const & par = tocitem.dit().innerParagraph();
-               makeTOCEntry(xs, par, op);
+               if (is_bibtex) {
+                       string const attr = "href='#" + par.magicLabel() + "' 
class='tocentry'";
+                       xs << xml::StartTag("a", attr)
+                          <<  tocitem.str()
+                          << xml::EndTag("a") << xml::CR();
+               } else
+                       makeTOCEntry(xs, par, op);
        }
        for (int i = lastdepth; i > 0; --i)
                xs << xml::EndTag("div") << xml::CR();
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to