Cut at a macros Plugin
I've got a first cut at a hopefully zen-of-blosxom macro package with most of the capability of Brad Choate's mtmacros.
right now, macros are defined with perl code -- it loads files from state_dir/.macros.
It supports
- "string"
- simple string replacement
- "pattern"
- regular expression replacement; $1-$9 are available to macros
- "tag"
- html-style tags without content (ie, <line width="30%">); attributes are available to macros, with defaults. $1-$9 are also available, if the name has ()s in it
- "ctag"
- html-style content tags (ie, <amazon asin="0434332333">Title</amazon>); everything from tag macros are available, plus the body
Replaced text can be either as-is ("${name}") or url-escaped ("$<name>").
The major missing feature is being able to apply macros only to content text, not to html markup. Also in mtmacros and missing are run-once, recursive, fold-case, and being able to enable or disable macros on a per-story basis.
There's too much repeated code right now, and I haven't started to optimize it yet, but any feedback on the syntax in particular is very appreciated; I think we're all better off with one really good macro package (whether it's based on this or not) than several almost-good-enough ones.
Anybody who wants to take this and run with it is encouraged. I'll get back to it sooner or later but think this is the kind of thing that a community can do better than one person.
URL summary:
2003-03-06 06:40:00 | Comments (3) | TrackBack (0) | Computers::Internet::Web::Blosxom
Todd Larason
Updated URLs:
1969-12-31 16:00:00