Class: AutomaticAuthorIndex
- Inherits:
-
Object
- Object
- AutomaticAuthorIndex
- Defined in:
- lib/helpers/default-helpers.rb
Instance Method Summary collapse
- #add_author(revision) ⇒ Object
- #create_author_page_for(author) ⇒ Object
- #find_all_authors(wiki) ⇒ Object
-
#initialize(wiki, create_author_pages = true, author_include_regexp = /.*/, author_exclude_regexp = /^Automatic.*/, pagename = "authors", author = "AutomaticAuthorIndexer", author_page_tail = "s pages") ⇒ AutomaticAuthorIndex
constructor
A new instance of AutomaticAuthorIndex.
- #render_author_index ⇒ Object
Constructor Details
#initialize(wiki, create_author_pages = true, author_include_regexp = /.*/, author_exclude_regexp = /^Automatic.*/, pagename = "authors", author = "AutomaticAuthorIndexer", author_page_tail = "s pages") ⇒ AutomaticAuthorIndex
Returns a new instance of AutomaticAuthorIndex.
362 363 364 365 366 367 368 369 |
# File 'lib/helpers/default-helpers.rb', line 362 def initialize( wiki, = true, = /.*/, = /^Automatic.*/, pagename = "authors", = "AutomaticAuthorIndexer", = "s pages" ) @wiki, , , , @pagename, , = wiki, , , , pagename, , = [] ( wiki ) @wiki.watch_for( :page_revised ) { |event, page, revision| $stderr.puts "Got a page revised message in AutomaticAuthorIndex" ( revision ) } end |
Instance Method Details
#add_author(revision) ⇒ Object
371 372 373 374 375 376 377 378 379 |
# File 'lib/helpers/default-helpers.rb', line 371 def ( revision ) return if .include? revision. return unless revision. =~ return unless revision. !~ << revision. .sort! (revision.) if end |
#create_author_page_for(author) ⇒ Object
402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/helpers/default-helpers.rb', line 402 def ( ) AutomaticSummary.new( @wiki, { :pagename => "#{author}#{@author_page_tail}" , :regexp_for_author => /#{author}/, :author => , :only_new_pages => false, :sort_pages_by => :revised_on, :include_metadata => true, :summarise_revisions => true, :reverse_sort => true, :remove_deleted_pages => false, } ) end |
#find_all_authors(wiki) ⇒ Object
381 382 383 384 385 386 387 |
# File 'lib/helpers/default-helpers.rb', line 381 def ( wiki ) wiki.each do |name, page| page.revisions.each do |revision| ( revision ) end end end |
#render_author_index ⇒ Object
389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/helpers/default-helpers.rb', line 389 def content = "h1. Index of Authors\n\n" .each do || content << "* #{author}" if content << " #{author}#{@author_page_tail}" end content << "\n" end @wiki.revise( @pagename, content, ) end |