h1. New page templates or categories code In some case it might be useful to add a new page that is part of a particular category, or has some default content. e.g. Add a new bug report, or Add a new contact). Bil Kleb has had success in writting this (copied from soks mailing list): Earlier, we had discussed adding various page categories, i.e., templates FWIW, here is what I hacked in to get there: h2. start.rb:

# defined a new type of summary:
class AutomaticCategorySummary
  def initialize( wiki, pagename )
    plural = pagename.sub(/y$/,'ie') + 's'
    AutomaticSummary.new( wiki, {
                          :regexp_for_title => /#{pagename}:/i,
                          :lines_to_include => 10,
                          :reverse_sort => true,
                          :pagename => "All #{plural}" } )
    AutomaticSummary.new( wiki, {
                          :regexp_for_title => /#{pagename}:/i,
                          :max_pages_to_show => 1,
                          :lines_to_include => 10,
                          :reverse_sort => true,
                          :pagename => "Latest #{plural}" } )
  end
end

# added :categories key to the CUSTOMSETTINGS hash:
 :categories => [ 'Trip report', 'Contact', 'Phone Call', 'Idea', 'Story', 'Thought' ]

# added to self.start:
  CUSTOMSETTINGS[:categories].each do |name|
    AutomaticCategorySummary.new( wiki, name )
  end if CUSTOMSETTINGS.has_key? :categories
h2. view/frame.rhtml:

# replaced "Add a new .*" section:
  Add new:
  '>+ Page
  <% if $SETTINGS.has_key? :categories %>
    <% $SETTINGS[:categories].each do |name| %>
      '>+ <%= name %>
    <% end %>
  <% end %>
  '>+ Image
  '>+ File
h2. views/Page_edit.rhtml