Skip to content
Snippets Groups Projects
Commit 74b27995 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Adding mailto: obfuscation

Former-commit-id: 0af8a81a
parent 0a7d91a7
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !49. Comments created here will be created in the context of that merge request.
......@@ -25,6 +25,7 @@ gem 'jekyll-theme-lcsb-default', '~> 0.2.18', :git => "https://git-r3lab.uni.lu/
group :jekyll_plugins do
gem "jekyll-paginate-v2", "~> 1.7"
gem "jekyll-feed", "~> 0.6"
gem "jekyll-email-protect"
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
......
Jekyll::Hooks.register([:pages, :posts, :documents], :pre_render) do |post|
# This will run every time the website is built
# Include a plugin (needs to be in gemfile)
include Jekyll::EmailProtect::EmailProtectionFilter
# Using a simpler version of email regexp
email_regexp = /mailto\:(?:[\'\"]*)(?:[\w+\-]\.?)+@[a-z\d\-]+(?:\.[a-z]+)*\.[a-z]+(?:[\'\"]*)/i
# Take post's content, and transform every occurence of the following regexp (an email)
post.content = post.content.gsub(email_regexp) {
# For every occurence, apply protection function:
|param| "mailto:" + Jekyll::EmailProtect::EmailProtectionFilter::encode_email(param[7..-1].delete("'").delete('"'))
}
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment