]> git.lyx.org Git - lyx.git/commitdiff
Fix bug #11418.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 4 Dec 2022 05:33:14 +0000 (00:33 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sun, 4 Dec 2022 05:33:14 +0000 (00:33 -0500)
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
lib/layouts/egs.layout
lib/layouts/stdstarsections.inc
lib/scripts/layout2layout.py
src/Layout.cpp
src/Layout.h
src/TextClass.cpp
src/insets/InsetTOC.cpp

index d824522c8b35fafa56f165790048696722ad5b82..209326fe74c7a186f74b63661e3b1dece691f18f 100644 (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
 
 
index 29da661f1523e1d7a75ea964344dea568081ea92..ab2b942bea4b4a5ad8de2c8844adc628437a2a58 100644 (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
 
 
index e1e09d43e9ef11ba2e3cbbe520e76e712ff99fc4..fd13de7c0fb5c47113fa118ed7bf43ce63645bf0 100644 (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
index c2fc7c20a768956a5e951572ec7a4b4628a5eea7..f7fe8376f14b981d43bb9292720587c583bc5bef 100644 (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").
 
index e5d683ec1855d3f089eaa19828926c7eff5a1017..b94696fa0c1953bdb470cc11aa1c1fd21ab5e707 100644 (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;
index 0588bc17a7355f731a0c8e17bd2fd97b8b95e49b..dd64bce75987879b9688d9efeabc9bad7f91f961 100644 (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.
index 3a131d9d8eb803254c42f60bedb546d6078f92fc..b387ce1a191f1180cfe07f327bf260947b5db231 100644 (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
index 46b5b4fcd974d756b56b82ca1c4315a3c936509d..0308392c0d3abaad4e474602032b4278c30d3447 100644 (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();