% Copyright 2026 Open-Guji (https://github.com/open-guji)
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
%     http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.

% luatex-cn-core.sty
% Core package for luatex-cn
% Includes vertical typesetting and font support
%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}

\ProvidesExplPackage {luatex-cn-core} {2026/08/07} {0.4.1} {Core features for luatex-cn}

% Version info — derived from \ProvidesExplPackage above (single source of truth)
\tl_const:Nn \c_luatexcn_core_version_tl {0.4.1}
\tl_const:Nn \c_luatexcn_core_date_tl {2026/08/07}

% Check if LuaTeX is being used
\sys_if_engine_luatex:TF
  { }
  {
    \PackageError { luatex-cn-core } { This~package~requires~LuaTeX }
      { Please~compile~your~document~with~LuaLaTeX~instead~of~pdfLaTeX~or~XeLaTeX. }
  }

% ============================================================================
% Load Core Dependencies
% ============================================================================

% Centralized debugging module
\RequirePackage{debug/luatex-cn-debug}

% Load luatexbase for attributes
\RequirePackage{luatexbase}
\RequirePackage{xcolor}

% Load core modules in order
\RequirePackage{core/luatex-cn-core-base}
\RequirePackage{core/luatex-cn-core-metadata}
\RequirePackage{core/luatex-cn-core-document}  % Document-level style (NEW)
\RequirePackage{core/luatex-cn-core-page}
\RequirePackage{core/luatex-cn-core-content}
\RequirePackage{core/luatex-cn-core-paragraph}
\RequirePackage{core/luatex-cn-core-settings}
\RequirePackage{core/luatex-cn-core-sidenote}
\RequirePackage{core/luatex-cn-core-textbox}
\RequirePackage{core/luatex-cn-core-column}
\RequirePackage{core/luatex-cn-core-style}
\RequirePackage{core/luatex-cn-core-section}
\RequirePackage{core/luatex-cn-core-punct}
\RequirePackage{core/luatex-cn-core-table}
\RequirePackage{core/luatex-cn-core-export}
\RequirePackage{decorate/luatex-cn-decorate}
\RequirePackage{decorate/luatex-cn-linemark}
\RequirePackage{decorate/luatex-cn-gongche}
\RequirePackage{banxin/luatex-cn-banxin}

% Font auto-detection module
\RequirePackage{fonts/luatex-cn-font-autodetect}



\cs_new:Npn \luatexcncoreversion { \c_luatexcn_core_version_tl }

% Print banner to terminal for easy debugging
\typeout{*************************************}
\typeout{*~luatex-cn~v\tl_use:N \c_luatexcn_core_version_tl \space (\tl_use:N \c_luatexcn_core_date_tl)}
\typeout{*~https://github.com/open-guji/luatex-cn}
\typeout{*************************************}

\ExplSyntaxOff

% Support CJK environment alias for core LaTeX environments
\NewEnvironmentCopy{列表}{itemize}

\endinput
