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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a64ab6872ddb290fbeebebba1a6c255d707e01f
4
- data.tar.gz: c87d84c8a4658714661195c3398abbaa7d24595d
3
+ metadata.gz: 92e6d796fc93341957b5483bff450aabae971b40
4
+ data.tar.gz: 576058a1b0d779f4f105bb3ae99adb93862310f5
5
5
  SHA512:
6
- metadata.gz: 683adb8878048a7bd72e3ec6cf7fae2499992331fc1bd87a764444dea3e97f5b396f11df75277c30d39e0ad45eb1514e35ac2360a2307bad6075f323ddbf648a
7
- data.tar.gz: 93a442e1f9c112096c143406288d856989f846b98e82a646eaae12538f3adce680aba3c3aaf88984cb5be6ea294dc48d6fc43e5cced1f9b2d2ad2d0db4c96af4
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module EmlToPdf
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
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.2
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-19 00:00:00.000000000 Z
12
+ date: 2017-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler