labia

Wednesday 10 September 2003

I made a CGI::Wiki dev list.

I'd like to be able to make wikis where the author of a node can choose what wiki (or other) syntax to write in - using, for example, a drop-down box on the edit screen.

This will allow you to do things like have documentation pages written in POD, test suite pages written in plain text and rendered using a simple formatter class that just puts <pre> around everything, and discussion pages written in your favourite Wiki syntax.

Now this could be done in the calling code - just call $relevant_formatter->format( ... ) rather than $wiki->format( ... ). But I'm wondering whether it should be explicitly supported by CGI::Wiki, and if so, should this be done by changing the CGI::Wiki API or by creating CGI::Wiki::Formatter::Multiple to handle it all.

The main tasks that a solution needs to accomplish are:

- when saving a node, store some metadata to indicate the required formatter

- when displaying a node, retrieve that metadata and use it to choose the appropriate formatter

Changing the CGI::Wiki API would mean that CGI::Wiki was mandating the behaviour of a particular metadata field, something it hasn't done up to now and I'm not sure it should do.

Handling it via CGI::Wiki::Formatter::Multiple would mean that the application code would be responsible for storing and retrieving the formatter-type metadata. The wins in this case over just handling all the multipleness in code would be:

- can just call $wiki->format instead of selecting the right formatter class, instantiating and calling that

- things like allowed_tags only need to be supplied once, to CGI::Wiki::Formatter::Multiple->new, rather than to each individual formatter. (On the other hand, you might want to allow different tags for the different types of pages.)

I'm also considering a grand renaming of CGI::Wiki, maybe to Wiki::Toolkit. We're discussing a major API change and a name change would help avoid the backwards compatibility demon.

< Sunday 13 September 2003 Monday 8 September 2003 >

foo

HTML generated from pod with podblog