maillinks 0.1.4 → 0.2.1
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/maillinks +18 -13
- data/doc/html/maillinks.html +154 -422
- data/doc/man/maillinks.1.gz +0 -0
- data/doc/pdf/maillinks.pdf +0 -0
- data/doc/rst/maillinks.rst +12 -1
- data/lib/basic_logging.rb +201 -0
- data/lib/color_output.rb +65 -0
- data/lib/constants.rb +7 -12
- data/lib/file_checking.rb +53 -60
- data/lib/maillinks.rb +52 -38
- data/maillinks.gemspec +20 -13
- metadata +21 -26
- data/lib/log.conf +0 -53
- data/lib/logging.rb +0 -104
- data/lib/translating.rb +0 -89
- data/lib/translations +0 -24
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: maillinks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Uplawski
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-04-28 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: nokogiri
|
|
@@ -16,20 +15,20 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
18
|
+
version: '1.19'
|
|
20
19
|
- - ">="
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 1.
|
|
21
|
+
version: 1.19.0
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - "~>"
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '1.
|
|
28
|
+
version: '1.19'
|
|
30
29
|
- - ">="
|
|
31
30
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 1.
|
|
31
|
+
version: 1.19.0
|
|
33
32
|
- !ruby/object:Gem::Dependency
|
|
34
33
|
name: escape
|
|
35
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -56,20 +55,20 @@ dependencies:
|
|
|
56
55
|
requirements:
|
|
57
56
|
- - "~>"
|
|
58
57
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: '2.
|
|
58
|
+
version: '2.9'
|
|
60
59
|
- - ">="
|
|
61
60
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 2.
|
|
61
|
+
version: 2.9.0
|
|
63
62
|
type: :runtime
|
|
64
63
|
prerelease: false
|
|
65
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
65
|
requirements:
|
|
67
66
|
- - "~>"
|
|
68
67
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: '2.
|
|
68
|
+
version: '2.9'
|
|
70
69
|
- - ">="
|
|
71
70
|
- !ruby/object:Gem::Version
|
|
72
|
-
version: 2.
|
|
71
|
+
version: 2.9.0
|
|
73
72
|
description: Marks in an email HTMl-links and creates a list of all links at the bottom
|
|
74
73
|
of the mail-text. Best used with the Mutt MUA
|
|
75
74
|
email: michael.uplawski@uplawski.eu
|
|
@@ -83,19 +82,18 @@ files:
|
|
|
83
82
|
- doc/man/maillinks.1.gz
|
|
84
83
|
- doc/pdf/maillinks.pdf
|
|
85
84
|
- doc/rst/maillinks.rst
|
|
85
|
+
- lib/basic_logging.rb
|
|
86
|
+
- lib/color_output.rb
|
|
86
87
|
- lib/constants.rb
|
|
87
88
|
- lib/file_checking.rb
|
|
88
|
-
- lib/log.conf
|
|
89
|
-
- lib/logging.rb
|
|
90
89
|
- lib/maillinks.rb
|
|
91
|
-
- lib/translating.rb
|
|
92
|
-
- lib/translations
|
|
93
90
|
- maillinks.gemspec
|
|
94
|
-
homepage:
|
|
91
|
+
homepage: https://www.uplawski.eu/software
|
|
95
92
|
licenses:
|
|
96
|
-
-
|
|
97
|
-
metadata:
|
|
98
|
-
|
|
93
|
+
- Nonstandard
|
|
94
|
+
metadata:
|
|
95
|
+
homepage_uri: https://www.uplawski.eu/software/
|
|
96
|
+
documentation_uri: https://www.uplawski.eu/software/maillinks/maillinks.html
|
|
99
97
|
rdoc_options: []
|
|
100
98
|
require_paths:
|
|
101
99
|
- lib
|
|
@@ -103,18 +101,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
103
101
|
requirements:
|
|
104
102
|
- - ">="
|
|
105
103
|
- !ruby/object:Gem::Version
|
|
106
|
-
version:
|
|
104
|
+
version: '4.0'
|
|
107
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
106
|
requirements:
|
|
109
107
|
- - ">="
|
|
110
108
|
- !ruby/object:Gem::Version
|
|
111
109
|
version: '0'
|
|
112
110
|
requirements:
|
|
113
|
-
- Linux,
|
|
114
|
-
|
|
115
|
-
rubygems_version: 2.7.6
|
|
116
|
-
signing_key:
|
|
111
|
+
- Linux, one of the browsers Dillo, W3M, Lynx, Brave-browser or Firefox
|
|
112
|
+
rubygems_version: 4.0.10
|
|
117
113
|
specification_version: 4
|
|
118
|
-
summary:
|
|
119
|
-
decoding is done correctly, now.
|
|
114
|
+
summary: Documentation in HTML formatted. Alternative Browsers allowed.
|
|
120
115
|
test_files: []
|
data/lib/log.conf
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#encoding: UTF-8
|
|
2
|
-
=begin
|
|
3
|
-
/***************************************************************************
|
|
4
|
-
* ©2013 Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
-
* *
|
|
6
|
-
* This program is free software; you can redistribute it and/or modify *
|
|
7
|
-
* it under the terms of the GNU General Public License as published by *
|
|
8
|
-
* the Free Software Foundation; either version 3 of the License, or *
|
|
9
|
-
* (at your option) any later version. *
|
|
10
|
-
* *
|
|
11
|
-
* This program is distributed in the hope that it will be useful, *
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
-
* GNU General Public License for more details. *
|
|
15
|
-
* *
|
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
|
17
|
-
* along with this program; if not, write to the *
|
|
18
|
-
* Free Software Foundation, Inc., *
|
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
20
|
-
***************************************************************************/
|
|
21
|
-
|
|
22
|
-
A simplified logger configuration. Set the level for each individual logger
|
|
23
|
-
below. Choose a different log-device or log-file if you like. Keep the
|
|
24
|
-
formatting intact. Do not change other sections of this file.
|
|
25
|
-
=end
|
|
26
|
-
|
|
27
|
-
# Do not touch from here ----->
|
|
28
|
-
require 'logger'
|
|
29
|
-
|
|
30
|
-
debug = Logger::DEBUG
|
|
31
|
-
info = Logger::INFO
|
|
32
|
-
error = Logger::ERROR
|
|
33
|
-
fatal = Logger::FATAL
|
|
34
|
-
warn = Logger::WARN
|
|
35
|
-
unknown = Logger::UNKNOWN
|
|
36
|
-
{
|
|
37
|
-
# <---------------- to here !
|
|
38
|
-
|
|
39
|
-
# Enter your settings here, but take into consideration that not all
|
|
40
|
-
# the named classes will really produce readable output. Well, you can
|
|
41
|
-
# always try... Either name just the log-level or make the log-level
|
|
42
|
-
# precede the output-device or output-file like in the examples.
|
|
43
|
-
|
|
44
|
-
# Example: naming a log-file
|
|
45
|
-
# :HtmlBuilder => [info, 'C:\temp\htmlbuilder.log']
|
|
46
|
-
# :HtmlBuilder => [debug, '/tmp/htmlbuilder.log'],
|
|
47
|
-
|
|
48
|
-
:MailLinks => info,
|
|
49
|
-
|
|
50
|
-
# And ignore the remainder, too.
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
#eof
|
data/lib/logging.rb
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
#encoding: UTF-8
|
|
2
|
-
=begin
|
|
3
|
-
/***************************************************************************
|
|
4
|
-
* ©2011-2014 Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
-
* *
|
|
6
|
-
* This program is free software; you can redistribute it and/or modify *
|
|
7
|
-
* it under the terms of the GNU General Public License as published by *
|
|
8
|
-
* the Free Software Foundation; either version 3 of the License, or *
|
|
9
|
-
* (at your option) any later version. *
|
|
10
|
-
* *
|
|
11
|
-
* This program is distributed in the hope that it will be useful, *
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
-
* GNU General Public License for more details. *
|
|
15
|
-
* *
|
|
16
|
-
* You should have received a copy of the GNU General Public License *
|
|
17
|
-
* along with this program; if not, write to the *
|
|
18
|
-
* Free Software Foundation, Inc., *
|
|
19
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
20
|
-
***************************************************************************/
|
|
21
|
-
=end
|
|
22
|
-
require 'logger'
|
|
23
|
-
require_relative 'translating'
|
|
24
|
-
|
|
25
|
-
# Creates for each implementing object a member @log and precede its
|
|
26
|
-
# output with the name of the class of the object.
|
|
27
|
-
module Logging
|
|
28
|
-
include Translating
|
|
29
|
-
include File_Checking
|
|
30
|
-
|
|
31
|
-
@@have_log = false
|
|
32
|
-
@@LOG_CONF = File.dirname(File.absolute_path(__FILE__)) << File::Separator << 'log.conf'
|
|
33
|
-
|
|
34
|
-
def init_logger(target = STDOUT, level = Logger::INFO)
|
|
35
|
-
# allow to override the set log-levels with an
|
|
36
|
-
# external configuration (log.conf).
|
|
37
|
-
log_conf
|
|
38
|
-
# Or use the defaults as set here or elsewhere...
|
|
39
|
-
|
|
40
|
-
@level ||= level
|
|
41
|
-
@target ||= target
|
|
42
|
-
|
|
43
|
-
@log = Logger.new(@target)
|
|
44
|
-
@log.level = @level
|
|
45
|
-
|
|
46
|
-
@log.formatter = proc do |severity, datetime, progname, msg|
|
|
47
|
-
t = Time.now
|
|
48
|
-
"#{self.class.name}: #{severity} #{t.hour}-#{t.min}-#{t.sec}: #{msg}\n"
|
|
49
|
-
end
|
|
50
|
-
if ! @@have_log
|
|
51
|
-
@log.debug self.class.name.dup << ' reading logging-configuration from ' << @@LOG_CONF
|
|
52
|
-
@@have_log = true
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def log_target=(target)
|
|
58
|
-
@target = target
|
|
59
|
-
@log = Logger.new(@@target)
|
|
60
|
-
@log.level = @level
|
|
61
|
-
end
|
|
62
|
-
def log_level=(level)
|
|
63
|
-
@level = level
|
|
64
|
-
@log.level = @level
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
private
|
|
68
|
-
# Override or set the log-level and target-device, as set in a file 'log.conf'.
|
|
69
|
-
# I do not like the look of this, but it works just the way I want it to.
|
|
70
|
-
# "HEAVANS! Isn't there a standard way to do this in Ruby, for Christ's sake?", you say.
|
|
71
|
-
# Heck, I don't care. <= Read that again, I say.
|
|
72
|
-
def log_conf
|
|
73
|
-
config = level = target = nil
|
|
74
|
-
if(File.exist?(@@LOG_CONF) )
|
|
75
|
-
begin
|
|
76
|
-
conf = File.read(@@LOG_CONF)
|
|
77
|
-
config = instance_eval(conf)
|
|
78
|
-
rescue Exception => ex
|
|
79
|
-
STDERR.puts trl("WARNING! Cannot evaluate the logger-configuration!") << ' ' << ex.message
|
|
80
|
-
STDERR.puts trl("Default log-levels apply.")
|
|
81
|
-
end
|
|
82
|
-
else
|
|
83
|
-
puts trl("Default log-levels apply.")
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
if(config && config.respond_to?(:to_hash) )
|
|
87
|
-
config.default = nil
|
|
88
|
-
config = config[self.class.name.to_sym]
|
|
89
|
-
if(config )
|
|
90
|
-
if(config.respond_to?(:to_ary) && config.size == 2)
|
|
91
|
-
@level, @target = config
|
|
92
|
-
logdir = File.dirname(@target)
|
|
93
|
-
msg = file_check(logdir, :exist?, :directory?, :writable?)
|
|
94
|
-
if(msg)
|
|
95
|
-
STDERR.puts trl("WARNING! A logfile for '%s' cannot be written to %s (%s)!") %[self.class.name, logdir, msg]
|
|
96
|
-
@target = nil
|
|
97
|
-
end
|
|
98
|
-
else
|
|
99
|
-
@level = config
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
data/lib/translating.rb
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#encoding: UTF-8
|
|
2
|
-
=begin
|
|
3
|
-
/***************************************************************************
|
|
4
|
-
* ©2011-2014, Michael Uplawski *
|
|
5
|
-
* <michael.uplawski@uplawski.eu> *
|
|
6
|
-
* *
|
|
7
|
-
* This program is free software; you can redistribute it and/or modify *
|
|
8
|
-
* it under the terms of the GNU General Public License as published by *
|
|
9
|
-
* the Free Software Foundation; either version 3 of the License, or *
|
|
10
|
-
* (at your option) any later version. *
|
|
11
|
-
* *
|
|
12
|
-
* This program is distributed in the hope that it will be useful, *
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
15
|
-
* GNU General Public License for more details. *
|
|
16
|
-
* *
|
|
17
|
-
* You should have received a copy of the GNU General Public License *
|
|
18
|
-
* along with this program; if not, write to the *
|
|
19
|
-
* Free Software Foundation, Inc., *
|
|
20
|
-
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
21
|
-
***************************************************************************/
|
|
22
|
-
=end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
RD = File.expand_path(File.dirname(__FILE__) ) + File::SEPARATOR if !defined?(RD)
|
|
26
|
-
|
|
27
|
-
require 'yaml'
|
|
28
|
-
require_relative 'file_checking'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# A way to produce translated text in a ruby-program.
|
|
32
|
-
# Translations are read from a file "translations" in the program folder.
|
|
33
|
-
module Translating
|
|
34
|
-
# There are better ways to extend a translated
|
|
35
|
-
# string, but I keep the 'wild-card' for
|
|
36
|
-
# historical reasons.
|
|
37
|
-
@@awild = 'XX'
|
|
38
|
-
|
|
39
|
-
@@lang = nil
|
|
40
|
-
@@lang_file = format("%s%s", RD, 'LANG')
|
|
41
|
-
@@tr = YAML::load_file("#{RD}translations")
|
|
42
|
-
|
|
43
|
-
# find the current language-setting and return it.
|
|
44
|
-
def self.language()
|
|
45
|
-
if @@lang == nil
|
|
46
|
-
r = ENV['LANG']
|
|
47
|
-
if(r)
|
|
48
|
-
@@lang = r[0, 2]
|
|
49
|
-
elsif( !File_Checking::file_check(@@lang_file, [:exist?, :readable?]) && File::size(@@lang_file) >= 2)
|
|
50
|
-
File::open(@@lang_file, 'r') {|f| @@lang = f.readline}
|
|
51
|
-
@@lang.chomp!.downcase! if @@lang
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
@@lang = 'en' if !@@lang
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# Translate a string to the currently set langage.
|
|
58
|
-
# The args parameter may contain replacement-text which
|
|
59
|
-
# will appear at the positions indicated by wildcard-characters
|
|
60
|
-
# in the original string.
|
|
61
|
-
def self.trl(t, *args)
|
|
62
|
-
Translating::language()
|
|
63
|
-
lt = @@tr[t]
|
|
64
|
-
if(lt)
|
|
65
|
-
lt = lt[@@lang]
|
|
66
|
-
else
|
|
67
|
-
# File.open('/tmp/mtf', 'a+') {|f| f << t << "\n"}
|
|
68
|
-
puts "\nTRANSLATION MISSING: \"" << t << "\""
|
|
69
|
-
end
|
|
70
|
-
lt ||= t
|
|
71
|
-
if(args && !args.empty?)
|
|
72
|
-
i = -1
|
|
73
|
-
lt = lt.gsub(@@awild) do |a|
|
|
74
|
-
i += 1
|
|
75
|
-
args.flatten[i]
|
|
76
|
-
end
|
|
77
|
-
lt += args[i + 1, args.length].join
|
|
78
|
-
end
|
|
79
|
-
return lt
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# Translate a string to the currently set langage.
|
|
83
|
-
# The args parameter may contain replacement-text which
|
|
84
|
-
# will appear at the positions indicated by wildcard-characters
|
|
85
|
-
# in the original string.
|
|
86
|
-
def trl(t, *args )
|
|
87
|
-
Translating::trl(t, args)
|
|
88
|
-
end
|
|
89
|
-
end
|
data/lib/translations
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2011, Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
2
|
-
# This program is free software; you can redistribute it and/or modify
|
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
|
4
|
-
# the Free Software Foundation; either version 3 of the License, or
|
|
5
|
-
# (at your option) any later version.
|
|
6
|
-
#
|
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
-
# GNU General Public License for more details.
|
|
11
|
-
#
|
|
12
|
-
# You should have received a copy of the GNU General Public License
|
|
13
|
-
# along with this program; if not, write to the
|
|
14
|
-
# Free Software Foundation, Inc.,
|
|
15
|
-
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
16
|
-
# =========================================================================
|
|
17
|
-
# These are the messages printed by Crème Fraîche. The first line of each
|
|
18
|
-
# block is the original english message, the following lines contain the
|
|
19
|
-
# translations for different locales.
|
|
20
|
-
|
|
21
|
-
# Keep this key 'MailLinks' as it is
|
|
22
|
-
|
|
23
|
-
MailLinks:
|
|
24
|
-
|