From 9c283e36ca83f396766a4d69436ef961ee0e37dd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 10 Sep 2012 22:52:21 +0000 Subject: censor (10sep12) git-svn-id: svn://tug.org/texlive/trunk@27638 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/censor/censor.sty | 54 +++++++++++++++++++-------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/censor/censor.sty b/Master/texmf-dist/tex/latex/censor/censor.sty index 822e69a1c00..dfc71912de0 100644 --- a/Master/texmf-dist/tex/latex/censor/censor.sty +++ b/Master/texmf-dist/tex/latex/censor/censor.sty @@ -1,39 +1,37 @@ % censor.sty -%% Copyright 2009 Steven B. Segletes +\ProvidesPackage{censor} +[2012/09/10 v2.10 + Provides capability for redaction of sensitive information] + +%% Copyright 2009, 2012 Steven B. Segletes % -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either version 1.3 +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of LaTeX +% and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. -% -% The Current Maintainer of this work is Steven B. Segletes. % -% This work consists of all files listed in manifest.txt. -% -% This notice added 2010/01/04 by Clea F. Rees the permission of -% Steven B. Segletes. -\ProvidesPackage{censor} -[2009/12/07 v1.00 - Provides capability for redaction of sensitive information] +% 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) To produce uncensored document, place \StopCensoring in preamble -% c) To produced a mixed document with some redaction, but elsewhere +% 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{\censor{Little} \censor{Bo} \censor{Peep}} +% \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: @@ -67,7 +65,15 @@ % braces, so that surrounding white space and/or punctuation is properly % handled. +% 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. + \usepackage{pbox} +\usepackage{ifnextok} \newcommand\censor{\@ifstar{\@cenlen}{\@cenword}} \newcommand\@cenlen[1]{\protect\rule[-.3ex]{#1 ex}{2.1ex}} @@ -82,5 +88,21 @@ \newcommand\RestartCensoring{% \renewcommand\censor{\@ifstar{\@cenlen}{\@cenword}}} +\def\stringend{$} +\def\blackout#1{\censor@Block#1\stringend} +\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 + \endinput -- cgit v1.2.3