Module | Hobix::BixWik |
In: |
lib/hobix/bixwik.rb
|
QUICK_MENU | = | YAML::load <<-END --- %YAML:1.0 !omap - HomePage: [Home Page, H, Start Over] - list/index: [All Pages, A, Alphabetically sorted list of pages] - recent/index: [Recently Revised, U, Pages sorted by when they were last changed] - authors/index: [Authors, ~, Who wrote what] - FeedList: [Feed List, ~, Subscribe to changes by RSS] END |
# File lib/hobix/bixwik.rb, line 106 106: def self.wiki_word( id ) 107: Hobix::BixWik::QUICK_MENU[ id ].to_a.first || id.gsub( /^\w|_\w|[A-Z]/ ) { |up| " #{up[-1, 1].upcase}" }.strip 108: end
# File lib/hobix/bixwik.rb, line 89 89: def abs_link( word ) 90: output_entry_map[word] && output_entry_map[word][:page].link 91: end
Handler for templates with `index’ prefix. These pages simply mirror the `HomePage’ entry.
# File lib/hobix/bixwik.rb, line 46 46: def skel_index( path_storage, section_path ) 47: homePage = path_storage.match( /^HomePage$/ ).first 48: page = Page.new( 'index' ) 49: unless homePage 50: homePage = Hobix::Storage::IndexEntry.new( path_storage.default_entry( authors.keys.first ) ) 51: end 52: page.timestamp = homePage.created 53: page.updated = homePage.created 54: yield :page => page, :entry => homePage 55: end
Handler for templates with `list/index’ prefix. These templates will receive a list of all pages in the Wiki.
# File lib/hobix/bixwik.rb, line 81 81: def skel_list_index( path_storage, section_path ) 82: all_pages = storage.all 83: page = Page.new( 'list/index' ) 84: page.timestamp = all_pages.first.created 85: page.updated = storage.last_updated( all_pages ) 86: yield :page => page, :entries => all_pages, :no_load => true 87: end
Handler for templates with `recent/index’ prefix. These templates will receive entries loaded by +Hobix::BaseStorage#lastn+. Only one index page is requested by this handler.
# File lib/hobix/bixwik.rb, line 71 71: def skel_recent_index( path_storage, section_path ) 72: index_entries = storage.lastn( @lastn || 120 ) 73: page = Page.new( 'recent/index' ) 74: page.timestamp = index_entries.first.created 75: page.updated = storage.last_updated( index_entries ) 76: yield :page => page, :entries => index_entries 77: end
Handler for templates with `list/index’ prefix. These templates will receive IndexEntry objects for every entry in the system. Only one index page is requested by this handler.
# File lib/hobix/bixwik.rb, line 60 60: def skel_recent_index( path_storage, section_path ) 61: index_entries = storage.find( :all => true ) 62: page = Page.new( 'list/index' ) 63: page.timestamp = index_entries.first.created 64: page.updated = storage.last_updated( index_entries ) 65: yield :page => page, :entries => index_entries 66: end
# File lib/hobix/bixwik.rb, line 97 97: def wiki_link( word ) 98: abs_link = output_entry_map[word] 99: if abs_link 100: "<a class=\"existingWikiWord\" href=\"#{ expand_path( abs_link[:page].link ) }\">#{ Hobix::BixWik::wiki_word word }</a>" 101: else 102: "<span class=\"newWikiWord\">#{ Hobix::BixWik::wiki_word word }<a href=\"#{ expand_path( "control/edit/#{ word }" ) }\">?</a></span>" 103: end 104: end