Fixed includes; started wrking onn caching strategy

This commit is contained in:
Alexey Verkhovsky 2005-09-11 04:23:50 +00:00
parent 70fa15e3f3
commit bfecd09b56
6 changed files with 58 additions and 32 deletions

View file

@ -22,16 +22,17 @@ class Include < WikiChunk::WikiReference
private
def get_unmask_text_avoiding_recursion_loops
if refpage then
refpage.clear_display_cache
if refpage.wiki_includes.include?(@content.page_name)
if refpage
# TODO This way of instantiating a renderer is ugly.
renderer = PageRenderer.new(refpage.current_revision)
if renderer.wiki_includes.include?(@content.page_name)
# this will break the recursion
@content.delete_chunk(self)
return "<em>Recursive include detected; #{@page_name} --> #{@content.page_name} " +
"--> #{@page_name}</em>\n"
else
@content.merge_chunks(refpage.display_content)
return refpage.display_content.pre_rendered
@content.merge_chunks(renderer.display_content)
return renderer.display_content.pre_rendered
end
else
return "<em>Could not include #{@page_name}</em>\n"

View file

@ -16,7 +16,7 @@ module WikiChunk
# the referenced page
def refpage
@content.web.pages[@page_name]
@content.web.page(@page_name)
end
end
@ -45,11 +45,6 @@ module WikiChunk
end
end
# the referenced page
def refpage
@content.web.pages[@page_name]
end
def textile_url?
not @textile_link_suffix.nil?
end