Merge pull request #4417 from jfbu/no_release_latex_header

Eliminate comma from PDF header when project has no release number
This commit is contained in:
Jean-François B
2018-01-13 09:09:12 +01:00
committed by GitHub
2 changed files with 22 additions and 12 deletions

View File

@@ -105,6 +105,8 @@ Features removed
* LaTeX environment ``notice``, use ``sphinxadmonition`` instead * LaTeX environment ``notice``, use ``sphinxadmonition`` instead
* LaTeX ``\sphinxstylethead``, use ``\sphinxstyletheadfamily`` * LaTeX ``\sphinxstylethead``, use ``\sphinxstyletheadfamily``
* C++, support of function concepts. Thanks to mickk-on-cpp. * C++, support of function concepts. Thanks to mickk-on-cpp.
* Not used and previously not documented LaTeX macros ``\shortversion``
and ``\setshortversion``
Bugs fixed Bugs fixed

View File

@@ -504,7 +504,7 @@
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}} \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}} \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}} \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
\fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}} \fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \@chappos when \@chappos is available for Japanese % define chaptermark with \@chappos when \@chappos is available for Japanese
@@ -1401,18 +1401,26 @@
% \date{}. This allows the date to reflect the document's date and % \date{}. This allows the date to reflect the document's date and
% release to specify the release that is documented. % release to specify the release that is documented.
% %
\newcommand{\py@release}{} \newcommand{\py@release}{\releasename\space\version}
\newcommand{\version}{} \newcommand{\version}{}% part of \py@release, used by title page and headers
\newcommand{\shortversion}{} % \releaseinfo is used on titlepage (sphinxmanual.cls, sphinxhowto.cls)
\newcommand{\releaseinfo}{} \newcommand{\releaseinfo}{}
\newcommand{\releasename}{Release} \newcommand{\setreleaseinfo}[1]{\renewcommand{\releaseinfo}{#1}}
\newcommand{\release}[1]{% % this is inserted via template and #1=release config variable
\renewcommand{\py@release}{\releasename\space\version}% \newcommand{\release}[1]{\renewcommand{\version}{#1}}
\renewcommand{\version}{#1}} % this is defined by template to 'releasename' latex_elements key
\newcommand{\setshortversion}[1]{% \newcommand{\releasename}{}
\renewcommand{\shortversion}{#1}} % Fix issue in case release and releasename deliberately left blank
\newcommand{\setreleaseinfo}[1]{% \newcommand{\sphinxheadercomma}{, }% used in fancyhdr header definition
\renewcommand{\releaseinfo}{#1}} \newcommand{\sphinxifemptyorblank}[1]{%
% test after one expansion of macro #1 if contents is empty or spaces
\if&\expandafter\@firstofone\detokenize\expandafter{#1}&%
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}%
\AtBeginDocument {%
\sphinxifemptyorblank{\releasename}
{\sphinxifemptyorblank{\version}{\let\sphinxheadercomma\empty}{}}
{}%
}%
% Allow specification of the author's address separately from the % Allow specification of the author's address separately from the
% author's name. This can be used to format them differently, which % author's name. This can be used to format them differently, which