Commit 446f9439 authored by Holger Just's avatar Holger Just

[#790] Add filter to output an array into an unordered list

parent 3c3eb2f7
......@@ -54,6 +54,23 @@ module ChiliProject
def strip(input)
input.to_s.strip
end
def to_list(array, header_or_depth = nil)
result = []
if header_or_depth.is_a?(String)
result << "\np. #{header_or_depth}\n"
depth = 1
else
if header_or_depth.respond_to?(:to_i)
depth = [1, header_or_depth.to_i].max
else
depth = 1
end
end
result += (array || []).collect{|elm| "#{"*" * depth.to_i } #{elm.to_s}"}
result.join("\n")
end
end
Template.register_filter(OverriddenFilters)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment