summaryrefslogtreecommitdiffstats
path: root/bin/ImANerdRules.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2018-05-22 10:03:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2018-05-22 10:03:03 +0200
commitb5b2b1b606af848d07f46058bcc00f49e2feef9e (patch)
treebbcb44c9366d460a8d95476da0af57a0a4b70521 /bin/ImANerdRules.rb
parent31ea74b4640d673da715373bfc60cabb2330f410 (diff)
downloadrules-vault-b5b2b1b606af848d07f46058bcc00f49e2feef9e.zip
rules-vault-b5b2b1b606af848d07f46058bcc00f49e2feef9e.tar.gz
support image tag with fancybox
Diffstat (limited to 'bin/ImANerdRules.rb')
-rwxr-xr-xbin/ImANerdRules.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/ImANerdRules.rb b/bin/ImANerdRules.rb
index 2443f51..5d74d04 100755
--- a/bin/ImANerdRules.rb
+++ b/bin/ImANerdRules.rb
@@ -6,10 +6,13 @@ require 'redcarpet'
module ImANerdRules
class CustomRender < Redcarpet::Render::HTML
- def header(text, header_level)
- text =~ /([\d+\.?]+)/
- "<h#{header_level} id=\"hdr#{$1}\">#{text}</h#{header_level}>"
- end
+ def header(text, header_level)
+ text =~ /([\d+\.?]+)/
+ "<h#{header_level} id=\"hdr#{$1}\">#{text}</h#{header_level}>"
+ end
+ def image link, title, alt_text
+ "<a data-fancybox='gallery' data-caption='#{title}' href='#{link}'><img src='#{link.gsub(/.png/,'_th.png')}'></a>"
+ end
end
class Node