Wiki Redirects and Page Renaming
Added the ability to rename existing pages. [[!redirects Some Page Name]] redirects Wikilinks [[Some Page Name]] to the current page (assuming "Some Page Name" does not exist). Real pages trump redirects (though this may change, depending on user feedback).
This commit is contained in:
parent
634f635f16
commit
d7832ba262
16 changed files with 161 additions and 33 deletions
|
@ -173,6 +173,13 @@ class PageRenderer
|
|||
:link_type => WikiReference::INCLUDED_PAGE
|
||||
end
|
||||
|
||||
redirect_chunks = rendering_result.find_chunks(Redirect)
|
||||
redirects = redirect_chunks.map { |c| ( c.escaped? ? nil : c.page_name ) }.compact.uniq
|
||||
redirects.each do |redirected_page_name|
|
||||
references.build :referenced_name => redirected_page_name,
|
||||
:link_type => WikiReference::REDIRECTED_PAGE
|
||||
end
|
||||
|
||||
categories = rendering_result.find_chunks(Category).map { |cat| cat.list }.flatten
|
||||
categories.each do |category|
|
||||
references.build :referenced_name => category, :link_type => WikiReference::CATEGORY
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue