Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,6 +347,13 @@ class TagError < StandardError; end | |
tag 'content' do |tag| | ||
page = tag.locals.page | ||
part_name = tag_part_name(tag) | ||
# Prevent simple and deep recursive rendering of the same page part | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
geapi
|
||
rendered_parts = (tag.locals.rendered_parts ||= Hash.new {|h,k| h[k] = []}) | ||
if rendered_parts[page.id].include?(part_name) | ||
raise TagError.new(%{Recursion error: already rendering the `#{part_name}' part.}) | ||
else | ||
rendered_parts[page.id] << part_name | ||
end | ||
boolean_attr = proc do |attribute_name, default| | ||
attribute = (tag.attr[attribute_name] || default).to_s | ||
raise TagError.new(%{`#{attribute_name}' attribute of `content' tag must be set to either "true" or "false"}) unless attribute =~ /true|false/i | ||
|
Was this causing problems? I can see several useful situations where I want something rendered twice on the same page, for example a link as header and then underneath an article.