Properly implement IsTocCaption for Arguments in standard TOC

Fixes: #10631

Candidate for 2.3.x.

(cherry picked from commit 3a4b233dbd)
This commit is contained in:
Juergen Spitzmueller 2017-12-29 11:51:24 +01:00
parent 4f865d0f4d
commit 438b067b5a
12 changed files with 39 additions and 17 deletions

View File

@ -309,7 +309,7 @@ Style Section
Series Bold
Size Huge
EndFont
TocLevel 1
TocLevel 1
End
@ -319,7 +319,7 @@ Style Subsection
Series Bold
Size Larger
EndFont
TocLevel 2
TocLevel 2
End
@ -329,7 +329,7 @@ Style Subsubsection
Series Bold
Size Large
EndFont
TocLevel 3
TocLevel 3
End
@ -339,7 +339,7 @@ Style Paragraph
Series Bold
Size Normal
EndFont
TocLevel 4
TocLevel 4
End
@ -350,7 +350,7 @@ Style Subparagraph
Size Normal
Shape Italic
EndFont
TocLevel 5
TocLevel 5
End

View File

@ -216,6 +216,7 @@ Style Part
LabelString "Short Title|S"
Tooltip "The part as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
NeedProtect 1
NextNoIndent 1
@ -270,6 +271,7 @@ Style Section
LabelString "Short Title|S"
Tooltip "The section as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Family Roman
@ -331,6 +333,7 @@ Style Subsection
LabelString "Short Title|S"
Tooltip "The subsection as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Family Roman
@ -392,6 +395,7 @@ Style Subsubsection
LabelString "Short Title|S"
Tooltip "The subsubsection as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Family Roman
@ -481,6 +485,7 @@ Style Frame
Size largest
EndFont
AutoInsert 1
IsTocCaption 1
EndArgument
End

View File

@ -136,7 +136,8 @@ Style Section
Argument 1
LabelString "Short Title|S"
Tooltip "The title as it appears in the header"
InsertCotext 1
InsertCotext 1
IsTocCaption 1
EndArgument
ParSkip 0.4
TopSep 1.3

View File

@ -153,7 +153,7 @@ Style Section
Series Bold
Size Normal
EndFont
TocLevel 1
TocLevel 1
End
# Subsection style definition
@ -163,7 +163,7 @@ Style Subsection
Series Bold
Size Normal
EndFont
TocLevel 2
TocLevel 2
End
# Subsubsection style definition
@ -173,7 +173,7 @@ Style Subsubsection
Series Bold
Size Normal
EndFont
TocLevel 3
TocLevel 3
End
# Section* style definition

View File

@ -46,11 +46,12 @@ Style Section
Family Sans
Series Bold
EndFont
TocLevel 1
TocLevel 1
Argument 1
LabelString "Short Title|S"
Tooltip "The section as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
End

View File

@ -32,6 +32,7 @@ Style Part
LabelString "Short Title|S"
Tooltip "The part as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold
@ -63,6 +64,7 @@ Style Chapter
LabelString "Short Title|S"
Tooltip "The chapter as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold
@ -93,6 +95,7 @@ Style Section
LabelString "Short Title|S"
Tooltip "The section as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold

View File

@ -140,6 +140,7 @@ Style PartBacktext
Mandatory 1
LabelString "Part Title"
Tooltip "Title of this part"
IsTocCaption 1
EndArgument
Preamble
\newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}

View File

@ -81,8 +81,9 @@ Style Chapter
RefPrefix chap
Argument 1
LabelString "Short Title|S"
Tooltip "The chapter as it appears in the table of contents/running headers"
Tooltip "The chapter as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold
@ -109,8 +110,9 @@ Style Section
RefPrefix sec
Argument 1
LabelString "Short Title|S"
Tooltip "The section as it appears in the table of contents/running headers"
Tooltip "The section as it appears in the table of contents/running headers"
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold

View File

@ -39,7 +39,8 @@ Style Part
Argument 1
LabelString "Short Title|S"
Tooltip "The part as it appears in the table of contents/running headers"
InsertCotext 1
InsertCotext 1
IsTocCaption 1
EndArgument
Font
Series Bold

View File

@ -43,7 +43,7 @@ InsetArgument::InsetArgument(Buffer * buf, string const & name)
: InsetCollapsible(buf), name_(name), labelstring_(docstring()),
font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false),
pass_thru_chars_(docstring())
pass_thru_chars_(docstring()), is_toc_caption_(false)
{}
@ -119,11 +119,13 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
decoration_ = (*lait).second.decoration;
pass_thru_chars_ = (*lait).second.pass_thru_chars;
pass_thru_local_ = false;
if (lait->second.is_toc_caption)
if (lait->second.is_toc_caption) {
is_toc_caption_ = true;
// empty if AddToToc is not set
caption_of_toc_ = insetlayout
? it.inset().getLayout().tocType()
: it.paragraph().layout().tocType();
}
switch ((*lait).second.passthru) {
case PT_INHERITED:

View File

@ -69,6 +69,8 @@ public:
///
bool isPassThru() const { return pass_thru_; }
///
bool isTocCaption() const { return is_toc_caption_; }
///
bool resetFontEdit() const { return false; }
//@}
/// \name Public functions inherited from InsetCollapsible class
@ -113,6 +115,8 @@ private:
bool pass_thru_;
///
docstring pass_thru_chars_;
/// Does this argument provide content for the TOC?
bool is_toc_caption_;
/// The type of Toc this is the caption of, empty otherwise.
std::string caption_of_toc_;

View File

@ -870,13 +870,15 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active,
addtotoc_stack.push({pit, end});
}
// if we find an optarg, we'll save it for use later.
// If we find an InsetArgument that is supposed to provide the TOC caption,
// we'll save it for use later.
InsetArgument const * arginset = nullptr;
for (auto const & table : par.insetList()) {
dit.pos() = table.pos;
table.inset->addToToc(dit, doing_output, utype, backend);
if (InsetArgument const * x = table.inset->asInsetArgument())
arginset = x;
if (x->isTocCaption())
arginset = x;
}
// End custom AddToToc in paragraph layouts