diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-05-22 10:03:03 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-05-22 10:03:03 +0200 |
commit | b5b2b1b606af848d07f46058bcc00f49e2feef9e (patch) | |
tree | bbcb44c9366d460a8d95476da0af57a0a4b70521 | |
parent | 31ea74b4640d673da715373bfc60cabb2330f410 (diff) | |
download | rules-vault-b5b2b1b606af848d07f46058bcc00f49e2feef9e.zip rules-vault-b5b2b1b606af848d07f46058bcc00f49e2feef9e.tar.gz |
support image tag with fancybox
-rwxr-xr-x | bin/ImANerdRules.rb | 11 | ||||
-rw-r--r-- | header | 5 |
2 files changed, 11 insertions, 5 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 @@ -1,6 +1,9 @@ <html> <header> - <link href="retro.css" media="screen, projection" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> + <link href="retro.css" media="screen, projection" rel="stylesheet" type="text/css"> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.css" /> + <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.3.5/jquery.fancybox.min.js"></script> </header> <body> |