glim-encode-email 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/glim-encode-email.rb +11 -0
  3. metadata +58 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2b6aba448db953ed4bbaad4614889dc3f52111ba5a68d3cfd51d73b549314835
4
+ data.tar.gz: 31d24bfb7cd872c65796cf7a7b81a8d413579922ba2fbc7731819bdbffccd418
5
+ SHA512:
6
+ metadata.gz: 9d850f74dbc96e160b0aa8e6a49bc8e37605f0da48c7c34fad9fd311d227e495a19c0a2e8815946d30c3511751d9142e21b9de37d4a613173a345f78d47c1bef
7
+ data.tar.gz: 663feb54ad7a8d3c35d661d640b3561b53a11b74db1feb0d1d30a7d8dce58f315e46af4dad505a78c79ae8dab83f52c8d7f3af8e0f4cbb3f12ab700bca5fcaae
@@ -0,0 +1,11 @@
1
+ module EncodeEmailFilter
2
+ def encode_email(input)
3
+ input.gsub(/(^mailto:)|\p{Alnum}+/) do |char|
4
+ char.bytes.inject(String.new) do |result, byte|
5
+ result << ($1 ? '&#%d;' : '%%%02X') % byte
6
+ end
7
+ end unless input.nil?
8
+ end
9
+ end
10
+
11
+ Liquid::Template.register_filter(EncodeEmailFilter)
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: glim-encode-email
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Allan Odgaard
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: glim
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description:
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - glim-encode-email.rb
34
+ homepage: https://macromates.com/glim/
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - "."
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.7.6
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Encode email addresses using HTML entities.
58
+ test_files: []