summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-11 22:25:18 +0000
committerKarl Berry <karl@freefriends.org>2020-04-11 22:25:18 +0000
commitc22890c46ab250bf72693f78d290576c71c3f46b (patch)
tree4c6e3d20d6b868a4abadd943276dd849ec436fb3 /Master/texmf-dist/source
parenta77b88f2b97d4d2363865d5d14c9a82634972fd4 (diff)
zhlipsum (10apr20)
git-svn-id: svn://tug.org/texlive/trunk@54661 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/zhlipsum/zhlipsum-text.dtx2
-rw-r--r--Master/texmf-dist/source/latex/zhlipsum/zhlipsum.dtx328
-rw-r--r--Master/texmf-dist/source/latex/zhlipsum/zhlipsum.ins4
3 files changed, 156 insertions, 178 deletions
diff --git a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum-text.dtx b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum-text.dtx
index 8a314fb10c5..ef9fc2903f4 100644
--- a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum-text.dtx
+++ b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum-text.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>
+% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
diff --git a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.dtx b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.dtx
index 3ef3fd63a81..f6e0c1b1181 100644
--- a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.dtx
+++ b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>
+% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
@@ -71,8 +71,8 @@ To install `zhlipsum`, you can use one of the following methods:
Contributing
------------
-[Issues](https://github.com/Stone-Zeng/zhlipsum/issues) and
-[pull requests](https://github.com/Stone-Zeng/zhlipsum/pulls)
+[Issues](https://github.com/stone-zeng/zhlipsum/issues) and
+[pull requests](https://github.com/stone-zeng/zhlipsum/pulls)
are always welcome.
License
@@ -85,7 +85,7 @@ version.
-----
-Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
+Copyright (C) 2017&ndash;2020 by Xiangdong Zeng <xdzeng96@gmail.com>.
%</readme>
%
%<*internal>
@@ -102,7 +102,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
\preamble
- Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>
+ Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
@@ -183,7 +183,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\RequirePackage{expl3}
%<*!(driver|install)>
-%<!readme>\GetIdInfo $Id: zhlipsum.dtx 1.1.1 2018-09-08 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $
+%<!readme>\GetIdInfo $Id: zhlipsum.dtx 1.2.0 2020-04-10 12:00:00Z Xiangdong Zeng <xdzeng96@gmail.com> $
%<package> {Chinese dummy text}
%<package>\ProvidesExplPackage{\ExplFileName}
%<utf8> {Chinese dummy text with UTF-8 encoding (for zhlipsum)}
@@ -195,12 +195,12 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%<!readme> {\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
%</!(driver|install)>
%<*driver>
-%\PassOptionsToPackage{showframe}{geometry}
%^^A! \PassOptionsToPackage{scheme=plain, linespread=1.1}{ctex}
%^^A+
\documentclass{ctxdoc}
\usepackage{multirow}
-\setCJKmonofont{FangSong}[ItalicFont=KaiTi]
+\setCJKmainfont{Source Han Serif SC}[ItalicFont=Kaiti SC]
+\setCJKmonofont{STFangsong}[ItalicFont=Kaiti SC]
%^^A-
\hypersetup{%
pdftitle={zhlipsum: 中文乱数假文(Lorem ipsum)},
@@ -219,21 +219,20 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%^^A! \pagestyle{headings}
%^^A+
% Use `!` for comment in `ctexexam`.
-\makeatletter
\catcode`!=\active
\RecustomVerbatimEnvironment{ctexexam}{Verbatim}{%
frame=single, framesep=10pt,
%^^A-
gobble=4,
label=\rule{0pt}{12pt}\textnormal{\bfseries 例 \arabic{ctexexam}},
-%^^A! gobble=2,
-%^^A! label=\rule{0pt}{12pt}\textnormal{\bfseries Example \arabic{ctexexam}},
+ defineactive=\def!{\color{gray}\%},
+%^^A! gobble=2,
+%^^A! label=\rule{0pt}{12pt}\textnormal{\bfseries Example \arabic{ctexexam}},
+%^^A! defineactive=\def!{\color{gray}\itshape\%},
%^^A+
listparameters=%
\setlength\topsep{\bigskipamount}%
- \refstepcounter{ctexexam}\ctexexamlabelref
- \appto\FV@EndList{\nointerlineskip},
- defineactive=\def!{\color{gray}\itshape\%}}
+ \refstepcounter{ctexexam}\ctexexamlabelref}
\preto\ctexexam{\catcode`!=\active}
\preto\endctexexam{\catcode`!=12}
\catcode`!=12
@@ -252,17 +251,6 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
}
\group_end:
}
-% From l3doc, to make @@ -> <module> while @@@@ -> @@
-\cs_set_protected:Npn \__ctxdoc_replace_at_at_aux:Nn #1#2
- {
- \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ }
- \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ }
- \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a }
- \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 }
- \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 }
- \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 }
- \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ }
- }
\ExplSyntaxOff
\makeatother
\RenewDocumentEnvironment{arguments}{}%
@@ -313,12 +301,12 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%
% \title{\textbf{zhlipsum: 中文乱数假文(Lorem ipsum)}}
% \author{曾祥东}
-% \date{2018/09/08 \quad v1.1.1^^A
-% \thanks{\url{https://github.com/Stone-Zeng/zhlipsum}.}}
+% \date{2020/04/10 \quad v1.2.0^^A
+% \thanks{\url{https://github.com/stone-zeng/zhlipsum}.}}
%^^A! \title{\textbf{The \pkg{zhlipsum} Package: Chinese Dummy Text}}
%^^A! \author{Xiangdong Zeng}
-%^^A! \date{2018/09/08 \quad v1.1.1%
-%^^A! \thanks{\url{https://github.com/Stone-Zeng/zhlipsum}.}}
+%^^A! \date{2020/04/10 \quad v1.2.0%
+%^^A! \thanks{\url{https://github.com/stone-zeng/zhlipsum}.}}
%^^A!
%
%^^A 标题页页边距
@@ -432,8 +420,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%^^A!
%
% 如果使用了 \CTeX{} 宏集,则编码会根据 \CTeX{} 自动确定。但需注意,
-% 在 \CTeX{} 宏集中,相应的宏包选项为 \opt{UTF8} 和 \opt{GBK},而本
-% 宏包中所有选项均为小写。
+% 在 \CTeX{} 宏集中,相应的宏包选项为大写的 \opt{UTF8} 和 \opt{GBK},
+% 而本宏包中所有选项均为小写。
%^^A! If you have loaded \CTeX{} bundle, then the encoding will be
%^^A! selected automatically according to \CTeX{}. Note that in \CTeX{}
%^^A! bundle, the correspoding options are \opt{UTF8} and \opt{GBK},
@@ -441,7 +429,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%^^A!
%
%^^A+
-% \begin{function}[updated=2018-04-08]{\zhlipsum}
+% \begin{function}[updated=2020-04-08]{\zhlipsum}
%^^A-
% \begin{syntax}
% \cs{zhlipsum}\oarg{段落}\oarg{选项}
@@ -460,11 +448,11 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%^^A! \end{function}
%^^A!
%
-% 默认情况下,不带星号的命令 \cs{zhlipsum} 会在假文段落之前、之后与
-% 之间进行分段(即插入 \tn{par}),而带星号的命令 \cs{zhlipsum}|*|
+% 默认情况下,不带星号的命令 \cs{zhlipsum} 会在假文段落之后与之间
+% 进行分段(即插入 \tn{par}),而带星号的命令 \cs{zhlipsum}|*|
% 则不做额外处理。您可以利用后文给出的 \opt{before}、\opt{after}、
% \opt{inter} 选项来更改默认设置。
-%^^A! By default, the \cs{zhlipsum} command will insert \tn{par} before,
+%^^A! By default, the \cs{zhlipsum} command will insert \tn{par}
%^^A! after and between dummy text paragraphs, while \cs{zhlipsum}|*|
%^^A! will not give any extra processing. To change the default
%^^A! behavior, you can use the \opt{before}, \opt{after} and
@@ -577,17 +565,17 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% \begin{function}[added=2018-03-29]{before,after,inter}
%^^A-
% \begin{syntax}
-% name = \meta{内容}
-% after = \meta{内容}
-% inter = \meta{内容}
+% before = \meta{内容}
+% after = \meta{内容}
+% inter = \meta{内容}
% \end{syntax}
% 在假文段落之前、之后与之间插入内容。注意使用不带星号的
% \cs{zhlipsum} 命令时插入的分段命令会被这里的设置覆盖。
% \end{function}
%^^A! \begin{syntax}
-%^^A! name = \meta{content}
-%^^A! after = \meta{content}
-%^^A! inter = \meta{content}
+%^^A! before = \meta{content}
+%^^A! after = \meta{content}
+%^^A! inter = \meta{content}
%^^A! \end{syntax}
%^^A! Insert contents before, after or between dummy text paragraphs.
%^^A! Note that the \tn{par} command inserted when using \cs{zhlipsum}
@@ -767,8 +755,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% ! \usepackage[encoding=big5]{zhlipsum}
%
% ! 直接使用 \newzhlipsum{big5}{許蓋功, 蓋功許, 功許蓋} 会报错
-% ! 原理:在分组内用 <、>、+ 代替 {、}、\,再将原先的 {、}、\ 设为“其他”
-% ! 类(即类别码为 12)
+% ! 原理:分组内使用 < > + 代替 { } \ 后,再将原先的 { } \ 设为“其他”类(即
+% ! 类别码为 12)
% \begingroup
% \catcode`\<=1
% \catcode`\>=2
@@ -786,7 +774,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%^^A!
%^^A! ! Using `\newzhlipsum{big5}{許蓋功, 蓋功許, 功許蓋}' directly will
%^^A! ! lead to an error.
-%^^A! ! Use <, >, + to replace {, } and \, and set the original {, } and \
+%^^A! ! Use <, >, + to replace {, } and \, then set the original {, } and \
%^^A! ! to be `other' category (i.e. catcode=12).
%^^A! \begingroup
%^^A! \catcode`\<=1
@@ -833,19 +821,17 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%
% \subsection{内部变量和函数}
%
-% \begin{variable}{\l_@@_tmpa_tl,\l_@@_tmpa_seq,\l_@@_tmpb_seq}
+% \begin{variable}{
+% \l_@@_tmpa_tl,
+% \l_@@_tmpa_seq,
+% \l_@@_tmpb_seq,
+% \l_@@_tmpa_str}
% 临时变量。
% \begin{macrocode}
\tl_new:N \l_@@_tmpa_tl
\seq_new:N \l_@@_tmpa_seq
\seq_new:N \l_@@_tmpb_seq
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{variable}{\g_@@_encoding_tl}
-% 编码信息。
-% \begin{macrocode}
-\tl_new:N \g_@@_encoding_tl
+\str_new:N \l_@@_tmpa_str
% \end{macrocode}
% \end{variable}
%
@@ -859,56 +845,64 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% \begin{variable}{\c_zhlipsum_simp_seq,\c_zhlipsum_trad_seq}
% 预定义的简体中文与繁体中文的假文名称列表。
% \begin{macrocode}
-\seq_new:N \c_zhlipsum_simp_seq
-\seq_new:N \c_zhlipsum_trad_seq
-\seq_set_from_clist:Nn \c_zhlipsum_simp_seq { simp, zhufu, aspirin }
-\seq_set_from_clist:Nn \c_zhlipsum_trad_seq { trad, xiangyu, nanshanjing }
+\seq_const_from_clist:Nn \c_zhlipsum_simp_seq { simp, zhufu, aspirin }
+\seq_const_from_clist:Nn \c_zhlipsum_trad_seq { trad, xiangyu, nanshanjing }
% \end{macrocode}
% \end{variable}
%
+% \begin{macro}[int]{\file_input:x}
% \LaTeX3 函数变体。
% \begin{macrocode}
\cs_generate_variant:Nn \file_input:n { x }
-\prg_generate_conditional_variant:Nnn \tl_if_eq:nn { Vn } { T, TF }
% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}[int,TF]{\@@_if_unicode_engine:}
+% \begin{macro}[TF]{\@@_if_unicode_engine:}
% 判断是否为 Unicode 引擎。来自于 \pkg{zhnumber} 宏包。
% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \@@_if_unicode_engine: { T, F, TF }
+\prg_new_conditional:Npnn \@@_if_unicode_engine: { T, F, TF }
{
\bool_lazy_any:nTF
{
- { \sys_if_engine_xetex_p: }
- { \sys_if_engine_luatex_p: }
- { \sys_if_engine_uptex_p: }
+ \sys_if_engine_xetex_p:
+ \sys_if_engine_luatex_p:
+ \sys_if_engine_uptex_p:
}
- { \prg_return_true: }
- { \prg_return_false: }
+ { \prg_return_true: } { \prg_return_false: }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}[TF]{\@@_if_encoding:n}
+% \begin{variable}{\g_@@_encoding_str}
% 判断当前编码。
% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \@@_if_encoding:n #1 { T, F, TF }
+\prg_new_conditional:Npnn \@@_if_encoding:n #1 { T, F, TF }
{
- \tl_if_eq:VnTF \g_@@_encoding_tl {#1}
+ \str_if_eq:VnTF \g_@@_encoding_str {#1}
{ \prg_return_true: } { \prg_return_false: }
}
+\prg_generate_conditional_variant:Nnn \@@_if_encoding:n { V } { T, F, TF }
+\str_new:N \g_@@_encoding_str
% \end{macrocode}
+% \end{variable}
% \end{macro}
%
-% \begin{macro}{\@@_msg_new:nn,
-% \@@_error:n,\@@_error:nn,
-% \@@_warning:nn,\@@_warning:nnn,\@@_warning:nxxx,
+% \begin{macro}{
+% \@@_msg_new:nn,
+% \@@_error:n,
+% \@@_error:nn,
+% \@@_warning:n,
+% \@@_warning:nn,
+% \@@_warning:nnn,
+% \@@_warning:nxxx,
% \@@_info:nn}
% 各种信息函数的缩略形式。
% \begin{macrocode}
\cs_new:Npn \@@_msg_new:nn { \msg_new:nnn { zhlipsum } }
\cs_new:Npn \@@_error:n { \msg_error:nn { zhlipsum } }
\cs_new:Npn \@@_error:nn { \msg_error:nnn { zhlipsum } }
+\cs_new:Npn \@@_warning:n { \msg_warning:nn { zhlipsum } }
\cs_new:Npn \@@_warning:nn { \msg_warning:nnn { zhlipsum } }
\cs_new:Npn \@@_warning:nnn { \msg_warning:nnnn { zhlipsum } }
\cs_new:Npn \@@_warning:nxxx { \msg_warning:nnxxx { zhlipsum } }
@@ -916,17 +910,12 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_par:}
-% 分段命令。
-% \begin{macrocode}
-\cs_new_eq:NN \@@_par: \tex_par:D
-% \end{macrocode}
-% \end{macro}
-%
% \subsection{宏包选项}
%
% \changes{v0.4}{2017/09/16}{新增 \opt{encoding} 选项。}
% \changes{v0.5}{2017/12/22}{支持 Big5 编码。}
+% \changes{v1.0.0}{2018/04/01}{根据 \CTeX{} 宏集的选项自动确定编码。}
+% \changes{v1.2.0}{2020/02/20}{优化编码判断。}
%
% \begin{macro}{encoding}
% 设置编码。
@@ -935,19 +924,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
{
encoding .choices:nn =
{ utf8, gbk, big5 }
- {
- \tl_gset_eq:NN \g_@@_encoding_tl \l_keys_choice_tl
- \@@_if_unicode_engine:T
- {
- \@@_if_encoding:nF { utf8 }
- {
- \tl_gset:Nn \g_@@_encoding_tl { utf8 }
- \@@_warning:nn { unicode-engine } {#1}
- }
- }
- \@@_if_ctex_valid_encoding:F
- { \@@_error:nn { ctex-invalid-encoding } {#1} }
- },
+ { \str_gset:Nn \g_@@_encoding_str {#1} },
encoding / unknown .code:n =
{ \@@_error:nn { invalid-encoding } {#1} },
encoding .value_required:n = true,
@@ -962,64 +939,78 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%
% 提示信息。
% \begin{macrocode}
-\@@_msg_new:nn { unicode-engine }
- {
- You~ are~ now~ using~ Unicode~ engine~ \c_sys_engine_str. \\
- Encoding~ "#1"~ is~ invalid.~ Changed~ into~ "utf8".
- }
-\@@_msg_new:nn { ctex-invalid-encoding }
- {
- Package~ option~ "encoding=#1"~ is~ in~ conflict~ with~ ctex's~
- option~ "\tl_use:N \l__ctex_encoding_tl".\\\\
- Please~ check~ the~ package~ options.
- }
\@@_msg_new:nn { invalid-encoding }
{
- Encoding~ "#1"~ is~ invalid. \\
- Available~ encodings~ are~ "utf8",~ "gbk"~ and~ "big5".
+ Encoding~"#1"~is~invalid. \\
+ Available~encodings~are~"utf8",~"gbk"~and~"big5".
}
\@@_msg_new:nn { unknown-option }
- { Package~ option~ "\l_keys_key_tl"~ is~ unknown. }
+ { Package~option~'\l_keys_key_tl'~is~unknown. }
% \end{macrocode}
%
-% \changes{v1.0.0}{2018/04/01}{根据 \CTeX{} 宏集的选项自动确定编码。}
-%
-% \begin{macro}[TF]{\@@_if_ctex_valid_encoding:}
-% 检查 \CTeX{} 编码。
+% \begin{macro}{\@@_check_unicode_engine_encoding:}
+% Unicode 引擎下编码始终设为 UTF-8。
% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \@@_if_ctex_valid_encoding: { F }
+\cs_new_protected:Npn \@@_check_unicode_engine_encoding:
{
- \tl_if_exist:NTF \l__ctex_encoding_tl
+ \@@_if_unicode_engine:T
{
- \tl_set:Nx \l_@@_tmpa_tl
- { \str_lower_case:f { \l__ctex_encoding_tl } }
- \str_if_eq:NNTF \g_@@_encoding_tl \l_@@_tmpa_tl
- { \prg_return_true: } { \prg_return_false: }
+ \str_if_empty:NF \g_@@_encoding_str
+ {
+ \@@_if_encoding:nF { utf8 }
+ { \@@_warning:n { unicode-engine } }
+ }
+ \str_gset:Nn \g_@@_encoding_str { utf8 }
}
- { \prg_return_true: }
+ }
+\@@_msg_new:nn { unicode-engine }
+ {
+ You~are~now~using~Unicode~engine~\c_sys_engine_str\c_space_tl~so~
+ encoding~"\g_@@_encoding_str"~is~invalid. \\
+ Changed~into~"utf8".
}
% \end{macrocode}
% \end{macro}
%
-% 如果调用了 \CTeX{} 宏集,则自动确定编码;否则默认设为 UTF-8。
+% \begin{macro}{\@@_check_ctex_encoding:}
+% 如果调用了 \CTeX{} 宏集,则自动确定编码。
% \begin{macrocode}
-\tl_if_exist:NTF \l__ctex_encoding_tl
+\cs_new_protected:Npn \@@_check_ctex_encoding:
{
- \tl_if_eq:VnTF \l__ctex_encoding_tl { UTF8 }
- { \tl_gset:Nn \g_@@_encoding_tl { utf8 } }
+ \tl_if_exist:NT \l__ctex_encoding_tl
{
- \tl_if_eq:VnT \l__ctex_encoding_tl { GBK }
- { \tl_gset:Nn \g_@@_encoding_tl { gbk } }
+ \str_set:Nx \l_@@_tmpa_str
+ { \str_lower_case:f { \l__ctex_encoding_tl } }
+ \str_if_empty:NF \g_@@_encoding_str
+ {
+ \@@_if_encoding:VF \l_@@_tmpa_str
+ { \@@_warning:n { ctex-encoding-conflict } }
+ }
+ \str_gset_eq:NN \g_@@_encoding_str \l_@@_tmpa_str
}
}
- { \tl_gset:Nn \g_@@_encoding_tl { utf8 } }
+\@@_msg_new:nn { ctex-encoding-conflict }
+ {
+ Package~option~"encoding=\g_@@_encoding_str"~is~in~conflict~with~
+ ctex's~option~"\l__ctex_encoding_tl". \\
+ Changed~into~"encoding=\l_@@_tmpa_str".
+ }
% \end{macrocode}
+% \end{macro}
%
% 将宏包选项传给 |zhlipsum/option|。
% \begin{macrocode}
\ProcessKeysOptions { zhlipsum / option }
% \end{macrocode}
%
+% 检查编码兼容性。
+% \begin{macrocode}
+\@@_check_unicode_engine_encoding:
+\@@_check_ctex_encoding:
+\str_if_empty:NT \g_@@_encoding_str
+ { \str_gset:Nn \g_@@_encoding_str { utf8 } }
+% \end{macrocode}
+%
% \subsection{函数选项}
%
% \begin{variable}{\l_@@_name_tl}
@@ -1063,8 +1054,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% \end{macrocode}
% \end{macro}
%
-% \changes{v0.5}{2017/12/22}{新增选项 \opt{script},同时支持简体中文
-% 和繁体中文。}
+% \changes{v0.5}{2017/12/22}{新增选项 \opt{script},同时支持简体中文和繁体中文。}
% \changes{v1.0.0}{2018/03/24}{\opt{script} 成为过时选项。}
%
% \begin{macro}{script}
@@ -1112,57 +1102,55 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%
% \subsection{输出假文}
%
-% \begin{macro}{\zhlipsum}
+% \begin{macro}{\zhlipsum,\@@:n}
% \changes{v0.5}{2018/01/05}{支持选项设置。}
-% \changes{v1.0.0}{2018/03/23}{更改参数形式,允许利用逗号分隔列表选择
-% 段落。}
+% \changes{v1.0.0}{2018/03/23}{更改参数形式,允许利用逗号分隔列表选择段落。}
% \changes{v1.1.0}{2018/04/08}{改回使用方括号指定段落数的形式。}
-% 输出假文,第一个可选参数表示段落数,默认为 |1-3|;第二个可选参数为选
-% 项列表。
+% \changes{v1.2.0}{2020/04/08}{修正 \env{quote}/\env{quotation} 等环境中段落缩进消失问题。}
+% \changes{v1.2.0}{2020/04/08}{与 \pkg{lipsum} 等宏包保持一致,不在开头插入分段命令。}
+% 输出假文,第一个可选参数表示段落数,默认为 |1-3|;第二个可选参数为选项列表。
% \begin{macrocode}
\NewDocumentCommand \zhlipsum { s o +o }
{
\group_begin:
\IfBooleanF {#1}
{
- \tl_set:Nn \l_@@_before_tl { \@@_par: }
- \tl_set:Nn \l_@@_after_tl { \@@_par: }
- \tl_set:Nn \l_@@_inter_tl { \@@_par: }
+ \tl_set:Nn \l_@@_before_tl { }
+ \tl_set:Nn \l_@@_after_tl { \par }
+ \tl_set:Nn \l_@@_inter_tl { \par }
}
\IfValueTF {#3}
{
\keys_set:nn { zhlipsum } {#3}
- \zhlipsum_use:Vn \l_@@_name_tl {#2}
+ \@@:n {#2}
}
{
\IfValueTF {#2}
{
% \end{macrocode}
-% 如果只带一个参数,那么根据其是否含有 |=| 来判断该参数是段落数还是
-% 选项列表。
+% 如果只带一个参数,那么根据其是否含有 |=| 来判断该参数是段落数还是选项列表。
% \begin{macrocode}
\@@_if_key_value_list:nTF {#2}
{
\keys_set:nn { zhlipsum } {#2}
- \zhlipsum_use:Vn \l_@@_name_tl { 1 - 3 }
+ \@@:n { 1 - 3 }
}
- { \zhlipsum_use:Vn \l_@@_name_tl {#2} }
+ { \@@:n {#2} }
}
- { \zhlipsum_use:Vn \l_@@_name_tl { 1 - 3 } }
+ { \@@:n { 1 - 3 } }
}
\group_end:
}
+\cs_new_protected:Npn \@@:n #1
+ { \exp_args:No \zhlipsum_use:nn { \l_@@_name_tl } {#1} }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[TF]{\@@_if_key_value_list:n}
+% \begin{macro}{\@@_if_key_value_list:nTF}
% 判断是否为键值列表,即是否含有 |=|。
% \begin{macrocode}
-\prg_new_protected_conditional:Npnn \@@_if_key_value_list:n #1 { TF }
- {
- \tl_if_in:nnTF {#1} { = }
- { \prg_return_true: } { \prg_return_false: }
- }
+\cs_new_protected:Npn \@@_if_key_value_list:nTF #1
+ { \tl_if_in:nnTF {#1} {=} }
% \end{macrocode}
% \end{macro}
%
@@ -1173,7 +1161,8 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\zhlipsum_use:nn,\zhlipsum_use:Vn}
+% \begin{macro}{\zhlipsum_use:nn}
+% \changes{v1.2.0}{2019/08/11}{检查空的段落范围避免陷入死循环。}
% 输出多段假文。|#1| = 假文名称,|#2| = 段落编号列表。解析段落编号之
% 后,按次序逐项输出,并在前后插入相应内容。注意最后一段需要单独处理。
% \begin{macrocode}
@@ -1184,33 +1173,34 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
\zhlipsum_if_exist:nTF {#1}
{
\@@_parse_par:nn {#1} {#2}
- \seq_pop_right:NN \l_@@_par_num_seq \l_@@_tmpa_tl
- \tl_use:N \l_@@_before_tl
- \seq_map_inline:Nn \l_@@_par_num_seq
+ \seq_if_empty:NF \l_@@_par_num_seq
{
- \@@_use:nn {#1} {##1}
- \tl_use:N \l_@@_inter_tl
+ \seq_pop_right:NN \l_@@_par_num_seq \l_@@_tmpa_tl
+ \l_@@_before_tl
+ \seq_map_inline:Nn \l_@@_par_num_seq
+ {
+ \@@_use:nn {#1} {##1}
+ \l_@@_inter_tl
+ }
+ \@@_use:nn {#1} { \l_@@_tmpa_tl }
+ \l_@@_after_tl
}
- \@@_use:nn {#1} { \tl_use:N \l_@@_tmpa_tl }
- \tl_use:N \l_@@_after_tl
}
{ \@@_error:nn { invalid-name } {#1} }
}
{ \@@_error:n { CJK-invalid-encoding } }
}
-\cs_generate_variant:Nn \zhlipsum_use:nn { Vn }
\@@_msg_new:nn { invalid-name }
{
- Name~ "#1"~ is~ unknown. \\\\
+ Name~ "#1"~ is~ unknown. \\
Please~ use~ the~ pre-defined~ Chinese~ dummy~ texts~ or~
declare~ new~ one.
}
\@@_msg_new:nn { CJK-invalid-encoding }
{
- The~ current~ CJK~ environment~ uses~ "\tl_use:N \CJK@@@@@enc"~
- encoding,\\
+ The~ current~ CJK~ environment~ uses~ "\CJK@@@@@enc"~ encoding,~
but~ zhlipsum~ package~ has~ been~ loaded~ with~ the~ option~
- "encoding=\tl_use:N \g_@@_encoding_tl".\\\\
+ "encoding=\g_@@_encoding_str". \\
Please~ check~ the~ package~ options.
}
% \end{macrocode}
@@ -1223,25 +1213,13 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
{
\tl_if_exist:NTF \CJK@@@@@enc
{
- \tl_set:Nx \l_@@_tmpa_tl { \str_lower_case:f { \CJK@@@@@enc } }
-% TODO: str or tl?
- \str_if_eq:NNTF \g_@@_encoding_tl \l_@@_tmpa_tl
- { \prg_return_true: }
+ \exp_args:NV \str_case:nn \g_@@_encoding_str
{
- \@@_if_encoding:nTF { gbk }
- {
- \str_if_eq:VnTF \l_@@_tmpa_tl { gb }
- { \prg_return_true: } { \prg_return_false: }
- }
- {
- \@@_if_encoding:nTF { big5 }
- {
- \str_if_eq:VnTF \l_@@_tmpa_tl { bg5 }
- { \prg_return_true: } { \prg_return_false: }
- }
- { \prg_return_false: }
- }
+ { utf8 } { \str_if_eq:VnTF \CJK@@@@@enc { UTF8 } }
+ { gbk } { \str_if_in:NnTF \CJK@@@@@enc { GB } }
+ { big5 } { \str_if_eq:VnTF \CJK@@@@@enc { Bg5 } }
}
+ { \prg_return_true: } { \prg_return_false: }
}
{ \prg_return_true: }
}
@@ -1288,7 +1266,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
\clist_map_inline:nn {#2}
{
\@@_parse_par_aux:n {##1}
- \bool_if:NTF \l@@_invalid_range_bool
+ \bool_if:NTF \l_@@_invalid_range_bool
{ \@@_warning:nnn { invalid-range } {##1} {#2} }
{
\bool_if:NT \l_@@_modified_range_bool
@@ -1449,7 +1427,7 @@ Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>.
%
% 根据编码读入假文文本定义文件。
% \begin{macrocode}
-\file_input:x { zhlipsum- \g_@@_encoding_tl .def }
+\file_input:x { zhlipsum- \g_@@_encoding_str .def }
%</package>
% \end{macrocode}
%
diff --git a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.ins b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.ins
index ebee71c7d60..231a01d98e0 100644
--- a/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.ins
+++ b/Master/texmf-dist/source/latex/zhlipsum/zhlipsum.ins
@@ -6,7 +6,7 @@
%%
%% zhlipsum.dtx (with options: `install')
%%
-%% Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>
+%% Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -39,7 +39,7 @@
\preamble
- Copyright (C) 2017, 2018 by Xiangdong Zeng <xdzeng96@gmail.com>
+ Copyright (C) 2017--2020 by Xiangdong Zeng <xdzeng96@gmail.com>
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either