From 4a0798e9378fdb2de85f56e1ef1d46653f86cc69 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 25 Oct 2015 22:41:38 +0000 Subject: srcredact (25oct15) git-svn-id: svn://tug.org/texlive/trunk@38710 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/texk/texlive/linked_scripts/Makefile.am | 1 + .../source/texk/texlive/linked_scripts/Makefile.in | 1 + .../texlive/linked_scripts/srcredact/srcredact.pl | 521 +++++++++++++++++++++ Master/bin/alpha-linux/srcredact | 1 + Master/bin/amd64-freebsd/srcredact | 1 + Master/bin/amd64-netbsd/srcredact | 1 + Master/bin/armel-linux/srcredact | 1 + Master/bin/armhf-linux/srcredact | 1 + Master/bin/i386-cygwin/srcredact | 1 + Master/bin/i386-freebsd/srcredact | 1 + Master/bin/i386-linux/srcredact | 1 + Master/bin/i386-netbsd/srcredact | 1 + Master/bin/i386-solaris/srcredact | 1 + Master/bin/mipsel-linux/srcredact | 1 + Master/bin/powerpc-linux/srcredact | 1 + Master/bin/sparc-solaris/srcredact | 1 + Master/bin/universal-darwin/srcredact | 1 + Master/bin/win32/srcredact.exe | Bin 0 -> 1536 bytes Master/bin/x86_64-cygwin/srcredact | 1 + Master/bin/x86_64-darwin/srcredact | 1 + Master/bin/x86_64-linux/srcredact | 1 + Master/bin/x86_64-solaris/srcredact | 1 + Master/texmf-dist/doc/man/man1/srcredact.1 | 311 ++++++++++++ Master/texmf-dist/doc/man/man1/srcredact.man1.pdf | Bin 0 -> 9850 bytes Master/texmf-dist/doc/support/srcredact/Makefile | 80 ++++ Master/texmf-dist/doc/support/srcredact/README | 11 + .../texmf-dist/doc/support/srcredact/srcredact.pdf | Bin 0 -> 118110 bytes .../texmf-dist/doc/support/srcredact/srcredact.pod | 185 ++++++++ .../texmf-dist/doc/support/srcredact/srcredact.tex | 209 +++++++++ .../doc/support/srcredact/twain-edited.tex | 101 ++++ .../doc/support/srcredact/twain1-default.pdf | Bin 0 -> 92007 bytes .../doc/support/srcredact/twain1-default.tex | 102 ++++ .../doc/support/srcredact/twain1-nobonds.pdf | Bin 0 -> 81766 bytes .../doc/support/srcredact/twain1-nobonds.tex | 100 ++++ .../doc/support/srcredact/twain1-uppercase.pdf | Bin 0 -> 82486 bytes .../doc/support/srcredact/twain1-uppercase.tex | 102 ++++ Master/texmf-dist/doc/support/srcredact/twain1.tex | 118 +++++ .../doc/support/srcredact/twain2-default.pdf | Bin 0 -> 117166 bytes .../doc/support/srcredact/twain2-default.tex | 103 ++++ .../doc/support/srcredact/twain2-nobonds.pdf | Bin 0 -> 107245 bytes .../doc/support/srcredact/twain2-nobonds.tex | 101 ++++ .../doc/support/srcredact/twain2-uppercase.pdf | Bin 0 -> 107955 bytes .../doc/support/srcredact/twain2-uppercase.tex | 103 ++++ Master/texmf-dist/doc/support/srcredact/twain2.tex | 119 +++++ Master/texmf-dist/scripts/srcredact/srcredact.pl | 521 +++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/libexec/ctan2tds | 2 + Master/tlpkg/tlpsrc/collection-binextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/srcredact.tlpsrc | 1 + 49 files changed, 2812 insertions(+), 1 deletion(-) create mode 100755 Build/source/texk/texlive/linked_scripts/srcredact/srcredact.pl create mode 120000 Master/bin/alpha-linux/srcredact create mode 120000 Master/bin/amd64-freebsd/srcredact create mode 120000 Master/bin/amd64-netbsd/srcredact create mode 120000 Master/bin/armel-linux/srcredact create mode 120000 Master/bin/armhf-linux/srcredact create mode 120000 Master/bin/i386-cygwin/srcredact create mode 120000 Master/bin/i386-freebsd/srcredact create mode 120000 Master/bin/i386-linux/srcredact create mode 120000 Master/bin/i386-netbsd/srcredact create mode 120000 Master/bin/i386-solaris/srcredact create mode 120000 Master/bin/mipsel-linux/srcredact create mode 120000 Master/bin/powerpc-linux/srcredact create mode 120000 Master/bin/sparc-solaris/srcredact create mode 120000 Master/bin/universal-darwin/srcredact create mode 100755 Master/bin/win32/srcredact.exe create mode 120000 Master/bin/x86_64-cygwin/srcredact create mode 120000 Master/bin/x86_64-darwin/srcredact create mode 120000 Master/bin/x86_64-linux/srcredact create mode 120000 Master/bin/x86_64-solaris/srcredact create mode 100644 Master/texmf-dist/doc/man/man1/srcredact.1 create mode 100644 Master/texmf-dist/doc/man/man1/srcredact.man1.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/Makefile create mode 100644 Master/texmf-dist/doc/support/srcredact/README create mode 100644 Master/texmf-dist/doc/support/srcredact/srcredact.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/srcredact.pod create mode 100644 Master/texmf-dist/doc/support/srcredact/srcredact.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain-edited.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-default.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-default.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-nobonds.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-nobonds.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-uppercase.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1-uppercase.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain1.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-default.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-default.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-nobonds.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-nobonds.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-uppercase.pdf create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2-uppercase.tex create mode 100644 Master/texmf-dist/doc/support/srcredact/twain2.tex create mode 100755 Master/texmf-dist/scripts/srcredact/srcredact.pl create mode 100644 Master/tlpkg/tlpsrc/srcredact.tlpsrc diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 42a2071877f..9548d82f0c9 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -164,6 +164,7 @@ texmf_other_scripts = \ pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ + srcredact/srcredact.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ tex4ebook/tex4ebook \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index 16b80d118f9..53c3f180d3b 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -380,6 +380,7 @@ texmf_other_scripts = \ pythontex/pythontex.py \ rubik/rubikrotation.pl \ splitindex/splitindex.pl \ + srcredact/srcredact.pl \ sty2dtx/sty2dtx.pl \ svn-multi/svn-multi.pl \ tex4ebook/tex4ebook \ diff --git a/Build/source/texk/texlive/linked_scripts/srcredact/srcredact.pl b/Build/source/texk/texlive/linked_scripts/srcredact/srcredact.pl new file mode 100755 index 00000000000..5908bde1e20 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/srcredact/srcredact.pl @@ -0,0 +1,521 @@ +#!/usr/bin/env perl + +use strict; + +my $USAGE = < + +or + + % + +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 + + % + % + +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 + // + + cpp + // + + fortran + C + + shell + # + + TeX + % + + 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 + + % + ... + % +END + + + my $COPYRIGHT= < 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/Master/bin/alpha-linux/srcredact b/Master/bin/alpha-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/alpha-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/amd64-freebsd/srcredact b/Master/bin/amd64-freebsd/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/amd64-freebsd/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/amd64-netbsd/srcredact b/Master/bin/amd64-netbsd/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/amd64-netbsd/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/armel-linux/srcredact b/Master/bin/armel-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/armel-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/armhf-linux/srcredact b/Master/bin/armhf-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/armhf-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/i386-cygwin/srcredact b/Master/bin/i386-cygwin/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/i386-cygwin/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/i386-freebsd/srcredact b/Master/bin/i386-freebsd/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/i386-freebsd/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/i386-linux/srcredact b/Master/bin/i386-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/i386-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/i386-netbsd/srcredact b/Master/bin/i386-netbsd/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/i386-netbsd/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/i386-solaris/srcredact b/Master/bin/i386-solaris/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/i386-solaris/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/mipsel-linux/srcredact b/Master/bin/mipsel-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/mipsel-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/powerpc-linux/srcredact b/Master/bin/powerpc-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/powerpc-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/sparc-solaris/srcredact b/Master/bin/sparc-solaris/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/sparc-solaris/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/universal-darwin/srcredact b/Master/bin/universal-darwin/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/universal-darwin/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/win32/srcredact.exe b/Master/bin/win32/srcredact.exe new file mode 100755 index 00000000000..5777d90a17a Binary files /dev/null and b/Master/bin/win32/srcredact.exe differ diff --git a/Master/bin/x86_64-cygwin/srcredact b/Master/bin/x86_64-cygwin/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/x86_64-cygwin/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/x86_64-darwin/srcredact b/Master/bin/x86_64-darwin/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/x86_64-darwin/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/x86_64-linux/srcredact b/Master/bin/x86_64-linux/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/x86_64-linux/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/bin/x86_64-solaris/srcredact b/Master/bin/x86_64-solaris/srcredact new file mode 120000 index 00000000000..f861a78dbd8 --- /dev/null +++ b/Master/bin/x86_64-solaris/srcredact @@ -0,0 +1 @@ +../../texmf-dist/scripts/srcredact/srcredact.pl \ No newline at end of file diff --git a/Master/texmf-dist/doc/man/man1/srcredact.1 b/Master/texmf-dist/doc/man/man1/srcredact.1 new file mode 100644 index 00000000000..d8b2040ad6d --- /dev/null +++ b/Master/texmf-dist/doc/man/man1/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 +\& % +.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 +\& % +\& %<*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 +\& /**/ +.Ve +.IP "\fBcpp\fR" 4 +.IX Item "cpp" +.Vb 1 +\& // +.Ve +.IP "\fBfortran\fR" 4 +.IX Item "fortran" +.Vb 1 +\& C +.Ve +.IP "\fBshell\fR" 4 +.IX Item "shell" +.Vb 1 +\& # +.Ve +.IP "\fBTeX\fR" 4 +.IX Item "TeX" +.Vb 1 +\& % +.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> +\& ... +\& % +.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 +\& % +\& 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/Master/texmf-dist/doc/man/man1/srcredact.man1.pdf b/Master/texmf-dist/doc/man/man1/srcredact.man1.pdf new file mode 100644 index 00000000000..810fab49865 Binary files /dev/null and b/Master/texmf-dist/doc/man/man1/srcredact.man1.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/Makefile b/Master/texmf-dist/doc/support/srcredact/Makefile new file mode 100644 index 00000000000..9d55f72d653 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/README b/Master/texmf-dist/doc/support/srcredact/README new file mode 100644 index 00000000000..c4c4187a0fe --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/srcredact.pdf b/Master/texmf-dist/doc/support/srcredact/srcredact.pdf new file mode 100644 index 00000000000..a7bb5b36ea6 Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/srcredact.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/srcredact.pod b/Master/texmf-dist/doc/support/srcredact/srcredact.pod new file mode 100644 index 00000000000..4f690848f06 --- /dev/null +++ b/Master/texmf-dist/doc/support/srcredact/srcredact.pod @@ -0,0 +1,185 @@ +=head1 NAME + +srcredact - a program for redaction of text files + +=head1 SYNOPSIS + +srcredact [I] B<-e> I [I] + +srcredact [I] B<-u> I I [I] + +srcredact B<-l> [I] + +srcredact B<-h|-v> + +=head1 DESCRIPTION + +B 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 intended for different +audiences. Each audience has a I, e.g. C, +C, C etc. Chunks are started and stopped by +I. Each guard line has the format (for the default TeX +syntax) + + %<*name1|name2|...> + +or + + % + +In the first cases the text following the guard is I for the +audiences C, C, .... In the second case it is +I for these audiences. + +THere is a special audience C: a wild card for all audiences. +Thus the idiom + + % + %<*classified> + +means that the chunk is excluded for all audiences but C + +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 + +Use the given pattern for comment lines to search for guards instead +of the default C pattern. The recognized patterns are: + +=over 4 + +=item B + + /**/ + +=item B + + // + +=item B + + C + +=item B + + # + +=item B + + % + +=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 + +Extract the contents for the current audience into the file I. +The cuurent audience is guessed from the I name, if the latter +has the structure I-I.I, +e.g. C. 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 + +Take a edited file intended for the I (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 + +If C, C<1> or C (the deafult), implicitly wrap the full +document into the guards + + %<*ALL> + ... + % + +=back + +=head1 RETURN VALUE + +The program returns 0 if successful, 1 if conflicts were found in the +C mode and 2 in case of problems. + +=head1 CONFLICTS IN UNEXTRACT MODE + +Like the standard L 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 + % + 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 is the full document, C is the extracted file +for the given audience, C 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/Master/texmf-dist/doc/support/srcredact/srcredact.tex b/Master/texmf-dist/doc/support/srcredact/srcredact.tex new file mode 100644 index 00000000000..5c1f27b2e73 --- /dev/null +++ b/Master/texmf-dist/doc/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% +\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 +% ++Redbf%<*classified> ++Red^_Classified version of the text ++Redbf% ++Greenbf%<*unclassified> ++Green^_Unclassified version of the text ++Greenbf% +%<*ALL> +\end{document} +% + \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/Master/texmf-dist/doc/support/srcredact/twain-edited.tex b/Master/texmf-dist/doc/support/srcredact/twain-edited.tex new file mode 100644 index 00000000000..9ec1fdf86e7 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain1-default.pdf b/Master/texmf-dist/doc/support/srcredact/twain1-default.pdf new file mode 100644 index 00000000000..9ef36b17170 Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain1-default.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain1-default.tex b/Master/texmf-dist/doc/support/srcredact/twain1-default.tex new file mode 100644 index 00000000000..39fbd0fc5d9 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain1-nobonds.pdf b/Master/texmf-dist/doc/support/srcredact/twain1-nobonds.pdf new file mode 100644 index 00000000000..f08bb08cb39 Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain1-nobonds.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain1-nobonds.tex b/Master/texmf-dist/doc/support/srcredact/twain1-nobonds.tex new file mode 100644 index 00000000000..c38e1b75baa --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain1-uppercase.pdf b/Master/texmf-dist/doc/support/srcredact/twain1-uppercase.pdf new file mode 100644 index 00000000000..f25a6bdbb8c Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain1-uppercase.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain1-uppercase.tex b/Master/texmf-dist/doc/support/srcredact/twain1-uppercase.tex new file mode 100644 index 00000000000..76ad14ca0d7 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain1.tex b/Master/texmf-dist/doc/support/srcredact/twain1.tex new file mode 100644 index 00000000000..dff4182ff9d --- /dev/null +++ b/Master/texmf-dist/doc/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 +% +default. +% +%<*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} + +% +%<*uppercase|nobonds> +THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.: +%<*ALL> +% +\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: + +% +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/Master/texmf-dist/doc/support/srcredact/twain2-default.pdf b/Master/texmf-dist/doc/support/srcredact/twain2-default.pdf new file mode 100644 index 00000000000..664f103f1a5 Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain2-default.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain2-default.tex b/Master/texmf-dist/doc/support/srcredact/twain2-default.tex new file mode 100644 index 00000000000..1eef073ddfa --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain2-nobonds.pdf b/Master/texmf-dist/doc/support/srcredact/twain2-nobonds.pdf new file mode 100644 index 00000000000..e938ed24fb6 Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain2-nobonds.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain2-nobonds.tex b/Master/texmf-dist/doc/support/srcredact/twain2-nobonds.tex new file mode 100644 index 00000000000..9ec1fdf86e7 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain2-uppercase.pdf b/Master/texmf-dist/doc/support/srcredact/twain2-uppercase.pdf new file mode 100644 index 00000000000..a412cfc68dc Binary files /dev/null and b/Master/texmf-dist/doc/support/srcredact/twain2-uppercase.pdf differ diff --git a/Master/texmf-dist/doc/support/srcredact/twain2-uppercase.tex b/Master/texmf-dist/doc/support/srcredact/twain2-uppercase.tex new file mode 100644 index 00000000000..5bce736c283 --- /dev/null +++ b/Master/texmf-dist/doc/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/Master/texmf-dist/doc/support/srcredact/twain2.tex b/Master/texmf-dist/doc/support/srcredact/twain2.tex new file mode 100644 index 00000000000..aae41372098 --- /dev/null +++ b/Master/texmf-dist/doc/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 +% +default. +% +%<*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} + +% +%<*uppercase|nobonds> +THE HON. THE SECRETARY OF THE TREASURY, WASHINGTON, D.~C.: +%<*ALL> +% +\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: + +% +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} diff --git a/Master/texmf-dist/scripts/srcredact/srcredact.pl b/Master/texmf-dist/scripts/srcredact/srcredact.pl new file mode 100755 index 00000000000..5908bde1e20 --- /dev/null +++ b/Master/texmf-dist/scripts/srcredact/srcredact.pl @@ -0,0 +1,521 @@ +#!/usr/bin/env perl + +use strict; + +my $USAGE = < + +or + + % + +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 + + % + % + +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 + // + + cpp + // + + fortran + C + + shell + # + + TeX + % + + 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 + + % + ... + % +END + + + my $COPYRIGHT= < 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/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 5fa9c6ff46b..70172da2115 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -507,7 +507,7 @@ my @TLP_working = qw( spanish-mx sparklines spath3 spelling spie sphack sphdthesis splines splitbib splitindex spot spotcolor spreadtab spverbatim - sr-vorl srbook-mem srcltx sseq sslides + sr-vorl srbook-mem srcltx srcredact sseq sslides stack stackengine stage standalone starfont startex statistik statex statex2 staves stdclsdv stdpage steinmetz diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 2fa549fdd21..699d5aee410 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -2680,6 +2680,7 @@ $standardttf = '\.ttf|\.TTC'; 'pygmentex', => 'pygmentex\.py$', 'pythontex' => '(de)?pythontex\.py$', 'rubik' => '\.pl$', + 'srcredact' => '\.pl$', 'splitindex' => 'splitindex\.pl$', 'sty2dtx' => '\.pl$', 'svn-multi' => 'svn-multi\.pl$', @@ -2739,6 +2740,7 @@ $standardttf = '\.ttf|\.TTC'; # 'prerex' => '\.5$', 'purifyeps' => 'purifyeps.1', 'splitindex' => '\.1$', + 'srcredact' => '\.1$', 'sty2dtx' => '\.1$', 'texdiff' => 'texdiff.1', 'texfot' => '\.1$', diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc index 0411ecc4eb6..6b2ede7bcc3 100644 --- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc @@ -62,6 +62,7 @@ depend pkfix-helper depend purifyeps depend pythontex depend seetexk +depend srcredact depend sty2dtx depend synctex depend tex4ebook diff --git a/Master/tlpkg/tlpsrc/srcredact.tlpsrc b/Master/tlpkg/tlpsrc/srcredact.tlpsrc new file mode 100644 index 00000000000..dca338c719c --- /dev/null +++ b/Master/tlpkg/tlpsrc/srcredact.tlpsrc @@ -0,0 +1 @@ +binpattern f bin/${ARCH}/${PKGNAME} -- cgit v1.2.3