-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'renovate/all-minor-patch-bundler'
- Loading branch information
Showing
16 changed files
with
128 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,8 @@ POSTGRES_PASSWORD=<password> | |
HOST=csvalpha.nl | ||
|
||
NGROK_HOST=<subdomain>.ngrok.io | ||
|
||
NOREPLY_EMAIL=[email protected] | ||
ICT_EMAIL=[email protected] | ||
PRIVACY_EMAIL=[email protected] | ||
MAILADMIN_EMAIL=[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,44 @@ | ||
module MarkdownHelper | ||
include CamoHelper | ||
|
||
def camofy(markdown) | ||
return unless markdown | ||
def camofy(text) | ||
return unless text | ||
|
||
markdown.gsub(markdown_img_regex) do | ||
text = sub_markdown(text) | ||
sub_html(text) | ||
end | ||
|
||
def sub_markdown(text) | ||
text.gsub(markdown_img_regex) do | ||
"![#{Regexp.last_match(1)}](#{camo(Regexp.last_match(2))}#{Regexp.last_match(3)})" | ||
end | ||
end | ||
|
||
def sub_html(text) | ||
text.gsub(html_img_regex) do | ||
preceding_src = Regexp.last_match(1) | ||
quote_mark = Regexp.last_match(2) | ||
url = Regexp.last_match(3) | ||
ending = Regexp.last_match(4) | ||
"<img#{preceding_src}src=#{quote_mark}#{camo(url)}#{quote_mark}#{ending}" | ||
end | ||
end | ||
|
||
def markdown_img_regex | ||
# ![alt text](url =widthxheight "title") | ||
/!\[([^\[]*)\]\(([^\ )]+)(( =[^)]?[^ ]+)?( [^)]?"[^)]+")?)?\)/ | ||
end | ||
|
||
def html_img_regex | ||
# warning: this regex may not be perfect. They rarely are. | ||
# If you find an edge case, improve this regex! | ||
# <img...something... src="url"...ending... | ||
# or, the alternative quotes: <img...something... src='url'...ending... | ||
# or, even without quotes: <img...something... src=url...ending... | ||
# and the ...ending... can be either a space, a > or /> | ||
# note that we don't allow mismatched quotes like 'url" or shenanigans like that | ||
# This regex contains two particularly useful features: | ||
# capturing groups, and lazy matching. | ||
%r{<img([^>]*\s)src=(["']?)(.+?)\2(\s|>|/)} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.