MTMacro Improved (Slightly)

Because of how I wanted to use MTMacro (so far at least), I decided to add a fouth type of macro (in addition to string, pattern, and tag / ctag): word.

Basically, word is just a specialized form of pattern, but formatted like string. All my additional code does is put the word into the following pattern: m/\b$word\b/

Here is the diff I generated for my code changes:

--- macros.pm 2002-10-04 21:31:53.000000000 -0400 +++ macros.pm_new 2002-10-10 10:10:02.000000000 -0400 @@ -240,6 +240,7 @@ my $pattern = $args->{pattern}; my $tag = $args->{tag} || $args->{ctag}; my $string = $args->{string}; + my $word = $args->{word}; # macro is a combination of text/html/MT tags that # is to be executed upon every use of the macro @@ -251,6 +252,9 @@ $type = 's'; } elsif ($tag) { $type = 't'; + } elsif ($word) { + $pattern = 'm/\b'.$word.'\b/'; + $type = 'p'; } else { return $ctx->error("You did not specify the type of macro."); }

Leave a comment

About Me

I am a software developer for Six Apart living outside of Baltimore, MD. I have written a number of plugins for Movable Type, including the award winning MultiBlog, which has (as of MT 4) been integrated into the base application....
More...

Recent Entries

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

  • Feedburner Widget 0.3

    At this point, I am really tempted to drop the ‘Widget’ from the name of the plugin, since it is doing so much more...

  • Feedburner Widget 0.2

    So I finally got around to updating the FeedburnerWidget plugin for MT 4.1 (since I finally got around to upgrading my install to MT 4.1)....

Close