mirror of
https://github.com/fmap/muflax65ngodyewp.onion
synced 2024-07-05 11:20:42 +02:00
37 lines
682 B
Ruby
37 lines
682 B
Ruby
# meta tags for text sections
|
|
|
|
def meta &block
|
|
annotate block do |c|
|
|
div_wrap :meta, c
|
|
end
|
|
end
|
|
|
|
def div_wrap tag, text
|
|
"<div class='#{tag}' markdown='1'>#{text}</div>"
|
|
end
|
|
|
|
def skip &block
|
|
annotate block do |c|
|
|
c unless @site.counting?
|
|
end
|
|
end
|
|
|
|
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
|