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:
parent
ac8de1412c
commit
775e563555
20
config.rb
20
config.rb
@ -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
|
||||
###
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user