summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/srcredact/srcredact.pod
blob: 4f690848f0683dde8fc176683b38c8ab33e21995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
=head1 NAME

srcredact - a program for redaction of text files

=head1 SYNOPSIS

srcredact [I<OPTIONS>] B<-e> I<audience> [I<full_file>]

srcredact [I<OPTIONS>] B<-u> I<audience> I<full_file> [I<redacted_file>]

srcredact B<-l> [I<full_file>]

srcredact B<-h|-v> 

=head1  DESCRIPTION

B<srcredact> is the program to extract ``redacted versions'' of the
master file (option B<-e>) or to incorporate the changes in the
redacted versions into the master file (``unredact'', option B<-u>). 

The master file consists of I<chunks> intended for different
audiences.  Each audience has a I<name>, e.g. C<classified>,
C<unclssified>, C<expert> etc.  Chunks are started and stopped by
I<guard lines>.  Each guard line has the format (for the default TeX
syntax)

  %<*name1|name2|...>
  
or

  %</name1|name2|...>

In the first cases the text following the guard is I<included> for the
audiences C<name1>, C<name2>, ....  In the second case it is
I<excluded> for these audiences.  

THere is a special audience C<ALL>: a wild card for all audiences.
Thus the idiom 

  %</ALL>
  %<*classified>

means that the chunk is excluded for all audiences but C<classified>

Exactly one of the options  B<-e> (extract) or B<-u> (unextract) must be
present.  In  the extract mode the  non-option argument is  the name of
the full file.   If it is absent, or is C<->,  standard input is used.
In the unextract mode the first non-option argument 

=head1 OPTIONS

=over 4


=item B<-c> I<list of comment patterns>

Use the given pattern for comment lines to search for guards instead
of the default C<TeX> pattern.  The recognized patterns are:

=over 4

=item B<c>

  /*<guard>*/

=item B<cpp>

  //<guard>

=item B<fortran>

  C<guard>

=item B<shell>

  #<guard>

=item B<TeX>

  %<guard>

=back

The pattern names should be separated by commas, and the list may be
enclosed in quotes to prevent shell expansion, e.g 

  -c "TeX, c, shell"

=item B<-d>

Debug mode on.

=item B<-e> I<audience>

Extract the contents for the current audience into the file I<file>.
The cuurent audience is guessed from the I<file> name, if the latter
has the structure I<base>-I<audience>.I<extension>,
e.g. C<report-unclassified.tex>.  The key B<-a> overrides this guess
and should be used if the file name does not follow this pattern.  The
file name C<-> means the standard output.  

=item B<-h>

Print help information and exit.

=item B<-l>

List all audiences set in the file (one per line) and exit.


=item B<-u> I<audience>

Take a edited file intended for the I<audience> (the second
non-option argument) and incorporate the changes in it into the full
file (the first non-option argument).  If the second argument is
missing, standard input is used instead.  As usual, C<-> also means
standard input.  Note that only one of the two file arguments in this
case can be standard input.

=item B<-v>

Print version information and exit.

=item B<-w> I<on|off|1|0|true|false>

If C<on>, C<1> or C<true> (the deafult), implicitly wrap the full
document into the guards

 %<*ALL>
 ...
 %</ALL>

=back

=head1 RETURN VALUE

The program returns 0 if successful, 1 if conflicts were found in the
C<unextract> mode and 2 in case of problems.

=head1 CONFLICTS IN UNEXTRACT MODE

Like the standard L<diff3(1)> tool, the program may find conflicts
between the full version and the edited one in the B<-u> mode.  Then
the resulting file brackets the conflicts in the usual manner, e.g.

  <<<<<<< /tmp/BrjXo0hMOB/full
  %</nobonds>
  Forty-five tons best old dry government bonds, suitable for furnace, gold
  7 per cents., 1864, preferred.
  %<*nobonds>
  ||||||| /tmp/BrjXo0hMOB/extracted
  Forty-five tons best old dry government bonds, suitable for furnace, gold
  7 per cents., 1864, preferred.
  =======
  >>>>>>> /tmp/BrjXo0hMOB/new

Here C<full> is the full document, C<extracted> is the extracted file
for the given audience, C<new> is the edited file. 

=head1 AUTHOR

Boris Veytsman, borisv@lk.net

This work was commissioned by Consumer Financial Protection Bureau,
United States Treasury.

=head1 LICENSE AND COPYRIGHT

Copyright (C) 2015 Boris Veytsman.  Version 1.0

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA