summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/kantlipsum
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-23 20:57:56 +0000
committerKarl Berry <karl@freefriends.org>2019-07-23 20:57:56 +0000
commit8eaa9a04c65e9be9a95c628900ee62eb9db112eb (patch)
treea304f618f14c807ad3bba1c78a392c03393daf23 /Master/texmf-dist/source/latex/kantlipsum
parente9c08d82a34034086b6e0f1fa65e6ff838f61707 (diff)
kantlipsum (23jul19)
git-svn-id: svn://tug.org/texlive/trunk@51710 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/kantlipsum')
-rw-r--r--Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx134
-rw-r--r--Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins8
2 files changed, 105 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
index afc57058963..09815662fd3 100644
--- a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
+++ b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.dtx
@@ -7,14 +7,14 @@ The kantlipsum package spits out sentences in Kantian style provided
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 @@ See http://www.latex-project.org/lppl.txt
---------------------------------------------------------------
\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 @@ This work consists of the file kantlipsum.dtx
\fi
%</internal>
%<*driver|package>
-\RequirePackage{expl3}[2017/11/14]
+\RequirePackage{expl3}[2019/07/01]
\RequirePackage{xparse}
%</driver|package>
%<*driver>
@@ -138,6 +138,7 @@ This work consists of the file kantlipsum.dtx
%\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 @@ This work consists of the file kantlipsum.dtx
% 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 work consists of the file kantlipsum.dtx
%
% 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 @@ This work consists of the file kantlipsum.dtx
% 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 @@ This work consists of the file kantlipsum.dtx
% \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 @@ This work consists of the file kantlipsum.dtx
\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 @@ This work consists of the file kantlipsum.dtx
}
\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,25 +347,31 @@ This work consists of the file kantlipsum.dtx
\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
% 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 @@ This work consists of the file kantlipsum.dtx
% 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 @@ This work consists of the file kantlipsum.dtx
{ \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 @@ This work consists of the file kantlipsum.dtx
% 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,14 +465,57 @@ This work consists of the file kantlipsum.dtx
% \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} }
% \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 @@ and time; still, the noumena, in the case of necessity, constitute the
whole content of philosophy.}
% \end{macrocode}
-%
+%
% Now we define the sequence of index words.
% \begin{macrocode}
\@@_newword:n {Ideal}
diff --git a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins
index 9aca7b82cb7..5ab4d563110 100644
--- a/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins
+++ b/Master/texmf-dist/source/latex/kantlipsum/kantlipsum.ins
@@ -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 @@ See http://www.latex-project.org/lppl.txt
---------------------------------------------------------------
\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 @@ This work consists of the file kantlipsum.dtx
\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
%%