Skip to content

alno/irwi

Repository files navigation

Irwi

Irwi is a Ruby on Rails 4 plugin which adds wiki functionality to your application.

Status

Build Status

Installation

Add to your Gemfile:

gem 'irwi', :git => 'git:https://github.com/alno/irwi.git'

Then in your application directory call:

rails g irwi_wiki

It will generate:

  • WikiPageController to serve wiki pages
  • WikiPage model to represent page
  • Migration to prepare database

Also it will add to your routes.rb something like:

wiki_root '/wiki'

Wiki syntax (links to other pages)

You can link pages by using

[[Some page title]]

construction in text. If linked page exists, when it will be replaced with link to this page, in other case it will be replaced with link to new page with such path/title.

Template definition

You may create your own templates for controller actions (show, edit and history), in other case default built-in templates will be used.

Helper definition

Following helpers are defined by default and you may replace them with you own:

  • wiki_user - Renders user name or link by given user object. By default renders <Unknown> for nil and "User#{user.id}" for others.

Configuration

Configuration options are acessed via Irwi.config object. Currently supported options:

  • user_class_name - Name of user model class. By default - 'User'

    Define a method named 'current_user' method on WikiPagesController that returns the object for the current user

  • formatter - Formatter instance, which process wiki content before output (see section below).

  • paginator - Paginator instance, which display pagination controls (see section below).

  • comparator - Comparator instance, which builds and renders a set of changes between to texts. By default instance of Irwi::Comparators::DiffLcs is used (requires