In regard to #1214:
https://trac.habariproject.org/habari/ticket/1214

The way habari handles filters and formatters is very bad.

Currently, every formatter is run with priority 8...which is causing
me its own share of problems.  A quick fix is the patch to #1214 which
moves the formatters to the back of the line and makes their priority
customizable so that new plugin filters can be inserted between other
filters and formatters.  It is not an ideal fix but it solves some
immediate problems.

Having independent plugins and user-defined filters all mixed together
with priorities set by the maintainers thereof is potential chaos.
There is a need for precision in determining in what order the filters
and formatters are applied.

Michaeltwofish echoed my thoughts exactly:
http://drunkenmonkey.org/irc/habari/2010-04-20#T00-03-56
<michaeltwofish> magic priority numbers are probably not good. There
should be a way to say "this should be run at a higher priority than
X"

An example of how this is done well is in drupal.  Drupal uses "input
formats" (which in a way are like content-types in habari).  For each
"input format", you can select which formatters to use and in which
order to apply them.  Habari needs something like this.

Here is a demo of the drupal admin area:
http://php.opensourcecms.com/scripts/details.php?scriptid=191
Select site-configuration->input-filters

We could do something similar by allowing each content-type to set the
priorities of individual filters.  Whether or not this is something
that should be done in the content-type declaration source or in the
admin area is up for debate.

A second issue that I have run into is: it is sometimes necessary to
have a plugin create multiple filters for a single filter-type.  In
other words, I want to filter the content on output
(filter_content_out) before another filter/formatter happens and then
I want to filter the content on output a second time
(filter_content_out) to do something entirely different.  At present,
it is not possible to add multiple filters in a single plugin.

So here is a rather vague proposal that could fix all of these issues:
* Change the plugin filter and formatter architecture to allow plugins
and filters to be registered with habari and each given a name (allow
more than one of each filter type per plugin).
* Allow each content-type to choose which filters (by name!?) to apply
and in what order. (perhaps in the admin area)

(What I'm really saying is that filters should be more like content-
types where they are registered with habari and given names.)

Comments or ideas on this would very much be appreciated.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev

Reply via email to