eml_to_pdf_ext 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eml_to_pdf/configuration.rb +2 -1
- data/lib/eml_to_pdf/email.rb +11 -0
- data/lib/eml_to_pdf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92e6d796fc93341957b5483bff450aabae971b40
|
4
|
+
data.tar.gz: 576058a1b0d779f4f105bb3ae99adb93862310f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7961bae8ef4751f109e1afa3f3aac589d478abf47f004268e1e44231d721dcda6650a5e9ecdb85277d4d630ea10c818eed1b746c1219a2afc5510008ef894deb
|
7
|
+
data.tar.gz: 86620fbc755552436a561fcde03577785d216c28aca43c51936c2b5a17d6c1488e0a85ec34a7fcd1f34a5f1b310c510e08f9e0100ba169c6a7c1e9b6a4f6e628
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module EmlToPdf
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :from_label, :to_label, :cc_label, :date_label, :metadata_visible
|
3
|
+
attr_accessor :from_label, :to_label, :cc_label, :date_label, :metadata_visible, :links_enabled
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@from_label, @to_label, @cc_label, @date_label= 'From', 'To', 'Cc', 'Date'
|
7
7
|
@date_format = lambda { |date| date.strftime('%Y-%m-%d %H:%M:%S %z') }
|
8
8
|
@metadata_visible = true
|
9
|
+
@links_enabled = true
|
9
10
|
end
|
10
11
|
|
11
12
|
def date_format(&block)
|
data/lib/eml_to_pdf/email.rb
CHANGED
@@ -15,6 +15,7 @@ module EmlToPdf
|
|
15
15
|
extraction = extraction.next until extraction.finished?
|
16
16
|
html = extraction.to_html
|
17
17
|
html = resolve_cids_from_attachments(html, @mail.all_parts)
|
18
|
+
html = disable_links(html) if links_disabled?
|
18
19
|
html = add_mail_metadata_to_html(@mail, html) if display_metadata?
|
19
20
|
html
|
20
21
|
end
|
@@ -75,8 +76,18 @@ module EmlToPdf
|
|
75
76
|
(mail.header[header] && mail.header[header].decoded) || ""
|
76
77
|
end
|
77
78
|
|
79
|
+
def disable_links(html)
|
80
|
+
doc = Nokogiri::HTML(html)
|
81
|
+
doc.css('a').each { |x| x.attributes['target'] = '_blank' }
|
82
|
+
doc.to_html
|
83
|
+
end
|
84
|
+
|
78
85
|
def display_metadata?
|
79
86
|
EmlToPdf.configuration.metadata_visible
|
80
87
|
end
|
88
|
+
|
89
|
+
def links_disabled?
|
90
|
+
EmlToPdf.configuration.metadata_visible
|
91
|
+
end
|
81
92
|
end
|
82
93
|
end
|
data/lib/eml_to_pdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eml_to_pdf_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Siegrist
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-01
|
12
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|