From 231f2bfbc6deb5f053659c5062e9b5be2ed8e5c8 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 13 Jan 2019 23:31:16 +0000
Subject: ducksay (13jan19)

git-svn-id: svn://tug.org/texlive/trunk@49691 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/ducksay/ducksay.code.v2.tex          | 218 +++++++++++----------
 1 file changed, 112 insertions(+), 106 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex')

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 fbd1143b637..413e221bbaa 100644
--- a/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex
+++ b/Master/texmf-dist/tex/latex/ducksay/ducksay.code.v2.tex
@@ -43,6 +43,8 @@
     The~specified~message~alignment~`\exp_not:n { #1 }`~is~unknown.~
     `l`~is~used~as~fallback.
   }
+\msg_new:nnn { ducksay } { v1-key-only }
+  { The~`\l_keys_key_tl`~key~is~only~available~for~`version=1`. }
 \tl_new:N \l_ducksay_msg_align_vbox_tl
 \box_new:N \l_ducksay_msg_box
 \bool_new:N \l_ducksay_eat_arg_box_bool
@@ -76,6 +78,7 @@
     ,wd* .initial:n = -\c_max_dim
     ,wd* .value_required:n = true
     ,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
     ,ignore-body   .bool_set:N = \l_ducksay_ignored_body_bool
     ,body-x      .dim_set:N = \l_ducksay_body_x_offset_dim
@@ -137,7 +140,7 @@
     ,bubble-bot-kern  .initial:n = { .2ex }
     ,bubble-bot-kern  .value_required:n = true
     ,bubble-side-kern .tl_set:N  = \l_ducksay_bubble_side_kern_tl
-    ,bubble-side-kern .initial:n = { 0.2em }
+    ,bubble-side-kern .initial:n = { .2em }
     ,bubble-side-kern .value_required:n = true
     ,bubble-delim-top     .tl_set:N  = \l_ducksay_bubble_delim_top_tl
     ,bubble-delim-left-1  .tl_set:N  = \l_ducksay_bubble_delim_left_a_tl
@@ -159,6 +162,12 @@
     ,bubble-delim-right-4 .initial:n = /
     ,strip-spaces .bool_set:N  = \l_ducksay_msg_strip_spaces_bool
   }
+\clist_map_inline:nn
+  { align, rel-align }
+  {
+    \keys_define:nn { ducksay }
+      { #1 .code:n = \msg_error:nn { ducksay } { v1-key-only } }
+  }
 \cs_new:Npn \ducksay_evaluate_message_alignment_fixed_width_common:
   {
     \str_case:Vn \l_ducksay_msg_align_tl
@@ -210,6 +219,7 @@
   }
 \cs_new:Npn \ducksay_digest_options:n #1
   {
+    \group_begin:
     \keys_set:nn { ducksay } { #1 }
     \tl_if_empty:NT \l_ducksay_animal_tl
       { \keys_set:nn { ducksay } { default_animal } }
@@ -264,6 +274,7 @@
           }
         \cs_set_eq:NN \ducksay_eat_argument:w \ducksay_eat_argument_tabular:w
       }
+    \ducksay_eat_argument:w
   }
 \cs_new:Npn \ducksay_set_bubble_top_kern:
   {
@@ -285,88 +296,119 @@
   }
 \cs_new_protected:Npn \ducksay_shipout:
   {
-    \hbox_set:Nn \l_ducksay_tmpa_box
-      { \l_ducksay_bubble_fount_tl \l_ducksay_bubble_delim_top_tl }
-    \int_set:Nn \l_ducksay_msg_width_int
-      {
-        \fp_eval:n
-          {
-            ceil
-              ( \box_wd:N \l_ducksay_msg_box / \box_wd:N \l_ducksay_tmpa_box )
-          }
-      }
-    \group_begin:
-    \l_ducksay_bubble_fount_tl
-    \exp_args:NNNx
-    \group_end:
-    \int_set:Nn \l_ducksay_msg_height_int
+    \hcoffin_set:Nn \l_ducksay_msg_coffin { \box_use:N \l_ducksay_msg_box }
+    \bool_if:NF \l_ducksay_no_bubble_bool
       {
-        \int_max:nn
+        \hbox_set:Nn \l_ducksay_tmpa_box
+          { \l_ducksay_bubble_fount_tl \l_ducksay_bubble_delim_top_tl }
+        \int_set:Nn \l_ducksay_msg_width_int
           {
             \fp_eval:n
               {
                 ceil
                   (
-                    (
-                      \box_ht:N \l_ducksay_msg_box
-                      + \box_dp:N \l_ducksay_msg_box
-                    )
-                    / ( \arraystretch * \baselineskip )
+                    \box_wd:N \l_ducksay_msg_box / \box_wd:N \l_ducksay_tmpa_box
                   )
               }
-            + \l_ducksay_vpad_int
           }
-          { \l_ducksay_msg_height_int }
-      }
-    \hcoffin_set:Nn \l_ducksay_bubble_open_coffin
-      {
+        \group_begin:
         \l_ducksay_bubble_fount_tl
-        \begin{tabular}{@{}l@{}}
-          \int_compare:nNnTF { \l_ducksay_msg_height_int } = { \c_one_int }
-            {
-              \l_ducksay_bubble_delim_left_a_tl
-            }
-            {
-              \l_ducksay_bubble_delim_left_b_tl\\
-              \int_step_inline:nnn
-                { 3 } { \l_ducksay_msg_height_int }
+        \exp_args:NNNx
+        \group_end:
+        \int_set:Nn \l_ducksay_msg_height_int
+          {
+            \int_max:nn
+              {
+                \fp_eval:n
+                  {
+                    ceil
+                      (
+                        (
+                          \box_ht:N \l_ducksay_msg_box
+                          + \box_dp:N \l_ducksay_msg_box
+                        )
+                        / ( \arraystretch * \baselineskip )
+                      )
+                  }
+                + \l_ducksay_vpad_int
+              }
+              { \l_ducksay_msg_height_int }
+          }
+        \hcoffin_set:Nn \l_ducksay_bubble_open_coffin
+          {
+            \l_ducksay_bubble_fount_tl
+            \begin{tabular}{@{}l@{}}
+              \int_compare:nNnTF { \l_ducksay_msg_height_int } = { \c_one_int }
                 {
-                  \kern-\l_ducksay_bubble_side_kern_tl
-                  \l_ducksay_bubble_delim_left_c_tl
-                  \\
+                  \l_ducksay_bubble_delim_left_a_tl
                 }
-              \l_ducksay_bubble_delim_left_d_tl
-            }
-        \end{tabular}
-      }
-    \hcoffin_set:Nn \l_ducksay_bubble_close_coffin
-      {
-        \l_ducksay_bubble_fount_tl
-        \begin{tabular}{@{}r@{}}
-          \int_compare:nNnTF { \l_ducksay_msg_height_int } = { \c_one_int }
-            {
-              \l_ducksay_bubble_delim_right_a_tl
-            }
-            {
-              \l_ducksay_bubble_delim_right_b_tl \\
-              \int_step_inline:nnn
-                { 3 } { \l_ducksay_msg_height_int }
                 {
-                  \l_ducksay_bubble_delim_right_c_tl
-                  \kern-\l_ducksay_bubble_side_kern_tl
-                  \\
+                  \l_ducksay_bubble_delim_left_b_tl\\
+                  \int_step_inline:nnn
+                    { 3 } { \l_ducksay_msg_height_int }
+                    {
+                      \kern-\l_ducksay_bubble_side_kern_tl
+                      \l_ducksay_bubble_delim_left_c_tl
+                      \\
+                    }
+                  \l_ducksay_bubble_delim_left_d_tl
                 }
-              \l_ducksay_bubble_delim_right_d_tl
-            }
-        \end{tabular}
-      }
-    \hcoffin_set:Nn \l_ducksay_bubble_top_coffin
-      {
-        \l_ducksay_bubble_fount_tl
-        \int_step_inline:nn { \l_ducksay_msg_width_int + \l_ducksay_hpad_int }
-          { \l_ducksay_bubble_delim_top_tl }
+            \end{tabular}
+          }
+        \hcoffin_set:Nn \l_ducksay_bubble_close_coffin
+          {
+            \l_ducksay_bubble_fount_tl
+            \begin{tabular}{@{}r@{}}
+              \int_compare:nNnTF { \l_ducksay_msg_height_int } = { \c_one_int }
+                {
+                  \l_ducksay_bubble_delim_right_a_tl
+                }
+                {
+                  \l_ducksay_bubble_delim_right_b_tl \\
+                  \int_step_inline:nnn
+                    { 3 } { \l_ducksay_msg_height_int }
+                    {
+                      \l_ducksay_bubble_delim_right_c_tl
+                      \kern-\l_ducksay_bubble_side_kern_tl
+                      \\
+                    }
+                  \l_ducksay_bubble_delim_right_d_tl
+                }
+            \end{tabular}
+          }
+        \hcoffin_set:Nn \l_ducksay_bubble_top_coffin
+          {
+            \l_ducksay_bubble_fount_tl
+            \int_step_inline:nn
+              { \l_ducksay_msg_width_int + \l_ducksay_hpad_int }
+              { \l_ducksay_bubble_delim_top_tl }
+          }
+        \dim_set:Nn \l_ducksay_hpad_dim
+          {
+            (
+              \coffin_wd:N \l_ducksay_bubble_top_coffin
+              - \coffin_wd:N \l_ducksay_msg_coffin
+            ) / 2
+          }
+        \coffin_join:NnnNnnnn
+          \l_ducksay_msg_coffin         { l } { vc }
+          \l_ducksay_bubble_open_coffin { r } { vc }
+          { - \l_ducksay_hpad_dim } { \c_zero_dim }
+        \coffin_join:NnnNnnnn
+          \l_ducksay_msg_coffin          { r } { vc }
+          \l_ducksay_bubble_close_coffin { l } { vc }
+          { \l_ducksay_hpad_dim } { \c_zero_dim }
+        \ducksay_set_bubble_top_kern:
+        \ducksay_set_bubble_bottom_kern:
+        \coffin_join:NnnNnnnn
+          \l_ducksay_msg_coffin        { hc } { t }
+          \l_ducksay_bubble_top_coffin { hc } { b }
+          { \c_zero_dim } { \l_ducksay_bubble_top_kern_dim }
+        \coffin_join:NnnNnnnn
+          \l_ducksay_msg_coffin        { hc } { b }
+          \l_ducksay_bubble_top_coffin { hc } { t }
+          { \c_zero_dim } { \l_ducksay_bubble_bottom_kern_dim }
       }
-    \hcoffin_set:Nn \l_ducksay_msg_coffin { \box_use:N \l_ducksay_msg_box }
     \bool_if:NF \l_ducksay_no_body_bool
       {
         \hcoffin_set:Nn \l_ducksay_body_coffin
@@ -387,34 +429,6 @@
                 { r } { \tl_set:Nn \l_ducksay_body_to_msg_align_body_tl { l } }
               }
           }
-      }
-    \dim_set:Nn \l_ducksay_hpad_dim
-      {
-        (
-          \coffin_wd:N \l_ducksay_bubble_top_coffin
-          - \coffin_wd:N \l_ducksay_msg_coffin
-        ) / 2
-      }
-    \coffin_join:NnnNnnnn
-      \l_ducksay_msg_coffin         { l } { vc }
-      \l_ducksay_bubble_open_coffin { r } { vc }
-      { - \l_ducksay_hpad_dim } { \c_zero_dim }
-    \coffin_join:NnnNnnnn
-      \l_ducksay_msg_coffin          { r } { vc }
-      \l_ducksay_bubble_close_coffin { l } { vc }
-      { \l_ducksay_hpad_dim } { \c_zero_dim }
-    \ducksay_set_bubble_top_kern:
-    \ducksay_set_bubble_bottom_kern:
-    \coffin_join:NnnNnnnn
-      \l_ducksay_msg_coffin        { hc } { t }
-      \l_ducksay_bubble_top_coffin { hc } { b }
-      { \c_zero_dim } { \l_ducksay_bubble_top_kern_dim }
-    \coffin_join:NnnNnnnn
-      \l_ducksay_msg_coffin        { hc } { b }
-      \l_ducksay_bubble_top_coffin { hc } { t }
-      { \c_zero_dim } { \l_ducksay_bubble_bottom_kern_dim }
-    \bool_if:NF \l_ducksay_no_body_bool
-      {
         \bool_if:NTF \l_ducksay_ignored_body_bool
           { \coffin_attach:NVnNVnnn }
           { \coffin_join:NVnNVnnn   }
@@ -485,22 +499,14 @@
 \cs_generate_variant:Nn \coffin_join:NnnNnnnn { NVnNVnnn }
 \cs_generate_variant:Nn \coffin_attach:NnnNnnnn { NVnNVnnn }
 \cs_generate_variant:Nn \coffin_typeset:Nnnnn { NVVnn }
-\cs_generate_variant:Nn \tl_if_eq:nnT { VnT }
 \cs_generate_variant:Nn \str_case:nn { Vn }
-\cs_generate_variant:Nn \regex_replace_all:NnN { Nnc }
 \NewDocumentCommand \ducksay { O{} }
   {
-    \group_begin:
-      \tl_set:Nn \l_ducksay_say_or_think_tl { say }
-      \ducksay_digest_options:n { #1 }
-      \ducksay_eat_argument:w
+    \ducksay_digest_options:n { #1 }
   }
 \NewDocumentCommand \duckthink { O{} }
   {
-    \group_begin:
-      \tl_set:Nn \l_ducksay_say_or_think_tl { think }
-      \ducksay_digest_options:n { #1 }
-      \ducksay_eat_argument:w
+    \ducksay_digest_options:n { think, #1 }
   }
 %% 
 %%
-- 
cgit v1.2.3

