From 5d7de5bd9023de735465bbdd3380eb232eab7a53 Mon Sep 17 00:00:00 2001
From: witiko <witiko@gmail.com>
Date: Sun, 26 Apr 2015 13:08:55 +0200
Subject: [PATCH] Removed `\thesis@authorEn` and `\thesis@advisorEn`. Added
 `\thesis@head`, `tail`, `author@head` and `author@tail`.

The `\thesis@authorEn` and `\thesis@advisorEn` macros are
unnecessary and can be emulated via

  `{\def\thesis@lang{english}\thesis@author` or `\thesis@placeholder}`

for an arbitrary language.
---
 fithesis.dtx       | 69 +++++++++++++++++++++++++++++++++-------------
 locale/czech.dtx   |  2 ++
 locale/english.dtx |  2 ++
 locale/slovak.dtx  |  2 ++
 style/mu/Makefile  |  4 +--
 style/mu/sci.dtx   |  7 +++--
 6 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/fithesis.dtx b/fithesis.dtx
index 0c7988b..838f322 100644
--- a/fithesis.dtx
+++ b/fithesis.dtx
@@ -305,21 +305,38 @@
   \fi}
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\thesis@author}\begin{macro}{\thesis@authorEn}
+% \begin{macro}{\thesis@author}
 % \subsubsection{The \texttt{author} key}
 % The \marg{\texttt{author}=name} pair sets the author's full
-% name to \textit{name}. The \textit{name} is stored within the
-% private |\thesis@author| and |\thesis@authorEn| macros, whose
-% implicit value is |\thesis@@{placeholders@author}| and
-% |\thesis@english@placeholders@author}|, respectively.
+% name to \textit{name}. The \textit{name} is parsed using the
+% \DescribeMacro{\thesis@parseAuthor} private macro and stored
+% within the following private macros:
+% \begin{itemize}
+%   \item\DescribeMacro{\thesis@author}|\thesis@author|
+%     -- The full name of the author. The default value of the
+%     macro is |\thesis@@{placeholders@author}|.
+%   \item\DescribeMacro{\thesis@author@head}|\thesis@author@head|
+%     -- The first space-delimited part of the name. This
+%     corresponds to the author's first name. The default value of
+%     the macro is |\thesis@@{placeholders@author@firstName}|.
+%   \item\DescribeMacro{\thesis@author@tail}|\thesis@author@tail|
+%     -- The full name without the first space-delimited part of
+%     the name. This corresponds to the author's surname. The
+%     default value of the macro is
+%     |\thesis@@{placeholders@author@surname}|.
+% \end{itemize}
 %    \begin{macrocode}
+\def\thesis@parseAuthor#1{%
+  \def\thesis@author{#1}%
+  \edef\thesis@author@head{\thesis@head#1 \relax}%
+  \edef\thesis@author@tail{\thesis@tail#1 \relax}}
 \def\thesis@author{\thesis@@{placeholders@author}}
-\def\thesis@authorEn{\thesis@english@placeholders@author}
+\def\thesis@author@head{\thesis@@{placeholders@author@firstName}}
+\def\thesis@author@tail{\thesis@@{placeholders@author@surname}}
 \define@key{thesis}{author}{%
-  \def\thesis@author{#1}%
-  \def\thesis@authorEn{#1}}
+  \expandafter\thesis@parseAuthor{#1}}
 %    \end{macrocode}
-% \end{macro}\end{macro}
+% \end{macro}
 % \begin{macro}{\thesis@type}
 % \subsubsection{The \texttt{type} key}
 % The \marg{\texttt{type}=type} pair sets the type of the thesis
@@ -769,22 +786,17 @@
   \long\def\thesis@abstractEn{#1}}
 %    \end{macrocode}
 % \end{macro}
-% \begin{macro}{\thesis@advisor}\begin{macro}{\thesis@advisorEn}
+% \begin{macro}{\thesis@advisor}
 % \subsubsection{The \texttt{advisor} key}
 % The \marg{\texttt{advisor}=name} pair sets the thesis advisor's
 % full name to \textit{name}. The \textit{name} is stored within
-% the private |\thesis@advisor| and |\thesis@advisorEn| macro,
-% whose implicit values are |\thesis@@{placeholders@advisor}| and
-% |\thesis@|\discretionary{}{}{}|english@placeholders@advisor|,
-% respectively.
+% the private |\thesis@advisor| macro, whose implicit value is
+% |\thesis@@{placeholders@advisor}|.
 %    \begin{macrocode}
 \def\thesis@advisor{\thesis@@{placeholders@advisor}}
-\def\thesis@advisorEn{\thesis@english@placeholders@advisor}
-\define@key{thesis}{advisor}{%
-  \def\thesis@advisor{#1}%
-  \def\thesis@advisorEn{#1}}
+\define@key{thesis}{advisor}{\def\thesis@advisor{#1}}
 %    \end{macrocode}
-% \end{macro}\end{macro}
+% \end{macro}
 % \begin{macro}{\thesis@thanks}
 % \subsubsection{The \texttt{thanks} key}
 % The \marg{\texttt{thanks}=text} pair sets the acknowledgement
@@ -1076,6 +1088,25 @@
 \def\thesis@@lower#1{\thesis@lower{\thesis@locale @#1}}
 \def\thesis@@upper#1{\thesis@upper{\thesis@locale @#1}}
 %    \end{macrocode}
+% The \DescribeMacro{\thesis@head}|\thesis@head|
+% and \DescribeMacro{\thesis@tail}|\thesis@tail|
+% private macros are used for retrieving a head or a tail of
+% space-separated token sequences, which end with |\relax|.
+%    \begin{macrocode}
+\def\thesis@head#1 #2{%
+  \ifx\relax#2%
+    \expandafter\@gobbletwo%
+  \else%
+    #1
+  \fi%
+  \thesis@head#2}%
+\def\thesis@tail#1 #2{%
+  \ifx\relax#2%
+    #1%
+    \expandafter\@gobbletwo%
+  \fi%
+  \thesis@tail#2}%
+%    \end{macrocode}
 % \subsection{General purpose macros}
 % The \DescribeMacro{\thesis@pages}|\thesis@pages| macro is defined
 % at the beginning of the second \LaTeX\ run as a part of the main
diff --git a/locale/czech.dtx b/locale/czech.dtx
index f96a131..f3af0a8 100644
--- a/locale/czech.dtx
+++ b/locale/czech.dtx
@@ -22,6 +22,8 @@
   klíčové slovo 2, ...}
 \def\thesis@czech@placeholders@abstract{Text shrnutí}
 \def\thesis@czech@placeholders@author{Jméno autora}
+\def\thesis@czech@placeholders@author@firstName{Jméno}
+\def\thesis@czech@placeholders@author@surname{Příjmení}
 \def\thesis@czech@universityName{Název univerzity}
 \def\thesis@czech@facultyName{Název fakulty}
 \def\thesis@czech@placeholders@advisor{Jméno vedoucího}
diff --git a/locale/english.dtx b/locale/english.dtx
index b561013..c0d9530 100644
--- a/locale/english.dtx
+++ b/locale/english.dtx
@@ -12,6 +12,8 @@
 \def\thesis@english@placeholders@keywords{keyword1, keyword2, ...}
 \def\thesis@english@placeholders@abstract{Abstract text}
 \def\thesis@english@placeholders@author{Author's name}
+\def\thesis@english@placeholders@author@firstName{Name}
+\def\thesis@english@placeholders@author@surname{Surname}
 \def\thesis@english@placeholders@universityName{University name}
 \def\thesis@english@facultyName{Faculty name}
 \def\thesis@english@placeholders@advisor{%
diff --git a/locale/slovak.dtx b/locale/slovak.dtx
index 1d8f0e0..c139885 100644
--- a/locale/slovak.dtx
+++ b/locale/slovak.dtx
@@ -20,6 +20,8 @@
   kľúčové slovo 2, ...}
 \def\thesis@slovak@placeholders@abstract{Text zhrnutie}
 \def\thesis@slovak@placeholders@author{Meno autora}
+\def\thesis@slovak@placeholders@author@firstName{Meno}
+\def\thesis@slovak@placeholders@author@surname{Priezvisko}
 \def\thesis@slovak@universityName{Názov univerzity}
 \def\thesis@slovak@facultyName{Názov fakulty}
 \def\thesis@slovak@placeholders@advisor{Meno vedúceho}
diff --git a/style/mu/Makefile b/style/mu/Makefile
index d8d14c0..1bb9865 100644
--- a/style/mu/Makefile
+++ b/style/mu/Makefile
@@ -1,5 +1,5 @@
-LOGS=base.log fi.log sci.log phil.log
-OUTPUT=fithesis3-base.sty fithesis3-1[012].clo fithesis3-fi.sty fithesis3-sci.sty fithesis3-phil.sty
+LOGS=base.log fi.log sci.log phil.log ped.log
+OUTPUT=fithesis3-base.sty fithesis3-1[012].clo fithesis3-fi.sty fithesis3-sci.sty fithesis3-phil.sty fithesis3-ped.sty
 
 .PHONY: explode implode all
 all: explode
diff --git a/style/mu/sci.dtx b/style/mu/sci.dtx
index 53108e4..f5d4380 100644
--- a/style/mu/sci.dtx
+++ b/style/mu/sci.dtx
@@ -157,6 +157,7 @@
 %    \begin{macrocode}
 \def\thesis@blocks@bibEntryEn{%
   \ifthesis@english\else
+    {\def\thesis@locale{english}
     \begin{alwayssingle}
       % Start the new chapter without clearing the right page
       {\def\cleardoublepage{}%
@@ -194,7 +195,7 @@
     \renewcommand{\arraystretch}{2}
     \begin{tabular}{@{}p{\@left}@{\hskip\@skip}p{\@right}@{}}
         \textbf{\thesis@english@bib@author:} & \vtop{%
-          \hbox{\strut\thesis@authorEn}%
+          \hbox{\strut\thesis@author}%
           \hbox{\strut\thesis@english@facultyName,
                 \thesis@english@universityName}%
           \hbox{\strut\thesis@departmentEn}} \\
@@ -208,7 +209,7 @@
         % thesis advisor.
         \ifx\thesis@type\thesis@rigorous\else%
           \textbf{\thesis@english@bib@advisor:}
-            & \thesis@advisorEn \\
+            & \thesis@advisor \\
         \fi
         \textbf{\thesis@english@bib@academicYear:}
           & \thesis@academicYear \\
@@ -218,7 +219,7 @@
           & \thesis@keywordsEn \\
       \end{tabular}}
     \end{alwayssingle}
-  \fi}
+  }\fi}
 %    \end{macrocode}
 % \end{macro}\begin{macro}{\thesis@blocks@frontMatter}
 % The |\thesis@blocks@frontMatter| private macro sets up the style
-- 
GitLab