flnews_post_proc 1.55 → 1.60
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/README.md +3 -7
- data/bin/flnews_post_proc +17 -5
- data/doc/fr/html/flnews_post_proc.html +6 -7
- 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 +6 -7
- data/doc/html/flnews_post_proc.html +6 -10
- 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 +7 -12
- data/lib/body.rb +58 -17
- data/lib/configuration.rb +8 -5
- data/lib/flnews_post_proc.conf +2 -1
- data/lib/flnews_post_proc.rb +16 -2
- data/lib/override.rb +1 -2
- data/lib/ruby_dlg +14 -31
- data/lib/version.rb +3 -2
- data/lib/whiptail_dlg +2 -4
- data/lib/yad_dlg +6 -13
- data/lib/zenity_dlg +6 -14
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 501b73b0978b60f22ec85311eb7b9f66df77802e963eec5ed9bf7e86066604fc
|
|
4
|
+
data.tar.gz: 985d92d55cf867f297f4ec3ceb337091495918d869b48d105b38452412835ff0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a5d65c1484b211db45f9af9b98f31eabb928cce5707fa7b661166ac02593d52bb76a00aef5e0fe36657b24c13e14faf3b3ce86192c4a8e23a96689f488ec7da
|
|
7
|
+
data.tar.gz: 33563ad93400d39082bf888618a8b43801a98b486bb678a458bb16a09797480c52f3d310d61ce4549ba7dc0c4d1b68fa7cb7921802513440a5ef494c81f94469
|
data/README.md
CHANGED
|
@@ -115,8 +115,8 @@ some users may not always agree with the result and for arbitrary reasons:
|
|
|
115
115
|
|
|
116
116
|
* The program can attempt to correct ill formatted references. This is an
|
|
117
117
|
option, you can disable it by setting the option VFY_URLS to “no” in the
|
|
118
|
-
configuration.
|
|
119
|
-
|
|
118
|
+
configuration. Only URLs starting with http or https are currently
|
|
119
|
+
handled.
|
|
120
120
|
|
|
121
121
|
Dialog to override settings
|
|
122
122
|
---------------------------
|
|
@@ -302,15 +302,11 @@ the original message-body contains text marked for use as such a footnote. See
|
|
|
302
302
|
**VFY_URLS**
|
|
303
303
|
A Boolean constant. It determines if the program shall verify and possibly
|
|
304
304
|
try to correct URLs. Even if URLs are identified as such, only a few
|
|
305
|
-
manipulations are attempted :
|
|
305
|
+
manipulations are attempted :
|
|
306
306
|
|
|
307
307
|
* Angular brackets '<' and '>' are added, if missing
|
|
308
|
-
* Article-references are prepended with "news:", if missing
|
|
309
308
|
* Slashes are added, if they are found missing after "http(s):"
|
|
310
309
|
|
|
311
|
-
ATTN! The program is unable to discern "mailto:" and "news:" references. If
|
|
312
|
-
neither is given, but '@' is present, "news:" is automatically prepended.
|
|
313
|
-
|
|
314
310
|
If the variable is not set, a value 'yes' is assumed.
|
|
315
311
|
|
|
316
312
|
CONTENT: One of YES, yes, NO, no, and other variations of case.
|
data/bin/flnews_post_proc
CHANGED
|
@@ -22,8 +22,10 @@ if ! /linux/ =~ RUBY_PLATFORM
|
|
|
22
22
|
exit false
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
# needs the ruby-filemagic gem
|
|
26
26
|
require 'filemagic'
|
|
27
|
+
require 'tempfile'
|
|
28
|
+
|
|
27
29
|
require_relative '../lib/override'
|
|
28
30
|
require_relative '../lib/flnews_post_proc'
|
|
29
31
|
require_relative '../lib/basic_logging'
|
|
@@ -45,9 +47,16 @@ msg = PROGNAME.dup << ' ' << PROGVERSION << ' starting'
|
|
|
45
47
|
msg = "–––––– " << msg << " ––––––"
|
|
46
48
|
info msg
|
|
47
49
|
# Get a configuration
|
|
50
|
+
# this call results in the configuration file to be
|
|
51
|
+
# read and interpreted. As the log depends on the
|
|
52
|
+
# configuration, errors may render the debug-log
|
|
53
|
+
# unavailable. See STDERR in these cases, i.e.
|
|
54
|
+
# call the program on the command-line and pipe-in
|
|
55
|
+
# a message. Is this okay?
|
|
48
56
|
config = Configuration::instance
|
|
49
57
|
|
|
50
|
-
#
|
|
58
|
+
# Store the path to the main executable
|
|
59
|
+
# ... Forgot what this should be good for.
|
|
51
60
|
# config.set(:BINDIR, File::dirname(__FILE__) )
|
|
52
61
|
|
|
53
62
|
# Only if data is on STDIN
|
|
@@ -57,9 +66,11 @@ if (!STDIN.tty?)
|
|
|
57
66
|
|
|
58
67
|
# There is content, create the post-processor.
|
|
59
68
|
if !artext.strip.empty?
|
|
69
|
+
# Be sure to know what you are doing.
|
|
70
|
+
# Ask around in case of doubt.
|
|
60
71
|
mime = FileMagic.mime.buffer artext
|
|
61
72
|
debug('mime is ' << mime)
|
|
62
|
-
if mime.start_with?('message/
|
|
73
|
+
if ['news', 'rfc822'].any? {|m| mime.start_with?('message/' << m) }
|
|
63
74
|
#----------->
|
|
64
75
|
# Allow to override the configuration,
|
|
65
76
|
# if not disabled (default is true)
|
|
@@ -78,8 +89,9 @@ if (!STDIN.tty?)
|
|
|
78
89
|
debug('new config: ' << config.inspect)
|
|
79
90
|
end
|
|
80
91
|
#<--------------
|
|
92
|
+
# Do it:
|
|
81
93
|
pp = PostProcessor.new(artext)
|
|
82
|
-
#
|
|
94
|
+
# and get a result.
|
|
83
95
|
article = pp.article
|
|
84
96
|
if article
|
|
85
97
|
# -------------> The main objective <------
|
|
@@ -90,7 +102,7 @@ if (!STDIN.tty?)
|
|
|
90
102
|
# whatever.
|
|
91
103
|
exit false
|
|
92
104
|
else
|
|
93
|
-
error ("Input is of wrong mime-type" << mime)
|
|
105
|
+
error ("Input is of wrong mime-type " << mime)
|
|
94
106
|
end
|
|
95
107
|
else
|
|
96
108
|
error( "Cannot read the article, no content" )
|
|
@@ -621,11 +621,10 @@ remplace le texte d'une future note du pied de page dans le corps du message.</p
|
|
|
621
621
|
</dd>
|
|
622
622
|
<dt><strong>VFY_URLS</strong></dt>
|
|
623
623
|
<dd><p class="first">Une constante booléen. Elle détermine si le programme doit essayer de corriger
|
|
624
|
-
des
|
|
624
|
+
des URLs. Même si les URLs sont identifiables, seulement quelques manipulations
|
|
625
625
|
sont temptées :</p>
|
|
626
626
|
<ul class="simple">
|
|
627
627
|
<li>'<' et '>' sont ajoutés, si manquants</li>
|
|
628
|
-
<li>"news:" est ajouté au début des références à d'autres articles</li>
|
|
629
628
|
<li>Des slashes sont insérés, s'ils manquent après "http(s):"</li>
|
|
630
629
|
</ul>
|
|
631
630
|
<p>ATTN! Le programme ne peut pas différencier entre "mailto:" et "news:". Si ni l'un
|
|
@@ -636,11 +635,11 @@ ni l'autre est donné, mais '@' est présent, "news:" est ajouté
|
|
|
636
635
|
<p class="last">EXEMPLE: No</p>
|
|
637
636
|
</dd>
|
|
638
637
|
<dt><strong>OVERRIDE_CONFIG</strong></dt>
|
|
639
|
-
<dd><p class="first">Une constante booléenne. Vous pouvez décider d'ignorer les options
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
638
|
+
<dd><p class="first">Une constante booléenne. Vous pouvez décider d'ignorer les options suivantes
|
|
639
|
+
avant qu'un article est posté : GROUP_SIGS, XNAY_GROUPS, CUSTOM_HEADERS,
|
|
640
|
+
VFY_URLS et DEBUG_LOG. Un dialogue peut être affiché, qui permet la
|
|
641
|
+
désactivation de chacune de ces options. Les valeurs par défaut, définis pour
|
|
642
|
+
flnews, vont donc prévaloir.</p>
|
|
644
643
|
<p>ATTN ! En poussant Esc ou le bouton « Annuler » du dialogue, vous interrompez
|
|
645
644
|
le programme et flnews ne va rien envoyer.</p>
|
|
646
645
|
<p>Notez la valeur 'no', 'NO' ou pareil pour désactiver le dialogue.</p>
|
|
Binary file
|
|
Binary file
|
|
@@ -297,11 +297,10 @@ variables définis dans ce fichier peuvent être classées en deux catégories :
|
|
|
297
297
|
|
|
298
298
|
**VFY_URLS**
|
|
299
299
|
Une constante booléen. Elle détermine si le programme doit essayer de corriger
|
|
300
|
-
des
|
|
300
|
+
des URLs. Même si les URLs sont identifiables, seulement quelques manipulations
|
|
301
301
|
sont temptées :
|
|
302
302
|
|
|
303
303
|
* '<' et '>' sont ajoutés, si manquants
|
|
304
|
-
* "news:" est ajouté au début des références à d'autres articles
|
|
305
304
|
* Des slashes sont insérés, s'ils manquent après "http(s):"
|
|
306
305
|
|
|
307
306
|
ATTN! Le programme ne peut pas différencier entre "mailto:" et "news:". Si ni l'un
|
|
@@ -316,11 +315,11 @@ variables définis dans ce fichier peuvent être classées en deux catégories :
|
|
|
316
315
|
EXEMPLE: No
|
|
317
316
|
|
|
318
317
|
**OVERRIDE_CONFIG**
|
|
319
|
-
Une constante booléenne. Vous pouvez décider d'ignorer les options
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
318
|
+
Une constante booléenne. Vous pouvez décider d'ignorer les options suivantes
|
|
319
|
+
avant qu'un article est posté : GROUP_SIGS, XNAY_GROUPS, CUSTOM_HEADERS,
|
|
320
|
+
VFY_URLS et DEBUG_LOG. Un dialogue peut être affiché, qui permet la
|
|
321
|
+
désactivation de chacune de ces options. Les valeurs par défaut, définis pour
|
|
322
|
+
flnews, vont donc prévaloir.
|
|
324
323
|
|
|
325
324
|
ATTN ! En poussant Esc ou le bouton « Annuler » du dialogue, vous interrompez
|
|
326
325
|
le programme et flnews ne va rien envoyer.
|
|
@@ -579,23 +579,19 @@ text in the message body.</p>
|
|
|
579
579
|
try to correct URLs. Even if URLs are identified as such, only a few
|
|
580
580
|
manipulations are attempted :
|
|
581
581
|
* Angular brackets '<' and '>' are added, if missing
|
|
582
|
-
* Article-references are prepended with "news:", if missing
|
|
583
582
|
* Slashes are added, if they are found missing after "http(s):"</p>
|
|
584
|
-
<p>ATTN! The program is unable to discern "mailto:" and "news:" references. If
|
|
585
|
-
neither is given, but '@' is present, "news:" is automatically prepended.</p>
|
|
586
583
|
<p>If the variable is not set, a value 'yes' is assumed.</p>
|
|
587
584
|
<p>CONTENT: One of YES, yes, NO, no, and other variations of case.</p>
|
|
588
585
|
<p>DEFAULT: yes</p>
|
|
589
586
|
<p class="last">Example: ... I let you guess.</p>
|
|
590
587
|
</dd>
|
|
591
588
|
<dt><strong>OVERRIDE_CONFIG</strong></dt>
|
|
592
|
-
<dd><p class="first">A Boolean constant. You can choose to override the following
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
the process. Flnews will not post the article.</p>
|
|
589
|
+
<dd><p class="first">A Boolean constant. You can choose to override the following configuration
|
|
590
|
+
options before an article is posted: GROUP_SIGS, XNAY_GROUPS, CUSTOM_HEADERS,
|
|
591
|
+
DEBUG_LOG and VFY_URLS. A dialog may be displayed which allows you to disable
|
|
592
|
+
any of these five options, so that the defaults from flnews prevail.</p>
|
|
593
|
+
<p>ATTN! Canceling the dialog or pushing the Esc-key does interrupt the process.
|
|
594
|
+
Flnews will not post the article.</p>
|
|
599
595
|
<p>Set this option to no, NO or similar to disable the dialog.</p>
|
|
600
596
|
<p>DEFAULT: yes</p>
|
|
601
597
|
<p class="last">EXAMPLE: No</p>
|
|
Binary file
|
|
Binary file
|
|
@@ -258,12 +258,8 @@ categories:
|
|
|
258
258
|
try to correct URLs. Even if URLs are identified as such, only a few
|
|
259
259
|
manipulations are attempted :
|
|
260
260
|
* Angular brackets '<' and '>' are added, if missing
|
|
261
|
-
* Article-references are prepended with "news:", if missing
|
|
262
261
|
* Slashes are added, if they are found missing after "http(s):"
|
|
263
262
|
|
|
264
|
-
ATTN! The program is unable to discern "mailto:" and "news:" references. If
|
|
265
|
-
neither is given, but '@' is present, "news:" is automatically prepended.
|
|
266
|
-
|
|
267
263
|
If the variable is not set, a value 'yes' is assumed.
|
|
268
264
|
|
|
269
265
|
CONTENT: One of YES, yes, NO, no, and other variations of case.
|
|
@@ -273,14 +269,13 @@ categories:
|
|
|
273
269
|
Example: ... I let you guess.
|
|
274
270
|
|
|
275
271
|
**OVERRIDE_CONFIG**
|
|
276
|
-
A Boolean constant. You can choose to override the following
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
the process. Flnews will not post the article.
|
|
272
|
+
A Boolean constant. You can choose to override the following configuration
|
|
273
|
+
options before an article is posted: GROUP_SIGS, XNAY_GROUPS, CUSTOM_HEADERS,
|
|
274
|
+
DEBUG_LOG and VFY_URLS. A dialog may be displayed which allows you to disable
|
|
275
|
+
any of these five options, so that the defaults from flnews prevail.
|
|
276
|
+
|
|
277
|
+
ATTN! Canceling the dialog or pushing the Esc-key does interrupt the process.
|
|
278
|
+
Flnews will not post the article.
|
|
284
279
|
|
|
285
280
|
Set this option to no, NO or similar to disable the dialog.
|
|
286
281
|
|
data/lib/body.rb
CHANGED
|
@@ -1,21 +1,54 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
|
|
3
3
|
=begin
|
|
4
|
-
/***************************************************************************
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
/***************************************************************************
|
|
5
|
+
* 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
6
|
+
* This program is free software; you can redistribute it and/or modify *
|
|
7
|
+
* it under the terms of the WTFPL 2.0 or later, see *
|
|
8
|
+
* http://www.wtfpl.net/about/ *
|
|
9
|
+
* *
|
|
10
|
+
* This program is distributed in the hope that it will be useful, *
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
13
|
+
* *
|
|
14
|
+
***************************************************************************/
|
|
15
15
|
=end
|
|
16
16
|
|
|
17
17
|
require_relative 'basic_logging'
|
|
18
|
-
require_relative 'configuration'
|
|
18
|
+
require_relative 'configuration'
|
|
19
|
+
|
|
20
|
+
WRAP_LENGTH = 65
|
|
21
|
+
# Endow the String class with a wrap function.
|
|
22
|
+
# This is not yet applicable to the message body, itself.
|
|
23
|
+
class String
|
|
24
|
+
include BasicLogging
|
|
25
|
+
public
|
|
26
|
+
# wraps at length, returns the result
|
|
27
|
+
def wrap! (length = WRAP_LENGTH, indent = 0)
|
|
28
|
+
max = length
|
|
29
|
+
|
|
30
|
+
line = 0
|
|
31
|
+
out = [""]
|
|
32
|
+
|
|
33
|
+
self.gsub!("\r\n", " ")
|
|
34
|
+
self.gsub!(" ", " ")
|
|
35
|
+
|
|
36
|
+
words = self.split(" ")
|
|
37
|
+
|
|
38
|
+
while !words.empty?
|
|
39
|
+
word = words.shift.strip
|
|
40
|
+
break if not word
|
|
41
|
+
if out[line].length + word.length > max
|
|
42
|
+
out[line].squeeze!(" ")
|
|
43
|
+
line += 1
|
|
44
|
+
out[line] = (line > 0 ? " " * indent : "")
|
|
45
|
+
end
|
|
46
|
+
out[line] << word + " "
|
|
47
|
+
end
|
|
48
|
+
self.replace( out.join("\r\n"))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
19
52
|
|
|
20
53
|
# An object of this class represents the body of a news-article.
|
|
21
54
|
# It processes the original text and changes some details:
|
|
@@ -104,7 +137,7 @@ class Body
|
|
|
104
137
|
# exchange original intro-line against the new one
|
|
105
138
|
@lines[@lines.index(ointro)] = intro.strip
|
|
106
139
|
# looked complicated because it is.
|
|
107
|
-
|
|
140
|
+
|
|
108
141
|
# keep this line for reference.
|
|
109
142
|
@intro = intro
|
|
110
143
|
else
|
|
@@ -141,7 +174,7 @@ class Body
|
|
|
141
174
|
# TODO : Concentrate all URL/URI munging functionality in 1 or 2 helper
|
|
142
175
|
# classes, e.g. Body::News and Body::Http
|
|
143
176
|
# <------
|
|
144
|
-
|
|
177
|
+
|
|
145
178
|
# Verify and possibly correct links in the post.
|
|
146
179
|
# Simple.
|
|
147
180
|
def handle_uris()
|
|
@@ -149,10 +182,11 @@ class Body
|
|
|
149
182
|
# Default is no. nil or '' do qualify as default.
|
|
150
183
|
debug 'verify URLs ? ' << @@config.VFY_URLS.to_s
|
|
151
184
|
if @@config.VFY_URLS
|
|
152
|
-
|
|
185
|
+
debug 'verifying URLs'
|
|
153
186
|
@lines.each_with_index do | l, i |
|
|
154
187
|
# leave cited lines as they are.
|
|
155
188
|
if !l.start_with?( '>')
|
|
189
|
+
=begin Currently Unused
|
|
156
190
|
# IMPORTANT --------------------------------->
|
|
157
191
|
# IT IS HENCEFORTH PROHIBITED TO WRITE AN EMAIL-ADDRESS
|
|
158
192
|
# IN THE BODY OF A NEWS-POST AND TO NOT PREPEND IT WITH
|
|
@@ -164,6 +198,7 @@ class Body
|
|
|
164
198
|
# BUGFIX : Urls with @
|
|
165
199
|
# BUGFIX : email address in the intro
|
|
166
200
|
new_line = handle_news(l) if !@intro || l.strip != @intro.strip
|
|
201
|
+
=end
|
|
167
202
|
# http(s)
|
|
168
203
|
if l.include?('http')
|
|
169
204
|
new_line = handle_http(l)
|
|
@@ -173,7 +208,7 @@ class Body
|
|
|
173
208
|
end # @lines.each_with_index
|
|
174
209
|
end # if verify
|
|
175
210
|
end
|
|
176
|
-
|
|
211
|
+
#
|
|
177
212
|
# extract URL or other stuff, if configured for footnotes,
|
|
178
213
|
def handle_references()
|
|
179
214
|
# a symbol or string to mark the beginning an ending of a future footnote.
|
|
@@ -203,6 +238,9 @@ class Body
|
|
|
203
238
|
end
|
|
204
239
|
end until ref == nil
|
|
205
240
|
debug("all references found:\n" << references.join('\n')) if !references.empty?
|
|
241
|
+
# re-wrap body
|
|
242
|
+
# ATTN! Does not work!
|
|
243
|
+
# body.wrap!
|
|
206
244
|
else
|
|
207
245
|
msg = 'The References Delimiter is the same in its reversed form.'
|
|
208
246
|
msg << "#{$LN}Cannot handle references or footnotes!"
|
|
@@ -214,7 +252,10 @@ class Body
|
|
|
214
252
|
body << $LN << @@config.REFERENCES_SEPARATOR << $LN
|
|
215
253
|
references.each_with_index do |r, i|
|
|
216
254
|
r = r.gsub(ref_delim, '').gsub(ref_delim.reverse,'')
|
|
217
|
-
|
|
255
|
+
num = (i + 1).to_s << ") "
|
|
256
|
+
r.strip!
|
|
257
|
+
r.wrap!(WRAP_LENGTH, num.length)
|
|
258
|
+
body << num << r << $LN
|
|
218
259
|
end
|
|
219
260
|
else
|
|
220
261
|
debug('no refences found')
|
data/lib/configuration.rb
CHANGED
|
@@ -98,8 +98,8 @@ class Configuration
|
|
|
98
98
|
File::write(bak_conf, File.read(@config_file))
|
|
99
99
|
File::write(@config_file, @conf.to_yaml)
|
|
100
100
|
rescue Exception => ex
|
|
101
|
-
msg = ex.message
|
|
102
|
-
|
|
101
|
+
msg = "Cannot write altered configuration to " << @config_file << "!\n\t" << ex.message
|
|
102
|
+
STDERR.puts(msg << "\nAborting, bye\n")
|
|
103
103
|
error msg
|
|
104
104
|
exit false
|
|
105
105
|
end
|
|
@@ -126,12 +126,15 @@ class Configuration
|
|
|
126
126
|
clear_log
|
|
127
127
|
debug('log target and -level set: ' << @@log_level.to_s << ', ' << target_string)
|
|
128
128
|
rescue Exception => ex
|
|
129
|
-
msg =
|
|
130
|
-
|
|
129
|
+
msg = "Cannot use the configuration-file (" << @config_file << ")"
|
|
130
|
+
msg << "\n\t" << ex.message
|
|
131
|
+
# No log.
|
|
132
|
+
# error msg
|
|
133
|
+
STDERR.puts(msg << "\nAborting, bye\n")
|
|
131
134
|
exit false
|
|
132
135
|
end
|
|
133
136
|
else
|
|
134
|
-
STDERR.puts("
|
|
137
|
+
STDERR.puts("Cannot read the configuration-file (" << @config_file << ")")
|
|
135
138
|
exit false
|
|
136
139
|
end
|
|
137
140
|
end
|
data/lib/flnews_post_proc.conf
CHANGED
|
@@ -145,11 +145,12 @@ REFERENCE_FORMAT: " ➤%s"
|
|
|
145
145
|
# try to correct URLs. Even if URLs are identified as such, only a few
|
|
146
146
|
# manipulations are attempted :
|
|
147
147
|
# * Angular brackets '<' and '>' are added, if missing
|
|
148
|
+
# -----> handling <news:/> is disabled
|
|
148
149
|
# * Article-references are prepended with "news:", if missing
|
|
149
150
|
# * Slashes are added, if they are found missing after "http(s):"
|
|
150
151
|
# ATTN! The program is unable to discern "mailto:" and "news:" references. If
|
|
151
152
|
# neither is given, but '@' is present, "news:" is automatically prepended.
|
|
152
|
-
#
|
|
153
|
+
# <-----
|
|
153
154
|
# If the variable is not set, a value 'yes' is assumed.
|
|
154
155
|
# CONTENT: One of YES, yes, NO, no, and other variations of case.
|
|
155
156
|
# DEFAULT: No
|
data/lib/flnews_post_proc.rb
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
require 'yaml'
|
|
17
17
|
require 'ostruct'
|
|
18
|
+
|
|
18
19
|
# --needs the Diffy gem
|
|
19
20
|
require 'diffy'
|
|
20
21
|
|
|
@@ -55,8 +56,21 @@ class PostProcessor
|
|
|
55
56
|
body.set_signature(newsgroups.signature)
|
|
56
57
|
|
|
57
58
|
# verify and eventually correct URIs.
|
|
58
|
-
#
|
|
59
|
-
|
|
59
|
+
# Will only handle http(s) for the time.
|
|
60
|
+
body.handle_uris
|
|
61
|
+
|
|
62
|
+
=begin
|
|
63
|
+
require 'gpgme'
|
|
64
|
+
|
|
65
|
+
debug('signing')
|
|
66
|
+
if ENV['GPG_AGENT_INFO']
|
|
67
|
+
crypto = GPGME::Crypto.new
|
|
68
|
+
data = GPGME::Data.new(body)
|
|
69
|
+
signature = crypto.clearsign(data, {
|
|
70
|
+
:output => File.new("/tmp/crypt_out.asc", 'w+')
|
|
71
|
+
})
|
|
72
|
+
end
|
|
73
|
+
=end
|
|
60
74
|
|
|
61
75
|
# get the headers and the body as a string.
|
|
62
76
|
# Assemble.
|
data/lib/override.rb
CHANGED
|
@@ -40,8 +40,7 @@ class OverrideDlg
|
|
|
40
40
|
@@LIBDIR = File::dirname(__FILE__)
|
|
41
41
|
# The configuration variables that can be unset.
|
|
42
42
|
# This class instance variable is exposed via a getter.
|
|
43
|
-
@cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :DEBUG_LOG]
|
|
44
|
-
# @cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :VFY_URLS, :DEBUG_LOG]
|
|
43
|
+
@cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :VFY_URLS, :DEBUG_LOG]
|
|
45
44
|
|
|
46
45
|
# ... here
|
|
47
46
|
# For the record: this is rather cool.
|
data/lib/ruby_dlg
CHANGED
|
@@ -50,35 +50,20 @@ if !ARGV.empty? && ARGV.length > 0
|
|
|
50
50
|
|
|
51
51
|
opt_array = []
|
|
52
52
|
message = ''
|
|
53
|
-
|
|
54
53
|
menu ||= %=
|
|
55
54
|
1 Unset Signature GROUP_SIGS
|
|
56
55
|
2 Unset Custom headers CUSTOM_HEADERS
|
|
57
56
|
3 Unset No Archive NO_ARCHIVE_GROUPS
|
|
58
|
-
4
|
|
57
|
+
4 Do not correct URLs VFY_URLS
|
|
58
|
+
5 Disable log DEBUG_LOG
|
|
59
59
|
––––––––––––––––––––––––––––––––––––––––––––––
|
|
60
|
-
|
|
60
|
+
6 Summary
|
|
61
61
|
––––––––––––––––––––––––––––––––––––––––––––––
|
|
62
62
|
0 Okay, use settings.
|
|
63
63
|
––––––––––––––––––––––––––––––––––––––––––––––––
|
|
64
|
-
|
|
64
|
+
{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
|
65
65
|
and no changes will be applied.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
# menu ||= %=
|
|
69
|
-
# 1 Unset Signature GROUP_SIGS
|
|
70
|
-
# 2 Unset Custom headers CUSTOM_HEADERS
|
|
71
|
-
# 3 Unset No Archive NO_ARCHIVE_GROUPS
|
|
72
|
-
# 4 Do not correct URLs VFY_URLS
|
|
73
|
-
# 5 Disable log DEBUG_LOG
|
|
74
|
-
# ––––––––––––––––––––––––––––––––––––––––––––––
|
|
75
|
-
# 6 Summary
|
|
76
|
-
# ––––––––––––––––––––––––––––––––––––––––––––––
|
|
77
|
-
# 0 Okay, use settings.
|
|
78
|
-
#––––––––––––––––––––––––––––––––––––––––––––––––
|
|
79
|
-
##{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
|
80
|
-
#and no changes will be applied.
|
|
81
|
-
# =
|
|
66
|
+
=
|
|
82
67
|
|
|
83
68
|
loop do
|
|
84
69
|
system 'clear'
|
|
@@ -126,16 +111,15 @@ and no changes will be applied.
|
|
|
126
111
|
message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
|
|
127
112
|
menu.sub!("Unset X-No-Archive", "Add X-No-Archive ") if active
|
|
128
113
|
menu.sub!("Add X-No-Archive ", "Unset X-No-Archive") if !active
|
|
129
|
-
# when 4
|
|
130
|
-
# active = !opt_array.include?(:VFY_URLS)
|
|
131
|
-
# opt_array << :VFY_URLS if active
|
|
132
|
-
# opt_array.delete(:VFY_URLS) if !active
|
|
133
|
-
#
|
|
134
|
-
# message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
|
|
135
|
-
# menu.sub!("Do not correct URLs", "Correct URLs ") if active
|
|
136
|
-
# menu.sub!("Correct URLs ", "Do not correct URLs") if !active
|
|
137
|
-
# when 5
|
|
138
114
|
when 4
|
|
115
|
+
active = !opt_array.include?(:VFY_URLS)
|
|
116
|
+
opt_array << :VFY_URLS if active
|
|
117
|
+
opt_array.delete(:VFY_URLS) if !active
|
|
118
|
+
|
|
119
|
+
message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
|
|
120
|
+
menu.sub!("Do not correct URLs", "Correct URLs ") if active
|
|
121
|
+
menu.sub!("Correct URLs ", "Do not correct URLs") if !active
|
|
122
|
+
when 5
|
|
139
123
|
active = !opt_array.include?(:DEBUG_LOG)
|
|
140
124
|
opt_array << :DEBUG_LOG if active
|
|
141
125
|
opt_array.delete(:DEBUG_LOG) if !active
|
|
@@ -143,8 +127,7 @@ and no changes will be applied.
|
|
|
143
127
|
message = "Log is #{ active ? 'not ' : ''} " << "written!"
|
|
144
128
|
menu.sub!("Disable log", "Enable log ") if active
|
|
145
129
|
menu.sub!("Enable log ", "Disable log") if !active
|
|
146
|
-
|
|
147
|
-
when 5
|
|
130
|
+
when 6
|
|
148
131
|
message = "Summary of " << bold('disabled') << " options: " << opt_array.join(' ')
|
|
149
132
|
end
|
|
150
133
|
end
|
data/lib/version.rb
CHANGED
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
PROGNAME = 'flnews_post_proc'
|
|
17
|
-
PROGVERSION = "1.
|
|
17
|
+
PROGVERSION = "1.60"
|
|
18
18
|
AUTHORS = "Michael Uplawski"
|
|
19
19
|
EMAIL = "michael.uplawski@uplawski.eu"
|
|
20
20
|
YEARS = "2023 - 2024"
|
|
21
|
-
SUMMARY = "
|
|
21
|
+
SUMMARY = "Word wrapping with indenting for reference-lists"
|
|
22
|
+
|
data/lib/whiptail_dlg
CHANGED
|
@@ -30,12 +30,10 @@ TITLE="Override post-processor configuration"
|
|
|
30
30
|
CHECKTITLE="Deselect to disable. Esc or Cancel close the dialog and no changes will be applied."
|
|
31
31
|
|
|
32
32
|
# These are the configuration variables which can be unset.
|
|
33
|
-
|
|
34
|
-
VARS=(GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS DEBUG_LOG)
|
|
33
|
+
VARS=(GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG)
|
|
35
34
|
|
|
36
35
|
# Checklist options
|
|
37
|
-
|
|
38
|
-
options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS 'Custom headers' ON NO_ARCHIVE_GROUPS 'No Archive' ON DEBUG_LOG 'Log' ON)
|
|
36
|
+
options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS 'Custom headers' ON NO_ARCHIVE_GROUPS 'No Archive' ON VFY_URLS 'Correct URLs' ON DEBUG_LOG 'Log' ON)
|
|
39
37
|
|
|
40
38
|
# show dialog and store results
|
|
41
39
|
result=$(whiptail --title "$TITLE" --checklist "$CHECKTITLE" 13 55 5 "${options[@]}" 3>&1 1>&2 2>&3)
|
data/lib/yad_dlg
CHANGED
|
@@ -22,20 +22,13 @@ NO_ARCHIVE_GROUPS=3
|
|
|
22
22
|
#VFY_URLS=4
|
|
23
23
|
DEBUG_LOG=4
|
|
24
24
|
|
|
25
|
-
#CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
|
|
26
|
-
# --field="Uncheck to disable options\n<b>Esc and Cancel</b> terminate the post-processor.":LBL ""\
|
|
27
|
-
# --field="Signature":CHK 'true' \
|
|
28
|
-
# --field="Custom-headers":CHK 'true' \
|
|
29
|
-
# --field="No Archive":CHK 'true' \
|
|
30
|
-
# --field="URL Correction":CHK 'true' \
|
|
31
|
-
# --field="Log":CHK 'true')
|
|
32
|
-
|
|
33
25
|
CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
--field="Uncheck to disable options\n<b>Esc and Cancel</b> terminate the post-processor.":LBL ""\
|
|
27
|
+
--field="Signature":CHK 'true' \
|
|
28
|
+
--field="Custom-headers":CHK 'true' \
|
|
29
|
+
--field="No Archive":CHK 'true' \
|
|
30
|
+
--field="URL Correction":CHK 'true' \
|
|
31
|
+
--field="Log":CHK 'true')
|
|
39
32
|
|
|
40
33
|
if [ $? == 0 ]
|
|
41
34
|
then
|
data/lib/zenity_dlg
CHANGED
|
@@ -16,21 +16,13 @@
|
|
|
16
16
|
TITLE="Override post-processor configuration"
|
|
17
17
|
# The options are the configuration variables which can be unset.
|
|
18
18
|
|
|
19
|
-
#CONF=$(zenity --title "$TITLE" --text "Deselect options to disable.\n<b>Esc and Cancel</b> terminate the post-processor."\
|
|
20
|
-
# --height 450 --list --checklist --column 'set' --column 'Option' --column '' \
|
|
21
|
-
# TRUE GROUP_SIGS Signature\
|
|
22
|
-
# TRUE CUSTOM_HEADERS "Custom Headers"\
|
|
23
|
-
# TRUE NO_ARCHIVE_GROUPS "No Archive"\
|
|
24
|
-
# TRUE VFY_URLS "Correct URLs"\
|
|
25
|
-
# TRUE DEBUG_LOG Log)
|
|
26
|
-
|
|
27
19
|
CONF=$(zenity --title "$TITLE" --text "Deselect options to disable.\n<b>Esc and Cancel</b> terminate the post-processor."\
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
--height 450 --list --checklist --column 'set' --column 'Option' --column '' \
|
|
21
|
+
TRUE GROUP_SIGS Signature\
|
|
22
|
+
TRUE CUSTOM_HEADERS "Custom Headers"\
|
|
23
|
+
TRUE NO_ARCHIVE_GROUPS "No Archive"\
|
|
24
|
+
TRUE VFY_URLS "Correct URLs"\
|
|
25
|
+
TRUE DEBUG_LOG Log)
|
|
34
26
|
|
|
35
27
|
if [ $? == 0 ]
|
|
36
28
|
then
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flnews_post_proc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.60'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Uplawski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: diffy
|
|
@@ -105,5 +105,5 @@ requirements: []
|
|
|
105
105
|
rubygems_version: 3.5.3
|
|
106
106
|
signing_key:
|
|
107
107
|
specification_version: 4
|
|
108
|
-
summary:
|
|
108
|
+
summary: Word wrapping with indenting for reference-lists
|
|
109
109
|
test_files: []
|