\hduthesis_provide_module:n {hdu.l3doc}

\keys_define:nn { hdu.l3doc / docinfo }
  {
    title .tl_set:N         = \l__docinfo_title_clist,
    author .tl_set:N        = \l__docinfo_author_tl,
    CJKmain-font .tl_set:N  = \g__docinfo_main_CJK_font,
    CJKsans-font .tl_set:N  = \g__docinfo_sans_CJK_font,
    CJKmono-font .tl_set:N  = \g__docinfo_mono_CJK_font
  }
\NewDocumentCommand \DocInfo { m }
  {
    \keys_set:nn { hdu.l3doc / docinfo } {#1}
    \title { \bfseries \l__docinfo_title_clist }
    \author { \l__docinfo_author_tl }
    \date
      {
        v\hduthesis@version
        \footnote
          {
            \url{https://github.com/\hduthesis@maintainerid/hduthesis},~
            \url{https://gitee.com/\hduthesis@maintainerid/hduthesis}
          }~ (\hduthesis@date)
      }
    \tl_if_empty:NF \g__docinfo_main_CJK_font
      { \exp_last_unbraced:No \setCJKmainfont \g__docinfo_main_CJK_font }
    \tl_if_empty:NF \g__docinfo_sans_CJK_font
      { \exp_last_unbraced:No \setCJKsansfont \g__docinfo_sans_CJK_font }
    \tl_if_empty:NF \g__docinfo_mono_CJK_font
      { \exp_last_unbraced:No \setCJKmonofont \g__docinfo_mono_CJK_font }
  }

\RequirePackage{ hyperref }
\RequirePackage [ svgnames ] { xcolor }
\hypersetup
  { filecolor = DarkGreen, urlcolor = MidnightBlue, linkcolor = FireBrick }
\ExplSyntaxOff
\RenewDocumentCommand \pkg {m} { \href{https://ctan.org/pkg/#1}{\textsf{#1}} }
\RenewDocumentCommand \cls {m} { \href{https://ctan.org/pkg/#1}{\textsf{#1}} }
\NewDocumentCommand \mailto {m} { \texttt{<\href{mailto:#1}{#1}>} }
\pdfstringdefDisableCommands
  { \def \file#1{<#1>} \def\pkg#1{<#1>} \def\cls#1{<#1>} \def\mailto#1{<#1>} }
\ExplSyntaxOn
\hologoFontSetup { general = \sffamily }
\RequirePackage [ mono = false ] { libertine }
\RequirePackage [ pass, verbose ] { geometry }
\RequirePackage
  { fancyhdr, enumitem, tasks, tabularx, dirtree, framed,
    xeCJKfntef, tikz, pdfpages, subcaption, datetime }
\pagestyle{plain}
\FrameSep = 0pt \yyyymmdddate
\RequirePackage[os = mac]{menukeys}
\RequirePackage[fontset = none]{ctex} \linespread{1.4}
\def \@emph#1 { \CJKsout*[thickness = 2.5ex, format = \color{blue!15}]{#1} }
\def \s@emph#1 { \CJKunderwave*{#1} }
\renewcommand \emph { \@ifstar \s@emph \@emph }
\hook_gput_code:nnn { env/function/before } { . } { \vspace{-2ex} }

\def \HoLogo@hduThesiS #1
  {
    \raisebox{-.5pt}
      {
        \HOLOGO@mbox
          {
            \tikz [ baseline = (hduthesis.base) ]
              {
                \node [ inner~sep = 0pt ] (hduthesis)
                  {\scshape \sffamily hduThesi\scalebox{1.2}[1.2]{S}};
                \draw let \p1 = (hduthesis.west), \p2 = (hduthesis.east)
                  in (\x1,\y1) (\x2,\y2) [ line~width = {.028pt * (\x2 - \x1)} ]
                  ([yshift = -.5ex]hduthesis.north~west) to[ bend~right = 5 ]
                  ([yshift = .25ex]hduthesis.north~east);
              }
          }
      }
  }
\def \HoLogo@hduthesis #1
  { \raisebox{-.5pt} { \HOLOGO@mbox { \scshape \cls{hduThesiS} } } }

\let \legacy@maketitle \maketitle
\RenewDocumentCommand \maketitle {}
  {
    \newgeometry { margin = 1.2in }
    \titlepage
    \legacy@maketitle
    \begin{center}
      \tikz
        {
          \node [ opacity = .8 ] 
            { \includegraphics [ width = .14\paperwidth ] { hdumotto.pdf } };
          \node [ opacity = .3 ]
            { \includegraphics [ width = .21\paperwidth ] { hdulogo.pdf } };
      }
    \end{center}
    \thispagestyle{empty}
  }
\hook_gput_code:nnn { cmd/tableofcontents/before } { . } { \clearpage }
\hook_gput_code:nnn { cmd/tableofcontents/after } { . }
  { \endtitlepage \restoregeometry }

\endinput
