[LyX/2.3.x] Assign InsetBibtex to appropriate toc level

Juergen Spitzmueller spitz at lyx.org
Sat May 16 06:40:58 UTC 2020


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

    Assign InsetBibtex to appropriate toc level
    
    Fixes #11863
    
    (cherry picked from commit 92ba05c53b572de0be27c66818a6e10ee6719280)
---
 src/insets/InsetBibtex.cpp |    9 ++++++---
 status.23x                 |    3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp
index e4c7f30..1107964 100644
--- a/src/insets/InsetBibtex.cpp
+++ b/src/insets/InsetBibtex.cpp
@@ -901,9 +901,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));
 }
 
 
diff --git a/status.23x b/status.23x
index 02def57..a34e52e 100644
--- a/status.23x
+++ b/status.23x
@@ -123,6 +123,9 @@ What's new
 
 - Fix disappearing selection with clipboard managers on X11 (bug 11715).
 
+- Correct hierarchy level of Bib(la)tex inset in outliner if "Show in Toc"
+  is selected (bug 11863).
+
 
 * INTERNALS
 


More information about the lyx-cvs mailing list