\hduthesis_provide_module:n {preamble}

\RenewDocumentEnvironment {abstract} { O{en} }
  {
    \str_if_eq:nnT {#1} {en}
    {
      \tl_set:Nn \l__keywords_name_tl {Keywords:~}
      \tl_set:Nn \l__keywords_sep_tl {;~}
    }
    \str_if_eq:nnT {#1} {cn}
    {
      \tl_set:Nn \l__keywords_name_tl {\textsf{关键词：}}
      \tl_set:Nn \l__keywords_sep_tl {；}
    }
    \vspace*{-27\p@}
    \@beginparpenalty\@lowpenalty
    \begin{center}%
      \bfseries\large
        \str_if_eq:nnT {#1} {en} {ABSTRACT}
        \str_if_eq:nnT {#1} {cn} {\textsf{摘\qquad 要}}
      \@endparpenalty\@M
    \end{center}%
    \vspace*{.7\baselineskip}
  }
  {
    \par\null
    \tl_clear:N \l__abstract_name_tl
    \cfoot{}
    \clearpage
  }

\clist_new:N \l__abstract_keywords_clist
\NewDocumentCommand \keywords { m }
  {
    \vspace*{\baselineskip}
    \noindent\textbf{\l__keywords_name_tl}
    \clist_set:Nn \l__abstract_keywords_clist {#1}
    \clist_use:Nn \l__abstract_keywords_clist {\l__keywords_sep_tl}
  }

\newcommand\frontmatter
{
  \clearpage
  \pagenumbering{Roman}
  \cfoot{}
}
\newcommand\mainmatter
{
  \clearpage
  \pagenumbering{arabic}
  \cfoot \thepage
}

\AddToHook{cmd/tableofcontents/after}{\thispagestyle{fancy}}
\RequirePackage{tocloft}
\renewcommand{\contentsname}{\hfill 目\qquad 录\hfill}
\renewcommand \cfttoctitlefont{\sffamily\large}
\dim_set:Nn \cftbeforetoctitleskip {3pt}
\dim_set:Nn \cftaftertoctitleskip {24pt}
\dim_set:Nn \cftbeforechapskip {1pt}
\dim_set:Nn \cftbeforesecskip {-.2pt}
\renewcommand*\l@chapter{\@dottedtocline{1}{0em}{1.6em}}
\renewcommand*\l@section{\@dottedtocline{1}{2.3em}{2.1em}}
\renewcommand*{\@dotsep}{1.7}
\renewcommand*{\@pnumwidth}{2.5ex}
\renewcommand{\cftchapfont}{\normalfont}
\setcounter{tocdepth}{1}

\endinput
