1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Allow sections to be excluded from table of contents in PDF output.

This commit is contained in:
David Steele 2018-02-21 15:26:30 -05:00
parent 64a7196cb6
commit aed578a4bd
3 changed files with 20 additions and 3 deletions

View File

@ -115,12 +115,22 @@ sub sectionProcess
&log(INFO, (' ' x ($iDepth + 1)) . 'process section: ' . $oSection->paramGet('path'));
}
# Create the section
# Create section type
my $strSectionTitle = $self->processText($oSection->nodeGet('title')->textGet());
$strSection .= (defined($strSection) ? ', ' : '') . "'${strSectionTitle}' " . ('Sub' x ($iDepth - 1)) . "Section";
# Create section comment
my $strLatex =
"% ${strSection}\n% " . ('-' x 130) . "\n\\";
"% ${strSection}\n% " . ('-' x 130) . "\n";
# Exclude from table of contents if requested
if ($iDepth <= 3 && $oSection->paramTest('toc', 'n'))
{
$strLatex .= '\\addtocontents{toc}{\\protect\\setcounter{tocdepth}{' . ($iDepth - 1) . "}}\n";
}
# Create section name
$strLatex .= '\\';
if ($iDepth <= 3)
{
@ -137,6 +147,12 @@ sub sectionProcess
$strLatex .= "\{${strSectionTitle}\}\\label{" . $oSection->paramGet('path', false) . "}\n";
# Reset table of contents numbering if the section was excluded
if ($iDepth <= 3 && $oSection->paramTest('toc', 'n'))
{
$strLatex .= '\\addtocontents{toc}{\\protect\\setcounter{tocdepth}{' . $iDepth . "}}\n";
}
foreach my $oChild ($oSection->nodeList())
{
&log(DEBUG, (' ' x ($iDepth + 2)) . 'process child ' . $oChild->nameGet());

View File

@ -118,6 +118,7 @@
<!ATTLIST section keyword CDATA "">
<!ATTLIST section depend CDATA "">
<!ATTLIST section source CDATA "">
<!ATTLIST section toc CDATA "">
<!ELEMENT title (#PCDATA|quote|b|i|bi|ul|ol|id|code|host|file|path|cmd|setting|exe|backrest|postgres|br-option|br-setting|
pg-option|pg-setting|link|user|proper)*>

View File

@ -170,7 +170,7 @@
</release-item>
<release-item>
<p>PDF rendering improvements. Check both <path>doc-path</path> and <path>bin-path</path> for logo. Allow PDF to be output to a location other than the <path>output</path> directory. Use PDF-specific version variable for more flexible formatting.</p>
<p>PDF rendering improvements. Check both <path>doc-path</path> and <path>bin-path</path> for logo. Allow PDF to be output to a location other than the <path>output</path> directory. Use PDF-specific version variable for more flexible formatting. Allow sections to be excluded from table of contents.</p>
</release-item>
<release-item>