Module: Hobix::BixWik
- Defined in:
- lib/hobix/bixwik.rb
Defined Under Namespace
Classes: Entry, IndexEntry, WikiRedCloth
Constant Summary
collapse
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
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.wiki_word(id) ⇒ Object
105
106
107
|
# File 'lib/hobix/bixwik.rb', line 105
def self.wiki_word( id )
Hobix::BixWik::QUICK_MENU[ id ].to_a.first || id.gsub( /^\w|_\w|[A-Z]/ ) { |up| " #{up[-1, 1].upcase}" }.strip
end
|
Instance Method Details
#abs_link(word) ⇒ Object
88
89
90
|
# File 'lib/hobix/bixwik.rb', line 88
def abs_link( word )
output_entry_map[word] && output_entry_map[word][:page].link
end
|
#default_entry_class ⇒ Object
40
|
# File 'lib/hobix/bixwik.rb', line 40
def default_entry_class; "Hobix::BixWik::Entry"; end
|
#default_index_class ⇒ Object
41
|
# File 'lib/hobix/bixwik.rb', line 41
def default_index_class; "Hobix::BixWik::IndexEntry"; end
|
#skel_index(path_storage, section_path) {|:page => page, :entry => homePage| ... } ⇒ Object
Handler for templates with ‘index’ prefix. These pages simply mirror the ‘HomePage’ entry.
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/hobix/bixwik.rb', line 45
def skel_index( path_storage, section_path )
homePage = path_storage.match( /^HomePage$/ ).first
page = Page.new( 'index' )
unless homePage
homePage = Hobix::Storage::IndexEntry.new( path_storage.default_entry( authors.keys.first ) )
end
page.timestamp = homePage.created
page.updated = homePage.created
yield :page => page, :entry => homePage
end
|
#skel_list_index(path_storage, section_path) {|:page => page, :entries => all_pages, :no_load => true| ... } ⇒ Object
Handler for templates with ‘list/index’ prefix. These templates will receive a list of all pages in the Wiki.
80
81
82
83
84
85
86
|
# File 'lib/hobix/bixwik.rb', line 80
def skel_list_index( path_storage, section_path )
all_pages = storage.all
page = Page.new( 'list/index' )
page.timestamp = all_pages.first.created
page.updated = storage.last_updated( all_pages )
yield :page => page, :entries => all_pages, :no_load => true
end
|
#skel_recent_index(path_storage, section_path) {|:page => page, :entries => index_entries| ... } ⇒ Object
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.
59
60
61
62
63
64
65
|
# File 'lib/hobix/bixwik.rb', line 59
def skel_recent_index( path_storage, section_path )
index_entries = storage.find( :all => true )
page = Page.new( 'list/index' )
page.timestamp = index_entries.first.created
page.updated = storage.last_updated( index_entries )
yield :page => page, :entries => index_entries
end
|
#wiki_link(word) ⇒ Object
96
97
98
99
100
101
102
103
|
# File 'lib/hobix/bixwik.rb', line 96
def wiki_link( word )
abs_link = output_entry_map[word]
if abs_link
"<a class=\"existingWikiWord\" href=\"#{ expand_path( abs_link[:page].link ) }\">#{ Hobix::BixWik::wiki_word word }</a>"
else
"<span class=\"newWikiWord\">#{ Hobix::BixWik::wiki_word word }<a href=\"#{ expand_path( "control/edit/#{ word }" ) }\">?</a></span>"
end
end
|
#wiki_page(src) ⇒ Object
92
93
94
|
# File 'lib/hobix/bixwik.rb', line 92
def wiki_page( src )
src.gsub( /\b([A-Z][a-z]+[A-Z][\w\/]+)\b/ ) { wiki_link( $1 ) }
end
|