summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-10 21:18:52 +0000
committerKarl Berry <karl@freefriends.org>2022-02-10 21:18:52 +0000
commit1d69ba3a31952647ab48fdc693b18fcffd388cd8 (patch)
tree41964edc215a245fc9c7b8d7b683b0e9544197b2 /Master
parent0cc3b9e766d5a223ba2e8c5f3580a08accf94db6 (diff)
censor (10feb22)
git-svn-id: svn://tug.org/texlive/trunk@61969 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/censor/censor.pdfbin219513 -> 221880 bytes
-rw-r--r--Master/texmf-dist/doc/latex/censor/censor.tex18
-rw-r--r--Master/texmf-dist/tex/latex/censor/censor.sty119
3 files changed, 101 insertions, 36 deletions
diff --git a/Master/texmf-dist/doc/latex/censor/censor.pdf b/Master/texmf-dist/doc/latex/censor/censor.pdf
index d5f14ea63d0..16b5780ed8d 100644
--- a/Master/texmf-dist/doc/latex/censor/censor.pdf
+++ b/Master/texmf-dist/doc/latex/censor/censor.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/censor/censor.tex b/Master/texmf-dist/doc/latex/censor/censor.tex
index e9990244f27..ef64629f13d 100644
--- a/Master/texmf-dist/doc/latex/censor/censor.tex
+++ b/Master/texmf-dist/doc/latex/censor/censor.tex
@@ -556,8 +556,20 @@ However, it is also clear that an extended text passage may contain
The \verb|\blackout| and \verb|\xblackout| macros can at least digest
control sequences in the input-text stream.
-How the sequences are handled will require some user intervention.
-By default, these macros will be echoed into the output stream in a literal
+How the sequences are handled may require some user intervention.
+
+Certain macro that are known to expand directly into typeset characters
+ are handled automatically.
+These include \verb|\$|, \verb|\&|, \verb|\#|, \verb|\%|, \verb|\_|,
+ \verb|\o|, \verb|\O|, \verb|\oe|, \verb|\OE|, \verb|\aa|, \verb|\AA|,
+ \verb|\ae|, \verb|\AE|, \verb|\l|, and \verb|\L|.
+Other macros, that are part of the \LaTeX{} accents, are likewise
+ handled seamlessly, including \verb|\`|, \verb|\=|, \verb|\'|,
+ \verb|\.|, \verb|\^|, \verb|\"|, \verb|\u|, \verb|\d|, \verb|\v|,
+ \verb|\b|, \verb|\H|, \verb|\t|, \verb|\~|, and \verb|\c|.
+
+For macros outside of these special cases, the default behavior is
+ to echo the macro into the output stream in a literal
(unexpanded) form.
Consider the following line of \LaTeX{} code:
@@ -574,7 +586,7 @@ The \verb|\textit| is still part of the blackout rendering, but the
of \verb|\textit|.
Some macros, however, expand to literal text.
-Because they are, by default, carried literally into the output, they
+Because macros are, by default, carried literally into the output, they
will only expand into text \textit{after} the censoring has been
applied.
Consider the following line of \LaTeX{} code:
diff --git a/Master/texmf-dist/tex/latex/censor/censor.sty b/Master/texmf-dist/tex/latex/censor/censor.sty
index 6335b16ae36..df38f68150c 100644
--- a/Master/texmf-dist/tex/latex/censor/censor.sty
+++ b/Master/texmf-dist/tex/latex/censor/censor.sty
@@ -1,7 +1,7 @@
% censor.sty
-\def\censorversionnumber{4.0}
+\def\censorversionnumber{4.1}
\ProvidesPackage{censor}
-[2021/12/23 \censorversionnumber
+[2022/02/09 \censorversionnumber\
Provides capability for redaction of sensitive information]
%
@@ -17,22 +17,6 @@
%
% The Current Maintainer of this work is Steven B. Segletes.
-% VERSION:
-% 1.00 - Initial release
-% 2.00 - Added \blackout
-% 2.10 - Allowed \blackout to cross paragraph boundaries with use of
-% \bpar. Stopped censoring periods, in order to preserve
-% end-of-sentence spacing, which differs from inter-word spacing.
-% 3.00 - \censorbox introduced to handle figures, tables, etc.
-% 3.10 - Made \blackout work with \par in argument. Introduced
-% \xblackout
-% 3.20 - Specify depth/height of censor rule. Introduced \def\censordot{}
-% 3.21 - Fixed bug regarding \xblackout rules remaining after a
-% \StopCensoring
-% 3.22 - changed `\if to \ifx in definition of \bl@t, to handle macros like \%
-% 4.0 - Recast \blackout and \xblackout in terms of tokcycle environments
-% - Introduced \blackoutenv...\endblackoutenv and
-% \xblackoutenv...\endxblackoutenv
\usepackage{pbox}
\newlength\censorruledepth
@@ -68,7 +52,8 @@
\usepackage{tokcycle}[2021/03/10]
-\def\@dump#1{\addcytoks[1]{\expandafter\censor\expandafter{#1}}\def#1{}}
+\def\@dump#1{\if\relax\detokenize\expandafter{#1}\relax\else
+ \addcytoks[1]{\expandafter\censor\expandafter{#1}}\fi\def#1{}}
\def\@append#1#2{\tc@defx#1{#1#2}}
\def\spacelap{0.6ex}
@@ -80,30 +65,78 @@
\newif\ifexpandarg
-\xtokcycleenvironment\xblackoutenv
+\xtokcycleenvironment\blackoutenv
{\ifx.##1\@dump\censored@word\addcytoks[1]{\censordot}\else
\@append\censored@word{##1}%
\tcpeek\@next\ifx\@next\@tcEscapeptr\@dump\censored@word\fi\fi}
- {\tctestifcon\ifexpandarg{\expandafter\processtoks\expandafter{\expanded{##1}}}%
- {\processtoks{##1}}\@dump\censored@word\expandargfalse}
- {\@dump\censored@word\tctestifx{~##1}{\@append\censored@word{##1}}%
- {\tctestifx{\expanded##1}{\expandargtrue}{\addcytoks{##1}}}}
- {\@dump\censored@word\addcytoks{\censpace}}
- {\def\censored@word{}}
+ {\tctestifcon\ifexpandarg{\expandafter\processtoks\expandafter
+ {\expanded{##1}}\@dump\censored@word}{\groupedcytoks{\processtoks{##1}%
+ \@dump\censored@word}}\expandargfalse}
+ {\tctestifx{~##1}{\@append\censored@word{##1}}%
+ {\tctestifx{\expanded##1}{\@dump\censored@word\expandargtrue}%
+ {\test@chars{##1}\ifchar\@append\censored@word{##1}\else
+ \test@accents{##1}\ifaccent\@append\censored@word{##1}\tcpop\tc@popped
+ \expandafter\@append\expandafter\censored@word\expandafter{\tc@popped}%
+ \else\@dump\censored@word\addcytoks{##1}\fi\fi}}}
+ {\@dump\censored@word\addcytoks{##1}}
+ {\stripgroupingtrue\def\censored@word{}}
{\@dump\censored@word}
-\xtokcycleenvironment\blackoutenv
+
+\xtokcycleenvironment\xblackoutenv
{\ifx.##1\@dump\censored@word\addcytoks[1]{\censordot}\else
\@append\censored@word{##1}%
\tcpeek\@next\ifx\@next\@tcEscapeptr\@dump\censored@word\fi\fi}
- {\tctestifcon\ifexpandarg{\expandafter\processtoks\expandafter{\expanded{##1}}}%
- {\processtoks{##1}}\@dump\censored@word\expandargfalse}
- {\@dump\censored@word\tctestifx{~##1}{\@append\censored@word{##1}}%
- {\tctestifx{\expanded##1}{\expandargtrue}{\addcytoks{##1}}}}
- {\@dump\censored@word\addcytoks{##1}}
- {\def\censored@word{}}
+ {\tctestifcon\ifexpandarg{\expandafter\processtoks\expandafter
+ {\expanded{##1}}\@dump\censored@word}{\groupedcytoks{\processtoks{##1}%
+ \@dump\censored@word}}\expandargfalse}
+ {\tctestifx{~##1}{\@append\censored@word{##1}}%
+ {\tctestifx{\expanded##1}{\@dump\censored@word\expandargtrue}%
+ {\test@chars{##1}\ifchar\@append\censored@word{##1}\else
+ \test@accents{##1}\ifaccent\@append\censored@word{##1}\tcpop\tc@popped
+ \expandafter\@append\expandafter\censored@word\expandafter{\tc@popped}%
+ \else\@dump\censored@word\addcytoks{##1}\fi\fi}}}
+ {\@dump\censored@word\addcytoks{\censpace}}
+ {\stripgroupingtrue\def\censored@word{}}
{\@dump\censored@word}
+\newif\ifchar
+\newcommand\test@chars[1]{\charfalse
+ \ifx\$#1\chartrue\else
+ \ifx\&#1\chartrue\else
+ \ifx\##1\chartrue\else
+ \ifx\%#1\chartrue\else
+ \ifx\_#1\chartrue\else
+ \ifx\o#1\chartrue\else
+ \ifx\O#1\chartrue\else
+ \ifx\oe#1\chartrue\else
+ \ifx\OE#1\chartrue\else
+ \ifx\aa#1\chartrue\else
+ \ifx\AA#1\chartrue\else
+ \ifx\ae#1\chartrue\else
+ \ifx\AE#1\chartrue\else
+ \ifx\l#1\chartrue\else
+ \ifx\L#1\chartrue
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
+\newif\ifaccent
+\newcommand\test@accents[1]{\accentfalse
+ \ifx\`#1\accenttrue\else
+ \ifx\=#1\accenttrue\else
+ \ifx\'#1\accenttrue\else
+ \ifx\.#1\accenttrue\else
+ \ifx\^#1\accenttrue\else
+ \ifx\"#1\accenttrue\else
+ \ifx\u#1\accenttrue\else
+ \ifx\d#1\accenttrue\else
+ \ifx\v#1\accenttrue\else
+ \ifx\b#1\accenttrue\else
+ \ifx\H#1\accenttrue\else
+ \ifx\t#1\accenttrue\else
+ \ifx\~#1\accenttrue\else
+ \ifx\c#1\accenttrue
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+}
%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -122,4 +155,24 @@
% NOTE: A \protect\censorbox{} MAY BE REQUIRED INSIDE SOME ENVIRONMENTS
\endinput
+VERSION:
+1.00 - Initial release
+2.00 - Added \blackout
+2.10 - Allowed \blackout to cross paragraph boundaries with use of
+ \bpar. Stopped censoring periods, in order to preserve
+ end-of-sentence spacing, which differs from inter-word spacing.
+3.00 - \censorbox introduced to handle figures, tables, etc.
+3.10 - Made \blackout work with \par in argument. Introduced
+ \xblackout
+3.20 - Specify depth/height of censor rule. Introduced \def\censordot{}
+3.21 - Fixed bug regarding \xblackout rules remaining after a
+ \StopCensoring
+3.22 - changed `\if to \ifx in definition of \bl@t, to handle macros like \%
+4.0 - Recast \blackout and \xblackout in terms of tokcycle environments
+ - Introduced \blackoutenv...\endblackoutenv and
+ \xblackoutenv...\endxblackoutenv
+4.1 - Added automatic support for censoring character macros such as \$,
+ etc. and character accents such as \', etc. See \test@chars and
+ \test@accents for details.
+ - Fixed bug in which \expanded arguments remained inside a TeX group