[LyX/master] Fix bug #11418.
Richard Kimberly Heck
rikiheck at lyx.org
Sun Dec 4 04:38:20 UTC 2022
commit 3eb3608138143249fe32edf9a55a766347ac87b0
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date: Sun Dec 4 00:33:14 2022 -0500
Fix bug #11418.
Add new HTMLInToc layout tag: When false, the thing will not be output
to the TOC. It's now set to false for starred sections.
---
lib/layouts/beamer.layout | 5 ++++-
lib/layouts/egs.layout | 4 +++-
lib/layouts/stdstarsections.inc | 9 ++++++++-
lib/scripts/layout2layout.py | 5 ++++-
src/Layout.cpp | 7 +++++++
src/Layout.h | 4 ++++
src/TextClass.cpp | 2 +-
src/insets/InsetTOC.cpp | 6 ++++++
8 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index d824522..209326f 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -6,7 +6,7 @@
# Richard Kimberly Heck <rikiheck at lyx.org>, Martin Vermeer <martin.vermeer at hut.fi> and probably others.
-Format 95
+Format 96
#
# GLOBAL SETTINGS
@@ -347,6 +347,7 @@ Style Section*
PassThru 1
EndArgument
LaTeXParam *
+ HTMLInToc 0
End
Style Subsection
@@ -409,6 +410,7 @@ Style Subsection*
PassThru 1
EndArgument
LaTeXParam *
+ HTMLInToc 0
End
Style Subsubsection
@@ -471,6 +473,7 @@ Style Subsubsection*
PassThru 1
EndArgument
LaTeXParam *
+ HTMLInToc 0
End
diff --git a/lib/layouts/egs.layout b/lib/layouts/egs.layout
index 29da661..ab2b942 100644
--- a/lib/layouts/egs.layout
+++ b/lib/layouts/egs.layout
@@ -9,7 +9,7 @@
# Converted article -> egs Martin Vermeer
-Format 95
+Format 96
Columns 2
Sides 1
PageStyle Plain
@@ -690,6 +690,7 @@ Style Section*
Series Bold
# Size Larger
EndFont
+ HTMLInToc 0
End
@@ -706,6 +707,7 @@ Style Subsection*
Align Block
AlignPossible Block, Left, Right, Center
LabelType No_Label
+ HTMLInToc 0
End
diff --git a/lib/layouts/stdstarsections.inc b/lib/layouts/stdstarsections.inc
index e1e09d4..fd13de7 100644
--- a/lib/layouts/stdstarsections.inc
+++ b/lib/layouts/stdstarsections.inc
@@ -9,7 +9,7 @@
# modifying the style of the regular sectioning layouts.
-Format 95
+Format 96
Style Part*
CopyStyle Part
Category Unnumbered
@@ -22,6 +22,7 @@ Style Part*
DocBookAttr "renderas='other' otherrenderas='part'"
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -37,6 +38,7 @@ Style Chapter*
DocBookAttr "renderas='other' otherrenderas='chapter'"
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -52,6 +54,7 @@ Style Section*
DocBookAttr renderas='sect1'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -67,6 +70,7 @@ Style Subsection*
DocBookAttr renderas='sect2'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -82,6 +86,7 @@ Style Subsubsection*
DocBookAttr renderas='sect3'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -97,6 +102,7 @@ Style Paragraph*
DocBookAttr renderas='sect4'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
@@ -112,4 +118,5 @@ Style Subparagraph*
DocBookAttr renderas='sect5'
DocBookSectionTag NONE
DocBookForceAbstractTag NONE
+ HTMLInToc 0
End
diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py
index c2fc7c2..f7fe837 100644
--- a/lib/scripts/layout2layout.py
+++ b/lib/scripts/layout2layout.py
@@ -11,7 +11,7 @@
# This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 95
+currentFormat = 96
# Incremented to format 4, 6 April 2007, lasgouttes
@@ -322,6 +322,9 @@ currentFormat = 95
# Incremented to format 95, 27 September 2021 by tcuvelier
# Add DocBookRenderAsImage
+# Incremented to format 96, 4 December 2022 by rikiheck
+# Add HTMLInToc
+
# Do not forget to document format change in Customization
# Manual (section "Declaring a new text class").
diff --git a/src/Layout.cpp b/src/Layout.cpp
index e5d683e..b94696f 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -142,6 +142,7 @@ enum LayoutTags {
LT_TOGGLE_INDENT,
LT_ADDTOTOC,
LT_ISTOCCAPTION,
+ LT_HTMLINTOC,
LT_INTITLE // keep this last!
};
@@ -187,6 +188,7 @@ Layout::Layout()
htmllabelfirst_ = false;
htmlforcecss_ = false;
htmltitle_ = false;
+ htmlintoc_ = true;
docbookabstract_ = false;
docbookwrappermergewithprevious_ = false;
docbooksection_ = false;
@@ -270,6 +272,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
{ "freespacing", LT_FREE_SPACING },
{ "htmlattr", LT_HTMLATTR },
{ "htmlforcecss", LT_HTMLFORCECSS },
+ { "htmlintoc", LT_HTMLINTOC },
{ "htmlitem", LT_HTMLITEM },
{ "htmlitemattr", LT_HTMLITEMATTR },
{ "htmllabel", LT_HTMLLABEL },
@@ -703,6 +706,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
break;
}
+ case LT_HTMLINTOC:
+ lex >> htmlintoc_;
+ break;
+
case LT_HTMLTAG:
lex >> htmltag_;
break;
diff --git a/src/Layout.h b/src/Layout.h
index 0588bc1..dd64bce 100644
--- a/src/Layout.h
+++ b/src/Layout.h
@@ -193,6 +193,8 @@ public:
///
std::string const & htmllabelattr() const;
///
+ bool htmlintoc() const { return htmlintoc_; }
+ ///
std::string defaultCSSClass() const;
///
bool htmllabelfirst() const { return htmllabelfirst_; }
@@ -516,6 +518,8 @@ private:
/// <item><label>...</label>...</item>
/// The latter is the default.
bool htmllabelfirst_;
+ /// Is this to be output with the toc?
+ bool htmlintoc_;
/// CSS information needed by this layout.
docstring htmlstyle_;
/// DocBook tag corresponding to this layout.
diff --git a/src/TextClass.cpp b/src/TextClass.cpp
index 3a131d9..b387ce1 100644
--- a/src/TextClass.cpp
+++ b/src/TextClass.cpp
@@ -59,7 +59,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files.
//
-int const LAYOUT_FORMAT = 95; // tcuvelier: DocBookRenderAsImage
+int const LAYOUT_FORMAT = 96; // rikiheck: HTMLInToc
// Layout format for the current lyx file format. Controls which format is
diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp
index 46b5b4f..0308392 100644
--- a/src/insets/InsetTOC.cpp
+++ b/src/insets/InsetTOC.cpp
@@ -165,6 +165,9 @@ void InsetTOC::makeTOCWithDepth(XMLStream & xs,
if (!tocitem.isOutput())
continue;
+ if (!tocitem.dit().paragraph().layout().htmlintoc())
+ continue;
+
// First, we need to manage increases and decreases of depth
// If there's no depth to deal with, we artificially set it to 1.
int const depth = tocitem.depth();
@@ -220,6 +223,9 @@ void InsetTOC::makeTOCNoDepth(XMLStream & xs,
if (!tocitem.isOutput())
continue;
+ if (!tocitem.dit().paragraph().layout().htmlintoc())
+ continue;
+
xs << xml::StartTag("div", "class='lyxtoc-flat'") << xml::CR();
Paragraph const & par = tocitem.dit().innerParagraph();
More information about the lyx-cvs
mailing list