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.
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

View File

@ -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

View File

@ -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

View File

@ -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").

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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();