1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-10-17 17:01:01 +00:00

Add some render helpers

This commit is contained in:
Holger Just 2015-12-05 23:07:08 +01:00
parent ac8de1412c
commit 775e563555

View File

@ -1,3 +1,23 @@
helpers do
def figure(caption, figure_options = {}, caption_options = {}, &block)
@_out_buf << content_tag(:figure, figure_options) do
[
markdown(&block),
content_tag(:figcaption, markdown(caption), caption_options)
].inject(&:concat)
end
end
def unicode_escape(str)
str.unpack("U*").map { |c| "&##{c};"}.join
end
def markdown(source=nil, &block)
source = capture(&block) if block_given?
Tilt['markdown'].new{ source }.render
end
end
###
# Blog settings
###