* Filter _Template content. Resolves #1603 and #1640. * Introduces a Gollum::TemplateFilter class with methods to easily add _Template Filters. * Adds support for relative _Template pages with fallback to _Template in root.
This commit is contained in:
@@ -33,4 +33,20 @@ module Gollum
|
||||
super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
|
||||
end
|
||||
end
|
||||
|
||||
class TemplateFilter
|
||||
@@filters = {}
|
||||
|
||||
def self.add_filter(pattern, &replacement)
|
||||
@@filters[pattern] = replacement
|
||||
end
|
||||
|
||||
def self.apply_filters(data)
|
||||
@@filters.each do |pattern, replacement|
|
||||
data.gsub!(pattern, replacement.call)
|
||||
end
|
||||
data
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user