flnews_post_proc 1.73 → 1.75

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.
data/lib/headers.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
3
  /***************************************************************************
4
- * 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
4
+ * 2023-2025, 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/ *
@@ -31,7 +31,7 @@ class Headers
31
31
  debug('before split, article_text is : ' << article_text)
32
32
  line_array = article_text.split($LN)
33
33
 
34
- # Emsure that all three headers are present.
34
+ # Ensure that all three headers are present.
35
35
  missing_header = ['From:', 'Newsgroups:', 'Message-ID:'].detect{|h| ! line_array.any?{|l| l.match(h) } }
36
36
  if(missing_header)
37
37
  msg = "Input does not look like a news-article, no #{missing_header.delete(':')}; aborting."
@@ -79,13 +79,9 @@ class Headers
79
79
  # it should.
80
80
  #
81
81
  # value is all after the first colon
82
- # BUGGY: val = l.match(/:(.*)/)[1].strip
83
- # BUGFIX 3/2024, use lstrip
84
82
  val = l.match(/:(.*)/)[1].lstrip
85
83
  else # start_with?(' ')
86
84
  # a wrapped value is not devided
87
- # BUGGY: val = l.strip
88
- # BUGFIX 3/2024
89
85
  val = l
90
86
  end
91
87
  # add value to the existing
@@ -95,10 +91,6 @@ class Headers
95
91
  # or add a new value
96
92
  @headers[cur_header] = val
97
93
  end
98
- # CURRENTLY UNUSED
99
- # @headers[l.match(/^(.*?):/)[1].to_sym] = l.match(/:(.*)/)[1].strip
100
- # h = l.split(':')
101
- # @headers[h[0].strip.to_sym] = h[1...h.size].join(':').strip
102
94
  end
103
95
  debug('headers are ' << @headers.to_s)
104
96
  @newsgroups = Newsgroups.new(header(:Newsgroups))
@@ -171,3 +163,4 @@ class Headers
171
163
 
172
164
  end
173
165
  # EOF
166
+
data/lib/newsgroups.rb CHANGED
@@ -116,8 +116,8 @@ class Newsgroups
116
116
  end # if no signature
117
117
  end # gsigs.each
118
118
  end # gsigs for group?
119
- if tsig && tsig.start_with?('/')
120
- tsig = pick_sig(tsig)
119
+ if tsig && tsig.strip.start_with?('/')
120
+ tsig = pick_sig(tsig.strip)
121
121
  end
122
122
  @signature = correct_linebreaks(tsig) if tsig
123
123
  else # gsigs and is hash?
@@ -127,6 +127,7 @@ class Newsgroups
127
127
  end
128
128
  end
129
129
 
130
+ # pick a random signature, if a list is available.
130
131
  def pick_sig(sigfile)
131
132
  # finds sourced files
132
133
  srcregex = /^\.\s(.*)/
@@ -134,7 +135,6 @@ class Newsgroups
134
135
  delim = "\n\n"
135
136
 
136
137
  if File.exist?(sigfile) && File.readable?(sigfile)
137
- debug 'found sourced signature file ' << sigfile
138
138
  ssigs = Array.new
139
139
  all_sigs = Array.new
140
140
  File::read(sigfile).split(delim).collect do |item|
@@ -166,35 +166,9 @@ class Newsgroups
166
166
  else
167
167
  warn 'cannot find or read signature file: ' << sigfile
168
168
  end
169
+ return nil
169
170
  end
170
171
 
171
- =begin
172
- # VERSION without sourced files
173
- #
174
- # pick a random signature, if a list is available.
175
- def pick_sig(sigfile)
176
- debug 'picking signature from ' << sigfile.to_s
177
- allSigs = nil
178
- sig = nil
179
- if sigfile && !sigfile.empty? && File.exist?(sigfile) && File.readable?(sigfile)
180
- File.open(sigfile, 'r') do |sfile|
181
- allSigs = sfile.read.split("\n\n")
182
- numSigs = allSigs.length
183
- # srand(Time.now.nsec)
184
- # use /dev/urandom
185
- srand()
186
- sig = allSigs[rand(numSigs)]
187
- end
188
- # improve hazard for the next time.
189
- # rearrange_sigs(sigfile, allSigs)
190
- else
191
- error 'Cannot read signature from file ' << sigfile
192
- nil
193
- end
194
- return sig
195
- end
196
- =end
197
-
198
172
  # write a new rearranged version of the signature file for
199
173
  # better hazard.
200
174
  # EXPERIMENTAL
data/lib/override.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  #encoding: UTF-8
2
2
  =begin
3
3
  /***************************************************************************
4
- * 2023-2024, Michael Uplawski <michael.uplawski@uplawski.eu> *
4
+ * 2023-2025, 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/ *
data/lib/version.rb CHANGED
@@ -14,9 +14,9 @@
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "1.73"
17
+ PROGVERSION = "1.75"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2025"
21
- SUMMARY = "files with random signatures can source other such files"
21
+ SUMMARY = "new documentation- and homepage URIs"
22
22
 
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: '1.73'
4
+ version: '1.75'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Uplawski
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-07-05 00:00:00.000000000 Z
10
+ date: 2025-08-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: diffy
@@ -82,10 +82,11 @@ files:
82
82
  - lib/whiptail_dlg
83
83
  - lib/yad_dlg
84
84
  - lib/zenity_dlg
85
- homepage: https://rubygems.org
86
85
  licenses:
87
86
  - Nonstandard
88
- metadata: {}
87
+ metadata:
88
+ homepage_uri: https://www.uplawski.eu/software/flnews_post_proc/
89
+ documentation_uri: https://www.uplawski.eu/div/flnews/gem_doc/html/flnews_post_proc.html
89
90
  rdoc_options: []
90
91
  require_paths:
91
92
  - lib
@@ -102,5 +103,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
103
  requirements: []
103
104
  rubygems_version: 3.6.7
104
105
  specification_version: 4
105
- summary: files with random signatures can source other such files
106
+ summary: new documentation- and homepage URIs
106
107
  test_files: []