flnews_post_proc 1.75 → 1.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/flnews_post_proc +5 -0
- data/doc/fr/html/flnews_post_proc.html +813 -395
- data/doc/fr/man/flnews_post_proc.1.gz +0 -0
- data/doc/fr/pdf/flnews_post_proc.pdf +0 -0
- data/doc/fr/rst/flnews_post_proc.rst +207 -143
- data/doc/html/flnews_post_proc.html +287 -188
- data/doc/man/flnews_post_proc.1.gz +0 -0
- data/doc/pdf/flnews_post_proc.pdf +0 -0
- data/doc/rst/flnews_post_proc.rst +270 -160
- data/lib/basic_logging.rb +0 -1
- data/lib/body.rb +18 -9
- data/lib/configuration.rb +25 -25
- data/lib/flnews_post_proc.rb +8 -1
- data/lib/headers.rb +40 -28
- data/lib/newsgroups.rb +9 -4
- data/lib/override.rb +2 -1
- data/lib/version.rb +2 -2
- metadata +3 -3
|
@@ -1,239 +1,334 @@
|
|
|
1
1
|
===========================
|
|
2
2
|
flnews_post_proc
|
|
3
3
|
===========================
|
|
4
|
+
|
|
5
|
+
.. |program| replace:: **flnews_post_proc**
|
|
6
|
+
|
|
4
7
|
------------------------------------------
|
|
5
8
|
Post-Processor for the flnews Newsreader
|
|
6
9
|
------------------------------------------
|
|
7
10
|
|
|
11
|
+
.. contents::
|
|
12
|
+
:local:
|
|
13
|
+
:backlinks: none
|
|
14
|
+
:depth: 3
|
|
15
|
+
|
|
16
|
+
.. _SYNOPSIS:
|
|
17
|
+
|
|
8
18
|
SYNOPSIS
|
|
9
19
|
===========================
|
|
10
|
-
The post-processor is invoked by piping an article into it. This typically
|
|
11
|
-
automatically when the "post_proc" variable is set to
|
|
12
|
-
flnews configuration file.
|
|
20
|
+
The post-processor is invoked by piping an article into it. This typically
|
|
21
|
+
occurs automatically when the "post_proc" variable is set to |program|
|
|
22
|
+
in the flnews `configuration`_ file.
|
|
23
|
+
|
|
24
|
+
For testing purposes, you can also pipe locally stored articles into the
|
|
25
|
+
post-processor using a command like:
|
|
26
|
+
|
|
27
|
+
|program| < article
|
|
13
28
|
|
|
14
|
-
|
|
15
|
-
using a command like:
|
|
29
|
+
.or:
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
cat article.txt | |program|
|
|
32
|
+
|
|
33
|
+
.. _DESCRIPTION:
|
|
18
34
|
|
|
19
35
|
DESCRIPTION
|
|
20
36
|
===========================
|
|
21
|
-
The flnews newsreader fully supports Usenet access, enabling the reception and
|
|
22
|
-
of articles from newsgroups, as well as composing and posting them.
|
|
37
|
+
The flnews newsreader fully supports Usenet access, enabling the reception and
|
|
38
|
+
reading of articles from newsgroups, as well as composing and posting them.
|
|
39
|
+
|
|
40
|
+
When comparing various news clients, differences will often influence your
|
|
41
|
+
choice of preferred client. Flnews distinguishes itself by not only offering
|
|
42
|
+
control over its internal behavior, but also by allowing you to modify outgoing
|
|
43
|
+
posts just before they are sent to the configured NNTP server.
|
|
23
44
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
45
|
+
The |program| program can be used to modify and enhance a post in ways
|
|
46
|
+
that flnews alone cannot. It is configurable and may meet the needs of some
|
|
47
|
+
Usenet users, though it is primarily intended as a starting point for creating
|
|
48
|
+
your own custom solutions.
|
|
28
49
|
|
|
29
|
-
|
|
30
|
-
flnews alone cannot. It is configurable and may meet the needs of some Usenet users,
|
|
31
|
-
though it is primarily intended as a starting point for creating your own custom solutions.
|
|
50
|
+
.. _Limitations of Basic Newsreaders:
|
|
32
51
|
|
|
33
52
|
Limitations of Basic Newsreaders
|
|
34
53
|
--------------------------------------------------------
|
|
35
|
-
While flnews creates posts that are generally complete and ready for
|
|
36
|
-
instances where users might find the output
|
|
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
|
-
|
|
54
|
+
While flnews creates posts that are generally complete and ready for
|
|
55
|
+
submission, there are instances where users might find the output
|
|
56
|
+
unsatisfactory for arbitrary reasons:
|
|
57
|
+
|
|
58
|
+
* If you're posting to different newsgroups in multiple languages, the
|
|
59
|
+
introductory line referencing a prior post can only be set once in the flnews
|
|
60
|
+
`configuration`_ file. As a result, posts to a French newsgroup, for example,
|
|
61
|
+
may start with an introduction in English. The post-processor can address
|
|
62
|
+
this by setting specific introductory lines for each newsgroup.
|
|
63
|
+
|
|
64
|
+
* Similar issues arise when you set a standard signature and want it to vary
|
|
65
|
+
based on the newsgroup. The post-processor allows different signatures to be
|
|
66
|
+
used for different newsgroups, and you can even randomize the selection from
|
|
67
|
+
a list of signatures stored in a file.
|
|
68
|
+
|
|
69
|
+
* Custom headers, such as GnuPG key IDs or your language proficiency, can also
|
|
70
|
+
be added to posts, though signatures may be a better alternative. Custom
|
|
71
|
+
headers can be defined in the `configuration`_ file and will be added to
|
|
72
|
+
outgoing posts.
|
|
73
|
+
|
|
74
|
+
* Headers like "Archive" and "X-No-Archive" are sometimes set to prevent an
|
|
75
|
+
article from being indexed by search engines (e.g., Google). For example,
|
|
76
|
+
test posts likely don't need to be included in search results. The
|
|
77
|
+
post-processor can apply both headers to all posts sent to certain
|
|
78
|
+
newsgroups.
|
|
79
|
+
|
|
80
|
+
**NOTE**: As of 2024, the "X-No-Archive" header has limited effectiveness,
|
|
81
|
+
and it is up to server operators whether or not to honor it.
|
|
82
|
+
|
|
83
|
+
* Posts that include many references to other posts or URLs can become
|
|
84
|
+
cluttered. The post-processor can convert marked text into footnotes, similar
|
|
85
|
+
to the <ref/> link format used in Wikipedia, with the delimiter configurable
|
|
86
|
+
in the `configuration`_ file.
|
|
87
|
+
Example (using %=): "This is an object %=and this becomes the footnote,
|
|
88
|
+
describing the object further=%"
|
|
89
|
+
|
|
90
|
+
.. _Dialog for Overriding Settings:
|
|
66
91
|
|
|
67
92
|
Dialog for Overriding Settings
|
|
68
93
|
------------------------------
|
|
69
|
-
**IMPORTANT**: As of version 1.72, YAD or Zenity cannot be used for the dialog
|
|
94
|
+
**IMPORTANT**: As of version 1.72, YAD or Zenity cannot be used for the dialog
|
|
95
|
+
interface.
|
|
70
96
|
|
|
71
|
-
Before the post-processor runs, a dialog can be displayed to allow users to
|
|
72
|
-
certain configuration options. If Whiptail or xterm are available,
|
|
73
|
-
disable the following options. You **cannot** enable options
|
|
74
|
-
in the configuration.
|
|
97
|
+
Before the post-processor runs, a dialog can be displayed to allow users to
|
|
98
|
+
**disable** certain `configuration`_ options. If Whiptail or xterm are available,
|
|
99
|
+
you can choose to disable the following options. You **cannot** enable options
|
|
100
|
+
that haven't already been set in the `configuration`_.
|
|
75
101
|
|
|
76
|
-
* Signatures (if set in the configuration) can be **ignored**. A default
|
|
77
|
-
be used, or no signature at all.
|
|
102
|
+
* Signatures (if set in the `configuration`_) can be **ignored**. A default
|
|
103
|
+
signature will be used, or no signature at all.
|
|
78
104
|
* Custom headers can be **omitted**.
|
|
79
|
-
* The "Archive" and "X-No-Archive" headers can be **ignored** if set for the
|
|
80
|
-
newsgroup.
|
|
105
|
+
* The "Archive" and "X-No-Archive" headers can be **ignored** if set for the
|
|
106
|
+
current newsgroup.
|
|
81
107
|
* Logging can be **disabled**, if enabled.
|
|
82
108
|
|
|
83
|
-
Pressing Esc or the Cancel button on the dialog will interrupt the process, and
|
|
84
|
-
will not post the article.
|
|
109
|
+
Pressing Esc or the Cancel button on the dialog will interrupt the process, and
|
|
110
|
+
flnews will not post the article.
|
|
111
|
+
|
|
112
|
+
To disable the dialog entirely (and apply all configured options without
|
|
113
|
+
further interaction), set the **OVERRIDE_CONFIG** option.
|
|
85
114
|
|
|
86
|
-
|
|
87
|
-
set the **OVERRIDE_CONFIG** option.
|
|
115
|
+
.. _CONFIGURATION:
|
|
88
116
|
|
|
89
117
|
CONFIGURATION
|
|
90
118
|
===============
|
|
91
|
-
Upon first execution of the program, a copy of the original configuration file
|
|
92
|
-
in */home/[user]/.flnews_post_proc.conf*. This file is used
|
|
93
|
-
cause the file to be recreated, but any custom
|
|
119
|
+
Upon first execution of the program, a copy of the original configuration file
|
|
120
|
+
is created in */home/[user]/.flnews_post_proc.conf*. This file is used
|
|
121
|
+
thereafter. Deleting it will cause the file to be recreated, but any custom
|
|
122
|
+
changes will be lost.
|
|
94
123
|
|
|
95
|
-
The configuration file uses YAML syntax and includes detailed explanations. The
|
|
96
|
-
within it fall into two categories:
|
|
124
|
+
The configuration file uses YAML syntax and includes detailed explanations. The
|
|
125
|
+
variables within it fall into two categories:
|
|
126
|
+
|
|
127
|
+
1. Variables that represent values originally set by flnews, which can be used
|
|
128
|
+
or replaced. These elements are typically captured using regular
|
|
129
|
+
expressions.
|
|
97
130
|
|
|
98
|
-
1. Variables that represent values originally set by flnews, which can be used or replaced.
|
|
99
|
-
These elements are typically captured using regular expressions.
|
|
100
131
|
2. Variables that define new or modified content.
|
|
101
132
|
|
|
102
|
-
|
|
133
|
+
Configuration Options
|
|
103
134
|
-------------------------------
|
|
104
135
|
|
|
105
|
-
|
|
106
|
-
A regular expression that matches the name of the previous poster in a quoted post. This
|
|
107
|
-
string is recognized in the original article and used with the matching element from
|
|
108
|
-
*GROUP_INTRO*.
|
|
109
|
-
|
|
110
|
-
Leave this field empty to retain the default value from the FLNews configuration.
|
|
111
|
-
|
|
112
|
-
CONTENT: A string representing a regular expression.
|
|
113
|
-
|
|
114
|
-
DEFAULT: EMPTY
|
|
136
|
+
.. empty lines in the following definition list are in reality '\ '
|
|
115
137
|
|
|
116
|
-
|
|
138
|
+
**FUP_NAME**
|
|
117
139
|
|
|
118
|
-
|
|
140
|
+
A regular expression that matches the name of the previous poster in a
|
|
141
|
+
quoted post. This string is recognized in the original article and used
|
|
142
|
+
with the matching element from `GROUP_INTROS`_.
|
|
143
|
+
|
|
144
|
+
Leave this field empty to retain the default value from the FLNews
|
|
145
|
+
configuration.
|
|
146
|
+
|
|
147
|
+
CONTENT: A string representing a regular expression.
|
|
148
|
+
|
|
149
|
+
DEFAULT: EMPTY
|
|
150
|
+
|
|
151
|
+
EXAMPLE1: "On \\\\d+.\\\\d+.\\\\d{2,4} at \\\\d+:\\\\d+ **(.*)** wrote:"
|
|
152
|
+
|
|
153
|
+
EXAMPLE2: "**(.*)** wrote:"
|
|
154
|
+
|
|
155
|
+
.. _fup_group:
|
|
119
156
|
|
|
120
157
|
**FUP_GROUP**
|
|
121
|
-
A regular expression that matches the newsgroup where the quoted post was published.
|
|
122
|
-
|
|
123
|
-
Leave this field empty to ignore the exact group.
|
|
124
|
-
|
|
125
|
-
CONTENT: A string representing a regular expression.
|
|
126
158
|
|
|
127
|
-
|
|
159
|
+
A regular expression that matches the newsgroup where the quoted post was
|
|
160
|
+
published.
|
|
161
|
+
|
|
162
|
+
Leave this field empty to ignore the exact group.
|
|
163
|
+
|
|
164
|
+
CONTENT: A string representing a regular expression.
|
|
165
|
+
|
|
166
|
+
DEFAULT: EMPTY
|
|
167
|
+
|
|
168
|
+
EXAMPLE: "wrote in **(.*)**:"
|
|
128
169
|
|
|
129
|
-
|
|
170
|
+
.. _group_intros:
|
|
130
171
|
|
|
131
172
|
**GROUP_INTROS**
|
|
132
|
-
Introductory strings referring to the previous poster in a quoted post. When the newsgroup
|
|
133
|
-
matches *FUP_GROUP*, these variables are used in the resulting introduction.
|
|
134
173
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
174
|
+
Introductory strings referring to the previous poster in a quoted post.
|
|
175
|
+
When the newsgroup matches `FUP_GROUP`_, these variables are used in the
|
|
176
|
+
resulting introduction.
|
|
177
|
+
|
|
178
|
+
CONTENT: A newsgroup or regular expression per line, followed by a colon,
|
|
179
|
+
space, and string.
|
|
180
|
+
|
|
181
|
+
DEFAULT: As configured in FLNews.
|
|
182
|
+
|
|
183
|
+
EXAMPLE: alt.test: "Thus spoke %fup_name% on that baleful %fup_date%:"
|
|
140
184
|
|
|
141
185
|
**GROUP_SIGS**
|
|
142
|
-
Signature lines for each newsgroup or a path to a file containing signatures, which should be
|
|
143
|
-
formatted and separated by one empty line. A random signature is picked from the file for each
|
|
144
|
-
newsgroup. You can also source another file within the signature file by starting a line with
|
|
145
|
-
". /path/to/other/file".
|
|
146
186
|
|
|
147
|
-
|
|
187
|
+
Signature lines for each newsgroup or a path to a file containing
|
|
188
|
+
signatures, which should be formatted and separated by one empty line. A
|
|
189
|
+
random signature is picked from the file for each newsgroup. You can also
|
|
190
|
+
source another file within the signature file by starting a line with
|
|
191
|
+
". /path/to/other/file".
|
|
192
|
+
|
|
193
|
+
CONTENT: A newsgroup or regular expression per line, followed by a colon,
|
|
194
|
+
\ \ \ \ space, and string.
|
|
195
|
+
|
|
196
|
+
DEFAULT: As configured in flnews.
|
|
148
197
|
|
|
149
|
-
|
|
198
|
+
EXAMPLE::
|
|
150
199
|
|
|
151
|
-
|
|
152
|
-
|
|
200
|
+
alt.test: "Signature for alt.test\\r\\nsecond line"
|
|
201
|
+
comp.*: /home/[user]/.my_sigs
|
|
153
202
|
|
|
154
203
|
**CUSTOM_HEADERS**
|
|
155
|
-
Additional custom headers to be added to outgoing articles.
|
|
156
|
-
|
|
157
|
-
CONTENT: One line per header, starting with a dash and space, followed by the header name and value.
|
|
158
204
|
|
|
159
|
-
|
|
205
|
+
Additional custom headers to be added to outgoing articles.
|
|
206
|
+
|
|
207
|
+
CONTENT: One line per header, starting with a dash and space, followed by
|
|
208
|
+
the header name and value.
|
|
209
|
+
|
|
210
|
+
DEFAULT: Undefined
|
|
211
|
+
|
|
212
|
+
EXAMPLE::
|
|
160
213
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
- 'X-Another-Header: care not!'
|
|
214
|
+
- 'X-My-Header: nothing fancy'
|
|
215
|
+
- 'X-Another-Header: care not!'
|
|
164
216
|
|
|
165
217
|
**NO_ARCHIVE_GROUPS**
|
|
166
|
-
Newsgroups where the "Archive: no" and "X-No-Archive: YES" headers should be set.
|
|
167
218
|
|
|
168
|
-
|
|
219
|
+
Newsgroups where the "Archive: no" and "X-No-Archive: YES" headers should
|
|
220
|
+
be set.
|
|
221
|
+
|
|
222
|
+
CONTENT: A line with a dash and space, followed by the group name or a
|
|
223
|
+
regular expression.
|
|
224
|
+
|
|
225
|
+
DEFAULT: Empty
|
|
226
|
+
|
|
227
|
+
EXAMPLE::
|
|
169
228
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
EXAMPLE:
|
|
173
|
-
- "alt.test"
|
|
174
|
-
- "^news.*"
|
|
229
|
+
- "alt.test"
|
|
230
|
+
- "^news.*"
|
|
175
231
|
|
|
176
232
|
**DEBUG_LOG**
|
|
177
|
-
The name of the file where debug messages are logged. If specified, logging will be enabled.
|
|
178
|
-
If empty, logging is disabled.
|
|
179
|
-
|
|
180
|
-
CONTENT: The name of a writable file, which will be created if it doesn't exist and overwritten if necessary.
|
|
181
233
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
234
|
+
The name of the file where debug messages are logged. If specified, logging
|
|
235
|
+
will be enabled. If empty, logging is disabled.
|
|
236
|
+
|
|
237
|
+
CONTENT: The name of a writable file, which will be created if it doesn't
|
|
238
|
+
exist and overwritten if necessary.
|
|
239
|
+
|
|
240
|
+
DEFAULT: Empty
|
|
241
|
+
|
|
242
|
+
EXAMPLE: '/tmp/a_log-file.txt'
|
|
185
243
|
|
|
186
244
|
**LOG LEVEL**
|
|
187
|
-
|
|
245
|
+
|
|
246
|
+
One of: debug, fatal, error, info, warn.
|
|
188
247
|
|
|
189
248
|
**REFERENCES_SEPARATOR**
|
|
190
|
-
A symbol or sequence marking the end of the message body and the beginning of a footnote list.
|
|
191
|
-
If not defined, footnotes are appended directly after the message body.
|
|
192
249
|
|
|
193
|
-
|
|
250
|
+
A symbol or sequence marking the end of the message body and the beginning
|
|
251
|
+
of a footnote list. If not defined, footnotes are appended directly after
|
|
252
|
+
the message body.
|
|
253
|
+
|
|
254
|
+
CONTENT: A quoted symbol or sequence.
|
|
255
|
+
|
|
256
|
+
DEFAULT: Empty
|
|
257
|
+
|
|
258
|
+
EXAMPLE: '---------'
|
|
194
259
|
|
|
195
|
-
|
|
260
|
+
**REFERENCES_DELIMITER**
|
|
196
261
|
|
|
197
|
-
|
|
262
|
+
A sequence marking the beginning and end of text to be used as a footnote
|
|
263
|
+
or reference. The reversed sequence is used to mark the end.
|
|
264
|
+
|
|
265
|
+
CONTENT: A quoted symbol or sequence.
|
|
266
|
+
|
|
267
|
+
DEFAULT: None (empty)
|
|
268
|
+
|
|
269
|
+
EXAMPLE: '%?'
|
|
198
270
|
|
|
199
|
-
**
|
|
200
|
-
A sequence marking the beginning and end of text to be used as a footnote or reference. The reversed
|
|
201
|
-
sequence is used to mark the end.
|
|
271
|
+
**REFERENCE_FORMAT**
|
|
202
272
|
|
|
203
|
-
|
|
273
|
+
A format string using `%s` for a number to replace the reference text in
|
|
274
|
+
the body.
|
|
275
|
+
|
|
276
|
+
DEFAULT: " %s)" → becomes 1) ... 2) ... 3)
|
|
277
|
+
|
|
278
|
+
EXAMPLE: "(%s)" → becomes (1) ... (2) ... (3)
|
|
204
279
|
|
|
205
|
-
|
|
280
|
+
**VFY_URLS**
|
|
206
281
|
|
|
207
|
-
|
|
282
|
+
A boolean constant determining whether URLs should be verified and
|
|
283
|
+
corrected if necessary. URL manipulations include adding angular brackets
|
|
284
|
+
('<', '>') and slashes after "http(s):".
|
|
285
|
+
|
|
286
|
+
CONTENT: One of YES, yes, NO, no (case insensitive).
|
|
287
|
+
|
|
288
|
+
DEFAULT: yes
|
|
289
|
+
|
|
290
|
+
EXAMPLE: ... I leave this to your discretion.
|
|
291
|
+
|
|
292
|
+
.. _override dialog:
|
|
208
293
|
|
|
209
|
-
**
|
|
210
|
-
A format string using `%s` for a number to replace the reference text in the body.
|
|
294
|
+
**OVERRIDE_CONFIG**
|
|
211
295
|
|
|
212
|
-
|
|
296
|
+
A boolean constant that controls whether configuration options can be
|
|
297
|
+
overridden before posting.
|
|
298
|
+
|
|
299
|
+
Set this to "no" to disable the dialog.
|
|
300
|
+
|
|
301
|
+
DEFAULT: yes
|
|
302
|
+
|
|
303
|
+
EXAMPLE: No
|
|
213
304
|
|
|
214
|
-
|
|
305
|
+
.. _Other Information:
|
|
215
306
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
URL manipulations include adding angular brackets ('<', '>') and slashes after "http(s):".
|
|
307
|
+
Other Information
|
|
308
|
+
========================
|
|
219
309
|
|
|
220
|
-
|
|
310
|
+
.. _Signatures in Supersedes:
|
|
221
311
|
|
|
222
|
-
|
|
312
|
+
Signatures in Supersedes
|
|
313
|
+
------------------------
|
|
314
|
+
When superseding an existing post, the post-processor will NOT automatically add a signature.
|
|
315
|
+
This preserves the original post content as much as possible.
|
|
223
316
|
|
|
224
|
-
|
|
317
|
+
To retain the signature from the original post:
|
|
225
318
|
|
|
226
|
-
|
|
227
|
-
|
|
319
|
+
1. In flnews, select the entire article body with the mouse—from the first line
|
|
320
|
+
(including any introductions) down to the last line of the signature.
|
|
228
321
|
|
|
229
|
-
|
|
322
|
+
2. From the Article menu, select **Supersede**.
|
|
230
323
|
|
|
231
|
-
|
|
324
|
+
3. Edit the article text as needed. The signature will be included in the
|
|
325
|
+
editable text (normally, flnews strips signatures before opening the editor).
|
|
232
326
|
|
|
233
|
-
|
|
327
|
+
4. Send the article.
|
|
234
328
|
|
|
235
|
-
|
|
236
|
-
|
|
329
|
+
**Note:** The `override dialog`_ (see above) does not affect signatures in superseding posts.
|
|
330
|
+
|
|
331
|
+
.. _Testing:
|
|
237
332
|
|
|
238
333
|
Testing
|
|
239
334
|
-------
|
|
@@ -243,15 +338,23 @@ You can verify the post-processor’s effect by using one of two methods:
|
|
|
243
338
|
|
|
244
339
|
**:~$ /usr/local/bin/[post-processor] < [test-article]**
|
|
245
340
|
|
|
246
|
-
This will show the modified article, and you can pipe it into another file
|
|
341
|
+
This will show the modified article, and you can pipe it into another file
|
|
342
|
+
for further testing.
|
|
343
|
+
|
|
344
|
+
2. Post directly to a test newsgroup (e.g., alt.test). This is essential before
|
|
345
|
+
posting to real newsgroups, especially when the post-processor will alter
|
|
346
|
+
the article.
|
|
247
347
|
|
|
248
|
-
|
|
249
|
-
real newsgroups, especially when the post-processor will alter the article.
|
|
348
|
+
.. _Source Code:
|
|
250
349
|
|
|
251
350
|
Source Code
|
|
252
351
|
-----------
|
|
253
|
-
|
|
254
|
-
|
|
352
|
+
|
|
353
|
+
.. _rubygems.org: https://rubygems.org/gems/flnews_post_proc
|
|
354
|
+
|
|
355
|
+
The gem file for the program, available via the gem utility or `rubygems.org`_,
|
|
356
|
+
contains all the source code and documentation (this page included). To extract
|
|
357
|
+
it, do the following:
|
|
255
358
|
|
|
256
359
|
1. Extract the gem file: `tar -xf flnews_post_proc-0.1.gem`
|
|
257
360
|
2. Uncompress the data archive: `gunzip data.gz`
|
|
@@ -259,15 +362,22 @@ the source code and documentation (this page included). To extract it, do the fo
|
|
|
259
362
|
|
|
260
363
|
This will create the directories `bin`, `doc`, and `lib`.
|
|
261
364
|
|
|
365
|
+
.. _License:
|
|
366
|
+
|
|
262
367
|
License
|
|
263
368
|
-------
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
369
|
+
|
|
370
|
+
.. _WTFPL-2.0: https://www.wtfpl.net/about/
|
|
371
|
+
|
|
372
|
+
The |program| is distributed under the `WTFPL-2.0`_ or later License. For
|
|
373
|
+
the complete license text, visit http://www.wtfpl.net/txt/copying/ or refer to
|
|
374
|
+
the license file in the documentation directory of the gem.
|
|
375
|
+
|
|
376
|
+
.. _Author:
|
|
267
377
|
|
|
268
378
|
Author
|
|
269
379
|
------
|
|
270
|
-
|
|
380
|
+
|program| has been developed by
|
|
271
381
|
Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
272
382
|
|
|
273
383
|
Ω
|
data/lib/basic_logging.rb
CHANGED
data/lib/body.rb
CHANGED
|
@@ -151,15 +151,23 @@ class Body
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def set_signature(signature)
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
#
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
unless @@config.SUPERSEDES
|
|
155
|
+
debug 'is not a supersedes'
|
|
156
|
+
# unless no changes requested.
|
|
157
|
+
debug 'signature is ' << (signature ? signature.to_s : 'NIL')
|
|
158
|
+
if signature && !signature.empty?
|
|
159
|
+
# remove any signature(s) from
|
|
160
|
+
# the current article
|
|
161
|
+
sigpos = @lines.index('-- ')
|
|
162
|
+
debug('found signature in line ' << sigpos.to_s) if sigpos
|
|
163
|
+
@lines = @lines.slice(0, sigpos ) if sigpos
|
|
164
|
+
debug('setting signature ' << signature) if signature
|
|
165
|
+
@lines << "-- " << signature if signature
|
|
166
|
+
else
|
|
167
|
+
debug 'signature is ' << (signature ? signature.to_s : 'not set.' )
|
|
168
|
+
end
|
|
169
|
+
else
|
|
170
|
+
debug 'ignoring signature in spersedes'
|
|
163
171
|
end
|
|
164
172
|
end
|
|
165
173
|
|
|
@@ -293,6 +301,7 @@ class Body
|
|
|
293
301
|
end
|
|
294
302
|
end
|
|
295
303
|
|
|
304
|
+
# formatting http URLs, not much is done here.
|
|
296
305
|
def handle_http(l)
|
|
297
306
|
debug('handle http')
|
|
298
307
|
l_array = l.split
|
data/lib/configuration.rb
CHANGED
|
@@ -77,33 +77,33 @@ class Configuration
|
|
|
77
77
|
# updates the configuration file, if need be.
|
|
78
78
|
def update_config(i_config)
|
|
79
79
|
if @conf
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
conf_version = @conf[:CONFIG_VERSION]
|
|
81
|
+
if !conf_version || conf_version < PROGVERSION.to_f
|
|
82
|
+
info "configuration has an older version number, looking for changes"
|
|
83
|
+
i_conf = YAML::load_file(i_config)
|
|
84
|
+
i_conf.transform_keys!{|k| k.to_sym}
|
|
85
|
+
i_keys = i_conf.keys
|
|
86
|
+
i_keys.each do |k|
|
|
87
|
+
if !@conf[k]
|
|
88
|
+
info('new configuration option: ' << k.to_s)
|
|
89
|
+
@conf[k] = ''
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
@conf[:CONFIG_VERSION] = PROGVERSION.to_f
|
|
93
|
+
bak_conf = @config_file.dup << '_' << conf_version.to_s
|
|
94
|
+
bak_conf.gsub!('.' << PROGNAME, 'bak_' << PROGNAME)
|
|
95
|
+
info('Old configuration is saved to ' << bak_conf )
|
|
96
|
+
info('New configuration is saved to ' << @config_file )
|
|
97
|
+
begin
|
|
98
|
+
File::write(bak_conf, File.read(@config_file))
|
|
99
|
+
File::write(@config_file, @conf.to_yaml)
|
|
100
|
+
rescue Exception => ex
|
|
101
|
+
msg = "Cannot write altered configuration to " << @config_file << "!\n\t" << ex.message
|
|
102
|
+
STDERR.puts(msg << "\nAborting, bye\n")
|
|
103
|
+
error msg
|
|
104
|
+
exit false
|
|
90
105
|
end
|
|
91
106
|
end
|
|
92
|
-
@conf[:CONFIG_VERSION] = PROGVERSION.to_f
|
|
93
|
-
bak_conf = @config_file.dup << '_' << conf_version.to_s
|
|
94
|
-
bak_conf.gsub!('.' << PROGNAME, 'bak_' << PROGNAME)
|
|
95
|
-
info('Old configuration is saved to ' << bak_conf )
|
|
96
|
-
info('New configuration is saved to ' << @config_file )
|
|
97
|
-
begin
|
|
98
|
-
File::write(bak_conf, File.read(@config_file))
|
|
99
|
-
File::write(@config_file, @conf.to_yaml)
|
|
100
|
-
rescue Exception => ex
|
|
101
|
-
msg = "Cannot write altered configuration to " << @config_file << "!\n\t" << ex.message
|
|
102
|
-
STDERR.puts(msg << "\nAborting, bye\n")
|
|
103
|
-
error msg
|
|
104
|
-
exit false
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
107
|
else
|
|
108
108
|
error "User-version of the configuration (#{@conf}) inaccessibble."
|
|
109
109
|
exit false
|