eigenclass logo
MAIN  Index  Search  Changes  PageRank  Login

Opening up my hiki wiki: bliki.rb plugin

You might have realized that eigenclass.org has been changing subtly as of late. In addition to the cosmetic modifications, I've upgraded to hiki 0.8.6 and rewritten my hiki hacks as self-contained plugins.

The last one I've been working on allows you to enable modifications to a set of nodes without opening up all of the wiki: creation of new nodes is disabled, and some operations are restricted. This is what the admin sees when editing a page: edit-form.png

hiki already ships with a plugin that allows you to restrict modification so that only authenticated users can edit the wiki (and also to freeze some pages), but my code allows you to open specific pages to everybody, while keeping the rest of the wiki frozen*1.

I've created a few "open" nodes, enabling modifications to them:

Larger parts of eigenclass.org will become open if spam doesn't get too annoying. I have several ideas to fight it, were it needed.

I'll release my hiki plugins in a while (which I sort of promised quite a long time ago), but here's bliki.rb, so you can see how easily hiki can be extended:

# Copyright (C) 2006 Mauricio Fernandez <mfp@acm.org> http://eigenclass.org
# Use & distribution under the same terms as Ruby.

def bliki_form
  checkedtxt = @db.get_attribute(@page, :third_party_edit) ? "checked" : ''
  <p><input type="checkbox" name="bliki.edit" value="true" #{checkedtxt}>Allow 3rd party changes</p>

add_edit_proc {
  if admin?

add_update_proc {
  if admin?
    if @cgi.params['bliki.edit'][0] == 'true'
      @db.set_attribute(@page, [[:third_party_edit, true]])
    elsif @cgi.params['md5hex'][0]
      # means that we came here from an edit form, not a mere Plugin#save
      # which could be executed by {{bbs}} or {{comment}}
      @db.set_attribute(@page, [[:third_party_edit, false]])

def auth?
  admin? || (@page && @db.get_attribute(@page, :third_party_edit))


I'm mostly happy with my hiki setup, for it supports

  • page aggregation
  • multiple RSS feeds with "tag algebra"
  • "single user mode"
  • per-page permissions to enable localized modifications
  • math support (LaTeX, roff)
  • bbs/comments with inline AJAXy preview
  • uploads/attachments
  • automatic hierarchy inference based on the tags
  • email notifications
  • sitemaps, TOCs, incremental search, pagerank, referrer tracking, trackback, basic BTS, RSS display...

There are a zillion plugins for hiki, easily making it the most featureful wiki written in Ruby I know of.

Docs? - Matthew (2006-08-16 (Wed) 17:51:05)

Are there any good docs for Hiki? The site (at least the English part) is pretty sparse, and the source code seems pretty readable, but largely uncommented. For some of the plugins, the functionality and behavior isn't entirely obvious.

I'm definitely interested in seeing the remainder of your plugins when they're ready.

mfp 2006-08-18 (Fri) 05:59:34

Yes, there's little documentation. Fortunately, there are a lot of plugins serving as examples --- the first ones I wrote were but variants of the standard ones.

These are the plugins I've either modified or written from scratch:

  • aggregate.rb: node aggregation (this is what generates the frontpage and a couple other nodes on this site)
  • attach.rb
  • bliki.rb: per-page public modifications
  • bbs.rb
  • comment.rb
  • incremental_search.rb
  • math_roff.rb: support for equations with roff
  • rss.rb: added RSS 2.0 suport, multiple feeds, tag algebra, several formats, rotation...
  • tag_hierarchy.rb: you can see that in 404 not found

Last modified:2006/08/12 13:57:09
Keyword(s):[blog] [ruby] [frontpage] [hiki] [eigenclass.org] [bliki] [plugin] [subpar]
References:[Ruby 1.8.5 released. What's new?]

*1 I wouldn't forgive myself if my site started propagating spam via RSS in case somebody edited a syndicated page