summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/censor
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-02 21:47:46 +0000
committerKarl Berry <karl@freefriends.org>2013-05-02 21:47:46 +0000
commit6cdb75282c226eb14173774707ff1d26629c47ac (patch)
tree0f342f7e8d6eeec8ce843a1f0442c38cc834477a /Master/texmf-dist/tex/latex/censor
parent3a564ce7121a94acea4334b6f89c6e6fe09442a5 (diff)
censor (2may13)
git-svn-id: svn://tug.org/texlive/trunk@30208 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/censor')
-rw-r--r--Master/texmf-dist/tex/latex/censor/censor.sty127
1 files changed, 67 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/latex/censor/censor.sty b/Master/texmf-dist/tex/latex/censor/censor.sty
index 7c3a60613b6..1170c2238b0 100644
--- a/Master/texmf-dist/tex/latex/censor/censor.sty
+++ b/Master/texmf-dist/tex/latex/censor/censor.sty
@@ -1,6 +1,6 @@
% censor.sty
\ProvidesPackage{censor}
-[2013/02/19 v3.00
+[2013/05/02 v3.10
Provides capability for redaction of sensitive information]
%% Copyright 2009, 2012, 2013 Steven B. Segletes
@@ -17,54 +17,6 @@
%
% The Current Maintainer of this work is Steven B. Segletes.
-% Packege: CENSOR
-% CHOOSE MODE OF OPERATION:
-% 1) IF .tex FILE IS CREATED IN PRIVATE (SECURE) ENVIRONMENT:
-% a) To produce censored document, censor individual words with
-% \censor{word}
-% b) Censor text blocks with \blackout{...}, subject to limitations.
-% c) To produce uncensored document, place \StopCensoring in preamble
-% d) To produced a mixed document with some redaction, but elsewhere
-% turned off, place \StopCensoring and/or \RestartCensoring in
-% various document locations as needed.
-%
-% DISCLAIMER: Don't \censor whitespace (i.e., phrases), or justifications
-% could get fouled up. If space-laden phrase needs repeated censoring,
-% I suggest typesetting according to the following example:
-% \def\CodeName{\blackout{Little Bo Peep}}
-% In the text, refer to {\CodeName} as often as needed.
-%
-% 2) IF .tex FILE IS INITIALLY CREATED IN PUBLIC (UNSECURE) ENVIRONMENT:
-% a) To produce censored document, define (in the document preamble)
-% placeholders for all censored phrases, like:
-% \def\ProjectName{\censor*{7}}
-% In document, refer to {\ProjectName} as needed. The "7" refers
-% to the approximate width (in ex's) of the censored word.
-% b) Use of \StopCensoring in preamble will merely turn censored
-% black rectangles into underlined blank spaces, since uncensored
-% word is not known to the public source (.tex) document.
-% c) To produce uncensored document, the source code must be moved
-% to a private (secure) working environment. At that point, the
-% uncensored document may be created merely by editing the document
-% preamble and redefining the censored placeholders, so that
-% \def\ProjectName{\censor*{7}} becomes \def\ProjectName{Liberty},
-% for example. Note that line justification could be affected, since
-% censored placeholders are not exactly the same width as the
-% actual word, in Mode 2 operation.
-% d) To produced (in the private/secure environment) a mixed document
-% with some redaction, but elsewhere turned off, place \StopCensoring
-% and/or \RestartCensoring in various document locations as needed.
-%
-% DISCLAIMER: Don't \censor whitespace (i.e., phrases), or justifications
-% could get fouled up. I suggest typesetting multi-word phrases according
-% to the following example:
-% \def\CodeName{\censor*{6} \censor*{2} \censor*{4}}
-% In the text, refer to {\CodeName} as often as needed.
-%
-% NOTE: For both modes of operation, placeholders are placed in curly
-% braces, so that surrounding white space and/or punctuation is properly
-% handled.
-
% VERSION:
% 1.00 - Initial release
% 2.00 - Added \blackout
@@ -72,7 +24,8 @@
% \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
\usepackage{pbox}
\usepackage{ifnextok}
@@ -94,21 +47,77 @@
\renewcommand\censorbox{\@ifstar{\censor@dim}{\censor@box}}%
}
+\let\sv@tilde~
+
\def\stringend{$}
-\def\blackout#1{\censor@Block#1\stringend}
-\def\censor@Block{\IfNextToken\stringend{\@gobble}%
+
+\long\def\blackout#1{\def~{-}\censor@Block#1\stringend\let~\sv@tilde}
+\long\def\censor@Block{\IfNextToken\stringend{\@gobble}%
{\IfNextToken\@sptoken{ \bl@t{\censor@Block}}%
{\bl@t{\censor@Block}}}}
% V2.00 DEFINITION:
% \def\bl@t#1#2{\censor{#2}#1}
-% V2.10 DEFINITION:
-\def\bl@t#1#2{\if\bpar#2\par\else\if.#2#2\else\censor{#2}\fi\fi#1}
-\def\bpar{_}
-
-% ALTERNATE DEFINITION IF ABOVE PROVES PROBLEMATIC
-%\def\bl@t#1#2{\if.#2#2\else\censor{#2}\fi#1} % JUST PERIODS, NO \bpar
+% V2.10 DEFINITION (MADE \long IN V3.1):
+\long\def\bl@t#1#2{\if\bpar#2\par\else\if.#2#2\else\censor{#2}\fi\fi#1}
+
+%\def\bpar{_} %V3.00 DEFINITION
+\let\bpar\par %AS OF V3.1, CAN HANDLE \par
+
+\long\def\xblackout#1{\rule{0ex}{0ex}%
+ \def~{-}%
+ \def\@justpar{F}%
+ \def\@justperiod{F}%
+ \def\@justspace{F}%
+ \xcensor@Block#1\stringend%
+ \let~\sv@tilde%
+ }
+
+\long\def\xcensor@Block{\IfNextToken\stringend{\@gobble}%
+ {\IfNextToken\@sptoken{ \def\@justspace{T}\xbl@t{\xcensor@Block}}%
+ {\xbl@t{\xcensor@Block}}}}
+
+\newlength\periodrlap\setlength\periodrlap{1.6ex}
+\newlength\afterperiodlap\setlength\afterperiodlap{1.2ex}
+\newlength\lletterlap\setlength\lletterlap{0.55ex}
+\newlength\rletterlap\setlength\rletterlap{0.55ex}
+\newlength\afterspacelap\setlength\afterspacelap{0.0ex}
+
+\def\@periodrlap{\rlap{\rule[-.3ex]{\periodrlap}{2.1ex}}}
+\def\@afterperiodlap{\llap{\rule[-.3ex]{\afterperiodlap}{2.1ex}}}
+\def\@lletterlap{\llap{\rule[-.3ex]{\lletterlap}{2.1ex}}}
+\def\@rletterlap{\rlap{\rule[-.3ex]{\rletterlap}{2.1ex}}}
+\def\@afterspacelap{\llap{\rule[-.3ex]{\afterspacelap}{2.1ex}}}
+
+\long\def\xbl@t#1#2{%
+ \if\par#2%
+ \par\def\@justpar{T}%
+ \else%
+ \if T\@justspace%
+ \rule{0ex}{1ex}\@afterspacelap%
+ \fi%
+ \if.#2%
+ \def\@justperiod{T}%
+ \@periodrlap%
+ #2%
+ \else%
+ \if F\@justpar%
+ \if T\@justperiod%
+ \@afterperiodlap%
+ \else%
+ \@lletterlap%
+ \fi%
+ \fi%
+ \censor{#2}%
+ \@rletterlap%
+ \def\@justpar{F}%
+ \def\@justperiod{F}%
+ \def\@justspace{F}%
+ \fi%
+ \fi%
+ #1%
+}
\newcommand\censorbox{\@ifstar{\censor@dim}{\censor@box}}
\newcommand\censor@dim[4][]{{#1%
@@ -123,6 +132,4 @@
\newcommand\un@censor@box[2][]{#1#2}
% NOTE: A \protect\censorbox{} MAY BE REQUIRED INSIDE SOME ENVIRONMENTS
-
\endinput
-