diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-01 22:14:47 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-01 22:14:47 +0000 |
commit | dd60ac9c1cfb4d948b0227a6368ceb47d8f0fbb7 (patch) | |
tree | 33994647523f9eb69a27e8d933acd0d87515b330 /Master/texmf-dist/tex/latex/ducksay | |
parent | dc0c240a49d0ca3f5e5313d4852f6c859257b536 (diff) |
ducksay (1feb20)
git-svn-id: svn://tug.org/texlive/trunk@53631 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ducksay')
4 files changed, 147 insertions, 59 deletions
diff --git a/Master/texmf-dist/tex/latex/ducksay/ducksay.animals.tex b/Master/texmf-dist/tex/latex/ducksay/ducksay.animals.tex index 30ba8b01769..53c6061cb1c 100644 --- a/Master/texmf-dist/tex/latex/ducksay/ducksay.animals.tex +++ b/Master/texmf-dist/tex/latex/ducksay/ducksay.animals.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2017-2019 Jonathan P. Spratte +%% Copyright (C) 2017-2020 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -120,24 +120,24 @@ // \\ ,/' `\_,}%=<< \AddAnimal[tail-symbol=s,tail-count=3]{rabbit}%>>= -{ s - s / \`\ __ - s | \ `\ /`/ \ - \_/`\ \-"-/` /\ \ - | | \ | - (d b) \_/ - / \ - ,".|.'.\_/.'.|.", - / /\' _|_ '/\ \ - | / '-`"`-' \ | - | | | | - | \ \ / / | - \ \ \ / / / - `"`\ : /'"` - `""`""`}%=<< +{ s + s / \`\ __ + s | \ `\ /`/ \ + \_/`\ \-"-/` /\ \ + | | \ | + (d b) \_/ + / \ + ,".|.'.\_/.'.|.", + / /\' _|_ '/\ \ + | / '-`"`-' \ | + | | | | + | \ \ / / | + \ \ \ / / / + `"`\ : /'"` + `""`""`}%=<< \AddAnimal{bunny}%>>= -{ \ - \ / +{ \ + \ / /\ / ( ) .( o ).}%=<< @@ -185,25 +185,25 @@ \\__..-: '.__.')._ "-._.._'.__.-'_.."}%=<< \AddAnimal{unicorn}%>>= -{ \ - \ /((((((\\\\ - ---====((((((((((\\\\\ - (( \\\\\\\ - ( (* _/ \\\\\\\ - \ / \ \\\\\\_ __,,__ - | | | </ "-----"" ((\\\\ - o_| / / \ \\\\ \\\\\\\ - | ._ ( \ \\\\\\\\\\\\\\\\ - | / / / \\\\\\\ \\ - .______/\/ / / / \\\ - / __.____/ _/ _( /\ - / / / ________/:_ ___,,--' \ / \_ - / / \ \ """"""" \ \ \_ \ - ( < \ \ > / \ \ - \/ \\_ / / > ) - \_| / / / / - _// _// - /_| /_|}%=<< +{ \ + \ /((((((\\\\ + ---====((((((((((\\\\\ + (( \\\\\\\ + ( (* _/ \\\\\\\ + \ / \ \\\\\\_ __,,__ + | | | </ "-----"" ((\\\\ + o_| / / \ \\\\ \\\\\\\ + | ._ ( \ \\\\\\\\\\\\\\\\ + | / / / \\\\\\\ \\ + .______/\/ / / / \\\ + / __.____/ _/ _( /\ + / / / ________/:_ ___,,--' \ / \_ + / / \ \ """"""" \ \ \_ \ + ( < \ \ > / \ \ + \/ \\_ / / > ) + \_| / / / / + _// _// + /_| /_|}%=<< \AddAnimal[tail-count=3,tail-symbol=s]{whale}%>>= { s |-. s .-""-._ \ \.--| @@ -362,6 +362,57 @@ { s s s}%=<< +\AddAnimal[tail-symbol=s,tail-count=3]{snake} +{ s + s /^\/^\ + s _|__| O | + /' \_/ \ + \/ |_________/ \ \ + \_/ \_______ \ \ + `| | |\ + / / _---_ | | + / / / __ "-_ ," | + | "--" / "-_ "--" ," + "-_____-" "-___-"} +\AddAnimal{cat} ++ \ + \ _ ___ .--. + \`.|\..----...-'` `-._.-' .-' + / ' ` , __.-' + )/' _/ \ `-_, / + `-'" `"\_ ,_.-;_.-\_ ', + _.-'_./ {_.' ; / + {_.-``-' {_/+ +\AddAnimal{sleepy-cat} +{ \ + \ |\ _,,,---,,_ _._ + /,`.-'`' -. )'._,'.-,) + |,4- ) )-,_. ,\ ( `-.-' + '---''(_/--' `-'\_)} +\AddAnimal{schroedinger-dead} +{ \ + \ _.--"""--._ + | | + | -|- | + | | | + | | + | Felix | + __|___________|__ _ + o . . . + ~ . o o + . ~ .} +\AddAnimal{schroedinger-alive} +{ \ + \ ,_ _ + |\\__,'/ + / _ _ | ,--. + ( @ @ ) / ,-' + \ _T_/-._( ( + / `. \ + | _ \ | + \ \ , / | + || |-_\__ / + ((_/`(____,-'} %% %% %% End of file `ducksay.animals.tex'. diff --git a/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v1.tex b/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v1.tex index f8cd9ae89b5..c6e48025ce5 100644 --- a/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v1.tex +++ b/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v1.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2017-2019 Jonathan P. Spratte +%% Copyright (C) 2017-2020 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -133,8 +133,7 @@ \int_set:Nn \l_ducksay_msg_width_int { -\c_max_int } \int_set:Nn \l_ducksay_msg_height_int { -\c_max_int } \keys_set:nn { ducksay } { #1 } - \tl_if_empty:NT \l_ducksay_animal_tl - { \keys_set:nn { ducksay } { default_animal } } + \ducksay_default_or_random_animal: \ducksay_print:nV { #2 } \l_ducksay_rel_align_tl \group_end: } diff --git a/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex b/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex index b02332998dc..9bcb0c89d60 100644 --- a/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex +++ b/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2017-2019 Jonathan P. Spratte +%% Copyright (C) 2017-2020 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -52,6 +52,7 @@ \bool_new:N \l_ducksay_eat_arg_box_bool \bool_new:N \l_ducksay_eat_arg_tab_verb_bool \bool_new:N \l_ducksay_mirrored_body_bool +\bool_new:N \l_ducksay_msg_eq_body_width_bool \coffin_new:N \l_ducksay_body_coffin \coffin_new:N \l_ducksay_bubble_close_coffin \coffin_new:N \l_ducksay_bubble_open_coffin @@ -79,6 +80,7 @@ ,wd* .dim_set:N = \l_ducksay_msg_width_dim ,wd* .initial:n = -\c_max_dim ,wd* .value_required:n = true + ,wd-eq-body .bool_set:N = \l_ducksay_msg_eq_body_width_bool ,none .bool_set:N = \l_ducksay_no_body_bool ,no-bubble .bool_set:N = \l_ducksay_no_bubble_bool ,body-mirrored .bool_set:N = \l_ducksay_mirrored_body_bool @@ -235,8 +237,30 @@ { \group_begin: \keys_set:nn { ducksay } { #1 } - \tl_if_empty:NT \l_ducksay_animal_tl - { \keys_set:nn { ducksay } { default_animal } } + \ducksay_default_or_random_animal: + \bool_if:NF \l_ducksay_no_body_bool + { + \hcoffin_set:Nn \l_ducksay_body_coffin + { + \frenchspacing + \l_ducksay_body_fount_tl + \begin{tabular} { @{} l @{} } + \l_ducksay_animal_tl + \ducksay_make_body_bigger: + \relax + \end{tabular} + } + \bool_if:NT \l_ducksay_msg_eq_body_width_bool + { + \bool_lazy_and:nnT + { \int_compare_p:nNn \l_ducksay_msg_width_int < \c_zero_int } + { \dim_compare_p:nNn \l_ducksay_msg_width_dim < \c_zero_dim } + { + \dim_set:Nn \l_ducksay_msg_width_dim + { \coffin_wd:N \l_ducksay_body_coffin } + } + } + } \bool_if:NTF \l_ducksay_eat_arg_box_bool { \ducksay_width_case_none_int_dim:nnn @@ -417,16 +441,6 @@ } \bool_if:NF \l_ducksay_no_body_bool { - \hcoffin_set:Nn \l_ducksay_body_coffin - { - \frenchspacing - \l_ducksay_body_fount_tl - \begin{tabular} { @{} l @{} } - \l_ducksay_animal_tl - \ducksay_make_body_bigger: - \relax - \end{tabular} - } \bool_if:NT \l_ducksay_mirrored_body_bool { \coffin_scale:Nnn \l_ducksay_body_coffin diff --git a/Master/texmf-dist/tex/latex/ducksay/ducksay.sty b/Master/texmf-dist/tex/latex/ducksay/ducksay.sty index 50a7318fd03..00234f5418a 100644 --- a/Master/texmf-dist/tex/latex/ducksay/ducksay.sty +++ b/Master/texmf-dist/tex/latex/ducksay/ducksay.sty @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2017-2019 Jonathan P. Spratte +%% Copyright (C) 2017-2020 Jonathan P. Spratte %% %% This work may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -35,8 +35,8 @@ \NeedsTeXFormat{LaTeX2e} \RequirePackage{xparse,l3keys2e} -\def\ducksay@version{2.4.1} -\def\ducksay@date{2019-09-28} +\def\ducksay@version{2.5} +\def\ducksay@date{2020-02-01} \ProvidesExplPackage {ducksay} {\ducksay@date} @@ -46,6 +46,7 @@ \int_new:N \l_ducksay_msg_height_int \int_new:N \l_ducksay_tail_symbol_count_int \seq_new:N \l_ducksay_msg_lines_seq +\seq_new:N \l_ducksay_defined_animals_seq \tl_new:N \l_ducksay_align_tl \tl_new:N \l_ducksay_msg_align_tl \tl_new:N \l_ducksay_animal_tl @@ -57,6 +58,7 @@ \tl_new:N \l_ducksay_tail_symbol_in_tl \bool_new:N \l_ducksay_version_one_bool \bool_new:N \l_ducksay_version_two_bool +\bool_new:N \l_ducksay_random_animal_bool \box_new:N \l_ducksay_tmpa_box \regex_const:Nn \c_ducksay_textcolor_regex { \cO(?:\\textcolor\{(.*?)\}\{(.*?)\}) } @@ -95,11 +97,19 @@ ,tail-2 .initial:x = \c_backslash_str ,no-tail .meta:n = { tail-1 = { ~ }, tail-2 = { ~ } } ,think .meta:n = { tail-1 = { O }, tail-2 = { o } } + ,random .bool_set:N = \l_ducksay_random_animal_bool ,say .code:n = { \exp_args:Nx \DucksayOptions { tail-1 = { \c_backslash_str }, tail-2 = { \c_backslash_str } } } + ,schroedinger .code:n = + { + \int_compare:nNnTF { \int_rand:n { 2 } } = \c_one_int + { \keys_set:nn { ducksay } { animal = schroedinger-dead } } + { \keys_set:nn { ducksay } { animal = schroedinger-alive } } + } + ,schroedinger .value_forbidden:n = true ,version .choice: ,version / 1 .code:n = { @@ -128,6 +138,7 @@ } \cs_generate_variant:Nn \tl_replace_once:Nnn { NVn } \cs_generate_variant:Nn \tl_replace_all:Nnn { NVn } +\cs_generate_variant:Nn \keys_set:nn { nx } \cs_set_eq:NN \__ducksay_everyeof:w \tex_everyeof:D \cs_set_eq:NN \__ducksay_scantokens:w \tex_scantokens:D \cs_new_protected:Npx \ducksay_replace_verb_newline:Nn #1 #2 @@ -190,18 +201,31 @@ #2 .code:n = { \exp_not:n { \tl_set_eq:NN \l_ducksay_animal_tl } - \exp_after:wN \exp_not:N \cs:w l_ducksay_animal_#2_tl \cs_end: + \exp_not:c { l_ducksay_animal_#2_tl } \exp_not:n { \exp_args:NV \DucksayOptions } - \exp_after:wN - \exp_not:N \cs:w l_ducksay_animal_#2_options_tl \cs_end: + \exp_not:c { l_ducksay_animal_#2_options_tl } } } \tl_if_exist:cF { l_ducksay_animal_#2_options_tl } { \tl_new:c { l_ducksay_animal_#2_options_tl } } \IfBooleanT { #4 } { \keys_define:nn { ducksay } { default_animal .meta:n = { #2 } } } + \seq_if_in:NnF \l_ducksay_defined_animals_seq { #2 } + { \seq_push:Nn \l_ducksay_defined_animals_seq { #2 } } } \cs_generate_variant:Nn \ducksay_add_animal_inner:nnnn { nnVn } +\cs_new_protected:Npn \ducksay_default_or_random_animal: + { + \tl_if_empty:NT \l_ducksay_animal_tl + { + \bool_if:NTF \l_ducksay_random_animal_bool + { + \keys_set:nx { ducksay } + { \seq_rand_item:N \l_ducksay_defined_animals_seq } + } + { \keys_set:nn { ducksay } { default_animal } } + } + } \NewDocumentCommand \DefaultAnimal { m } { \keys_define:nn { ducksay } { default_animal .meta:n = { #1 } } |