flnews_post_proc 1.48 → 1.52

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a019c52dac602a5b00c71131e8b44a61769604a08035b7afad305a27c5d43a0
4
- data.tar.gz: 7f5a69f62df2a18fefe9f0f5f499d7960d40b751b4bda67f26a88f91034ac941
3
+ metadata.gz: ce08a05f564e461547838e8be747b716bf319f0e873bdae49032bc11b27bad99
4
+ data.tar.gz: a7ecf3115645be839b9de3bcb20a503c51558107655c569c86a8e73b9179ce19
5
5
  SHA512:
6
- metadata.gz: fe1d5fee2fffc214f8aa96b34e4886b3c2e7b16a71dd2ac99b8df214528d53c43df8b425fe4b21d4edf58e691e6cd5f497e09ed12a81129dd0f0e883fcf9ab76
7
- data.tar.gz: 40f0b45424e01cc6b034aeeb4a7729bb0a499e231eb0001a60d762e4f1952964090dacda102fb87215ed66786e7e2887c471c95cc930018b469df669d16915b1
6
+ metadata.gz: 3031a8647b65d99a133f2064f839d19441f51babd4bed2df6e9c382fa0d3621584bb005b1b8335dbbb6c864c1714d76008b5698c5a38879ea409740f5f19e266
7
+ data.tar.gz: e7b68552b48ac5b475b220d5fdf6695e761e1443b0ce214676ca67122dc4ae32d84c6c22ca8a6e89e63ee606d3418dd0c1f2c62dde082fec3e189c6d580c9910
data/README.md CHANGED
@@ -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
 
@@ -93,13 +93,13 @@ some users may not always agree with the result and for arbitrary reasons:
93
93
  Custom headers may be defined in the configuration file for the program
94
94
  and will then be added to each outgoing post.
95
95
 
96
- * The Archive- and X-No-Archive headers are sometimes set to avoid that an
97
- article be saved and stays available to search-engines (Google, notably).
98
- Test- postings, for example, do probably not justify at all that they would
99
- be referenced in search results. The post-processor program can impose the
100
- Archive- and X-No-Archive header for all posts to certain newsgroups.
96
+ * The Archive- and X-No-Archive headers are sometimes set to avoid that an
97
+ article be saved and stays available to search-engines (Google, notably).
98
+ Test- postings, for example, do probably not justify at all that they would
99
+ be referenced in search results. The post-processor program can impose the
100
+ Archive- and X-No-Archive header for all posts to certain newsgroups.
101
101
 
102
- **ATTN** As of 2024, the header “X-No-Archive“ has lost most of its utility
102
+ **ATTN** As of 2024, the header “X-No-Archive“ has lost most of its utility
103
103
  and it is the decision of server operators to honor it or not.
104
104
 
105
105
  * If a news post contains many references to either other posts or Web
@@ -166,7 +166,7 @@ Ruby, noted as a String. Beware to mask a backslash '\\' by another one,
166
166
  ike in the example. A capture-group '()' serves to extract the name from the
167
167
  match result.
168
168
 
169
- 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
170
170
  intact.
171
171
 
172
172
  CONTENT: A String equivalent of a regular expression.
@@ -199,7 +199,7 @@ intact.
199
199
 
200
200
  CONTENT: A newsgroup or regexp per line, followed by a colon, a space and a String
201
201
 
202
- DEFAULT: As configured in FLNews
202
+ DEFAULT: As configured in flnews
203
203
 
204
204
  EXAMPLE: _alt.test: "Thus spoke #\{fup_name\} on that baleful #\{fup_date\}:"_
205
205
 
@@ -320,7 +320,7 @@ A dialog may be displayed which allows you to disable any of these
320
320
  four options, so that the defaults from flnews prevail.
321
321
 
322
322
  ATTN! Canceling the dialog or pushing the Esc-key does interrupt
323
- the process. Flnews will not post the article.
323
+ the process. flnews will not post the article.
324
324
 
325
325
  Set this option to no, NO or similar to disable the dialog.
326
326
 
@@ -1 +1,2 @@
1
+ # UNUSED
1
2
  " > >> > testerei ei ei".strip.gsub( /^>+(\s+>+)*/) {|m| m.to_s.delete(" ")}
data/lib/body.rb CHANGED
@@ -17,7 +17,12 @@
17
17
  require_relative 'basic_logging'
18
18
  require_relative 'configuration'
19
19
 
20
- # an object of this class represents the body of a news-article.
20
+ # An object of this class represents the body of a news-article.
21
+ # It processes the original text and changes some details:
22
+ # intro-lines
23
+ # signatures
24
+ # URI formats
25
+ # Footnotes (and/or a list of references) are created
21
26
  class Body
22
27
  # a class-level configuration instance.
23
28
  @@config = Configuration.instance
@@ -99,6 +104,13 @@ class Body
99
104
  # exchange original intro-line against the new one
100
105
  @lines[@lines.index(ointro)] = intro.strip
101
106
  # looked complicated because it is.
107
+
108
+ # keep this line for reference.
109
+ @intro = intro
110
+ else
111
+ wmsg = 'Text following the intro is not a citation!'
112
+ wmsg << "\n\tIntro will NOT be modified: \"#{ointro}\"!"
113
+ warn wmsg
102
114
  end
103
115
  end
104
116
  end # fn.strip.empty?
@@ -111,7 +123,7 @@ class Body
111
123
  # remove any signature(s) from
112
124
  # the current article
113
125
  sigpos = @lines.index('-- ')
114
- debug('found signature at position ' << sigpos) if sigpos
126
+ debug('found signature in line ' << sigpos.to_s) if sigpos
115
127
  @lines = @lines.slice(0, sigpos ) if sigpos
116
128
  debug('setting signature ' << signature) if signature
117
129
  @lines << "-- " << signature if signature
@@ -128,7 +140,7 @@ class Body
128
140
 
129
141
  # Verify and possibly correct links in the post.
130
142
  # Simple.
131
- def handle_urls()
143
+ def handle_uris()
132
144
  # Determine here or elsewhere if URLs shall be verified.
133
145
  # Default is != no. nil or '' do qualify as default.
134
146
  if @@config.VFY_URLS
@@ -144,7 +156,8 @@ class Body
144
156
  # <----------------------------
145
157
 
146
158
  # BUGFIX : Urls with @
147
- new_line = handle_news(l)
159
+ # BUGFIX : email address in the intro
160
+ new_line = handle_news(l) if !@intro || l.strip != @intro.strip
148
161
  # http(s)
149
162
  if l.include?('http')
150
163
  new_line = handle_http(l)
@@ -172,9 +185,8 @@ class Body
172
185
  # to the whole body, over multiple lines, if need be.
173
186
  begin
174
187
  ref = body.match(ref_rx )
175
- debug("found reference " << ref.to_s << " (length: " << (ref ? ref.to_s.size.to_s : '0') << ")")
188
+ debug("found reference " << ref.to_s << " (length: " << (ref ? ref.to_s.size.to_s : '0') << ")") if ref && ref.length > 0
176
189
  if ref
177
- debug('ref is ' << ref.to_s)
178
190
  # ... This is some presentation thing and I think
179
191
  # it works, too.
180
192
  r = ref[0].gsub(/[ \t]+/, ' ').strip
@@ -184,7 +196,7 @@ class Body
184
196
  body.gsub!(ref[0], format(@@config.REFERENCE_FORMAT, index.to_s ))
185
197
  end
186
198
  end until ref == nil
187
- debug("all references found:\n" << references.join('\n'))
199
+ debug("all references found:\n" << references.join('\n')) if !references.empty?
188
200
  else
189
201
  msg = 'The References Delimiter is the same in its reversed form.'
190
202
  msg << "#{$LN}Cannot handle references or footnotes!"
@@ -198,6 +210,8 @@ class Body
198
210
  r = r.gsub(ref_delim, '').gsub(ref_delim.reverse,'')
199
211
  body << (i + 1 ).to_s << ") " << r.strip << $LN
200
212
  end
213
+ else
214
+ debug('no refences found')
201
215
  end
202
216
  end
203
217
  @lines = body.split($LN)
@@ -238,7 +252,8 @@ class Body
238
252
  url_strs = l_array.collect do |ele|
239
253
  if ele.strip.include?('http') && ele.match(/https?:\S+/)
240
254
  ele.lstrip!
241
- while !ele.match(/([[:alnum:]]|>)$/) do
255
+ # ensure last character is alphanumeric or '>' or '/'
256
+ until ele.match(/([[:alnum:]]|>|\/)$/) do
242
257
  ele.chop!
243
258
  end
244
259
  ele
data/lib/configuration.rb CHANGED
@@ -91,6 +91,7 @@ class Configuration
91
91
  end
92
92
  @conf[:CONFIG_VERSION] = PROGVERSION.to_f
93
93
  bak_conf = @config_file.dup << '_' << conf_version.to_s
94
+ bak_conf.gsub!('.' << PROGNAME, 'bak_' << PROGNAME)
94
95
  info('Old configuration is saved to ' << bak_conf )
95
96
  info('New configuration is saved to ' << @config_file )
96
97
  begin
@@ -55,7 +55,7 @@ class PostProcessor
55
55
  body.set_signature(newsgroups.signature)
56
56
 
57
57
  # verify and eventually correct URLs
58
- body.handle_urls
58
+ body.handle_uris
59
59
 
60
60
  # get the headers and the body as a string.
61
61
  # Assemble.
data/lib/version.rb CHANGED
@@ -14,9 +14,8 @@
14
14
  =end
15
15
 
16
16
  PROGNAME = 'flnews_post_proc'
17
- PROGVERSION = "1.48"
17
+ PROGVERSION = "1.52"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2024"
21
- SUMMARY = "\tConcurrent access to the log file\n\tLog cleared upon setting log target"
22
- SUMMARY << "\n\t\"STDOUT\" allowed as log target"
21
+ SUMMARY = "Configuration backups are no longer hidden files."
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.48'
4
+ version: '1.52'
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-05-30 00:00:00.000000000 Z
11
+ date: 2024-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -30,7 +30,7 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 3.4.2
33
- description: Post-processor for Usenet-articles created in FLNews
33
+ description: Post-processor for Usenet-articles created in flnews
34
34
  email: michael.uplawski@uplawski.eu
35
35
  executables:
36
36
  - flnews_post_proc
@@ -85,6 +85,5 @@ requirements: []
85
85
  rubygems_version: 3.5.3
86
86
  signing_key:
87
87
  specification_version: 4
88
- summary: Concurrent access to the log file Log cleared upon setting log target "STDOUT"
89
- allowed as log target
88
+ summary: Configuration backups are no longer hidden files.
90
89
  test_files: []