[LyX/master] Assign InsetBibtex to appropriate toc level

Juergen Spitzmueller spitz at lyx.org
Fri May 15 07:53:33 UTC 2020


commit 92ba05c53b572de0be27c66818a6e10ee6719280
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri May 15 10:14:22 2020 +0200

    Assign InsetBibtex to appropriate toc level
    
    Fixes #11863
---
 src/insets/InsetBibtex.cpp |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index bf70c44..15953e1 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -961,9 +961,12 @@ void InsetBibtex::addToToc(DocIterator const & cpit, bool output_active,
 		return;
 
 	docstring const str = getRefLabel();
-	TocBuilder & b = backend.builder("tableofcontents");
-	b.pushItem(cpit, str, output_active);
-	b.pop();
+	shared_ptr<Toc> toc = backend.toc("tableofcontents");
+	// Assign to appropriate level
+	int const item_depth =
+		(buffer().masterParams().documentClass().hasLaTeXLayout("chapter")) 
+			? 1 : 2;
+	toc->push_back(TocItem(cpit, item_depth, str, output_active));
 }
 
 


More information about the lyx-cvs mailing list