summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-28 20:46:50 +0000
committerKarl Berry <karl@freefriends.org>2021-07-28 20:46:50 +0000
commit3852dfa87b96bfd1be37ecbcbd5441d0f1ed34e0 (patch)
treea263ee371cf5f89cdc4775dbc7cd692d095b9646
parent0f5bd79518a904915f525ae67748373aa4822852 (diff)
lipsum (28jul21)
git-svn-id: svn://tug.org/texlive/trunk@60101 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/lipsum/CHANGELOG.md12
-rw-r--r--Master/texmf-dist/doc/latex/lipsum/DEPENDS.txt1
-rw-r--r--Master/texmf-dist/doc/latex/lipsum/lipsum.pdfbin644963 -> 650355 bytes
-rw-r--r--Master/texmf-dist/source/latex/lipsum/lipsum.dtx125
-rw-r--r--Master/texmf-dist/tex/latex/lipsum/lipsum.sty87
5 files changed, 177 insertions, 48 deletions
diff --git a/Master/texmf-dist/doc/latex/lipsum/CHANGELOG.md b/Master/texmf-dist/doc/latex/lipsum/CHANGELOG.md
index a9010903f4c..379801f73f6 100644
--- a/Master/texmf-dist/doc/latex/lipsum/CHANGELOG.md
+++ b/Master/texmf-dist/doc/latex/lipsum/CHANGELOG.md
@@ -3,7 +3,17 @@ All notable changes to the `lipsum` bundle since mid-2021 will be
documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
-this project uses date-based 'snapshot' version identifiers.
+and this project uses major+minor version identifiers.
+
+## [v2.5]
+
+### Fixed
+- Language 'latin' undefined error with LuaTeX (gh/6).
+
+### Changed
+- Require `babel` for language-specific hyphenation patterns (gh/6).
+- In case a language is unknown, just warn instead of an error (gh/8).
+- Use `\par` by default in `par-sep` rather than `par-end` (gh/7).
## [v2.4]
diff --git a/Master/texmf-dist/doc/latex/lipsum/DEPENDS.txt b/Master/texmf-dist/doc/latex/lipsum/DEPENDS.txt
index 574e1c1ca4b..df6e9d50dde 100644
--- a/Master/texmf-dist/doc/latex/lipsum/DEPENDS.txt
+++ b/Master/texmf-dist/doc/latex/lipsum/DEPENDS.txt
@@ -1 +1,2 @@
hard l3kernel
+soft babel
diff --git a/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf b/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf
index 4186c1880fd..c27ddc7e8b4 100644
--- a/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf
+++ b/Master/texmf-dist/doc/latex/lipsum/lipsum.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/lipsum/lipsum.dtx b/Master/texmf-dist/source/latex/lipsum/lipsum.dtx
index 8a20f78de8d..63717374142 100644
--- a/Master/texmf-dist/source/latex/lipsum/lipsum.dtx
+++ b/Master/texmf-dist/source/latex/lipsum/lipsum.dtx
@@ -15,8 +15,8 @@
% Please send error reports and suggestions for improvements to
% https://github.com/PhelypeOleinik/lipsum
%
-\def\lipsumversion{2.4}
-\def\lipsumdate{2021-06-03}
+\def\lipsumversion{2.5}
+\def\lipsumdate{2021-07-28}
%<*driver>
\ProvidesFile{lipsum.dtx}%
[\lipsumdate\space v\lipsumversion\space
@@ -467,6 +467,12 @@
% disable automatic language switching with
% |\setlipsum{auto-lang=false}|.
%
+% \pkg{lipsum} relies on \pkg{babel}'s \cs{hyphenrules} command to
+% change the hyphenation patterns, thus it requires \pkg{babel} to be
+% loaded in the document if |auto-lang=true|. If \pkg{babel} is not
+% loaded, a warning is printed and the default language is used for
+% hyphenation instead.
+%
% The language is defined individually for each dummy text
% \secref{sec:other-texts}, but you may change it for the current dummy
% text by using |\setlipsum{language=|\meta{lang}|}|. If you load
@@ -1252,29 +1258,29 @@
%
% \begin{macro}{\@@_set_hyphens:,\@@_restore_hyphens:}
% Selects the hyphenation patterns for the language of the dummy text,
-% using \pkg{babel}'s \cs{hyphenrules} if that's defined (when
-% \pkg{babel} is loaded) or using \cs{language}\cs{l@\meta{lang}}
-% otherwise. The hyphenation patterns are properly restored by
+% using \pkg{babel}'s \cs{hyphenrules} if that's defined.
+% If \cs{hyphenrules} doesn't exist (thus \pkg{babel} not loaded),
+% call \cs{@@_set_hyphens_babel_missing:} which will behave in a
+% slightly different way if encountered in the preamble or in the
+% document body. The hyphenation patterns are properly restored by
% \cs{@@_restore_hypehens:} when the text ends.
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_hyphens:
{
\bool_if:NTF \l_@@_autolang_bool
- { \use:x } { \use_none:n }
+ { \use:n } { \use_none:n }
{
\cs_if_exist:NTF \hyphenrules
{
- \exp_not:N \hyphenrules { \g_@@_language_tl }
- \cs_set_protected:Npn \@@_restore_hyphens:
- { \exp_not:N \hyphenrules { \languagename } }
- }
- {
\cs_if_exist:cTF { l@ \g_@@_language_tl }
- { \language \use:c { l@ \g_@@_language_tl } }
- { \msg_error:nn { lipsum } { language-undefined } }
- \cs_set_protected:Npn \@@_restore_hyphens:
- { \language \int_eval:n { \language } \scan_stop: }
+ {
+ \exp_args:NV \hyphenrules \g_@@_language_tl
+ \cs_set_protected:Npx \@@_restore_hyphens:
+ { \exp_not:N \hyphenrules { \languagename } }
+ }
+ { \@@_missing_language_warning: }
}
+ { \@@_set_hyphens_babel_missing: }
}
}
\cs_new_protected:Npn \@@_restore_hyphens:
@@ -1282,6 +1288,48 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\@@_set_hyphens_babel_missing:}
+% In the document preamble this emits a warning telling the user that
+% the proper hyphenations can't be used because \pkg{babel} isn't
+% loaded, then shut up for the rest of the preamble. In the document
+% body however, this is more serious, so we give a final warning and
+% deactivate automatic hyphenation setting.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_set_hyphens_babel_missing:
+ {
+ \msg_warning:nnn { lipsum } { missing-babel } { preamble }
+ \cs_gset_eq:NN \@@_set_hyphens_babel_missing: \prg_do_nothing:
+ }
+\AtBeginDocument
+ {
+ \cs_gset_protected:Npx \@@_set_hyphens_babel_missing:
+ {
+ \@ifpackageloaded { babel }
+ { \msg_error:nnn { lipsum } { missing-babel } { impossible } }
+ { \msg_warning:nnn { lipsum } { missing-babel } { document } }
+ \setlipsum { auto-lang = false }
+ }
+ }
+\cs_if_exist:NT \DeclareHookRule
+ { \DeclareHookRule { begindocument } { lipsum } { after } { babel } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_missing_language_warning:}
+% Warn the user about an unknown/missing language. Most of the time
+% the issue is a minimal installation that doesn't have Latin, but
+% sometimes it may be a typo. Regardless of the case, warn the user
+% then change the lanugage to \cs{languagename} so the warning appears
+% only once, at least until it is changed again.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_missing_language_warning:
+ {
+ \msg_warning:nn { lipsum } { missing-language }
+ \tl_gset_eq:NN \g_@@_language_tl \languagename
+ }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\NewLipsumPar}
% Developer-Level macro to add a paragraph to the dummy text used by
% \cs{lipsum} and related commands. To specify a new dummy text, see
@@ -1333,22 +1381,22 @@
% \LipsumRestoreSentenceList,
% \LipsumRestoreAll,
% }
-% \begin{macro}{\@@_delim_restore:nnnnn}
+% \begin{macro}{\@@_delim_restore:nnn}
% \begin{macro}{\@@_restore_par_list:,\@@_restore_sentence_list:}
% These are some auxiliaries for the package options and for setting
% up the default behaviour.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_delim_restore:nnnnn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \@@_delim_restore:nnn #1 #2 #3
{
\keys_set:nn { lipsum }
{
- #1-before = , #1-begin = , #1-end = {#2}, #1-after = ,
- #1-before* = , #1-begin* = , #1-end* = {#3}, #1-after* = ,
- #1-sep = {#4}, #1-sep* = {#5}
+ #1-before = , #1-begin = , #1-end = , #1-after = ,
+ #1-before* = , #1-begin* = , #1-end* = , #1-after* = ,
+ #1-sep = {#2}, #1-sep* = {#3}
}
}
\cs_new_protected:Nn \@@_restore_sentence_list:
- { \@@_delim_restore:nnnnn { sentence } { } { } { ~ } { ~ } }
+ { \@@_delim_restore:nnn { sentence } { ~ } { ~ } }
\cs_new_eq:NN \@@_restore_par_list: ?
\cs_new_protected:Npn \LipsumRestoreParList
{
@@ -1379,7 +1427,7 @@
{
% \end{macrocode}
% \opt{nopar} is implemented as a choice key instead of a boolean so
-% we can update the separators using \cs{@@_delim_restore:nnnnn}.
+% we can update the separators using \cs{@@_delim_restore:nnn}.
% It's initially false, and the default is |true| so that
% |\usepackage[nopar]{lipsum}| works as it always did.
% \begin{macrocode}
@@ -1387,12 +1435,12 @@
nopar / true .code:n =
{
\cs_gset_protected:Npn \@@_restore_par_list:
- { \@@_delim_restore:nnnnn { par } { } { \par } { ~ } { } }
+ { \@@_delim_restore:nnn { par } { ~ } { \par } }
} ,
nopar / false .code:n =
{
\cs_gset_protected:Nn \@@_restore_par_list:
- { \@@_delim_restore:nnnnn { par } { \par } { } { } { ~ } }
+ { \@@_delim_restore:nnn { par } { \par } { ~ } }
} ,
nopar .initial:n = false ,
nopar .default:n = true ,
@@ -1470,13 +1518,38 @@
% \begin{macrocode}
\msg_new:nnn { lipsum } { invalid-range }
{ Invalid~number~or~range~'#1'. }
-\msg_new:nnn { lipsum } { language-undefined }
- { Language~'\g_@@_language_tl'~undefined. }
\msg_new:nnn { lipsum } { cmd-deprecated }
{
Command~'\iow_char:N\\#1'~deprecated. \\
See~the~lipsum~documentation~for~help.
}
+\msg_new:nnn { lipsum } { missing-babel }
+ {
+ Hyphenation~patterns~for~'\g_@@_language_tl'~
+ cannot~be~used~because~babel~is~not~loaded.~
+ \str_case:nn {#1}
+ {
+ { preamble }
+ { Loading~lipsum~after~babel~should~fix~the~issue. }
+ { document }
+ {
+ The~default~document~language~will~be~used~
+ for~hyphenation~instead.
+ }
+ { impossible }
+ {
+ Something~wrong~happened~and~the~command~
+ \iow_char:N\\hyphenrules~is~not~available. \\ \\
+ Please~report!
+ }
+ }
+ \\ \\ This~message~won't~be~shown~again.
+ }
+\msg_new:nnn { lipsum } { missing-language }
+ {
+ Unknown~language~'\g_@@_language_tl'.~
+ Hyphenation~patterns~for~'\languagename'~will~be~used~instead.
+ }
% \end{macrocode}
%
% \begin{macrocode}
diff --git a/Master/texmf-dist/tex/latex/lipsum/lipsum.sty b/Master/texmf-dist/tex/latex/lipsum/lipsum.sty
index 0d72f0a0820..3615ac74e76 100644
--- a/Master/texmf-dist/tex/latex/lipsum/lipsum.sty
+++ b/Master/texmf-dist/tex/latex/lipsum/lipsum.sty
@@ -21,8 +21,8 @@
%% Please send error reports and suggestions for improvements to
%% https://github.com/PhelypeOleinik/lipsum
%%
-\def\lipsumversion{2.4}
-\def\lipsumdate{2021-06-03}
+\def\lipsumversion{2.5}
+\def\lipsumdate{2021-07-28}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{l3keys2e}
\@ifundefined{NewDocumentCommand}
@@ -256,25 +256,45 @@
\cs_new_protected:Npn \__lipsum_set_hyphens:
{
\bool_if:NTF \l__lipsum_autolang_bool
- { \use:x } { \use_none:n }
+ { \use:n } { \use_none:n }
{
\cs_if_exist:NTF \hyphenrules
{
- \exp_not:N \hyphenrules { \g__lipsum_language_tl }
- \cs_set_protected:Npn \__lipsum_restore_hyphens:
- { \exp_not:N \hyphenrules { \languagename } }
- }
- {
\cs_if_exist:cTF { l@ \g__lipsum_language_tl }
- { \language \use:c { l@ \g__lipsum_language_tl } }
- { \msg_error:nn { lipsum } { language-undefined } }
- \cs_set_protected:Npn \__lipsum_restore_hyphens:
- { \language \int_eval:n { \language } \scan_stop: }
+ {
+ \exp_args:NV \hyphenrules \g__lipsum_language_tl
+ \cs_set_protected:Npx \__lipsum_restore_hyphens:
+ { \exp_not:N \hyphenrules { \languagename } }
+ }
+ { \__lipsum_missing_language_warning: }
}
+ { \__lipsum_set_hyphens_babel_missing: }
}
}
\cs_new_protected:Npn \__lipsum_restore_hyphens:
{ \prg_do_nothing: }
+\cs_new_protected:Npn \__lipsum_set_hyphens_babel_missing:
+ {
+ \msg_warning:nnn { lipsum } { missing-babel } { preamble }
+ \cs_gset_eq:NN \__lipsum_set_hyphens_babel_missing: \prg_do_nothing:
+ }
+\AtBeginDocument
+ {
+ \cs_gset_protected:Npx \__lipsum_set_hyphens_babel_missing:
+ {
+ \@ifpackageloaded { babel }
+ { \msg_error:nnn { lipsum } { missing-babel } { impossible } }
+ { \msg_warning:nnn { lipsum } { missing-babel } { document } }
+ \setlipsum { auto-lang = false }
+ }
+ }
+\cs_if_exist:NT \DeclareHookRule
+ { \DeclareHookRule { begindocument } { lipsum } { after } { babel } }
+\cs_new_protected:Npn \__lipsum_missing_language_warning:
+ {
+ \msg_warning:nn { lipsum } { missing-language }
+ \tl_gset_eq:NN \g__lipsum_language_tl \languagename
+ }
\cs_new_protected:Npn \NewLipsumPar #1
{
\int_gincr:N \g__lipsum_par_int
@@ -293,17 +313,17 @@
}
\NewDocumentCommand \SetLipsumLanguage { m }
{ \tl_gset:Nn \g__lipsum_language_tl {#1} }
-\cs_new_protected:Npn \__lipsum_delim_restore:nnnnn #1 #2 #3 #4 #5
+\cs_new_protected:Npn \__lipsum_delim_restore:nnn #1 #2 #3
{
\keys_set:nn { lipsum }
{
- #1-before = , #1-begin = , #1-end = {#2}, #1-after = ,
- #1-before* = , #1-begin* = , #1-end* = {#3}, #1-after* = ,
- #1-sep = {#4}, #1-sep* = {#5}
+ #1-before = , #1-begin = , #1-end = , #1-after = ,
+ #1-before* = , #1-begin* = , #1-end* = , #1-after* = ,
+ #1-sep = {#2}, #1-sep* = {#3}
}
}
\cs_new_protected:Nn \__lipsum_restore_sentence_list:
- { \__lipsum_delim_restore:nnnnn { sentence } { } { } { ~ } { ~ } }
+ { \__lipsum_delim_restore:nnn { sentence } { ~ } { ~ } }
\cs_new_eq:NN \__lipsum_restore_par_list: ?
\cs_new_protected:Npn \LipsumRestoreParList
{
@@ -328,12 +348,12 @@
nopar / true .code:n =
{
\cs_gset_protected:Npn \__lipsum_restore_par_list:
- { \__lipsum_delim_restore:nnnnn { par } { } { \par } { ~ } { } }
+ { \__lipsum_delim_restore:nnn { par } { ~ } { \par } }
} ,
nopar / false .code:n =
{
\cs_gset_protected:Nn \__lipsum_restore_par_list:
- { \__lipsum_delim_restore:nnnnn { par } { \par } { } { } { ~ } }
+ { \__lipsum_delim_restore:nnn { par } { \par } { ~ } }
} ,
nopar .initial:n = false ,
nopar .default:n = true ,
@@ -369,13 +389,38 @@
\__lipsum_restore_sentence_list:
\msg_new:nnn { lipsum } { invalid-range }
{ Invalid~number~or~range~'#1'. }
-\msg_new:nnn { lipsum } { language-undefined }
- { Language~'\g__lipsum_language_tl'~undefined. }
\msg_new:nnn { lipsum } { cmd-deprecated }
{
Command~'\iow_char:N\\#1'~deprecated. \\
See~the~lipsum~documentation~for~help.
}
+\msg_new:nnn { lipsum } { missing-babel }
+ {
+ Hyphenation~patterns~for~'\g__lipsum_language_tl'~
+ cannot~be~used~because~babel~is~not~loaded.~
+ \str_case:nn {#1}
+ {
+ { preamble }
+ { Loading~lipsum~after~babel~should~fix~the~issue. }
+ { document }
+ {
+ The~default~document~language~will~be~used~
+ for~hyphenation~instead.
+ }
+ { impossible }
+ {
+ Something~wrong~happened~and~the~command~
+ \iow_char:N\\hyphenrules~is~not~available. \\ \\
+ Please~report!
+ }
+ }
+ \\ \\ This~message~won't~be~shown~again.
+ }
+\msg_new:nnn { lipsum } { missing-language }
+ {
+ Unknown~language~'\g__lipsum_language_tl'.~
+ Hyphenation~patterns~for~'\languagename'~will~be~used~instead.
+ }
%%
%%
%% End of file `lipsum.sty'.