Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
howto-cards
Commits
ebd06159
Verified
Commit
ebd06159
authored
Jan 07, 2020
by
Laurent Heirendt
✈
Browse files
remove email protector plugin
parent
4ca8f165
Changes
1
Hide whitespace changes
Inline
Side-by-side
_plugins/hook_mailto_email_protector.rb
deleted
100644 → 0
View file @
4ca8f165
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment