Skip to content

Commit

Permalink
Allow custom logo for PDF documentation.
Browse files Browse the repository at this point in the history
Contributed by Cynthia Shang.
  • Loading branch information
cmwshang authored and dwsteele committed Dec 31, 2018
1 parent 72865ca commit 2b7440d
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 9 deletions.
14 changes: 9 additions & 5 deletions doc/lib/BackRestDoc/Latex/DocLatex.pm
Expand Up @@ -94,16 +94,20 @@ sub process

my $oRender = $self->{oManifest}->renderGet(RENDER_TYPE_PDF);

# Should the logo be pulled from the doc path or the bin path?
my $strLogoFile = "$self->{oManifest}{strDocPath}/resource/latex/cds-logo.eps";
my $strLogo = $self->{oManifest}->variableGet('pdf-resource-logo');

if (!$self->{oManifest}->storage()->exists($strLogoFile))
if (!defined($strLogo))
{
$strLogoFile = "$self->{oManifest}{strBinPath}/resource/latex/cds-logo.eps";
$strLogo = 'blank.eps';
}

my ($strExt) = $strLogo =~ /(\.[^.]+)$/;
my $strLogoPath = defined($self->{oManifest}->variableGet('pdf-resource-path')) ?
$self->{oManifest}->variableGet('pdf-resource-path') :
"$self->{oManifest}{strDocPath}/resource/latex/";

# Copy the logo
copy($strLogoFile, "$self->{strLatexPath}/logo.eps")
copy($strLogoPath . $strLogo, "$self->{strLatexPath}/logo$strExt")
or confess &log(ERROR, "unable to copy logo");

my $strLatex = $self->{oManifest}->variableReplace(
Expand Down
6 changes: 3 additions & 3 deletions doc/manifest.xml
Expand Up @@ -54,9 +54,6 @@
$stryMonth[$month] . ' ' . $mday . ', ' . $year;
</variable>

<!-- Logo locations -->
<variable key="logo">{[doc-path]}/output/latex/logo</variable>

<!-- HTML variables -->
<variable key="html-footer" eval='y'>
'Copyright &amp;copy; 2015' . '-' . substr('{[release-date]}', length('{[release-date]}') - 4) .
Expand All @@ -66,11 +63,14 @@
<!-- <variable key="html-logo">&lt;img src=&quot;{[project-logo]}&quot;&gt;</variable> -->

<!-- PDF variables -->
<variable key="pdf-logo">{[doc-path]}/output/latex/logo</variable>

<variable key="pdf-title1">{[project]} User Guide</variable>
<variable key="pdf-title2">Open Source PostgreSQL Backup and Restore Utility</variable>
<variable key="pdf-title3">Version {[version]}</variable>

<variable key="pdf-organization">Crunchy Data Solutions, Inc.</variable>
<variable key="pdf-resource-logo">cds-logo.eps</variable>

<variable key='pdf-footer-left'>{[pdf-title1]}\\{[pdf-title3]}</variable>
<variable key='pdf-footer-center'>\ \\-\ \thepage\ -</variable>
Expand Down
280 changes: 280 additions & 0 deletions doc/resource/latex/blank.eps

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion doc/resource/latex/preamble.tex
Expand Up @@ -135,7 +135,7 @@
{\huge \bfseries {[pdf-title1]}}\\[1ex]
{\large \bfseries {[pdf-title2]}}\\[4ex]
{\large {[pdf-title3]}}\\[12ex]
\includegraphics[width=6in]{{[logo]}}\\[12ex]
\includegraphics[width=6in]{{[pdf-logo]}}\\[12ex]
{\large {[pdf-organization]}}\\[1ex]
{\large \today}
\end{center}
Expand Down
8 changes: 8 additions & 0 deletions doc/xml/release.xml
Expand Up @@ -291,6 +291,14 @@
<p>Add Centos/RHEL 7 option to documentation build.</p>
</release-item>

<release-item>
<release-item-contributor-list>
<release-item-contributor id="cynthia.shang"/>
</release-item-contributor-list>

<p>Allow custom logo for PDF documentation.</p>
</release-item>

<release-item>
<p>Use absolute paths so that <file>./doc.pl</file> runs.</p>
</release-item>
Expand Down

0 comments on commit 2b7440d

Please sign in to comment.