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.
This commit is contained in:
Richard Kimberly Heck 2022-12-04 00:33:14 -05:00
parent eb949f1d05
commit 3eb3608138
8 changed files with 37 additions and 5 deletions

View File

@ -6,7 +6,7 @@
# Richard Kimberly Heck <rikiheck@lyx.org>, Martin Vermeer <martin.vermeer@hut.fi> and probably others. # Richard Kimberly Heck <rikiheck@lyx.org>, Martin Vermeer <martin.vermeer@hut.fi> and probably others.
Format 95 Format 96
# #
# GLOBAL SETTINGS # GLOBAL SETTINGS
@ -347,6 +347,7 @@ Style Section*
PassThru 1 PassThru 1
EndArgument EndArgument
LaTeXParam * LaTeXParam *
HTMLInToc 0
End End
Style Subsection Style Subsection
@ -409,6 +410,7 @@ Style Subsection*
PassThru 1 PassThru 1
EndArgument EndArgument
LaTeXParam * LaTeXParam *
HTMLInToc 0
End End
Style Subsubsection Style Subsubsection
@ -471,6 +473,7 @@ Style Subsubsection*
PassThru 1 PassThru 1
EndArgument EndArgument
LaTeXParam * LaTeXParam *
HTMLInToc 0
End End

View File

@ -9,7 +9,7 @@
# Converted article -> egs Martin Vermeer # Converted article -> egs Martin Vermeer
Format 95 Format 96
Columns 2 Columns 2
Sides 1 Sides 1
PageStyle Plain PageStyle Plain
@ -690,6 +690,7 @@ Style Section*
Series Bold Series Bold
# Size Larger # Size Larger
EndFont EndFont
HTMLInToc 0
End End
@ -706,6 +707,7 @@ Style Subsection*
Align Block Align Block
AlignPossible Block, Left, Right, Center AlignPossible Block, Left, Right, Center
LabelType No_Label LabelType No_Label
HTMLInToc 0
End End

View File

@ -9,7 +9,7 @@
# modifying the style of the regular sectioning layouts. # modifying the style of the regular sectioning layouts.
Format 95 Format 96
Style Part* Style Part*
CopyStyle Part CopyStyle Part
Category Unnumbered Category Unnumbered
@ -22,6 +22,7 @@ Style Part*
DocBookAttr "renderas='other' otherrenderas='part'" DocBookAttr "renderas='other' otherrenderas='part'"
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -37,6 +38,7 @@ Style Chapter*
DocBookAttr "renderas='other' otherrenderas='chapter'" DocBookAttr "renderas='other' otherrenderas='chapter'"
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -52,6 +54,7 @@ Style Section*
DocBookAttr renderas='sect1' DocBookAttr renderas='sect1'
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -67,6 +70,7 @@ Style Subsection*
DocBookAttr renderas='sect2' DocBookAttr renderas='sect2'
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -82,6 +86,7 @@ Style Subsubsection*
DocBookAttr renderas='sect3' DocBookAttr renderas='sect3'
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -97,6 +102,7 @@ Style Paragraph*
DocBookAttr renderas='sect4' DocBookAttr renderas='sect4'
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End
@ -112,4 +118,5 @@ Style Subparagraph*
DocBookAttr renderas='sect5' DocBookAttr renderas='sect5'
DocBookSectionTag NONE DocBookSectionTag NONE
DocBookForceAbstractTag NONE DocBookForceAbstractTag NONE
HTMLInToc 0
End End

View File

@ -11,7 +11,7 @@
# This script will update a .layout file to current format # This script will update a .layout file to current format
# The latest layout format is also defined in src/TextClass.cpp # The latest layout format is also defined in src/TextClass.cpp
currentFormat = 95 currentFormat = 96
# Incremented to format 4, 6 April 2007, lasgouttes # Incremented to format 4, 6 April 2007, lasgouttes
@ -322,6 +322,9 @@ currentFormat = 95
# Incremented to format 95, 27 September 2021 by tcuvelier # Incremented to format 95, 27 September 2021 by tcuvelier
# Add DocBookRenderAsImage # Add DocBookRenderAsImage
# Incremented to format 96, 4 December 2022 by rikiheck
# Add HTMLInToc
# Do not forget to document format change in Customization # Do not forget to document format change in Customization
# Manual (section "Declaring a new text class"). # Manual (section "Declaring a new text class").

View File

@ -142,6 +142,7 @@ enum LayoutTags {
LT_TOGGLE_INDENT, LT_TOGGLE_INDENT,
LT_ADDTOTOC, LT_ADDTOTOC,
LT_ISTOCCAPTION, LT_ISTOCCAPTION,
LT_HTMLINTOC,
LT_INTITLE // keep this last! LT_INTITLE // keep this last!
}; };
@ -187,6 +188,7 @@ Layout::Layout()
htmllabelfirst_ = false; htmllabelfirst_ = false;
htmlforcecss_ = false; htmlforcecss_ = false;
htmltitle_ = false; htmltitle_ = false;
htmlintoc_ = true;
docbookabstract_ = false; docbookabstract_ = false;
docbookwrappermergewithprevious_ = false; docbookwrappermergewithprevious_ = false;
docbooksection_ = false; docbooksection_ = false;
@ -270,6 +272,7 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
{ "freespacing", LT_FREE_SPACING }, { "freespacing", LT_FREE_SPACING },
{ "htmlattr", LT_HTMLATTR }, { "htmlattr", LT_HTMLATTR },
{ "htmlforcecss", LT_HTMLFORCECSS }, { "htmlforcecss", LT_HTMLFORCECSS },
{ "htmlintoc", LT_HTMLINTOC },
{ "htmlitem", LT_HTMLITEM }, { "htmlitem", LT_HTMLITEM },
{ "htmlitemattr", LT_HTMLITEMATTR }, { "htmlitemattr", LT_HTMLITEMATTR },
{ "htmllabel", LT_HTMLLABEL }, { "htmllabel", LT_HTMLLABEL },
@ -703,6 +706,10 @@ bool Layout::readIgnoreForcelocal(Lexer & lex, TextClass const & tclass,
break; break;
} }
case LT_HTMLINTOC:
lex >> htmlintoc_;
break;
case LT_HTMLTAG: case LT_HTMLTAG:
lex >> htmltag_; lex >> htmltag_;
break; break;

View File

@ -193,6 +193,8 @@ public:
/// ///
std::string const & htmllabelattr() const; std::string const & htmllabelattr() const;
/// ///
bool htmlintoc() const { return htmlintoc_; }
///
std::string defaultCSSClass() const; std::string defaultCSSClass() const;
/// ///
bool htmllabelfirst() const { return htmllabelfirst_; } bool htmllabelfirst() const { return htmllabelfirst_; }
@ -516,6 +518,8 @@ private:
/// <item><label>...</label>...</item> /// <item><label>...</label>...</item>
/// The latter is the default. /// The latter is the default.
bool htmllabelfirst_; bool htmllabelfirst_;
/// Is this to be output with the toc?
bool htmlintoc_;
/// CSS information needed by this layout. /// CSS information needed by this layout.
docstring htmlstyle_; docstring htmlstyle_;
/// DocBook tag corresponding to this layout. /// DocBook tag corresponding to this layout.

View File

@ -59,7 +59,7 @@ namespace lyx {
// You should also run the development/tools/updatelayouts.py script, // You should also run the development/tools/updatelayouts.py script,
// to update the format of all of our layout files. // 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 // Layout format for the current lyx file format. Controls which format is

View File

@ -165,6 +165,9 @@ void InsetTOC::makeTOCWithDepth(XMLStream & xs,
if (!tocitem.isOutput()) if (!tocitem.isOutput())
continue; continue;
if (!tocitem.dit().paragraph().layout().htmlintoc())
continue;
// First, we need to manage increases and decreases of depth // First, we need to manage increases and decreases of depth
// If there's no depth to deal with, we artificially set it to 1. // If there's no depth to deal with, we artificially set it to 1.
int const depth = tocitem.depth(); int const depth = tocitem.depth();
@ -220,6 +223,9 @@ void InsetTOC::makeTOCNoDepth(XMLStream & xs,
if (!tocitem.isOutput()) if (!tocitem.isOutput())
continue; continue;
if (!tocitem.dit().paragraph().layout().htmlintoc())
continue;
xs << xml::StartTag("div", "class='lyxtoc-flat'") << xml::CR(); xs << xml::StartTag("div", "class='lyxtoc-flat'") << xml::CR();
Paragraph const & par = tocitem.dit().innerParagraph(); Paragraph const & par = tocitem.dit().innerParagraph();