Skip to content
Snippets Groups Projects
Commit c12ea770 authored by Vít Novotný's avatar Vít Novotný
Browse files

Refactored the code.

parent 8fe3c3e8
No related branches found
No related tags found
No related merge requests found
...@@ -1284,7 +1284,7 @@ ...@@ -1284,7 +1284,7 @@
% the same effect. % the same effect.
% \begin{macrocode} % \begin{macrocode}
\newif\ifthesis@loaded\thesis@loadedfalse \newif\ifthesis@loaded\thesis@loadedfalse
\AtEndPreamble{\thesisload} \BeforeBeginEnvironment{document}{\thesisload}
\def\thesis@load{\thesisload} \def\thesis@load{\thesisload}
\def\thesisload{% \def\thesisload{%
\ifthesis@loaded\else \ifthesis@loaded\else
...@@ -1312,24 +1312,6 @@ ...@@ -1312,24 +1312,6 @@
\RequirePackage[base]{babel}} \RequirePackage[base]{babel}}
\fi \fi
% \end{macrocode} % \end{macrocode}
% If the \textsf{babel} or \textsf{polyglossia} locale is identical
% to the thesis locale, the |\thesis@selectLocale| macro will be
% used to globally set up the \textsf{csquotes} style appropriate for
% the given locale.
% \begin{macrocode}
\ifx\languagename\empty\else
\begingroup
\edef\@doclocale{\languagename}%
\ifx\@doclocale\thesis@locale
\endgroup
\AtBeginDocument{%
\thesis@selectLocale{\thesis@locale}}%
\else
\endgroup
\fi
\fi
\fi
% \end{macrocode}
% Consequently, the style files are loaded. If the user specified an % Consequently, the style files are loaded. If the user specified an
% explicit empty string as the value of |\thesis@style|, do nothing. % explicit empty string as the value of |\thesis@style|, do nothing.
% \begin{macrocode} % \begin{macrocode}
...@@ -1337,6 +1319,23 @@ ...@@ -1337,6 +1319,23 @@
\thesis@requireStyle{\thesis@style} \thesis@requireStyle{\thesis@style}
\fi \fi
% \end{macrocode} % \end{macrocode}
% If the \textsf{babel} or \textsf{polyglossia} locale is identical
% to the thesis locale, the |\thesis@selectLocale| macro will be
% used to globally set up the \textsf{csquotes} style appropriate for
% the given locale.
% \begin{macrocode}
\ifx\languagename\empty\else
\begingroup
\edef\@doclocale{\languagename}%
\ifx\@doclocale\thesis@locale
\endgroup
\AtBeginDocument{%
\thesis@selectLocale{\thesis@locale}}%
\else
\endgroup
\fi
\fi
% \end{macrocode}
% With the placeholder strings loaded from the locale files, we % With the placeholder strings loaded from the locale files, we
% can now inject metadata into the resulting PDF file. To this % can now inject metadata into the resulting PDF file. To this
% end, the \textsf{hyperref} package is conditionally included with % end, the \textsf{hyperref} package is conditionally included with
...@@ -1557,14 +1556,12 @@ ...@@ -1557,14 +1556,12 @@
% locale, \textsf{csquotes}, and hyphenation settings return back to % locale, \textsf{csquotes}, and hyphenation settings return back to
% what the user has specified after the localized blocks of % what the user has specified after the localized blocks of
% typographic material. % typographic material.
%
% If not loaded by the user, the \textsf{csquotes} package gets
% loaded at the end of the preamble.
% \begin{macrocode} % \begin{macrocode}
\AtEndPreamble{\thesis@require{csquotes}}
\def\thesis@selectLocale#1{% \def\thesis@selectLocale#1{%
\edef\thesis@locale{#1}% \edef\thesis@locale{#1}%
\csq@setstyle{\thesis@@{csquotesStyle}}% \ltx@ifpackageloaded{csquotes}{%
\csq@setstyle{\thesis@@{csquotesStyle}}%
}{}%
\ltx@ifpackageloaded{polyglossia}{% \ltx@ifpackageloaded{polyglossia}{%
\selectlanguage{\thesis@locale} \selectlanguage{\thesis@locale}
}{% }{%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment