diff options
author | Karl Berry <karl@freefriends.org> | 2021-09-20 20:02:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-09-20 20:02:29 +0000 |
commit | d97a5a655499df784fed17b577a1355a0932266a (patch) | |
tree | cc3521349866b90d2e14940164541e574ffb5025 /Master/texmf-dist/tex/latex/lipsum/lipsum.sty | |
parent | 386db97a7b843f42e1b0cce508ef13b2893695f0 (diff) |
lipsum (20sep21)
git-svn-id: svn://tug.org/texlive/trunk@60561 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/lipsum/lipsum.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/lipsum/lipsum.sty | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/latex/lipsum/lipsum.sty b/Master/texmf-dist/tex/latex/lipsum/lipsum.sty index a7474d9215a..c26c7a56911 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.5} -\def\lipsumdate{2021-08-01} +\def\lipsumversion{2.7} +\def\lipsumdate{2021-09-20} \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} \@ifundefined{NewDocumentCommand} @@ -260,39 +260,52 @@ { \cs_if_exist:NTF \hyphenrules { - \cs_if_exist:cTF { l@ \g__lipsum_language_tl } - { - \exp_args:NV \hyphenrules \g__lipsum_language_tl - \cs_set_protected:Npx \__lipsum_restore_hyphens: - { \exp_not:N \hyphenrules { \languagename } } - } - { \__lipsum_missing_language_warning: } + \cs_if_exist:cTF { ver@polyglossia.sty } + { \__lipsum_set_hyphens_polyglossia: } + { \__lipsum_set_hyphens_babel: } } - { \__lipsum_set_hyphens_babel_missing: } + { \__lipsum_set_hyphens_raw: } } } \cs_new_protected:Npn \__lipsum_restore_hyphens: { \prg_do_nothing: } -\cs_new_protected:Npn \__lipsum_set_hyphens_babel_missing: +\cs_new_protected:Npn \__lipsum_set_hyphens_babel: { - \msg_warning:nnn { lipsum } { missing-babel } { preamble } - \cs_gset_eq:NN \__lipsum_set_hyphens_babel_missing: \prg_do_nothing: + \cs_if_exist:cTF { l@ \g__lipsum_language_tl } + { + \exp_args:NV \hyphenrules \g__lipsum_language_tl + \cs_set_protected:Npx \__lipsum_restore_hyphens: + { \exp_not:N \hyphenrules { \languagename } } + } + { \__lipsum_lang_not_available: } + } +\cs_new_protected:Npn \__lipsum_set_hyphens_polyglossia: + { + \cs_if_exist:cTF { \g__lipsum_language_tl @loaded } + { + \exp_args:NnV \begin{hyphenrules} \g__lipsum_language_tl + \cs_set_protected:Npn \__lipsum_restore_hyphens: + { \end{hyphenrules} } + } + { \__lipsum_set_hyphens_raw: } } -\AtBeginDocument +\cs_new_protected:Npn \__lipsum_set_hyphens_raw: { - \cs_gset_protected:Npx \__lipsum_set_hyphens_babel_missing: + \cs_if_exist:cTF { l@ \g__lipsum_language_tl } { - \@ifpackageloaded { babel } - { \msg_error:nnn { lipsum } { missing-babel } { impossible } } - { \msg_warning:nnn { lipsum } { missing-babel } { document } } - \setlipsum { auto-lang = false } + \use:x + { + \language \use:c { l@ \g__lipsum_language_tl } + \cs_set_protected:Npn \__lipsum_restore_hyphens: + { \language \int_eval:n { \language } \scan_stop: } + } } + { \__lipsum_lang_not_available: } } -\cs_if_exist:NT \DeclareHookRule - { \DeclareHookRule { begindocument } { lipsum } { after } { babel } } -\cs_new_protected:Npn \__lipsum_missing_language_warning: +\cs_new_protected:Npn \__lipsum_lang_not_available: { - \msg_warning:nn { lipsum } { missing-language } + \msg_warning:nnx { lipsum } { missing-language } + { \g__lipsum_language_tl } \tl_gset_eq:NN \g__lipsum_language_tl \languagename } \cs_new_protected:Npn \NewLipsumPar #1 @@ -394,32 +407,24 @@ Command~'\iow_char:N\\#1'~deprecated. \\ See~the~lipsum~documentation~for~help. } -\msg_new:nnn { lipsum } { missing-babel } +\msg_new:nnn { lipsum } { missing-language } { - Hyphenation~patterns~for~'\g__lipsum_language_tl'~ - cannot~be~used~because~babel~is~not~loaded.~ - \str_case:nn {#1} + Unknown~language~'#1'.~Hyphenation~patterns~for~ + '\languagename'~will~be~used~instead. + \sys_if_engine_luatex:T { - { preamble } - { Loading~lipsum~after~babel~should~fix~the~issue. } - { document } + \\ \\ + \cs_if_exist:cTF { ver@polyglossia.sty } { - The~default~document~language~will~be~used~ - for~hyphenation~instead. + With~polyglossia,~you~have~to~explicitly~load~languages~ + with~\iow_char:N\\setotherlanguage{#1}~or~similar. } - { impossible } { - Something~wrong~happened~and~the~command~ - \iow_char:N\\hyphenrules~is~not~available. \\ \\ - Please~report! + With~LuaTeX,~lipsum~requires~babel~to~get~proper~ + hyphenation~(you~can~use~ + \iow_char:N\\usepackage[base]{babel}). } } - \\ \\ 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. } %% %% |