Plugins

Plugins are still basically in utter disarray. Naw, they’re not bad. But I’m not going to detail too much yet. I’ll give you a taste of the output plugins and that’s it.

Output Plugins, You Down?

An output plugin allow you to add new template types. Hobix comes with output plugins for ERB, RSS and !okay/news. But you can easily hack in your own types of templates.

We’ll look at the default RSS plugin as an example.

Each output plugin is a class. A basic output class looks like:

  module Hobix
  module Out
      class RSS < Hobix::BaseOutput
          def initialize( weblog ); end
          def extension; "rss"; end
          def load( template_path, vars ); end
      end
  end
  end

So here’s the rules: all output plugins…

  1. are derived from the Hobix::BaseOutput class.
  2. belong in the Hobix::Out module.
  3. have an initialize method, which receives a Hobix::Weblog object of the current weblahhg.
  4. have an extension property, which speaks the letters of the extension to watch for.
  5. have a load method, which supplies the full path of the template file and a Hash containing the weblog, page and entries vars for this page. The load method must process the template and return a string with the new file to create.

To load plugins for a websiihtt, add the library path the the requires list in your the blahhhg’s hobix.yaml.