texlive[51710] Master/texmf-dist: kantlipsum (23jul19)

commits+karl at tug.org commits+karl at tug.org
Tue Jul 23 22:57:56 CEST 2019


Revision: 51710
          http://tug.org/svn/texlive?view=revision&revision=51710
Author:   karl
Date:     2019-07-23 22:57:56 +0200 (Tue, 23 Jul 2019)
Log Message:
-----------
kantlipsum (23jul19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/kantlipsum/README.md
    trunk/Master/texmf-dist/doc/latex/kantlipsum/kantlipsum.pdf
    trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
    trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins
    trunk/Master/texmf-dist/tex/latex/kantlipsum/kantlipsum.sty

Modified: trunk/Master/texmf-dist/doc/latex/kantlipsum/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/kantlipsum/README.md	2019-07-22 23:52:42 UTC (rev 51709)
+++ trunk/Master/texmf-dist/doc/latex/kantlipsum/README.md	2019-07-23 20:57:56 UTC (rev 51710)
@@ -2,14 +2,14 @@
 by the "Kant generator for Python" by Mark Pilgrim, described in the
 book "Dive into Python".
 
-This is version 0.6 of the package
+This is version 0.8 of the package
 
 Changes from earlier version:
 
-The `index' option for writing index entries has been added; the
-code has been polished.
+Support for printing only a few sentences from one paragraph has been added;
+the code has been polished.
 
- Copyright 2011-2012 Enrico Gregorio
+ Copyright 2011-2019 Enrico Gregorio
 
  It may be distributed and/or modified under the conditions of the
  LaTeX Project Public License (LPPL), either version 1.3c of this

Modified: trunk/Master/texmf-dist/doc/latex/kantlipsum/kantlipsum.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx	2019-07-22 23:52:42 UTC (rev 51709)
+++ trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx	2019-07-23 20:57:56 UTC (rev 51710)
@@ -7,14 +7,14 @@
 by the "Kant generator for Python" by Mark Pilgrim, described in the
 book "Dive into Python".
 
-This is version 0.6 of the package
+This is version 0.8 of the package
 
 Changes from earlier version:
 
-The `index' option for writing index entries has been added; the
-code has been polished.
+Support for printing only a few sentences from one paragraph has been added;
+the code has been polished.
 
- Copyright 2011-2012 Enrico Gregorio
+ Copyright 2011-2019 Enrico Gregorio
 
  It may be distributed and/or modified under the conditions of the
  LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -64,7 +64,7 @@
 ---------------------------------------------------------------
 \endpreamble
 \postamble
-Copyright (C) 2011-2017 by
+Copyright (C) 2011-2019 by
   Enrico Gregorio
   enrico DOT gregorio AT univr DOT it
 
@@ -101,7 +101,7 @@
 \fi
 %</internal>
 %<*driver|package>
-\RequirePackage{expl3}[2017/11/14]
+\RequirePackage{expl3}[2019/07/01]
 \RequirePackage{xparse}
 %</driver|package>
 %<*driver>
@@ -138,6 +138,7 @@
 %\changes{v0.6}{2012/10/14}{Fixes for kernel changes}
 %\changes{v0.6}{2012/10/14}{Added functions for producing an index}
 %\changes{v0.7}{2017/11/16}{Use new kernel function}
+%\changes{v0.8}{2017/07/23}{Print only a few sentences of a paragraph}
 %
 % \begin{documentation}
 %
@@ -197,6 +198,11 @@
 % store in \cs{mytext} the 164th paragraph of pseudokantian text
 % provided by this package.
 % \end{itemize}
+% The commands \cs{kant}, \cs{kant*} and \cs{kantdef} take a further
+% optional argument; with \verb|\kant[42][1-3]| just the first three
+% sentences of paragraph number~42 will be printed; ranges outside the
+% actual number of sentences will be ignored. The requested sentences
+% are stored, in the case of \cs{kantdef}.
 %
 % What's the difference between \cs{kant} and \cs{kant*}? The normal
 % version will respect the given package option; that is, if
@@ -216,8 +222,8 @@
 %
 % This package is just an exercise for practicing with \LaTeX3
 % syntax. It uses the ``experimental'' packages made available by the
-% \LaTeX3 team. Many thanks to Joseph Wright and Bruno Le Floch for
-% suggesting improvements.
+% \LaTeX3 team. Many thanks to Joseph Wright, Bruno Le Floch and Frank
+% Mittelbach for suggesting improvements.
 %
 % \subsection*{Changes from version 0.1}
 %
@@ -240,6 +246,11 @@
 % Maintenance release with new functions from \texttt{expl3}. Now
 % a kernel released on 2017/11/14 or later is required.
 %
+% \subsection*{Changes from version 0.7}
+%
+% Printing just some sentences in a paragraph is possible. Now
+% a kernel released on 2019/07/01 or later is required.
+%
 % \end{documentation}
 %
 % \begin{implementation}
@@ -258,14 +269,14 @@
 %    \begin{macrocode}
 \ProvidesExplPackage
   {kantlipsum}
-  {2017/11/16}
-  {0.7}
+  {2019/07/23}
+  {0.8}
   {Generate text in Kantian style}
 %    \end{macrocode}
 %
 % A check to make sure that \pkg{expl3} is not too old
 %    \begin{macrocode}
-\@ifpackagelater { expl3 } { 2017/11/14 }
+\@ifpackagelater { expl3 } { 2019/07/01 }
   { }
   {
     \PackageError { kantlipsum } { Support~package~expl3~too~old }
@@ -287,7 +298,7 @@
 \DeclareOption { par }
   {
    \cs_set_protected:Nn \@@_star: { \c_space_tl }
-   \cs_set_protected:Nn \@@_nostar: { \par } 
+   \cs_set_protected:Nn \@@_nostar: { \par }
   }
 
 \DeclareOption{ nopar }
@@ -297,7 +308,12 @@
   }
 
 \DeclareOption{ numbers }
-  { \cs_set_protected:Nn \@@_number:n { #1\nobreak\enspace\textbullet\nobreak\enspace } }
+  {
+   \cs_set_protected:Nn \@@_number:n
+    {
+     #1\nobreak\enspace\textbullet\nobreak\enspace
+    }
+  }
 
 \bool_new:N \g_@@_makeindex_bool
 \bool_gset_false:N \g_@@_makeindex_bool
@@ -331,11 +347,12 @@
 \int_new:N \l_@@_end_int
 \seq_new:N \g_@@_pars_seq
 \seq_new:N \g_@@_words_seq
+\seq_new:N \l_@@_sentences_seq
 %    \end{macrocode}
 %
 % \subsection{User level commands}
 % There are two user level commands, \cs{kant} (with a *-variant) and \cs{kantdef}.
-% 
+%
 % \begin{function}{\kant}
 % The (optional) argument is described as before. We use the
 % \cs{SplitArgument} feature provided by \pkg{xparse} to decide
@@ -342,14 +359,19 @@
 % whether the `range form' has been specified. In the \cs{kant*} form
 % we reverse the logic.
 %    \begin{macrocode}
-\NewDocumentCommand{\kant}{s>{\SplitArgument{1}{-}}O{1-7}}
+\NewDocumentCommand{\kant}
   {
+   s
+   >{\SplitArgument{1}{-}}O{1-7}
+   >{\SplitArgument{1}{-}}o}
+  {
    \group_begin:
    \IfBooleanTF{#1}
      { \cs_set_eq:NN \@@_par: \@@_star: }
      { \cs_set_eq:NN \@@_par: \@@_nostar: }
-   \@@_process:nn #2
-   \@@_print:
+   \IfNoValueTF{#3}
+     { \@@_process:nn #2 \@@_print: }
+     { \@@_process:nnnn #2 #3 \tl_use:N \l_tmpa_tl }
    \group_end:
   }
 %    \end{macrocode}
@@ -364,19 +386,15 @@
 % number given as second argument. If the control sequence is already
 % defined we issue an error and don't perform the definition.
 %    \begin{macrocode}
-\NewDocumentCommand{\kantdef}{mm}
+\NewDocumentCommand{\kantdef}
   {
+   m
+   m
+   >{\SplitArgument{1}{-}}O{1-50}
+  }
+  {
    \group_begin:
-   \cs_set_eq:NN \@@_number:n \use_none:n
-   \cs_set_eq:NN \@@_par: \prg_do_nothing:
-   \cs_if_exist:NTF #1
-     {
-      \msg_error:nnn {kantlipsum} {already-defined} {#1}
-     }
-     {
-      \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_@@_pars_seq {#2} }
-      \cs_new:Npx #1 { \l_tmpa_tl }
-     }
+   \@@_define:nnnn {#1} {#2} #3
    \group_end:
   }
 %    \end{macrocode}
@@ -398,6 +416,13 @@
      { \int_set:Nn \l_@@_end_int {#1} }
      { \int_set:Nn \l_@@_end_int {#2} }
   }
+\cs_new_protected:Nn \@@_process:nnnn
+  {
+   \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_@@_pars_seq {#1} }
+   \tl_if_novalue:nTF {#4}
+    { \@@_extract:nnV {#3} {#3} \l_tmpa_tl }
+    { \@@_extract:nnV {#3} {#4} \l_tmpa_tl }
+  }
 %    \end{macrocode}
 % \end{function}
 % \changes{v0.7}{2017/11/16}{Use \cs{tl_if_novalue:nTF} instead of \cs{IfNoValueTF}}
@@ -413,8 +438,8 @@
 % the page reference might not be correct, though.
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_print:
-  { 
-   \int_step_function:nnnN 
+  {
+   \int_step_function:nnnN
      {\l_@@_start_int} {1} {\l_@@_end_int} \@@_use:n
   }
 \cs_new:Nn \@@_use:n
@@ -440,8 +465,9 @@
 % \end{function}
 %
 % \begin{function}{\@@_newword:n}
-% The |\@@_newword:n| appends a new item to the sequence |\g_@@_words_seq|
-% consisting of one word from the corresponding paragraph.
+% The |\@@_newword:n| function appends a new item to the sequence
+% |\g_@@_words_seq| consisting of one word from the corresponding
+% paragraph.
 %    \begin{macrocode}
 \cs_new_protected:Nn \@@_newword:n
   { \seq_gput_right:Nn \g_@@_words_seq {#1} }
@@ -448,6 +474,48 @@
 %    \end{macrocode}
 % \end{function}
 %
+% \begin{function}{\@@define:nnnn}
+% The function |\@@define:nnnn| chooses the paragraph, then extracts the
+% requested sentences.
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_define:nnnn
+  {
+   \cs_set_eq:NN \@@_number:n \use_none:n
+   \cs_set_eq:NN \@@_par: \prg_do_nothing:
+   \cs_if_exist:NTF #1
+     {
+      \msg_error:nnn {kantlipsum} {already-defined} {#1}
+     }
+     {
+      \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g_@@_pars_seq {#2} }
+      \tl_if_novalue:nTF {#4}
+       { \@@_extract:nnV {#3} {#3} \l_tmpa_tl }
+       { \@@_extract:nnV {#3} {#4} \l_tmpa_tl }
+      \cs_new:Npx #1 { \l_tmpa_tl }
+     }
+  }
+%    \end{macrocode}
+% \end{function}
+% \begin{function}{\@@_extract:nnn}
+% This function does the extraction by splitting the input at periods
+% and then adding the requested sentences to another sequence that
+% later can be used.
+%    \begin{macrocode}
+\cs_new_protected:Nn \@@_extract:nnn
+  {
+   \seq_set_split:Nnn \l_@@_sentences_seq { . } {#3}
+   \seq_clear:N \l_tmpa_seq
+   \seq_indexed_map_inline:Nn \l_@@_sentences_seq
+    {
+     \int_compare:nT { #1 <= ##1 <= #2 }
+      {\seq_put_right:Nn \l_tmpa_seq { ##2 } }
+    }
+   \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { .~ }. }
+  }
+\cs_generate_variant:Nn \@@_extract:nnn { nnV }
+%    \end{macrocode}
+% \end{function}
+%
 % \subsection{Defining the sentences}
 % We start a group where we set the category
 % code of the space to 10 so as not to be forced to write |~| for
@@ -3368,7 +3436,7 @@
 whole content of philosophy.}
 
 %    \end{macrocode}
-% 
+%
 % Now we define the sequence of index words.
 %    \begin{macrocode}
 \@@_newword:n {Ideal}

Modified: trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins	2019-07-22 23:52:42 UTC (rev 51709)
+++ trunk/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins	2019-07-23 20:57:56 UTC (rev 51710)
@@ -6,7 +6,7 @@
 %%
 %% kantlipsum.dtx  (with options: `install')
 %% ---------------------------------------------------------------
-%% The kantlipsum package --- Generate text in Kant's style
+%% The kantlipsum package --- Generate text in Kantian style
 %% Maintained by Enrico Gregorio
 %% E-mail: enrico DOT gregorio AT univr DOT it
 %% Released under the LaTeX Project Public License v1.3c or later
@@ -17,7 +17,7 @@
 \askforoverwritefalse
 \preamble
 ---------------------------------------------------------------
-The kantlipsum package --- Generate text in Kant's style
+The kantlipsum package --- Generate text in Kantian style
 Maintained by Enrico Gregorio
 E-mail: enrico DOT gregorio AT univr DOT it
 Released under the LaTeX Project Public License v1.3c or later
@@ -25,7 +25,7 @@
 ---------------------------------------------------------------
 \endpreamble
 \postamble
-Copyright (C) 2011-2017 by
+Copyright (C) 2011-2019 by
   Enrico Gregorio
   enrico DOT gregorio AT univr DOT it
 
@@ -44,7 +44,7 @@
   \file{\jobname.sty}{\from{\jobname.dtx}{package}}
 }
 \endbatchfile
-%% Copyright (C) 2011-2017 by
+%% Copyright (C) 2011-2019 by
 %%   Enrico Gregorio
 %%   enrico DOT gregorio AT univr DOT it
 %% 

Modified: trunk/Master/texmf-dist/tex/latex/kantlipsum/kantlipsum.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/kantlipsum/kantlipsum.sty	2019-07-22 23:52:42 UTC (rev 51709)
+++ trunk/Master/texmf-dist/tex/latex/kantlipsum/kantlipsum.sty	2019-07-23 20:57:56 UTC (rev 51710)
@@ -6,20 +6,20 @@
 %%
 %% kantlipsum.dtx  (with options: `package')
 %% ---------------------------------------------------------------
-%% The kantlipsum package --- Generate text in Kant's style
+%% The kantlipsum package --- Generate text in Kantian style
 %% Maintained by Enrico Gregorio
 %% E-mail: enrico DOT gregorio AT univr DOT it
 %% Released under the LaTeX Project Public License v1.3c or later
 %% See http://www.latex-project.org/lppl.txt
 %% ---------------------------------------------------------------
-\RequirePackage{expl3}[2017/11/14]
+\RequirePackage{expl3}[2019/07/01]
 \RequirePackage{xparse}
 \ProvidesExplPackage
   {kantlipsum}
-  {2017/11/16}
-  {0.7}
+  {2019/07/23}
+  {0.8}
   {Generate text in Kantian style}
-\@ifpackagelater { expl3 } { 2017/11/14 }
+\@ifpackagelater { expl3 } { 2019/07/01 }
   { }
   {
     \PackageError { kantlipsum } { Support~package~expl3~too~old }
@@ -43,7 +43,12 @@
   }
 
 \DeclareOption{ numbers }
-  { \cs_set_protected:Nn \__kgl_number:n { #1\nobreak\enspace\textbullet\nobreak\enspace } }
+  {
+   \cs_set_protected:Nn \__kgl_number:n
+    {
+     #1\nobreak\enspace\textbullet\nobreak\enspace
+    }
+  }
 
 \bool_new:N \g__kgl_makeindex_bool
 \bool_gset_false:N \g__kgl_makeindex_bool
@@ -64,29 +69,31 @@
 \int_new:N \l__kgl_end_int
 \seq_new:N \g__kgl_pars_seq
 \seq_new:N \g__kgl_words_seq
-\NewDocumentCommand{\kant}{s>{\SplitArgument{1}{-}}O{1-7}}
+\seq_new:N \l__kgl_sentences_seq
+\NewDocumentCommand{\kant}
   {
+   s
+   >{\SplitArgument{1}{-}}O{1-7}
+   >{\SplitArgument{1}{-}}o}
+  {
    \group_begin:
    \IfBooleanTF{#1}
      { \cs_set_eq:NN \__kgl_par: \__kgl_star: }
      { \cs_set_eq:NN \__kgl_par: \__kgl_nostar: }
-   \__kgl_process:nn #2
-   \__kgl_print:
+   \IfNoValueTF{#3}
+     { \__kgl_process:nn #2 \__kgl_print: }
+     { \__kgl_process:nnnn #2 #3 \tl_use:N \l_tmpa_tl }
    \group_end:
   }
-\NewDocumentCommand{\kantdef}{mm}
+\NewDocumentCommand{\kantdef}
   {
+   m
+   m
+   >{\SplitArgument{1}{-}}O{1-50}
+  }
+  {
    \group_begin:
-   \cs_set_eq:NN \__kgl_number:n \use_none:n
-   \cs_set_eq:NN \__kgl_par: \prg_do_nothing:
-   \cs_if_exist:NTF #1
-     {
-      \msg_error:nnn {kantlipsum} {already-defined} {#1}
-     }
-     {
-      \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g__kgl_pars_seq {#2} }
-      \cs_new:Npx #1 { \l_tmpa_tl }
-     }
+   \__kgl_define:nnnn {#1} {#2} #3
    \group_end:
   }
 \cs_new_protected:Nn \__kgl_process:nn
@@ -96,6 +103,13 @@
      { \int_set:Nn \l__kgl_end_int {#1} }
      { \int_set:Nn \l__kgl_end_int {#2} }
   }
+\cs_new_protected:Nn \__kgl_process:nnnn
+  {
+   \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g__kgl_pars_seq {#1} }
+   \tl_if_novalue:nTF {#4}
+    { \__kgl_extract:nnV {#3} {#3} \l_tmpa_tl }
+    { \__kgl_extract:nnV {#3} {#4} \l_tmpa_tl }
+  }
 \cs_new_protected:Nn \__kgl_print:
   {
    \int_step_function:nnnN
@@ -115,6 +129,34 @@
   { \seq_gput_right:Nn \g__kgl_pars_seq {#1\__kgl_par:} }
 \cs_new_protected:Nn \__kgl_newword:n
   { \seq_gput_right:Nn \g__kgl_words_seq {#1} }
+\cs_new_protected:Nn \__kgl_define:nnnn
+  {
+   \cs_set_eq:NN \__kgl_number:n \use_none:n
+   \cs_set_eq:NN \__kgl_par: \prg_do_nothing:
+   \cs_if_exist:NTF #1
+     {
+      \msg_error:nnn {kantlipsum} {already-defined} {#1}
+     }
+     {
+      \tl_set:Nx \l_tmpa_tl { \seq_item:Nn \g__kgl_pars_seq {#2} }
+      \tl_if_novalue:nTF {#4}
+       { \__kgl_extract:nnV {#3} {#3} \l_tmpa_tl }
+       { \__kgl_extract:nnV {#3} {#4} \l_tmpa_tl }
+      \cs_new:Npx #1 { \l_tmpa_tl }
+     }
+  }
+\cs_new_protected:Nn \__kgl_extract:nnn
+  {
+   \seq_set_split:Nnn \l__kgl_sentences_seq { . } {#3}
+   \seq_clear:N \l_tmpa_seq
+   \seq_indexed_map_inline:Nn \l__kgl_sentences_seq
+    {
+     \int_compare:nT { #1 <= ##1 <= #2 }
+      {\seq_put_right:Nn \l_tmpa_seq { ##2 } }
+    }
+   \tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { .~ }. }
+  }
+\cs_generate_variant:Nn \__kgl_extract:nnn { nnV }
 \group_begin:
 \char_set_catcode_space:n {`\ }
 \__kgl_newpara:n {As any dedicated reader can clearly see, the Ideal of
@@ -3191,7 +3233,7 @@
 \group_end:
 \msg_info:nnx {kantlipsum} {how-many}
   { \int_eval:n {\seq_count:N \g__kgl_pars_seq} }
-%% Copyright (C) 2011-2017 by
+%% Copyright (C) 2011-2019 by
 %%   Enrico Gregorio
 %%   enrico DOT gregorio AT univr DOT it
 %% 



More information about the tex-live-commits mailing list