3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/filters/pre/helper.rb', line 3
def format_helper(text)
prefix = '<p'
text.gsub /\n?``` helper(.+?)```/m do |block|
block.gsub! /^``` helper/, ''
block.gsub! /^```$/, ''
= ''
block.gsub! /^#### (.+?)$/ do
= $1.strip
''
end
content = block.strip
content = "<p>#{content}</p>" unless content[0, prefix.length] == prefix
content = "<div class='helper'><h4 class='header'><a href='#'>#{header}</a></h4><div class='content'>#{content}</div></div>"
end
end
|