flnews_post_proc 1.96.1 → 2.0
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 +1 -1
- data/changelog.txt +13 -0
- data/doc/fr/html/flnews_post_proc.html +70 -79
- 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 +25 -6
- data/doc/html/flnews_post_proc.html +366 -333
- 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 +273 -259
- data/lib/basic_logging.rb +64 -16
- data/lib/body.rb +17 -37
- data/lib/color_output.rb +41 -4
- data/lib/headers.rb +13 -6
- data/lib/newsgroups.rb +1 -3
- data/lib/override.rb +0 -40
- data/lib/version.rb +2 -2
- data/lib/whiptail_dlg +4 -4
- metadata +7 -9
- data/lib/_quoting_style_regexp +0 -2
- data/lib/yad_dlg +0 -57
- data/lib/zenity_dlg +0 -60
data/lib/basic_logging.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
#encoding: UTF-8
|
|
3
3
|
=begin
|
|
4
4
|
/***************************************************************************
|
|
5
|
-
* 2023-
|
|
5
|
+
* 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
6
6
|
* This program is free software; you can redistribute it and/or modify *
|
|
7
7
|
* it under the terms of the WTFPL 2.0 or later, see *
|
|
8
8
|
* http://www.wtfpl.net/about/ *
|
|
@@ -34,7 +34,7 @@ module BasicLogging
|
|
|
34
34
|
@@log_level = UNKNOWN
|
|
35
35
|
@@target = STDOUT
|
|
36
36
|
@@muted = []
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
# do not log, if caller is obj (class or instance)
|
|
39
39
|
def self.mute(obj)
|
|
40
40
|
name = obj.class == Class ? obj.name.dup : obj.class.name
|
|
@@ -48,8 +48,8 @@ module BasicLogging
|
|
|
48
48
|
|
|
49
49
|
# set the log level
|
|
50
50
|
def set_level(lv)
|
|
51
|
-
if lv.respond_to?(:to_str) && Levels.keys.include?(lv.strip.to_sym)
|
|
52
|
-
lv = Levels[lv.to_sym]
|
|
51
|
+
if lv.respond_to?(:to_str) && Levels.keys.include?(lv.downcase.strip.to_sym)
|
|
52
|
+
lv = Levels[lv.downcase.to_sym]
|
|
53
53
|
elsif lv.respond_to?(:to_sym) && Levels.keys.include?(lv)
|
|
54
54
|
lv = Levels[lv]
|
|
55
55
|
end
|
|
@@ -57,7 +57,7 @@ module BasicLogging
|
|
|
57
57
|
if(!lv || (lv.respond_to?(:to_int) && lv >= DEBUG && lv <= FATAL) )
|
|
58
58
|
@@log_level = lv
|
|
59
59
|
else
|
|
60
|
-
msg =
|
|
60
|
+
msg = calling_method << ": ERROR : invalid log level \"" << lv.to_s << "\""
|
|
61
61
|
msg << "\n" << "Keepinng old log level " << Levels.keys.detect {| k| Levels[k] == @@log_level}.to_s
|
|
62
62
|
STDERR.puts msg
|
|
63
63
|
puts msg
|
|
@@ -73,14 +73,14 @@ module BasicLogging
|
|
|
73
73
|
elsif !tg || tg.respond_to?(:to_str) && tg.strip.empty?
|
|
74
74
|
@@target = nil
|
|
75
75
|
else
|
|
76
|
-
STDERR.puts
|
|
76
|
+
STDERR.puts calling_method << ': ERROR : target ' << tg.to_str << ' cannot be set'
|
|
77
77
|
STDERR.puts "Keeping old target " << @@target.inspect
|
|
78
78
|
return
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
-
# Output of log messages, depending on the log level
|
|
83
|
-
#
|
|
82
|
+
# Output of log messages, depending on the set log level and the name of the
|
|
83
|
+
# alias method which is actually called.
|
|
84
84
|
def log(message)
|
|
85
85
|
if !BasicLogging.is_muted?(self)
|
|
86
86
|
# how has this method been called?
|
|
@@ -90,7 +90,7 @@ module BasicLogging
|
|
|
90
90
|
# the calling alias.
|
|
91
91
|
format_log( message, mlevel) if @@log_level && Levels[mlevel] >= @@log_level
|
|
92
92
|
else
|
|
93
|
-
STDERR.puts
|
|
93
|
+
STDERR.puts calling_method << ": ERROR : invalid log level \"" << mlevel.to_s << "\""
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
end
|
|
@@ -110,6 +110,21 @@ module BasicLogging
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
# find the name of the calling object's class or the file name in case of the
|
|
114
|
+
# top level object... or any dumb instance of Object
|
|
115
|
+
def log_name()
|
|
116
|
+
if !@log_name
|
|
117
|
+
clname = self.class.name
|
|
118
|
+
# limit analysis of the call stack to 'Object'.
|
|
119
|
+
if clname == 'Object'
|
|
120
|
+
@log_name = File::basename(caller.last.split(':')[0])
|
|
121
|
+
else
|
|
122
|
+
@log_name = self.class == Class ? self.name.dup << ' [class]' : clname
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
@log_name
|
|
126
|
+
end
|
|
127
|
+
|
|
113
128
|
alias :debug :log
|
|
114
129
|
alias :info :log
|
|
115
130
|
alias :warn :log
|
|
@@ -118,6 +133,31 @@ module BasicLogging
|
|
|
118
133
|
|
|
119
134
|
private
|
|
120
135
|
|
|
136
|
+
# Find the method that called, or 'main' in case of a top level Object.
|
|
137
|
+
# This needs a bunch of memory and slows down the process.
|
|
138
|
+
# Use of this method should be limited.
|
|
139
|
+
def calling_method()
|
|
140
|
+
# find instances other than the current module.
|
|
141
|
+
stack_item = caller.detect do |item|
|
|
142
|
+
item.split(':')[0] != __FILE__
|
|
143
|
+
end
|
|
144
|
+
if stack_item
|
|
145
|
+
if stack_item.include?('#')
|
|
146
|
+
m = stack_item.split(':').last.split("#")[1]
|
|
147
|
+
m.gsub!("'", '') if m && m.include?("'")
|
|
148
|
+
# looks cooler with a class name in front.
|
|
149
|
+
return '#' << m << '()'
|
|
150
|
+
else
|
|
151
|
+
# top level Object
|
|
152
|
+
return stack_item.split(':').last
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
# This is dumb but won't hurt a lot.
|
|
156
|
+
return 'from main'
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# could be useful
|
|
121
161
|
def lock_target(&block)
|
|
122
162
|
begin
|
|
123
163
|
if @@target.respond_to?(:flock)
|
|
@@ -128,19 +168,27 @@ module BasicLogging
|
|
|
128
168
|
block.call
|
|
129
169
|
end
|
|
130
170
|
rescue => ex
|
|
131
|
-
STDERR.puts
|
|
171
|
+
STDERR.puts calling_method << ": ERROR : cannot lock target (" << ex.message << ")"
|
|
132
172
|
end
|
|
133
173
|
end
|
|
134
174
|
|
|
135
175
|
# 1 format_log for all loggers.
|
|
136
176
|
def format_log(message, mlevel)
|
|
137
177
|
if @@target
|
|
178
|
+
location = log_name().dup << ' '
|
|
179
|
+
# Limit the memory-hungry analysis of the call stack
|
|
180
|
+
# This also takes about 2.5 times as long.
|
|
181
|
+
if mlevel != :info
|
|
182
|
+
location = log_name().dup << ' ' << calling_method << ' '
|
|
183
|
+
end
|
|
138
184
|
# indicate if a registered class or the registered object of a class is calling.
|
|
139
|
-
|
|
140
|
-
lock_target{@@target.puts '' << name << ' ' << mlevel.to_s << ' ' << Time.now.strftime("%H:%M:%S:%6N") << ': ' << message.gsub("\n", "\n |")}
|
|
185
|
+
lock_target{@@target.puts '' << location << mlevel.to_s << ' ' << Time.now.strftime("%H:%M:%S:%6N") << ': ' << message.gsub("\n", "\n |")}
|
|
141
186
|
end
|
|
142
187
|
end
|
|
143
|
-
end
|
|
188
|
+
end # Module end
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
144
192
|
#---------test: execute file----------
|
|
145
193
|
if $0 == __FILE__
|
|
146
194
|
Array.extend(BasicLogging)
|
|
@@ -186,14 +234,14 @@ if $0 == __FILE__
|
|
|
186
234
|
obj.warn('warn')
|
|
187
235
|
obj.error('error')
|
|
188
236
|
obj.fatal('fatal')
|
|
189
|
-
|
|
237
|
+
# ---- into file ---
|
|
190
238
|
obj.set_target "/tmp/test_log.log"
|
|
191
|
-
puts "
|
|
239
|
+
puts "------ INFO into #{obj.target}-----------"
|
|
192
240
|
obj.set_level BasicLogging::INFO
|
|
193
241
|
obj.info('info output')
|
|
194
242
|
|
|
195
243
|
obj.info('info output 2')
|
|
196
|
-
puts "---------- invalid -------"
|
|
244
|
+
puts "---------- invalid (fails) -------"
|
|
197
245
|
obj.set_target "/dev/sr0"
|
|
198
246
|
obj.set_level "power"
|
|
199
247
|
end
|
data/lib/body.rb
CHANGED
|
@@ -20,6 +20,7 @@ require_relative 'configuration'
|
|
|
20
20
|
WRAP_LENGTH = 65
|
|
21
21
|
# Endow the String class with a wrap function.
|
|
22
22
|
# This is not yet applicable to the message body, itself.
|
|
23
|
+
|
|
23
24
|
class String
|
|
24
25
|
include BasicLogging
|
|
25
26
|
public
|
|
@@ -47,7 +48,6 @@ class String
|
|
|
47
48
|
end
|
|
48
49
|
self.replace( out.join("\r\n"))
|
|
49
50
|
end
|
|
50
|
-
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# An object of this class represents the body of a news-article.
|
|
@@ -151,23 +151,18 @@ class Body
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def set_signature(signature)
|
|
154
|
-
unless
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
|
154
|
+
# unless no changes requested.
|
|
155
|
+
debug 'signature is ' << (signature ? signature.to_s : 'NIL')
|
|
156
|
+
if signature && !signature.empty?
|
|
157
|
+
# remove any signature(s) from
|
|
158
|
+
# the current article
|
|
159
|
+
sigpos = @lines.index('-- ')
|
|
160
|
+
debug('found signature in line ' << sigpos.to_s) if sigpos
|
|
161
|
+
@lines = @lines.slice(0, sigpos ) if sigpos
|
|
162
|
+
debug('setting signature ' << signature) if signature
|
|
163
|
+
@lines << "-- " << signature if signature
|
|
169
164
|
else
|
|
170
|
-
debug '
|
|
165
|
+
debug 'signature is ' << (signature ? signature.to_s : 'not set.' )
|
|
171
166
|
end
|
|
172
167
|
end
|
|
173
168
|
|
|
@@ -268,26 +263,11 @@ class Body
|
|
|
268
263
|
refs << num << r << $LN
|
|
269
264
|
end
|
|
270
265
|
|
|
271
|
-
#
|
|
272
|
-
|
|
273
|
-
#
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
debug 'inserting references'
|
|
277
|
-
# a line, separating the footnotes from the body of the article
|
|
278
|
-
body.insert(sigpos, $LN.dup << @@config.REFERENCES_SEPARATOR.strip << $LN)
|
|
279
|
-
# move the position lower than the separator
|
|
280
|
-
sigpos = body.index('-- ')
|
|
281
|
-
body.insert(sigpos, refs)
|
|
282
|
-
else
|
|
283
|
-
# ... or append references.
|
|
284
|
-
debug 'appending references'
|
|
285
|
-
# a line, separating the footnotes from the body of the article
|
|
286
|
-
body << $LN << @@config.REFERENCES_SEPARATOR.strip << $LN
|
|
287
|
-
body << refs
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
|
|
266
|
+
# append references.
|
|
267
|
+
debug 'appending references'
|
|
268
|
+
# a line, separating the footnotes from the body of the article
|
|
269
|
+
body << $LN << @@config.REFERENCES_SEPARATOR.strip << $LN
|
|
270
|
+
body << refs
|
|
291
271
|
else
|
|
292
272
|
debug('no refences found')
|
|
293
273
|
end
|
data/lib/color_output.rb
CHANGED
|
@@ -33,22 +33,48 @@ STYLES = {:regular => REGULAR, :bold => BOLD, :underline => UNDERLINE, :blink =>
|
|
|
33
33
|
# Colorizes the given text. Color-code is either an escape-sequence or one of
|
|
34
34
|
# the symbols representing color-names in the COLORS hash.
|
|
35
35
|
def colorize(text, color_code)
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
# ensure that colors are supported
|
|
37
|
+
if $stdout.tty? && ENV['TERM'] != 'dumb'
|
|
38
|
+
if (COLORS.keys.include?(color_code) )
|
|
39
|
+
"\033[3#{COLORS[color_code]}m#{text}\033[0m"
|
|
40
|
+
else
|
|
41
|
+
"#{color_code}#{text}\033[0m"
|
|
42
|
+
end
|
|
43
|
+
# if Terminal does not support colors
|
|
38
44
|
else
|
|
39
|
-
|
|
45
|
+
text
|
|
40
46
|
end
|
|
41
47
|
end
|
|
42
48
|
|
|
49
|
+
# rgb foreground
|
|
50
|
+
def colorize_RGB(text, r, g, b)
|
|
51
|
+
code = "%s;%s;%s" %[r, g, b]
|
|
52
|
+
"\033[38;2;#{code}m#{text}\033[0m"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# rgb background
|
|
56
|
+
def background_RGB(text, r, g, b)
|
|
57
|
+
code = "%s;%s;%s" %[r, g, b]
|
|
58
|
+
"\033[48;2;#{code}m#{text}\033[0m"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# duplicate code without much intelligence
|
|
43
62
|
def style(text, style_code)
|
|
44
63
|
"#{style_code}#{text}\033[0m"
|
|
45
64
|
end
|
|
65
|
+
|
|
46
66
|
# a function which allows to manipulate every known aspect of the ansi-output.
|
|
47
67
|
def colored_output(output_text, fg_color = :default, bg_color = :default, style = :regular , mode = :neutral )
|
|
48
|
-
|
|
68
|
+
if $stdout.tty? && ENV['TERM'] != 'dumb'
|
|
69
|
+
"\033[%i;%i;%i%i;%i%im%s\033[0m" %[STYLES[mode.to_sym], STYLES[style.to_sym], FG, COLORS[fg_color.to_sym], BG, COLORS[bg_color.to_sym], output_text]
|
|
70
|
+
else
|
|
71
|
+
# fallback for terminals that do not support colors.
|
|
72
|
+
output_text
|
|
73
|
+
end
|
|
49
74
|
end
|
|
50
75
|
|
|
51
76
|
# convenience functions
|
|
77
|
+
def black(text); colorize(text, "\033[30m"); end
|
|
52
78
|
def red(text); colorize(text, "\033[31m"); end
|
|
53
79
|
def green(text); colorize(text, "\033[32m"); end
|
|
54
80
|
def yellow(text); colorize(text, "\033[33m"); end
|
|
@@ -57,9 +83,20 @@ def cyan(text); colorize(text, "\033[36m"); end
|
|
|
57
83
|
def blue(text); colorize(text, "\033[34m"); end
|
|
58
84
|
def white(text); colorize(text, "\033[37m"); end
|
|
59
85
|
|
|
86
|
+
# RGB
|
|
87
|
+
# TODO: Fallbacks from the 256 color palette
|
|
88
|
+
def orange(text); colorize(text, "\033[38;2;255;165;0m"); end
|
|
89
|
+
def pink(text); colorize(text, "\033[38;2;255;0;165m"); end
|
|
90
|
+
def lightred(text); colorize(text, "\033[38;2;255;100;100m"); end
|
|
91
|
+
def lightgreen(text); colorize(text, "\033[38;2;100;255;100m"); end
|
|
92
|
+
def brown(text); colorize(text, "\033[38;2;153;76;0m"); end
|
|
93
|
+
def crimson(text); colorize(text, "\033[38;2;220;20;60m"); end
|
|
94
|
+
|
|
95
|
+
# quick contrast
|
|
60
96
|
def black_on_white(text); colorize(colorize(text, "\033[30m"), "\033[47m");end
|
|
61
97
|
def white_on_black(text); colorize(colorize(text, "\033[37m"), "\033[40m");end
|
|
62
98
|
|
|
99
|
+
# styles
|
|
63
100
|
def bold(text); style(text, "\033[01m");end
|
|
64
101
|
def underline(text); style(text, "\033[04m");end
|
|
65
102
|
|
data/lib/headers.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
3
|
/***************************************************************************
|
|
4
|
-
* 2023-
|
|
4
|
+
* 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
5
|
* This program is free software; you can redistribute it and/or modify *
|
|
6
6
|
* it under the terms of the WTFPL 2.0 or later, see *
|
|
7
7
|
* http://www.wtfpl.net/about/ *
|
|
@@ -132,18 +132,26 @@ class Headers
|
|
|
132
132
|
ch = @config.CUSTOM_HEADERS
|
|
133
133
|
debug('setting custom headers : ' << ch.inspect)
|
|
134
134
|
@config.CUSTOM_HEADERS.each do |pair|
|
|
135
|
-
|
|
135
|
+
# limit to 2 elements to include ':' in values.
|
|
136
|
+
ch = pair.split(':', 2)
|
|
137
|
+
# ^ here
|
|
138
|
+
# name
|
|
136
139
|
hn = ch[0].strip
|
|
140
|
+
# value
|
|
137
141
|
hv = ch[1].strip
|
|
138
|
-
|
|
142
|
+
debug 'setting new header ' << hn << ': ' << hv
|
|
143
|
+
# Ensure header is ascii only
|
|
139
144
|
if hv.ascii_only? && hn.ascii_only?
|
|
140
145
|
# <---------- special treatment Post-Processor ---------->
|
|
141
146
|
hv << ' ' << PROGVERSION.to_s if hn == 'X-Post-Processor' && hv == 'flnews_post_proc'
|
|
142
147
|
# >----------<
|
|
143
148
|
@headers[hn.to_sym] = hv
|
|
144
149
|
else
|
|
145
|
-
warn "Custom header [#{hn}:#{hv}] should be ASCII only!
|
|
150
|
+
warn "Custom header [#{hn}:#{hv}] should be ASCII only! But I try to encode it..."
|
|
151
|
+
hv = hv.split.collect{|w| (w.ascii_only? ? w : Rfc2047.encode(w, encoding: :Q)) }.join(' ')
|
|
152
|
+
debug ' custom header encoded'
|
|
146
153
|
end
|
|
154
|
+
@headers[hn.to_sym] = hv
|
|
147
155
|
end
|
|
148
156
|
@headers.compact!
|
|
149
157
|
end
|
|
@@ -180,7 +188,6 @@ class Headers
|
|
|
180
188
|
private
|
|
181
189
|
|
|
182
190
|
# Check for was, war, était and clip the old subject header.
|
|
183
|
-
# Currently UNUSED
|
|
184
191
|
def alterSubject
|
|
185
192
|
if @config.USE_OLD
|
|
186
193
|
refs = @headers[:References]
|
|
@@ -230,7 +237,7 @@ class Headers
|
|
|
230
237
|
new_subject = parts[0].strip('(')
|
|
231
238
|
# <--- but it is
|
|
232
239
|
# encode if you must.
|
|
233
|
-
new_subject = new_subject.split.
|
|
240
|
+
new_subject = new_subject.split.collect{|w| (w.ascii_only? ? w : Rfc2047.encode(w, encoding: :Q)) }.join(' ')
|
|
234
241
|
# encode everything.
|
|
235
242
|
#new_subject = new_subject.ascii_only? ? new_subject : Rfc2047.encode(new_subject, encoding: :Q)
|
|
236
243
|
# probably unneeded
|
data/lib/newsgroups.rb
CHANGED
|
@@ -29,9 +29,7 @@ class Newsgroups
|
|
|
29
29
|
|
|
30
30
|
# set details for this post
|
|
31
31
|
if @groups.size == 1
|
|
32
|
-
|
|
33
|
-
debug 'Signature will ' << (@config.SUPERSEDES ? 'NOT ' : '') << 'be set'
|
|
34
|
-
set_signature if !@config.SUPERSEDES
|
|
32
|
+
set_signature
|
|
35
33
|
set_intro
|
|
36
34
|
set_no_archive
|
|
37
35
|
end
|
data/lib/override.rb
CHANGED
|
@@ -30,13 +30,10 @@ class OverrideDlg
|
|
|
30
30
|
XTERM = 'xterm'
|
|
31
31
|
# TERMINAL = 'x-terminal-emulator'
|
|
32
32
|
WHIPTAIL = 'whiptail'
|
|
33
|
-
YAD = 'yad'
|
|
34
|
-
ZENITY = 'zenity'
|
|
35
33
|
# The external programs which are supported for the time. They will be run in
|
|
36
34
|
# a new process (IO.popen() ). The first program from this array, which is
|
|
37
35
|
# found in the Path, will be used. Whiptail and a pure ruby dialog
|
|
38
36
|
# necessitate that xterm be found, too.
|
|
39
|
-
# @@Executables = [YAD, ZENITY, WHIPTAIL, XTERM]
|
|
40
37
|
@@Executables = [WHIPTAIL, XTERM]
|
|
41
38
|
@@LIBDIR = File::dirname(__FILE__)
|
|
42
39
|
# The configuration variables that can be unset.
|
|
@@ -70,13 +67,6 @@ class OverrideDlg
|
|
|
70
67
|
debug('found executables ' << @executables.join(', '))
|
|
71
68
|
opts = nil
|
|
72
69
|
begin
|
|
73
|
-
=begin unresolved issues with YAD and Zenity
|
|
74
|
-
if has?(YAD)
|
|
75
|
-
return yad_dlg.split.collect {|o| o.to_s}.join(' ')
|
|
76
|
-
elsif has?(ZENITY)
|
|
77
|
-
return zenity_dlg.split.collect {|o| o.to_s}.join(' ')
|
|
78
|
-
elsif has? XTERM
|
|
79
|
-
=end
|
|
80
70
|
if has? XTERM
|
|
81
71
|
if has?(WHIPTAIL)
|
|
82
72
|
return whiptail_dlg.split.collect {|o| o.to_s}.join(' ')
|
|
@@ -172,36 +162,6 @@ class OverrideDlg
|
|
|
172
162
|
tf.unlink
|
|
173
163
|
return nopts
|
|
174
164
|
end
|
|
175
|
-
|
|
176
|
-
# creates a Zenity dialog.
|
|
177
|
-
def zenity_dlg
|
|
178
|
-
debug('Zenity dialog')
|
|
179
|
-
# dialog = @config.BINDIR << File::Separator << 'zenity_dlg'
|
|
180
|
-
dialog = @@LIBDIR << File::Separator << 'zenity_dlg'
|
|
181
|
-
io = IO.popen(dialog)
|
|
182
|
-
Process::wait(io.pid)
|
|
183
|
-
rc = $?.exitstatus
|
|
184
|
-
|
|
185
|
-
exit true if rc != 0
|
|
186
|
-
|
|
187
|
-
nopts = io.read
|
|
188
|
-
return nopts
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
# creates a YAD dialog.
|
|
192
|
-
def yad_dlg
|
|
193
|
-
debug('yad dialog')
|
|
194
|
-
# dialog = @config.BINDIR << File::Separator << 'yad_dlg'
|
|
195
|
-
dialog = @@LIBDIR << File::Separator << 'yad_dlg'
|
|
196
|
-
debug('dialog will be ' << dialog)
|
|
197
|
-
io = IO::popen(dialog)
|
|
198
|
-
Process::wait(io.pid)
|
|
199
|
-
exit true if $?.exitstatus != 0
|
|
200
|
-
|
|
201
|
-
nopts = io.read
|
|
202
|
-
return nopts
|
|
203
|
-
end
|
|
204
|
-
|
|
205
165
|
end
|
|
206
166
|
|
|
207
167
|
# EOF
|
data/lib/version.rb
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
PROGNAME = 'flnews_post_proc'
|
|
17
|
-
PROGVERSION = "
|
|
17
|
+
PROGVERSION = "2.0"
|
|
18
18
|
AUTHORS = "Michael Uplawski"
|
|
19
19
|
EMAIL = "michael.uplawski@uplawski.eu"
|
|
20
20
|
YEARS = "2023 - 2026"
|
|
21
|
-
SUMMARY = "
|
|
21
|
+
SUMMARY = "Modify news posts, before flnews sends them."
|
data/lib/whiptail_dlg
CHANGED
|
@@ -44,10 +44,10 @@ okcancel=$?
|
|
|
44
44
|
read -ra opts <<< $result
|
|
45
45
|
|
|
46
46
|
# comment out -------->
|
|
47
|
-
echo "cancel/ok ? $okcancel"
|
|
48
|
-
echo $result
|
|
49
|
-
echo "${opts[@]}"
|
|
50
|
-
echo "${#opts[@]}"
|
|
47
|
+
#echo "cancel/ok ? $okcancel"
|
|
48
|
+
#echo $result
|
|
49
|
+
#echo "${opts[@]}"
|
|
50
|
+
#echo "${#opts[@]}"
|
|
51
51
|
# <--------
|
|
52
52
|
|
|
53
53
|
# Find deselected options which shall be written to the outfile.
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flnews_post_proc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: '2.0'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Uplawski
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-07-28 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: diffy
|
|
@@ -58,6 +58,7 @@ extra_rdoc_files: []
|
|
|
58
58
|
files:
|
|
59
59
|
- README.md
|
|
60
60
|
- bin/flnews_post_proc
|
|
61
|
+
- changelog.txt
|
|
61
62
|
- doc/fr/html/flnews_post_proc.html
|
|
62
63
|
- doc/fr/man/flnews_post_proc.1.gz
|
|
63
64
|
- doc/fr/pdf/flnews_post_proc.pdf
|
|
@@ -67,7 +68,6 @@ files:
|
|
|
67
68
|
- doc/man/flnews_post_proc.1.gz
|
|
68
69
|
- doc/pdf/flnews_post_proc.pdf
|
|
69
70
|
- doc/rst/flnews_post_proc.rst
|
|
70
|
-
- lib/_quoting_style_regexp
|
|
71
71
|
- lib/basic_logging.rb
|
|
72
72
|
- lib/body.rb
|
|
73
73
|
- lib/color_output.rb
|
|
@@ -80,13 +80,12 @@ files:
|
|
|
80
80
|
- lib/ruby_dlg
|
|
81
81
|
- lib/version.rb
|
|
82
82
|
- lib/whiptail_dlg
|
|
83
|
-
- lib/yad_dlg
|
|
84
|
-
- lib/zenity_dlg
|
|
85
83
|
licenses:
|
|
86
|
-
-
|
|
84
|
+
- WTFPL
|
|
87
85
|
metadata:
|
|
88
86
|
homepage_uri: https://www.uplawski.eu/software/flnews_post_proc/
|
|
89
87
|
documentation_uri: https://www.uplawski.eu/div/flnews/gem_doc/html/flnews_post_proc.html
|
|
88
|
+
changelog_uri: https://www.uplawski.eu/div/flnews/gem_doc/changelog.txt
|
|
90
89
|
rdoc_options: []
|
|
91
90
|
require_paths:
|
|
92
91
|
- lib
|
|
@@ -101,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
101
100
|
- !ruby/object:Gem::Version
|
|
102
101
|
version: '0'
|
|
103
102
|
requirements: []
|
|
104
|
-
rubygems_version: 4.0.
|
|
103
|
+
rubygems_version: 4.0.16
|
|
105
104
|
specification_version: 4
|
|
106
|
-
summary:
|
|
107
|
-
french prefix 'était' is used.
|
|
105
|
+
summary: Modify news posts, before flnews sends them.
|
|
108
106
|
test_files: []
|
data/lib/_quoting_style_regexp
DELETED
data/lib/yad_dlg
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
#/**************************************************************************
|
|
4
|
-
#* This program is free software; you can redistribute it and/or modify *
|
|
5
|
-
#* it under the terms of the WTFPL 2.0 or later, see *
|
|
6
|
-
#* http://www.wtfpl.net/about/ *
|
|
7
|
-
#* *
|
|
8
|
-
#* This program is distributed in the hope that it will be useful, *
|
|
9
|
-
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
10
|
-
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
11
|
-
#* *
|
|
12
|
-
#***************************************************************************/
|
|
13
|
-
|
|
14
|
-
# A dialog to override configuration options
|
|
15
|
-
|
|
16
|
-
TITLE="Override post-processor configuration"
|
|
17
|
-
# These are the configuration variables which can be
|
|
18
|
-
# unset.
|
|
19
|
-
GROUP_SIGS=1
|
|
20
|
-
CUSTOM_HEADERS=2
|
|
21
|
-
NO_ARCHIVE_GROUPS=3
|
|
22
|
-
#VFY_URLS=4
|
|
23
|
-
DEBUG_LOG=4
|
|
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
|
-
|
|
34
|
-
if [ $? == 0 ]
|
|
35
|
-
then
|
|
36
|
-
IFS="|"
|
|
37
|
-
read -ra C_ARR <<< $CONF
|
|
38
|
-
echo "$C_ARR"
|
|
39
|
-
CONF=''
|
|
40
|
-
# ------------->
|
|
41
|
-
# echo ${C_ARR[@]}
|
|
42
|
-
# <-------------
|
|
43
|
-
|
|
44
|
-
for i in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
|
45
|
-
do
|
|
46
|
-
echo -e "$i: ${C_ARR[$i]}"
|
|
47
|
-
echo -e "\n"
|
|
48
|
-
if [ 'FALSE' == "${C_ARR[$i]}" ]
|
|
49
|
-
then
|
|
50
|
-
CONF="$i $CONF"
|
|
51
|
-
fi
|
|
52
|
-
done
|
|
53
|
-
# signal the fields to disable (others will be ignored)
|
|
54
|
-
echo $CONF
|
|
55
|
-
else
|
|
56
|
-
exit 1
|
|
57
|
-
fi
|
data/lib/zenity_dlg
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
#/**************************************************************************
|
|
4
|
-
#* This program is free software; you can redistribute it and/or modify *
|
|
5
|
-
#* it under the terms of the WTFPL 2.0 or later, see *
|
|
6
|
-
#* http://www.wtfpl.net/about/ *
|
|
7
|
-
#* *
|
|
8
|
-
#* This program is distributed in the hope that it will be useful, *
|
|
9
|
-
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
10
|
-
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
11
|
-
#* *
|
|
12
|
-
#***************************************************************************/
|
|
13
|
-
|
|
14
|
-
# A dialog to override configuration options
|
|
15
|
-
|
|
16
|
-
TITLE="Override post-processor configuration"
|
|
17
|
-
# The options are the configuration variables which can be unset.
|
|
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
|
-
if [ $? == 0 ]
|
|
28
|
-
then
|
|
29
|
-
IFS="|"
|
|
30
|
-
read -ra C_ARR <<< $CONF
|
|
31
|
-
CONF=''
|
|
32
|
-
# ------------->
|
|
33
|
-
# echo ${C_ARR[@]}
|
|
34
|
-
# <-------------
|
|
35
|
-
|
|
36
|
-
# for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
|
37
|
-
for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS DEBUG_LOG
|
|
38
|
-
do
|
|
39
|
-
# disable only the options which are missing in
|
|
40
|
-
# the Zenity return value
|
|
41
|
-
disable=1
|
|
42
|
-
|
|
43
|
-
for o in "${C_ARR[@]}"
|
|
44
|
-
do
|
|
45
|
-
if [ "$o" == "$c" ]
|
|
46
|
-
then
|
|
47
|
-
disable=
|
|
48
|
-
fi
|
|
49
|
-
done
|
|
50
|
-
|
|
51
|
-
if [ $disable ]
|
|
52
|
-
then
|
|
53
|
-
CONF="$CONF $c"
|
|
54
|
-
fi
|
|
55
|
-
done
|
|
56
|
-
# signal the fields to disable (others will be ignored)
|
|
57
|
-
echo $CONF
|
|
58
|
-
else
|
|
59
|
-
exit 1
|
|
60
|
-
fi
|