Sha256: d66edf812c241db39c2f13966c2f255e3b1403d9d474c24025a0c7ebbd92d3be
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. # written as an example of how to implement the minimal _why wiki require 'ramaze' require 'bluecloth' include Ramaze Db = YAMLStoreCache.new('wiki.yaml') class WikiController < Controller def index redirect(R(:show, 'Home')) end def show page = 'Home' @page = page @text = Db[page].to_s @text.gsub!(/\[\[(.*?)\]\]/) do |m| exists = Db[$1] ? 'exists' : 'nonexists' link( R(self, :show, CGI.escape($1)), :title => $1, :class => exists) end @text = BlueCloth.new(@text).to_html end def edit page = 'Home' @page = page @text = Db[page] end def save redirect_referer unless request.post? page = request['page'].to_s text = request['text'].to_s Db[page] = text redirect R(self, :show, CGI.escape(page)) end end Global.adapter = :mongrel #Global.tidy = true Global.mapping = {'/' => WikiController} start
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.0.9 | examples/whywiki/main.rb |
ramaze-0.0.8 | examples/whywiki/main.rb |
ramaze-0.1.0 | examples/whywiki/main.rb |