2012-05-30 06:06:38 +02:00
|
|
|
# meta tags for text sections
|
|
|
|
|
|
|
|
def meta &block
|
|
|
|
annotate block do |c|
|
|
|
|
div_wrap :meta, c
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-09 18:30:19 +02:00
|
|
|
# wrap in div tags
|
2012-05-30 06:06:38 +02:00
|
|
|
def div_wrap tag, text
|
|
|
|
"<div class='#{tag}' markdown='1'>#{text}</div>"
|
|
|
|
end
|
|
|
|
|
2012-09-09 18:30:19 +02:00
|
|
|
# don't parse this when counting words
|
2012-05-30 06:06:38 +02:00
|
|
|
def skip &block
|
|
|
|
annotate block do |c|
|
2012-05-30 06:26:53 +02:00
|
|
|
c unless @item_rep.name == :wordcount
|
2012-05-30 06:06:38 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-09-09 18:30:19 +02:00
|
|
|
# replace end-of-line with " " used by markdown
|
|
|
|
def poem &block
|
|
|
|
annotate block do |c|
|
|
|
|
c.split("\n").join(" \n")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-05-30 06:06:38 +02:00
|
|
|
def annotate content, &filter
|
|
|
|
# get erbout so far
|
|
|
|
erbout = eval('_erbout', content.binding)
|
|
|
|
erbout_length = erbout.length
|
|
|
|
|
|
|
|
# execute content block
|
|
|
|
content.call
|
|
|
|
|
|
|
|
# remove raw content
|
|
|
|
raw = erbout[erbout_length..-1]
|
|
|
|
erbout[erbout_length..-1] = ''
|
|
|
|
|
|
|
|
# filter content, if possible
|
|
|
|
filtered = block_given? ? filter.call(raw) : raw
|
|
|
|
|
|
|
|
# print filtered content
|
|
|
|
erbout << filtered unless filtered.nil?
|
|
|
|
end
|