flnews_post_proc 1.7 → 1.40

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c864ce301d84082376b2d6662eab044a8b9386d7fc59bea42ffa457811687d7
4
- data.tar.gz: deb232cd41c1d3e8c96052eace342f022d440039beeb5b644e0697ecc3209888
3
+ metadata.gz: f76e4432bd460f49ef15abd469ac4f79e1c4887c99229620b0a79ec9cb8ad836
4
+ data.tar.gz: a6416c6b5f53bdfb9995e1b64accadf97a18fbb2b2dc69b36f4aff86e38f35e3
5
5
  SHA512:
6
- metadata.gz: 523e37695eaef8c553b9458d7eba015e54ac709370368de54377f6b91c6a837a225f2f885e2c88b28aaf887ac33d4344f6d2b5b600e17f45e847c32327941ec9
7
- data.tar.gz: 8c2c7747e1209268bedca5468c4cbc19251bab962c0783990444e0739042b7bf22444d714b466e656825ba0d8b76642d5eebf985a31c407049fc6a6c0d31e7e3
6
+ metadata.gz: 4f331c0092c7ffeb7ac6b8ee485de68a8ad30534166b65b6be049d6b1d16a3a0a7754396da615dc397a6dd17ffdbf555363e4d41576a604963d09b21c4834031
7
+ data.tar.gz: 057cf2f67069ac2708d8b2444a6339b4671415bd55e86662f23d2ced0d95e5a7e80b69c3514123dab71a1edceab3717f346de7c876119c7c68bb6f31179dc3bb
data/README.md CHANGED
@@ -7,12 +7,12 @@
7
7
  Please give priority to the documentation which is delivered with the gem
8
8
  file, as the markdown syntax plays tricks, sometimes, and I may not be
9
9
  quick enough to correct this file. This applies especially to the section
10
- [_Configuration_](#CONFIGURATION), below.
10
+ [_Configuration_](#CONFIGURATION), below.
11
11
 
12
- The gem-file contains different formats of the man-page in English and French.
13
- See section [_Source Code_](Source-Code), below, for instructions to access
14
- these texts. Or see the same files [on the
15
- Web](https://www.uplawski.eu/div/flnews/).
12
+ The gem-file contains different formats of the man-page in English and French.
13
+ See section [_Source Code_](Source-Code), below, for instructions to access
14
+ these texts. Or see the same files [on the
15
+ Web](https://www.uplawski.eu/div/flnews/).
16
16
 
17
17
  SYNOPSIS
18
18
  =======================
@@ -56,7 +56,7 @@ The flnews newsreader is sufficient for Usenet access, i.e. to receive and read
56
56
  articles from -, as well as to write and post articles to newsgroups.
57
57
 
58
58
  When you compare news-clients, you will always notice the differences and
59
- choose the software that you prefer. flnews however, has the charm that you can
59
+ choose the software that you prefer. Flnews however, has the charm that you can
60
60
  influence how the program itself works but also modify posts that flnews
61
61
  produces, just before the program will transmit them to the chosen nntp-server.
62
62
 
@@ -83,8 +83,7 @@ some users may not always agree with the result and for arbitrary reasons:
83
83
  would like to replace it against another, based on the newsgroup you are
84
84
  about to post to.
85
85
  The post-processor program sets specific signatures as configured for one
86
- or several newsgroups. You can even define a list of signatures and have
87
- the program pick one from the list.
86
+ or several newsgroups.
88
87
 
89
88
  * Some custom headers may serve to convey additional information to
90
89
  interested readers of your post, like GnuPG key IDs, your language skills
@@ -94,14 +93,14 @@ some users may not always agree with the result and for arbitrary reasons:
94
93
  Custom headers may be defined in the configuration file for the program
95
94
  and will then be added to each outgoing post.
96
95
 
97
- * The Archive- and X-No-Archive headers are sometimes set to avoid that an
98
- article be saved and stays available to search-engines (Google, notably).
99
- Test- postings, for example, do probably not justify at all that they would
100
- be referenced in search results. The post-processor program can impose the
101
- Archive- and X-No-Archive header for all posts to certain newsgroups.
96
+ * The X-No-Archive header is sometimes set to avoid that an article be
97
+ saved and stays available to search-engines (Google, notably). Test-
98
+ postings, for example, do probably not justify at all that they would be
99
+ referenced in search results.
100
+ The post-processor program can impose the X-No-Archive header for all
101
+ posts to certain newsgroups.
102
102
 
103
- **ATTN** As of 2024, the header “X-No-Archive“ has lost most of its utility
104
- and it is the decision of server operators to honor it or not.
103
+ **ATTN** As of 2024, this header might serve no purpose any more.
105
104
 
106
105
  * If a news post contains many references to either other posts or Web
107
106
  pages, the text can be cluttered with URLs.
@@ -116,8 +115,8 @@ some users may not always agree with the result and for arbitrary reasons:
116
115
 
117
116
  * The program can attempt to correct ill formatted references. This is an
118
117
  option, you can disable it by setting the option VFY_URLS to “no” in the
119
- configuration. Only URLs starting with http or https are currently
120
- handled.
118
+ configuration. Beware that mailto: links are not recognized and cannot be
119
+ corrected. See the explanations for VFY_URLS, below.
121
120
 
122
121
  Dialog to override settings
123
122
  ---------------------------
@@ -130,7 +129,7 @@ have not yet been set in the configuration.
130
129
  * Signatures, as set in the configuration **can be ignored**. Either
131
130
  a default signature will appear as set in flnews or none.
132
131
  * Custom Headers, if configured, can be **omitted**.
133
- * Archive- and X-No-Archive headers, if set for the current newsgroup, **can be
132
+ * The X-No-Archive header, if set for the current newsgroup, **can be
134
133
  ignored**.
135
134
  * The verification & correction of references **can be disabled**.
136
135
  * Logging can be **switched off**, if set.
@@ -158,11 +157,6 @@ categories:
158
157
 
159
158
  * Variables defining the new or altered content.
160
159
 
161
- *ATTENTION*: Most problems that occurred with recent versions of
162
- *flnews_post_proc* were caused by inadequate option values and very often ill
163
- chosen or mal formatted regular expressions. PSE double check your
164
- configuration, if the program does not seem to work normally.
165
-
166
160
  **FUP_NAME**
167
161
  A Regular Expression, describing the string which contains the name of
168
162
  previous poster who is the author of a quoted post. This string is
@@ -172,7 +166,7 @@ Ruby, noted as a String. Beware to mask a backslash '\\' by another one,
172
166
  ike in the example. A capture-group '()' serves to extract the name from the
173
167
  match result.
174
168
 
175
- Leave this field empty to keep the default from the flnews configuration
169
+ Leave this field empty to keep the default from the FLNews configuration
176
170
  intact.
177
171
 
178
172
  CONTENT: A String equivalent of a regular expression.
@@ -205,15 +199,12 @@ intact.
205
199
 
206
200
  CONTENT: A newsgroup or regexp per line, followed by a colon, a space and a String
207
201
 
208
- DEFAULT: As configured in flnews
202
+ DEFAULT: As configured in FLNews
209
203
 
210
204
  EXAMPLE: _alt.test: "Thus spoke #\{fup_name\} on that baleful #\{fup_date\}:"_
211
205
 
212
206
  **GROUP_SIGS**
213
207
  A signature line per Newsgroup.
214
- If a file is named instead, the program will pick randomly one signature from
215
- that file. The file should contain signatures, separated by 1 empty line.
216
-
217
208
  ATTN! In multi line signatures, you have to use \r\n for line breaks.
218
209
 
219
210
  CONTENT: A newsgroup or regexp per line, followed by a colon, a space and a String.
@@ -221,7 +212,6 @@ intact.
221
212
  DEFAULT: As configured in flnews
222
213
 
223
214
  EXAMPLE: alt.test: _"Signature for alt.test\\\\r\\\\nsecond line"_
224
- EXAMPLE: comp.*: /home/user/.my_sigs
225
215
 
226
216
  **CUSTOM_HEADERS**
227
217
  Additional headers for the outgoing article
@@ -235,10 +225,9 @@ intact.
235
225
  _\- 'X-My-Header: nothing fancy'_
236
226
  _\- 'X-Another-Header: care not!'_
237
227
 
238
- **NO_ARCHIVE_GROUPS**
239
-
240
- The newsgroups, where the headers “Archive: no and “X-No-Archive: YES” shall
241
- be set.
228
+ **XNAY_GROUPS**
229
+ The newsgroups, where a header X-No-Archive: YES shall be set.
230
+ **ATTN** As of 2024, this header might serve no purpose any more.
242
231
 
243
232
  CONTENT: a dash and space, then a String, containing the name of the group or
244
233
  a regexp.
@@ -307,11 +296,15 @@ the original message-body contains text marked for use as such a footnote. See
307
296
  **VFY_URLS**
308
297
  A Boolean constant. It determines if the program shall verify and possibly
309
298
  try to correct URLs. Even if URLs are identified as such, only a few
310
- manipulations are attempted :
299
+ manipulations are attempted :
311
300
 
312
301
  * Angular brackets '<' and '>' are added, if missing
302
+ * Article-references are prepended with "news:", if missing
313
303
  * Slashes are added, if they are found missing after "http(s):"
314
304
 
305
+ ATTN! The program is unable to discern "mailto:" and "news:" references. If
306
+ neither is given, but '@' is present, "news:" is automatically prepended.
307
+
315
308
  If the variable is not set, a value 'yes' is assumed.
316
309
 
317
310
  CONTENT: One of YES, yes, NO, no, and other variations of case.
@@ -326,7 +319,7 @@ A dialog may be displayed which allows you to disable any of these
326
319
  four options, so that the defaults from flnews prevail.
327
320
 
328
321
  ATTN! Canceling the dialog or pushing the Esc-key does interrupt
329
- the process. flnews will not post the article.
322
+ the process. Flnews will not post the article.
330
323
 
331
324
  Set this option to no, NO or similar to disable the dialog.
332
325
 
data/bin/flnews_post_proc CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/bin/env ruby
2
2
  #encoding: UTF-8
3
-
4
3
  =begin
5
4
  /***************************************************************************
6
- * ©2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ * ©2023-2023, Michael Uplawski <michael.uplawski@uplawski.eu> *
7
6
  * *
8
7
  * This program is free software; you can redistribute it and/or modify *
9
8
  * it under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE *
@@ -22,73 +21,25 @@ if ! /linux/ =~ RUBY_PLATFORM
22
21
  exit false
23
22
  end
24
23
 
25
- # needs the ruby-filemagic gem
26
- # require 'filemagic'
27
- # require 'marcel'
28
24
  require 'tempfile'
29
-
30
25
  require_relative '../lib/override'
31
26
  require_relative '../lib/flnews_post_proc'
32
27
  require_relative '../lib/basic_logging'
33
28
  require_relative '../lib/configuration'
34
- require_relative '../lib/version'
35
29
 
36
30
  self.extend(BasicLogging)
37
-
38
- def usage
39
- usage = "\nWhat do you want me to do? Where is the article to post-process?"
40
- usage << "\nUsage: "
41
- usage << "\n\t#{$0} < article.text"
42
- info usage
43
- STDERR.puts usage
44
- exit false
45
- end
46
-
47
- msg = PROGNAME.dup << ' ' << PROGVERSION << ' starting'
48
- msg = "–––––– " << msg << " ––––––"
49
- info msg
50
31
  # Get a configuration
51
- # this call results in the configuration file to be
52
- # read and interpreted. As the log depends on the
53
- # configuration, errors may render the debug-log
54
- # unavailable. See STDERR in these cases, i.e.
55
- # call the program on the command-line and pipe-in
56
- # a message. Is this okay?
57
- debug 'creating config'
58
32
  config = Configuration::instance
59
33
 
60
- # Store the path to the main executable
61
- # ... Forgot what this should be good for.
34
+ # store the path to the main executable
62
35
  # config.set(:BINDIR, File::dirname(__FILE__) )
63
36
 
64
37
  # Only if data is on STDIN
65
38
  if (!STDIN.tty?)
66
39
  # read from STDIN
67
40
  artext = ARGF.read
68
-
69
41
  # There is content, create the post-processor.
70
- if !artext.strip.empty?
71
- =begin
72
- # unused
73
- if (['news', 'rfc822'].none? {|m| mime.start_with?('message/' << m) } )
74
- # Not a pure news message
75
- # Add more reactions, as you stumble upon them ...
76
- warn ("Input is of wrong mime-type " << mime.split(';')[0])
77
-
78
- # Javascript okay
79
- if (['javascript'].any? {|m| mime.start_with?('application/' << m)} )
80
- warn 'Input contains java-script code!'
81
- # C okay
82
- elsif(['x-c'].any? {|m| mime.start_with?('text/' << m)} )
83
- warn 'Input contains C- or C++ code!'
84
- # Ruby okay
85
- elsif(['x-ruby'].any? {|m| mime.start_with?('text/' << m) })
86
- warn 'Input contains Ruby-code!'
87
- else
88
- warn 'Input contains other things than plain-text, but I cannot say, what.'
89
- end
90
- end
91
- =end
42
+ if !artext.strip.empty?
92
43
  #----------->
93
44
  # Allow to override the configuration,
94
45
  # if not disabled (default is true)
@@ -107,9 +58,8 @@ if (!STDIN.tty?)
107
58
  debug('new config: ' << config.inspect)
108
59
  end
109
60
  #<--------------
110
- # Do it:
111
61
  pp = PostProcessor.new(artext)
112
- # and get a result.
62
+ # ... and print its result.
113
63
  article = pp.article
114
64
  if article
115
65
  # -------------> The main objective <------
@@ -120,9 +70,15 @@ if (!STDIN.tty?)
120
70
  # whatever.
121
71
  exit false
122
72
  else
123
- error( "Cannot read the article, no content" )
73
+ error( "Cannot read the article, no content" )
124
74
  end
125
75
  else
126
- usage()
76
+ usage = "\nWhat do you want me to do? Where is the article to post-process?"
77
+ usage << "\nUsage: "
78
+ usage << "\n\t#{$0} < article.text"
79
+ info usage
80
+ STDERR.puts usage
81
+ exit false
127
82
  end
83
+
128
84
  # Ω