Commit 93f88339 authored by Vít Starý Novotný's avatar Vít Starý Novotný
Browse files

`\thesis@def@extra` now accepts a default definition.

parent 9adda30a
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -1358,18 +1358,27 @@
  \fi}
%    \end{macrocode}
% \begin{macro}{\thesis@def@extra}
% The |\thesis@def@extra|\oarg{key}\marg{name} macro defines
% The |\thesis@def@extra|\oarg{definition}\marg{name} macro defines
% the |\thesis@extra@|\textit{name} macro to expand
% to either <<\textit{key}>>, if specified, or to
% <<extra@\textit{name}>>. The macro serves to provide placeholder
% strings for extra data macros. If |\thesis@extra@|\textit{name}
% has already been defined by the user, |\thesis@def@extra| has no
% to either \textit{definition}, if specified, or to
% |\thesis@placeholder@extra@|\textit{name}, where
% |\thesis@placeholder@extra@|\textit{name} is defined to expand to
% <<extra@\textit{name}>>. If |\thesis@extra@|\textit{name} has
% already been defined by the user, |\thesis@def@extra| has no
% effect.
%    \begin{macrocode}
\newcommand{\thesis@def@extra}[2][]{%
  \expandafter\ifx\csname thesis@extra@#2\endcsname\undefined
    \expandafter\def\csname thesis@extra@#2\endcsname{%
      <<extra@\ifx\thesis@empty#1\thesis@empty#2\else#1\fi>>}%
  \expandafter\ifx\csname thesis@extra@#2\endcsname\relax
    \def\thesis@placeholder@extra{<<extra@#2>>}%
    \expandafter\let\csname thesis@placeholder@extra@#2\endcsname
      \thesis@placeholder@extra
    \def\thesis@arg{#1}%
    \ifx\empty\thesis@arg
      \expandafter\let\csname thesis@extra@#2\endcsname
        \thesis@placeholder@extra
    \else
      \expandafter\def\csname thesis@extra@#2\endcsname{#1}%
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}