summaryrefslogtreecommitdiff
path: root/support/srcredact
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/srcredact
Initial commit
Diffstat (limited to 'support/srcredact')
-rw-r--r--support/srcredact/Makefile80
-rw-r--r--support/srcredact/README11
-rw-r--r--support/srcredact/srcredact.1311
-rw-r--r--support/srcredact/srcredact.pdfbin0 -> 118110 bytes
-rwxr-xr-xsupport/srcredact/srcredact.pl521
-rw-r--r--support/srcredact/srcredact.pod185
-rw-r--r--support/srcredact/srcredact.tex209
-rw-r--r--support/srcredact/twain-edited.tex101
-rw-r--r--support/srcredact/twain1-default.pdfbin0 -> 92007 bytes
-rw-r--r--support/srcredact/twain1-default.tex102
-rw-r--r--support/srcredact/twain1-nobonds.pdfbin0 -> 81766 bytes
-rw-r--r--support/srcredact/twain1-nobonds.tex100
-rw-r--r--support/srcredact/twain1-uppercase.pdfbin0 -> 82486 bytes
-rw-r--r--support/srcredact/twain1-uppercase.tex102
-rw-r--r--support/srcredact/twain1.tex118
-rw-r--r--support/srcredact/twain2-default.pdfbin0 -> 117166 bytes
-rw-r--r--support/srcredact/twain2-default.tex103
-rw-r--r--support/srcredact/twain2-nobonds.pdfbin0 -> 107245 bytes
-rw-r--r--support/srcredact/twain2-nobonds.tex101
-rw-r--r--support/srcredact/twain2-uppercase.pdfbin0 -> 107955 bytes
-rw-r--r--support/srcredact/twain2-uppercase.tex103
-rw-r--r--support/srcredact/twain2.tex119
22 files changed, 2266 insertions, 0 deletions
diff --git a/support/srcredact/Makefile b/support/srcredact/Makefile
new file mode 100644
index 0000000000..9d55f72d65
--- /dev/null
+++ b/support/srcredact/Makefile
@@ -0,0 +1,80 @@
+PACKAGE=srcredact
+WD = $(shell pwd)
+CURRDIR = $(notdir ${WD})
+
+
+TEXFILES = srcredact.tex
+
+PODS = srcredact.pod
+
+MAN1 = ${PODS:%.pod=%.1}
+
+SAMPLEPDFS = \
+ twain1-default.pdf twain1-uppercase.pdf twain1-nobonds.pdf \
+ twain2-default.pdf twain2-uppercase.pdf twain2-nobonds.pdf
+
+DOCS = ${TEXFILES:%.tex=%.pdf} ${MAN1} ${SAMPLEPDFS}
+
+
+
+SCRIPTS = srcredact.pl
+
+
+
+all: ${DOCS}
+ perl -c ${SCRIPTS}
+ chmod a+x ${SCRIPTS}
+
+%.pdf: %.tex srcredact-man.tex
+ pdflatex $<
+ - for file in *.aux; do bibtex $$file; done
+ pdflatex $<
+ while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log || \
+ grep -q '^Package pdfscreen Warning: TOC file not available' $*.log ||\
+ grep -q '^Package natbib Warning: Citation(s) may have changed' $*.log)\
+ do pdflatex $*; done
+
+srcredact-man.tex: srcredact.pod
+ pod2latex -out $@ -h1level 2 $<
+
+%.1: %.pod
+ pod2man -c "Text tools" -r "1.0" $< >$@
+
+twain1-%.tex: twain1.tex srcredact.pl
+ perl srcredact.pl -e $* twain1.tex > $@
+
+twain2-%.tex: twain2.tex srcredact.pl
+ perl srcredact.pl -e $* twain2.tex > $@
+
+twain2.tex: twain1.tex twain-edited.tex
+ perl srcredact.pl -u nobonds twain1.tex twain-edited.tex > $@
+
+clean:
+ $(RM) *.aux *.bbl *.dvi *.log *.out *.toc *.blg *.lof *.lot *.zip \
+ *.ps *.tgz depend *.4* *.css *.idv *.lg *.xref *~ *.tmp \
+ srcredact-man.tex
+
+
+.PRECIOUS: \
+ twain1-uppercase.tex twain1-default.tex twain1-nobonds.tex \
+ twain2-uppercase.tex twain2-default.tex twain2-nobonds.tex \
+ twain2.tex
+
+distclean: clean
+ $(RM) ${DOCS} *.1 twain1-* twain2*
+
+archive: all clean
+ cd ..; \
+ tar -czvf $(PACKAGE).tgz --exclude 'debug*' \
+ --exclude '*~' --exclude '*.tgz' --exclude '*.zip' \
+ --exclude CVS $(CURRDIR); \
+ mv $(PACKAGE).tgz $(CURRDIR); \
+ cd $(CURRDIR)
+
+
+zip: all clean
+ cd ..; \
+ zip -r $(PACKAGE).zip $(CURRDIR) \
+ -x 'debug*' -x '*~' -x '*.tgz' -x '*.zip' -x CVS -x '*/CVS/*'; \
+ mv $(PACKAGE).zip $(CURRDIR); \
+ cd $(CURRDIR)
diff --git a/support/srcredact/README b/support/srcredact/README
new file mode 100644
index 0000000000..c4c4187a0f
--- /dev/null
+++ b/support/srcredact/README
@@ -0,0 +1,11 @@
+ A tool for redacting sources
+ Boris Veytsman
+ Version 1.0
+
+srcredact is a tool to keep a master source, consisting of different
+``chunks'' intended for different audiences. The tool allows to
+extract the versions intended for different audiences and to incorporate
+the changes made in any of these versions into the master document
+
+This work was commissioned by Consumer Financial Protection Bureau,
+United States Treasury.
diff --git a/support/srcredact/srcredact.1 b/support/srcredact/srcredact.1
new file mode 100644
index 0000000000..d8b2040ad6
--- /dev/null
+++ b/support/srcredact/srcredact.1
@@ -0,0 +1,311 @@
+.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "SRCREDACT 1"
+.TH SRCREDACT 1 "2015-10-24" "1.0" "Text tools"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+srcredact \- a program for redaction of text files
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+srcredact [\fI\s-1OPTIONS\s0\fR] \fB\-e\fR \fIaudience\fR [\fIfull_file\fR]
+.PP
+srcredact [\fI\s-1OPTIONS\s0\fR] \fB\-u\fR \fIaudience\fR \fIfull_file\fR [\fIredacted_file\fR]
+.PP
+srcredact \fB\-l\fR [\fIfull_file\fR]
+.PP
+srcredact \fB\-h|\-v\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fBsrcredact\fR is the program to extract ``redacted versions'' of the
+master file (option \fB\-e\fR) or to incorporate the changes in the
+redacted versions into the master file (``unredact'', option \fB\-u\fR).
+.PP
+The master file consists of \fIchunks\fR intended for different
+audiences. Each audience has a \fIname\fR, e.g. \f(CW\*(C`classified\*(C'\fR,
+\&\f(CW\*(C`unclssified\*(C'\fR, \f(CW\*(C`expert\*(C'\fR etc. Chunks are started and stopped by
+\&\fIguard lines\fR. Each guard line has the format (for the default TeX
+syntax)
+.PP
+.Vb 1
+\& %<*name1|name2|...>
+.Ve
+.PP
+or
+.PP
+.Vb 1
+\& %</name1|name2|...>
+.Ve
+.PP
+In the first cases the text following the guard is \fIincluded\fR for the
+audiences \f(CW\*(C`name1\*(C'\fR, \f(CW\*(C`name2\*(C'\fR, .... In the second case it is
+\&\fIexcluded\fR for these audiences.
+.PP
+THere is a special audience \f(CW\*(C`ALL\*(C'\fR: a wild card for all audiences.
+Thus the idiom
+.PP
+.Vb 2
+\& %</ALL>
+\& %<*classified>
+.Ve
+.PP
+means that the chunk is excluded for all audiences but \f(CW\*(C`classified\*(C'\fR
+.PP
+Exactly one of the options \fB\-e\fR (extract) or \fB\-u\fR (unextract) must be
+present. In the extract mode the non-option argument is the name of
+the full file. If it is absent, or is \f(CW\*(C`\-\*(C'\fR, standard input is used.
+In the unextract mode the first non-option argument
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-c\fR \fIlist of comment patterns\fR" 4
+.IX Item "-c list of comment patterns"
+Use the given pattern for comment lines to search for guards instead
+of the default \f(CW\*(C`TeX\*(C'\fR pattern. The recognized patterns are:
+.RS 4
+.IP "\fBc\fR" 4
+.IX Item "c"
+.Vb 1
+\& /*<guard>*/
+.Ve
+.IP "\fBcpp\fR" 4
+.IX Item "cpp"
+.Vb 1
+\& //<guard>
+.Ve
+.IP "\fBfortran\fR" 4
+.IX Item "fortran"
+.Vb 1
+\& C<guard>
+.Ve
+.IP "\fBshell\fR" 4
+.IX Item "shell"
+.Vb 1
+\& #<guard>
+.Ve
+.IP "\fBTeX\fR" 4
+.IX Item "TeX"
+.Vb 1
+\& %<guard>
+.Ve
+.RE
+.RS 4
+.Sp
+The pattern names should be separated by commas, and the list may be
+enclosed in quotes to prevent shell expansion, e.g
+.Sp
+.Vb 1
+\& \-c "TeX, c, shell"
+.Ve
+.RE
+.IP "\fB\-d\fR" 4
+.IX Item "-d"
+Debug mode on.
+.IP "\fB\-e\fR \fIaudience\fR" 4
+.IX Item "-e audience"
+Extract the contents for the current audience into the file \fIfile\fR.
+The cuurent audience is guessed from the \fIfile\fR name, if the latter
+has the structure \fIbase\fR\-\fIaudience\fR.\fIextension\fR,
+e.g. \f(CW\*(C`report\-unclassified.tex\*(C'\fR. The key \fB\-a\fR overrides this guess
+and should be used if the file name does not follow this pattern. The
+file name \f(CW\*(C`\-\*(C'\fR means the standard output.
+.IP "\fB\-h\fR" 4
+.IX Item "-h"
+Print help information and exit.
+.IP "\fB\-l\fR" 4
+.IX Item "-l"
+List all audiences set in the file (one per line) and exit.
+.IP "\fB\-u\fR \fIaudience\fR" 4
+.IX Item "-u audience"
+Take a edited file intended for the \fIaudience\fR (the second
+non-option argument) and incorporate the changes in it into the full
+file (the first non-option argument). If the second argument is
+missing, standard input is used instead. As usual, \f(CW\*(C`\-\*(C'\fR also means
+standard input. Note that only one of the two file arguments in this
+case can be standard input.
+.IP "\fB\-v\fR" 4
+.IX Item "-v"
+Print version information and exit.
+.IP "\fB\-w\fR \fIon|off|1|0|true|false\fR" 4
+.IX Item "-w on|off|1|0|true|false"
+If \f(CW\*(C`on\*(C'\fR, \f(CW1\fR or \f(CW\*(C`true\*(C'\fR (the deafult), implicitly wrap the full
+document into the guards
+.Sp
+.Vb 3
+\& %<*ALL>
+\& ...
+\& %</ALL>
+.Ve
+.SH "RETURN VALUE"
+.IX Header "RETURN VALUE"
+The program returns 0 if successful, 1 if conflicts were found in the
+\&\f(CW\*(C`unextract\*(C'\fR mode and 2 in case of problems.
+.SH "CONFLICTS IN UNEXTRACT MODE"
+.IX Header "CONFLICTS IN UNEXTRACT MODE"
+Like the standard \fIdiff3\fR\|(1) tool, the program may find conflicts
+between the full version and the edited one in the \fB\-u\fR mode. Then
+the resulting file brackets the conflicts in the usual manner, e.g.
+.PP
+.Vb 10
+\& <<<<<<< /tmp/BrjXo0hMOB/full
+\& %</nobonds>
+\& Forty\-five tons best old dry government bonds, suitable for furnace, gold
+\& 7 per cents., 1864, preferred.
+\& %<*nobonds>
+\& ||||||| /tmp/BrjXo0hMOB/extracted
+\& Forty\-five tons best old dry government bonds, suitable for furnace, gold
+\& 7 per cents., 1864, preferred.
+\& =======
+\& >>>>>>> /tmp/BrjXo0hMOB/new
+.Ve
+.PP
+Here \f(CW\*(C`full\*(C'\fR is the full document, \f(CW\*(C`extracted\*(C'\fR is the extracted file
+for the given audience, \f(CW\*(C`new\*(C'\fR is the edited file.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Boris Veytsman, borisv@lk.net
+.PP
+This work was commissioned by Consumer Financial Protection Bureau,
+United States Treasury.
+.SH "LICENSE AND COPYRIGHT"
+.IX Header "LICENSE AND COPYRIGHT"
+Copyright (C) 2015 Boris Veytsman. Version 1.0
+.PP
+This program is free software; you can redistribute it and/or modify
+it under the terms of the \s-1GNU\s0 General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+.PP
+This program is distributed in the hope that it will be useful, but
+\&\s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
+\&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0
+General Public License for more details.
+.PP
+You should have received a copy of the \s-1GNU\s0 General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, \s-1MA\s0
+02110\-1301, \s-1USA\s0
diff --git a/support/srcredact/srcredact.pdf b/support/srcredact/srcredact.pdf
new file mode 100644
index 0000000000..a7bb5b36ea
--- /dev/null
+++ b/support/srcredact/srcredact.pdf
Binary files differ
diff --git a/support/srcredact/srcredact.pl b/support/srcredact/srcredact.pl
new file mode 100755
index 0000000000..5908bde1e2
--- /dev/null
+++ b/support/srcredact/srcredact.pl
@@ -0,0 +1,521 @@
+#!/usr/bin/env perl
+
+use strict;
+
+my $USAGE = <<END;
+srcredact - a program for redacting the sources
+
+Usage:
+
+srcredact [OPTIONS] -e audience [full_file]
+
+srcredact [OPTIONS] -u audience full_file [redacted_file]
+
+srcredact -l [full_file]
+
+srcredact -h|-v
+
+
+srcredact is the program to extract ``redacted versions'' of the master
+file (option -e) or to incorporate the changes in the redacted versions
+into the master file (``unextract'', option -u).
+
+The master file consists of chunks intended for different audiences.
+Each audience has a name, e.g. "classified", "unclssified", "expert"
+etc. Chunks are started and stopped by guard lines. Each guard line
+has the format (for the default TeX syntax)
+
+ %<name1|name2|...>
+
+or
+
+ %</name1|name2|...>
+
+In the first cases the text following the guard is included for the
+audiences "name1", "name2", .... In the second case it is excluded for
+these audiences.
+
+THere is a special audience "ALL": a wild card for all audiences. Thus
+the idiom
+
+ %</ALL>
+ %<classified>
+
+means that the chunk is excluded for all audiences but "classified"
+
+Exactly one of the options -e (extract) or -u (unextract) must be present.
+In the redact mode the non-option argument is the name of the full file.
+If it is absent, or is "-", standard input is used. In the unextract mode
+the first non-option argument
+
+OPTIONS
+ -c list of comment patterns
+ Use the given pattern for comment lines to search for guards instead
+ of the default "TeX" pattern. The recognized patterns are:
+
+ c
+ /<guard>/
+
+ cpp
+ //<guard>
+
+ fortran
+ C<guard>
+
+ shell
+ #<guard>
+
+ TeX
+ %<guard>
+
+ The pattern names should be separated by commas, and the list may be
+ enclosed in quotes to prevent shell expansion, e.g
+
+ -c "TeX, c, shell"
+
+ -d Debug mode on.
+
+ -e audience
+ Extract the contents for the current audience into the file file.
+ The cuurent audience is guessed from the file name, if the latter
+ has the structure base-audience.extension, e.g.
+ "report-unclassified.tex". The key -a overrides this guess and
+ should be used if the file name does not follow this pattern. The
+ file name "-" means the standard output.
+
+ -h Print help information and exit.
+
+ -l List all audiences set in the file (one per line) and exit.
+
+ -u audience
+ Take a redacted file intended for the audience (the second
+ non-option argument) and incorporate the changes in it into the full
+ file (the first non-option argument). If the second argument is
+ missing, standard input is used instead. As usual, "-" also means
+ standard input. Note that only one of the two file arguments in this
+ case can be standard input.
+
+ -v Print version information and exit.
+
+ -w on|off|1|0|true|false
+ If "on", 1 or "true" (the deafult), implicitly wrap the full
+ document into the guards
+
+ %<ALL>
+ ...
+ %</ALL>
+END
+
+
+ my $COPYRIGHT= <<END;
+srcredact - a program for redacting the sources
+
+Copyright (C) 2015 Boris Veytsman. Version 1.0
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA
+END
+
+
+######################################################
+# Reading arguments
+######################################################
+
+use Getopt::Std;
+use File::Temp qw/tempdir/;
+
+our %opts;
+getopts ('c:de:hlu:vw:', \%opts) or do {
+ print STDERR $USAGE;
+ exit(2);
+};
+
+if ($opts{h}) {
+ die ($USAGE);
+}
+
+if ($opts{v}){
+ die ($COPYRIGHT);
+}
+
+my $DEBUG=0;
+if ($opts{d}) {
+ $DEBUG=1;
+}
+
+
+my @commentPatterns;
+if ($opts{c}) {
+ @commentPatterns=GetCommentPatterns($opts{c});
+} else {
+ @commentPatterns=GetCommentPatterns('TeX');
+}
+
+# We want exactly one of the modes -l, -e, -u:
+my $audience;
+my $mode;
+my $modesFound=0;
+if ($opts{l}) {
+ $mode = "list";
+ $modesFound++;
+}
+if ($opts{e}) {
+ $mode='extract';
+ $audience = $opts{e};
+ $modesFound++;
+}
+if ($opts{u}) {
+ $mode = "unextract";
+ $audience = $opts{u};
+ $modesFound++;
+}
+
+if ($modesFound != 1) {
+ print STDERR
+ "Exactly one of the options -l, -e, -u must be present.\n\n$USAGE";
+ exit (2);
+}
+
+my $wrap=1;
+if (exists $opts{w}) {
+ if ($opts{w} eq '0' || $opts{w} =~ m/^off$/i ||
+ $opts{w} =~ m/^false$/i) {
+ $wrap=0;
+ } elsif ($opts{w} eq '1' || $opts{w} =~ m/^on$/i ||
+ $opts{w} =~ m/^true$/i) {
+ $wrap=0;
+ } else {
+ print STDERR "Unknwon value for -w option: $opts{w}.\n" .
+ "Must be 0|1|on|off|true|false\n";
+ exit (2);
+ }
+}
+
+if ($DEBUG) {
+ print STDERR "Wrapping in <ALL> is $wrap\n";
+}
+
+# Opening files
+my $fullFH;
+my $newFH;
+
+# In 'l' or 'e' mode we need one or zero non-option arguments
+if (($mode eq 'list') || ($mode eq 'extract')) {
+ if (scalar(@ARGV) == 0) {
+ if ($DEBUG) {
+ print STDERR "Usign stdin for full file\n";
+ }
+ $fullFH=*STDIN;
+ } elsif (scalar(@ARGV) == 1) {
+ my $full = shift @ARGV;
+ if ($full eq '-') {
+ if ($DEBUG) {
+ print STDERR "Usign stdin for full file\n";
+ }
+ $fullFH = *STDIN;
+ } else {
+ if ($DEBUG) {
+ print STDERR "Usign $full for full file\n";
+ }
+ open ($fullFH, "<", $full) or do {
+ print STDERR "Cannot open file $full\n";
+ exit (2);
+ };
+ }
+ } else {
+ print STDERR
+ "Options -e and -l require one or zero non-option argument\n\n";
+ print STDERR $USAGE;
+ exit(2);
+ }
+}
+
+# In 'u' mode we need one or two arguments
+if ($mode eq 'unextract') {
+ if ((scalar(@ARGV) < 1) || (scalar(@ARGV) > 2)) {
+ print STDERR
+ "Option -u requires one or two non-option argument\n\n";
+ print STDERR $USAGE;
+ exit(2);
+ }
+
+ my $full = shift @ARGV;
+ if ($full eq '-') {
+ if ($DEBUG) {
+ print STDERR "Usign stdin for full file\n";
+ }
+ $fullFH = *STDIN;
+ } else {
+ if ($DEBUG) {
+ print STDERR "Usign $full for full file\n";
+ }
+ open ($fullFH, "<", $full) or do {
+ print STDERR "Cannot open file $full\n";
+ exit (2);
+ };
+ }
+
+ if (scalar(@ARGV) == 0) {
+ if ($DEBUG) {
+ print STDERR "Usign stdin for redacted file\n";
+ }
+ $newFH=*STDIN;
+ } else {
+ my $redacted = shift @ARGV;
+ if ($redacted eq '-') {
+ if ($DEBUG) {
+ print STDERR "Usign stdin for redacted file\n";
+ }
+ $newFH = *STDIN;
+ } else {
+ if ($DEBUG) {
+ print STDERR "Usign $redacted for redacted file\n";
+ }
+ open ($newFH, "<", $redacted) or do {
+ print STDERR "Cannot open file $redacted\n";
+ exit (2);
+ };
+ }
+ }
+}
+
+
+
+# And the real work
+if ($mode eq 'list') {
+ if ($DEBUG) {
+ print STDERR "List mode\n";
+ }
+ my @audiences=ListAudiences($fullFH, \@commentPatterns);
+ print join("\n", @audiences), "\n";
+ exit (0);
+}
+
+if ($mode eq 'extract') {
+ if ($DEBUG) {
+ print STDERR "Extract mode\n";
+ }
+ ExtractText($fullFH, \*STDOUT, $audience,
+ \@commentPatterns, $wrap);
+ exit (0);
+}
+
+if ($mode eq 'unextract') {
+ if ($DEBUG) {
+ print STDERR "Unextract mode\n";
+ }
+
+ my $exitCode = UnextractText($fullFH, $newFH, \*STDOUT,
+ $audience, \@commentPatterns, $wrap);
+
+ exit ($exitCode);
+
+}
+
+##################################################
+# Extracting comment patterns
+##################################################
+
+sub GetCommentPatterns {
+
+ my %knownPatterns = ( 'c' => '^/\*<([^>]*)>\*/',
+ 'cpp' => '^\/\/<([^>]*)>',
+ fortran => '^C<([^>]*)>',
+ shell => '^#<([^>]*)>',
+ tex => '^%<([^>]*)>'
+ );
+
+
+
+ my $input = shift;
+ if ($DEBUG) {
+ print STDERR "Got pattern string $input\n";
+ }
+ $input =~ s/^\s*//;
+ $input =~ s/\s*$//;
+ my @languages = split /[\s,]\s*/, $input;
+ my @patterns;
+
+ foreach my $lang (@languages) {
+ $lang =~ s/^(.*)$/\L$1\E/;
+ if ($DEBUG) {
+ print STDERR "Processing language $lang... ";
+ }
+ if (exists $knownPatterns{$lang}) {
+ push @patterns, $knownPatterns{$lang};
+ if ($DEBUG) {
+ print STDERR "found pattern $knownPatterns{$lang}\n";
+ }
+ } else {
+ print STDERR
+ "Unknown comment language $lang. The supported languages are ",
+ join(", ", keys %knownPatterns), "\n";
+ exit(2);
+ }
+ }
+
+ return @patterns;
+}
+
+##################################################
+# List audiences
+##################################################
+
+sub ListAudiences {
+ my $fh=shift;
+ my $patterns=shift;
+ my %foundAudiences = ('ALL' => 1);
+ while (<$fh>) {
+ my @result = FindAudiences ($_, $patterns);
+ if (scalar @result) {
+ shift @result;
+ foreach my $audience (@result) {
+ $foundAudiences{$audience} = 1;
+ }
+ }
+ }
+ return (sort keys %foundAudiences);
+}
+
+##################################################
+# Check whether the line is a comment
+##################################################
+# Return 0 to delete, 1 to add, and the list of
+# audiences
+sub FindAudiences {
+ my $line = shift;
+ my $patterns=shift;
+ foreach my $pattern (@{$patterns}) {
+ if ($line =~ m/$pattern/) {
+ if ($DEBUG) {
+ print STDERR "Line $. is a guard: $line";
+ }
+ my $guards = $1;
+ my @result;
+ if (substr($guards,0,1) eq '*') {
+ push @result, 1;
+ } elsif (substr($guards,0,1) eq '/') {
+ push @result, 0;
+ } else {
+ die "Wrong guard line $line\n";
+ }
+ @result = (@result, split(/\|/, substr($guards,1)));
+ return @result;
+ }
+ }
+ return ();
+}
+
+##################################################
+# Extracting text for the given audience
+##################################################
+sub ExtractText {
+ my $fullFH=shift;
+ my $outFH=shift;
+ my $audience = shift;
+ my $patterns = shift;
+ my $state = shift;
+
+ if ($DEBUG) {
+ print STDERR "Initial state $state\n";
+ }
+
+ while (<$fullFH>) {
+ my @result = FindAudiences ($_, $patterns);
+ if (scalar @result) {
+ my $newstate = shift @result;
+ foreach my $tryaudience (@result) {
+ if (($tryaudience eq 'ALL') ||
+ ($audience eq $tryaudience)) {
+ $state = $newstate;
+ if ($DEBUG) {
+ print STDERR "Changing state to $state\n";
+ }
+ last;
+ }
+ }
+ } else { # Normal line
+ if ($state) {
+ print $outFH $_;
+ }
+ }
+ }
+}
+
+################################################################
+# Merge files
+################################################################
+
+sub UnextractText {
+ my $fullFH=shift;
+ my $newFH=shift;
+ my $outFH = shift;
+ my $audience = shift;
+ my $patterns = shift;
+ my $state = shift;
+
+ # Creating tempdir. We leave the tempdir in place in
+ # the debug mode
+ my $tmpdir = tempdir (CLEANUP => !$DEBUG);
+ if ($DEBUG) {
+ print STDERR "Creating directory $tmpdir\n";
+ }
+
+ open (FULL, ">$tmpdir/full") or do {
+ print STDERR "Cannot open temporary file $tmpdir/full\n";
+ return(2);
+ };
+
+ print FULL <$fullFH>;
+ close FULL;
+
+ open (FULL, "<$tmpdir/full") or do {
+ print STDERR "Cannot open temporary file $tmpdir/full\n";
+ return(2);
+ };
+
+ open (EXTRACTED, ">$tmpdir/extracted") or do {
+ print STDERR "Cannot open temporary file $tmpdir/extracted\n";
+ return(2);
+ };
+
+ if ($DEBUG) {
+ print STDERR "Extracting text\n";
+ }
+
+ ExtractText(\*FULL, \*EXTRACTED, $audience,
+ $patterns, $wrap);
+
+ close FULL;
+ close EXTRACTED;
+
+ open (NEW, ">$tmpdir/new") or do {
+ print STDERR "Cannot open temporary file $tmpdir/new\n";
+ return(2);
+ };
+
+ print NEW <$newFH>;
+ close NEW;
+
+
+ if ($DEBUG) {
+ print STDERR "Merging text\n";
+ }
+
+ print $outFH `diff3 -m $tmpdir/full $tmpdir/extracted $tmpdir/new`;
+
+ return ${^CHILD_ERROR_NATIVE};
+
+}
diff --git a/support/srcredact/srcredact.pod b/support/srcredact/srcredact.pod
new file mode 100644
index 0000000000..4f690848f0
--- /dev/null
+++ b/support/srcredact/srcredact.pod
@@ -0,0 +1,185 @@
+=head1 NAME
+
+srcredact - a program for redaction of text files
+
+=head1 SYNOPSIS
+
+srcredact [I<OPTIONS>] B<-e> I<audience> [I<full_file>]
+
+srcredact [I<OPTIONS>] B<-u> I<audience> I<full_file> [I<redacted_file>]
+
+srcredact B<-l> [I<full_file>]
+
+srcredact B<-h|-v>
+
+=head1 DESCRIPTION
+
+B<srcredact> is the program to extract ``redacted versions'' of the
+master file (option B<-e>) or to incorporate the changes in the
+redacted versions into the master file (``unredact'', option B<-u>).
+
+The master file consists of I<chunks> intended for different
+audiences. Each audience has a I<name>, e.g. C<classified>,
+C<unclssified>, C<expert> etc. Chunks are started and stopped by
+I<guard lines>. Each guard line has the format (for the default TeX
+syntax)
+
+ %<*name1|name2|...>
+
+or
+
+ %</name1|name2|...>
+
+In the first cases the text following the guard is I<included> for the
+audiences C<name1>, C<name2>, .... In the second case it is
+I<excluded> for these audiences.
+
+THere is a special audience C<ALL>: a wild card for all audiences.
+Thus the idiom
+
+ %</ALL>
+ %<*classified>
+
+means that the chunk is excluded for all audiences but C<classified>
+
+Exactly one of the options B<-e> (extract) or B<-u> (unextract) must be
+present. In the extract mode the non-option argument is the name of
+the full file. If it is absent, or is C<->, standard input is used.
+In the unextract mode the first non-option argument
+
+=head1 OPTIONS
+
+=over 4
+
+
+=item B<-c> I<list of comment patterns>
+
+Use the given pattern for comment lines to search for guards instead
+of the default C<TeX> pattern. The recognized patterns are:
+
+=over 4
+
+=item B<c>
+
+ /*<guard>*/
+
+=item B<cpp>
+
+ //<guard>
+
+=item B<fortran>
+
+ C<guard>
+
+=item B<shell>
+
+ #<guard>
+
+=item B<TeX>
+
+ %<guard>
+
+=back
+
+The pattern names should be separated by commas, and the list may be
+enclosed in quotes to prevent shell expansion, e.g
+
+ -c "TeX, c, shell"
+
+=item B<-d>
+
+Debug mode on.
+
+=item B<-e> I<audience>
+
+Extract the contents for the current audience into the file I<file>.
+The cuurent audience is guessed from the I<file> name, if the latter
+has the structure I<base>-I<audience>.I<extension>,
+e.g. C<report-unclassified.tex>. The key B<-a> overrides this guess
+and should be used if the file name does not follow this pattern. The
+file name C<-> means the standard output.
+
+=item B<-h>
+
+Print help information and exit.
+
+=item B<-l>
+
+List all audiences set in the file (one per line) and exit.
+
+
+=item B<-u> I<audience>
+
+Take a edited file intended for the I<audience> (the second
+non-option argument) and incorporate the changes in it into the full
+file (the first non-option argument). If the second argument is
+missing, standard input is used instead. As usual, C<-> also means
+standard input. Note that only one of the two file arguments in this
+case can be standard input.
+
+=item B<-v>
+
+Print version information and exit.
+
+=item B<-w> I<on|off|1|0|true|false>
+
+If C<on>, C<1> or C<true> (the deafult), implicitly wrap the full
+document into the guards
+
+ %<*ALL>
+ ...
+ %</ALL>
+
+=back
+
+=head1 RETURN VALUE
+
+The program returns 0 if successful, 1 if conflicts were found in the
+C<unextract> mode and 2 in case of problems.
+
+=head1 CONFLICTS IN UNEXTRACT MODE
+
+Like the standard L<diff3(1)> tool, the program may find conflicts
+between the full version and the edited one in the B<-u> mode. Then
+the resulting file brackets the conflicts in the usual manner, e.g.
+
+ <<<<<<< /tmp/BrjXo0hMOB/full
+ %</nobonds>
+ Forty-five tons best old dry government bonds, suitable for furnace, gold
+ 7 per cents., 1864, preferred.
+ %<*nobonds>
+ ||||||| /tmp/BrjXo0hMOB/extracted
+ Forty-five tons best old dry government bonds, suitable for furnace, gold
+ 7 per cents., 1864, preferred.
+ =======
+ >>>>>>> /tmp/BrjXo0hMOB/new
+
+Here C<full> is the full document, C<extracted> is the extracted file
+for the given audience, C<new> is the edited file.
+
+=head1 AUTHOR
+
+Boris Veytsman, borisv@lk.net
+
+This work was commissioned by Consumer Financial Protection Bureau,
+United States Treasury.
+
+=head1 LICENSE AND COPYRIGHT
+
+Copyright (C) 2015 Boris Veytsman. Version 1.0
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA
+
diff --git a/support/srcredact/srcredact.tex b/support/srcredact/srcredact.tex
new file mode 100644
index 0000000000..5c1f27b2e7
--- /dev/null
+++ b/support/srcredact/srcredact.tex
@@ -0,0 +1,209 @@
+\documentclass{article}
+\usepackage[osf]{Baskervaldx} % tosf in text, tlf in math
+\usepackage[baskervaldx,bigdelims,vvarbb]{newtxmath} % math italic
+ % letters from Baskervaldx
+\usepackage[cal=boondoxo]{mathalfa} % mathcal from STIX, unslanted a
+ % bit
+\usepackage{inconsolata}
+\usepackage{fancyvrb}
+\usepackage{xcolor}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\def\Redbf{\color{red}\bfseries}
+\def\Red{\color{red}}
+\def\Greenbf{\color{green}\bfseries}
+\def\Green{\color{green}}
+\begin{document}
+\title{A tool for redacting the sources:
+ \textsl{srcredact}\thanks{This work was commissioned by the US Consumer
+ Financial Protection Bureau, United States Treasury}}
+\author{Boris Veytsman}
+\date{$ $Revision: 1.4 $ $Date: 2015/05/20 23:30:22 $ $}
+\maketitle
+
+\clearpage
+\tableofcontents
+
+\clearpage
+
+\section{Introduction}
+\label{sec:intro}
+
+Many documents containing confidential information exist in several
+versions: one for the general public, one for the limited audience (or
+even several confidential versions for the different audiences). In
+some cases the desire to have several versions of a document might be
+caused not by confidentiality, but by the different needs of
+audiences: e.g. an ``executive'' and ``research'' version of the same
+white paper.
+
+One can maintain several versions of the document separately, but this
+quickly becomes cumbersome and error-prone. At some point the
+versions drift away too much, and making them close again becomes a
+difficult and expensive task. This is a typical ``anti-pattern'',
+well known to programmers.
+
+Therefore the task is to enable the user to have a single source from
+which various versions of a document can be produced.
+
+There are different ways to achieve this effect. The
+\emph{output-level} redaction means that we have a specially marked
+source file, from which several different PDF files can be produced.
+
+The \emph{source-level} redaction means that we have one source file,
+also specially marked, from which several different \emph{sources} can
+be produced. This means that different co-authors can get different
+versions of a source file and work in their own versions of text.
+This is the approach taken by the present tool.
+
+One may consider the idea of different co-authors to have different
+versions of text to be rather strange. Why would an author to be
+denied the access to a part of her own text? However, there are
+situations where this idea is warranted. Suppose we have a report
+that has classified and non-classified parts. Suppose also that some
+non-classified parts are co-authored by experts that do not have the
+privilige to read (all or some) classified parts of the report. We
+want to enable their work on their parts without compromising the
+confidentiality of the whole.
+
+\LaTeX\ actually provides some facilities for this approach with its
+\verb|\input| and \verb|\include| mechanism. Indeed, one can put in
+the document:
+\begin{verbatim}
+classified text...
+
+\input{unclassified-part}
+
+classified tex
+\end{verbatim}
+However, this mechanism allows only limited control over the sources.
+
+The program \textsl{srcredact} is intended to provide a more
+fine-grained control over the included and excluded parts.
+
+\section{Concept of Operation}
+\label{sec:concept}
+
+Let us first discuss a document, that has two versions: classified and
+unclassified one. There are two modes for creation of such document
+with the package \textsl{srcredact}. In the first mode the master
+file is a valid \TeX\ file, which provides the full version of the
+document, and the redacted version is the file with certain parts
+omitted (Figure~\ref{fig:master1st}). In the second mode some parts
+of the redacted version are \emph{not} present in the unredacted
+version (Figure~\ref{fig:master2nd}). These two modes determine two
+work flows. In the first case flow we run \textsl{latex} on the
+document to get the full version, \emph{or} \textsl{srcredact} and
+then \textsl{latex} to get the redacted (unclassified) version
+(Figure~\ref{fig:flow1st}). In the second case we run
+\textsl{srcredact} (with different options) to get either classified
+or unclassified versions of the package (Figure~\ref{fig:flow2nd}).
+
+\begin{figure}
+ \centering
+ \begin{Verbatim}[commandchars=+^_]
+\documentclass{article}
+
+\begin{document}
+Common text
++Redbf%<*!unclassified>
++Red^_Classified text
++Redbf%</!unclassified>
+\end{document}
+ \end{Verbatim}
+ \caption{Master document in the first mode}
+ \label{fig:master1st}
+\end{figure}
+
+\begin{figure}
+ \centering
+ \begin{Verbatim}[commandchars=+^_]
+%<*ALL>
+\documentclass{article}
+
+\begin{document}
+Common text
+%</ALL>
++Redbf%<*classified>
++Red^_Classified version of the text
++Redbf%</!classified>
++Greenbf%<*unclassified>
++Green^_Unclassified version of the text
++Greenbf%</unclassified>
+%<*ALL>
+\end{document}
+%</ALL>
+ \end{Verbatim}
+ \caption{Master document in the second mode}
+ \label{fig:master2nd}
+\end{figure}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[draw, rectangle, on grid, color=red] (filetex)
+ {\color{red}\bfseries file.tex};
+ \node[draw, ellipse, below=2cm of filetex, on grid,
+ color=red] (filepdf) {\color{red}file.pdf};
+ \draw[arrows=-latex] (filetex) -- node [right] {\textsl{latex}}
+ (filepdf);
+ \node[draw,rectangle, right=2 cm of filetex, on grid, color=green]
+ (redactedtex) {\color{green}file-unclassified.tex};
+ \draw[arrows=-latex] (filetex) -- node[above] {\textsl{srcredact}}
+ (redactedtex);
+ \node[draw, ellipse, below=2 cm of redactedtex, on grid,
+ color=green] (redactedpdf) {\color{green}file-unclassified.pdf};
+ \draw[arrows=-latex] (redactedtex) -- node [right] {\textsl{latex}}
+ (redactedpdf);
+ \end{tikzpicture}
+ \caption{Work flow in the first mode. The red color corresponds to
+ the classified material, the green color to the unclassified one.}
+ \label{fig:flow1st}
+\end{figure}
+
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[draw, rectangle, on grid, color=red] (filetex)
+ {\color{red}\bfseries file.tex};
+ \node[draw,rectangle, left=2 cm of filetex, on grid, color=red]
+ (secrettex) {\color{red}file-classified.tex};
+ \draw[arrows=-latex] (filetex) -- node[above] {\textsl{srcredact}}
+ (secrettex);
+ \node[draw, ellipse, below=2cm of secrettex, on grid,
+ color=red] (secretpdf) {\color{red}file-classified.pdf};
+ \draw[arrows=-latex] (secrettex) -- node [right] {\textsl{latex}}
+ (secretpdf);
+ \node[draw,rectangle, right=2 cm of filetex, on grid, color=green]
+ (redactedtex) {\color{green}file-unclassified.tex};
+ \draw[arrows=-latex] (filetex) -- node[above] {\textsl{srcredact}}
+ (redactedtex);
+ \node[draw, ellipse, below=2 cm of redactedtex, on grid,
+ color=green] (redactedpdf) {\color{green}file-unclassified.pdf};
+ \draw[arrows=-latex] (redactedtex) -- node [right] {\textsl{latex}}
+ (redactedpdf);
+ \end{tikzpicture}
+ \caption{Work flow in the second mode. The red color corresponds to
+ the classified material, the green color to the unclassified one.}
+ \label{fig:flow2nd}
+\end{figure}
+
+In a more complex case we can have more than two versions of the
+document, for example, intended for different audiences. In all cases
+we can either plan to a ``full'' version, obtained by \textsl{latex}'ing
+the master document, or to assume that no version is the superset of
+all other versions, and thus we need \textsl{srcredact} to get any
+version of the document.
+
+\section{\textsl{srcredact} man page}
+\label{sec:manpage}
+
+The following is the manual page of \textsl{srcredact} tool.
+
+\input{srcredact-man}
+
+%\bibliographystyle{unsrt}
+%\bibliography{srcredact}
+
+\end{document}
diff --git a/support/srcredact/twain-edited.tex b/support/srcredact/twain-edited.tex
new file mode 100644
index 0000000000..9ec1fdf86e
--- /dev/null
+++ b/support/srcredact/twain-edited.tex
@@ -0,0 +1,101 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson\footnote{Now a neighborhood in Bronx},
+ October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+nobonds.
+
+This document is updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+\emph{Mark Twain, Who will be very grateful, and will vote right.}
+\end{document}
diff --git a/support/srcredact/twain1-default.pdf b/support/srcredact/twain1-default.pdf
new file mode 100644
index 0000000000..9ef36b1717
--- /dev/null
+++ b/support/srcredact/twain1-default.pdf
Binary files differ
diff --git a/support/srcredact/twain1-default.tex b/support/srcredact/twain1-default.tex
new file mode 100644
index 0000000000..39fbd0fc5d
--- /dev/null
+++ b/support/srcredact/twain1-default.tex
@@ -0,0 +1,102 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson, October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+default.
+
+This document is not updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+\textsc{the hon. the secretary of the treasury, washington, d.~c.:}
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+Mark Twain, Who will be very grateful, and will vote right.
+\end{document}
diff --git a/support/srcredact/twain1-nobonds.pdf b/support/srcredact/twain1-nobonds.pdf
new file mode 100644
index 0000000000..f08bb08cb3
--- /dev/null
+++ b/support/srcredact/twain1-nobonds.pdf
Binary files differ
diff --git a/support/srcredact/twain1-nobonds.tex b/support/srcredact/twain1-nobonds.tex
new file mode 100644
index 0000000000..c38e1b75ba
--- /dev/null
+++ b/support/srcredact/twain1-nobonds.tex
@@ -0,0 +1,100 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson, October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+nobonds.
+
+This document is not updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+Mark Twain, Who will be very grateful, and will vote right.
+\end{document}
diff --git a/support/srcredact/twain1-uppercase.pdf b/support/srcredact/twain1-uppercase.pdf
new file mode 100644
index 0000000000..f25a6bdbb8
--- /dev/null
+++ b/support/srcredact/twain1-uppercase.pdf
Binary files differ
diff --git a/support/srcredact/twain1-uppercase.tex b/support/srcredact/twain1-uppercase.tex
new file mode 100644
index 0000000000..76ad14ca0d
--- /dev/null
+++ b/support/srcredact/twain1-uppercase.tex
@@ -0,0 +1,102 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson, October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+uppercase.
+
+This document is not updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+Mark Twain, Who will be very grateful, and will vote right.
+\end{document}
diff --git a/support/srcredact/twain1.tex b/support/srcredact/twain1.tex
new file mode 100644
index 0000000000..dff4182ff9
--- /dev/null
+++ b/support/srcredact/twain1.tex
@@ -0,0 +1,118 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson, October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+%</uppercase|nobonds>
+default.
+%</ALL>
+%<*uppercase>
+uppercase.
+%</uppercase>
+%<*nobonds>
+nobonds.
+%<*ALL>
+
+This document is not updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+%</ALL>
+%<*uppercase|nobonds>
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+%<*ALL>
+%</uppercase|nobonds>
+\textsc{the hon. the secretary of the treasury, washington, d.~c.:}
+%<*ALL>
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+%</nobonds>
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+%<*nobonds>
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+Mark Twain, Who will be very grateful, and will vote right.
+\end{document}
diff --git a/support/srcredact/twain2-default.pdf b/support/srcredact/twain2-default.pdf
new file mode 100644
index 0000000000..664f103f1a
--- /dev/null
+++ b/support/srcredact/twain2-default.pdf
Binary files differ
diff --git a/support/srcredact/twain2-default.tex b/support/srcredact/twain2-default.tex
new file mode 100644
index 0000000000..1eef073ddf
--- /dev/null
+++ b/support/srcredact/twain2-default.tex
@@ -0,0 +1,103 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson\footnote{Now a neighborhood in Bronx},
+ October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+default.
+
+This document is updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+\textsc{the hon. the secretary of the treasury, washington, d.~c.:}
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+\emph{Mark Twain, Who will be very grateful, and will vote right.}
+\end{document}
diff --git a/support/srcredact/twain2-nobonds.pdf b/support/srcredact/twain2-nobonds.pdf
new file mode 100644
index 0000000000..e938ed24fb
--- /dev/null
+++ b/support/srcredact/twain2-nobonds.pdf
Binary files differ
diff --git a/support/srcredact/twain2-nobonds.tex b/support/srcredact/twain2-nobonds.tex
new file mode 100644
index 0000000000..9ec1fdf86e
--- /dev/null
+++ b/support/srcredact/twain2-nobonds.tex
@@ -0,0 +1,101 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson\footnote{Now a neighborhood in Bronx},
+ October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+nobonds.
+
+This document is updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+\emph{Mark Twain, Who will be very grateful, and will vote right.}
+\end{document}
diff --git a/support/srcredact/twain2-uppercase.pdf b/support/srcredact/twain2-uppercase.pdf
new file mode 100644
index 0000000000..a412cfc68d
--- /dev/null
+++ b/support/srcredact/twain2-uppercase.pdf
Binary files differ
diff --git a/support/srcredact/twain2-uppercase.tex b/support/srcredact/twain2-uppercase.tex
new file mode 100644
index 0000000000..5bce736c28
--- /dev/null
+++ b/support/srcredact/twain2-uppercase.tex
@@ -0,0 +1,103 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson\footnote{Now a neighborhood in Bronx},
+ October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+uppercase.
+
+This document is updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+\emph{Mark Twain, Who will be very grateful, and will vote right.}
+\end{document}
diff --git a/support/srcredact/twain2.tex b/support/srcredact/twain2.tex
new file mode 100644
index 0000000000..aae4137209
--- /dev/null
+++ b/support/srcredact/twain2.tex
@@ -0,0 +1,119 @@
+\documentclass{article}
+\usepackage{tikz}
+\usetikzlibrary{positioning,shapes}
+\begin{document}
+\title{A Letter to the Secretary of the Treasury}
+\author{Mark Twain}
+\date{Riverdale-on-the-Hudson\footnote{Now a neighborhood in Bronx},
+ October 15, 1902}
+\maketitle
+
+\begin{quotation}
+ \em
+ This document consists of three versions:
+ \begin{description}
+ \item[uppercase:] the salutation is in uppercase.
+ \item[nobonds:] the salutation is in uppercase, and the paragraph
+ about government bonds omitted.
+ \item[default:] the salutation is in small caps, and the paragraph
+ about government bonds included.
+ \end{description}
+ There are also updated versions of all three documents, which
+ include the description of the Riverdale. The update is done in the
+ nobonds version, and then propagated to the other versions of the
+ document. This is shown on Figure~\ref{fig:flow}.
+
+ This document' version is
+%</uppercase|nobonds>
+default.
+%</ALL>
+%<*uppercase>
+uppercase.
+%</uppercase>
+%<*nobonds>
+nobonds.
+%<*ALL>
+
+This document is updated.
+\end{quotation}
+
+\begin{figure}
+ \centering
+ \begin{tikzpicture}
+ \node[on grid] (twain1) {\color{blue}twain1.tex};
+ \node[on grid, below= 2cm of twain1] (twain1-nobonds)
+ {\color{red}twain1-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain1-nobonds] (twain1-default)
+ {\color{red}twain1-default.tex};
+ \node[on grid, right= 3.5cm of twain1-nobonds] (twain1-uppercase)
+ {\color{red}twain1-uppercase.tex};
+ \node[on grid, below= 2cm of twain1-nobonds] (twainedited)
+ {\color{blue}twain-edited.tex};
+ \node[on grid, below= 2cm of twainedited] (twain2)
+ {\color{green}twain2.tex};
+ \node[on grid, below= 2cm of twain2] (twain2-nobonds)
+ {\color{red}twain2-nobonds.tex};
+ \node[on grid, left= 3.5cm of twain2-nobonds] (twain2-default)
+ {\color{red}twain2-default.tex};
+ \node[on grid, right= 3.5cm of twain2-nobonds] (twain2-uppercase)
+ {\color{red}twain2-uppercase.tex};
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain1-default);
+ \draw[arrows=-latex, color=red] (twain1) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain1-nobonds);
+ \draw[arrows=-latex, color=red] (twain1) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain1-uppercase);
+ \draw[arrows=-latex, color=blue] (twain1-nobonds) -- node[right]
+ {\scriptsize Manual editing} (twainedited);
+ \draw[arrows=-latex, color=green] (twainedited) -- node[right]
+ (unredact) {\scriptsize srcredact -u nobonds} (twain2);
+ \coordinate[above=of twain1] (above1);
+ \coordinate[right=2 cm of twain1-uppercase] (right-uppercase);
+ \draw[arrows=-latex, color=green, style=dashed] (twain1)
+ -- (above1) -| (right-uppercase) |- (unredact);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e default}
+ (twain2-default);
+ \draw[arrows=-latex, color=red] (twain2) -- node[right]
+ {\scriptsize srcredact -e nobonds} (twain2-nobonds);
+ \draw[arrows=-latex, color=red] (twain2) -|
+ node[below=1cm, right] {\scriptsize srcredact -e uppercase}
+ (twain2-uppercase);
+ \end{tikzpicture}
+ \caption{Document workflow. \textcolor{blue}{Blue}---manual edits,
+ \textcolor{red}{Red}---generated by srcredact in extract mode,
+ \textcolor{green}{Green}---generated by srcredact in unextract mode.}
+ \label{fig:flow}
+\end{figure}
+
+%</ALL>
+%<*uppercase|nobonds>
+THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.:
+%<*ALL>
+%</uppercase|nobonds>
+\textsc{the hon. the secretary of the treasury, washington, d.~c.:}
+%<*ALL>
+
+Sir,---Prices for the customary kinds of winter fuel having reached an
+altitude which puts them out of the reach of literary persons in
+straitened circumstances, I desire to place with you the following order:
+
+%</nobonds>
+Forty-five tons best old dry government bonds, suitable for furnace, gold
+7 per cents., 1864, preferred.
+%<*nobonds>
+
+Twelve tons early greenbacks, range size, suitable for cooking.
+
+Eight barrels seasoned 25 and 50 cent postal currency, vintage of 1866,
+eligible for kindlings.
+
+Please deliver with all convenient despatch at my house in Riverdale at
+lowest rates for spot cash, and send bill to
+
+Your obliged servant,
+
+\emph{Mark Twain, Who will be very grateful, and will vote right.}
+\end{document}