Class: AutomaticMultiPageIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers/default-helpers.rb

Instance Method Summary collapse

Constructor Details

#initialize(wiki, pageroot = "Site Index", author = "AutomaticIndex") ⇒ AutomaticMultiPageIndex

Returns a new instance of AutomaticMultiPageIndex.



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/helpers/default-helpers.rb', line 244

def initialize( wiki, pageroot = "Site Index", author = "AutomaticIndex"  )
  ('A'..'Z').each do |letter|
    AutomaticList.new( wiki, "#{pageroot} #{letter}.", :author => author, :sort_pages_by => :name_for_index ) do |page|
      if page.name =~ /^#{Regexp.escape(pageroot)} ([a-z]|Other)\./i
        false
      else
        page.name =~ /^#{letter}.*/i
      end
    end
  end

  AutomaticList.new( wiki, "#{pageroot} Other.", :author => author, :sort_pages_by => :name_for_index ) do |page|
    if page.name =~ /^#{Regexp.escape(pageroot)} ([a-z]|Other)\./i
      false
    else
      page.name =~  /^[^A-Za-z].*/i
    end
  end

  AutomaticList.new( wiki, pageroot, :author => author, :sort_pages_by => :name_for_index ) do |page|
    page.name =~ /^#{Regexp.escape(pageroot)} ([a-z]|Other)\./i
  end
end