Auto-Acronym Plugin

I created my first plugin for b2evo last night. It will automatically add the markup to add title attributes to known acronyms. So, if I type “PHP” in my post, it automatically turns that into <acronym title="PHP: Hypertext Processor">PHP</acronym> in your browser.

I’m still working out a few of the bugs, and it seems that every time I turn around, I think of some new acronym that I forgot to add to the list.

If you’re using b2evolution, drop the file into your …/plugins/renderers/ folder, and LMKWYT. :)

15 Responses to “Auto-Acronym Plugin”

  1. On June 27th, 2004 at 03:27:56, Graham Said:

    It looks pretty nice to me - I’ve been playing with it locally for the past day or so, and I haven’t been able to break it yet.

  2. On June 27th, 2004 at 13:11:05, tin-men Said:

    Finally!My exams are finally over! I think I might have just about fluked them, although I kinda hope that I don’t, so I’ll be able to stay here and be with Nina. I’m a fool.

    I’ve also done a few geek thinks to this website, the most noticable is that I tar…

  3. On June 27th, 2004 at 21:01:36, d kitty Said:

    I hardly ever use acronym tags and yet I probably should. This plugin could come in quite handy.

  4. On June 29th, 2004 at 08:14:20, Isaac Schlueter Said:

    Tweaked it to prevent tags-in-tags, and also to add the title to links that have no title, when the link text is one of the known acronyms.

  5. On June 29th, 2004 at 22:18:03, d kitty Said:

    *blink* Wait. You added code to prevent tags inside tags? How? Is the zip file updated? I may have to check it.

  6. On June 29th, 2004 at 22:28:28, Isaac Schlueter Said:


    $content = preg_replace( '#(<[^<>]*)(<[A-Za-z]+[^>]*>)(.*)(</[A-Za-z]+>)([^<>]*>)#’, ‘$1$3$5′, $content); // (Bug, see below - IZS)

    $content = preg_replace( '#(<[^<>]*)(<[A-Za-z]+[^>]*>)([^<>*)(</[A-Za-z]+>)([^<>]*>)#’, ‘$1$3$5′, $content);


    No worries about spamming the kitty. Your email address is never displayed on this site, nor given to anyone. The only way that it is used is to (possibly, if I feel like it) responding to questions you may ask me.

  7. On July 12th, 2004 at 11:40:55, d kitty Said:

    Noted. Thank you.

    And I like the plug-in quite a bit.

  8. On August 4th, 2004 at 23:09:49, Brian Said:

    Installed plugin today. Well done.

    Just one minor annoyance… acronyms in the title="" property of a hyperlink get auto-acronym’d which breaks the tag.

  9. On August 5th, 2004 at 00:24:25, Isaac Schlueter Said:

    Thanks for spotting that Brian.

    Isaac Z. Schlueter says:weird. you found a really rare bugIsaac Z. Schlueter says:nice jobBrianS says:errr… tks I guess. Took me about 15 seconds between saving file and saving post.Isaac Z. Schlueter says:you’ve gotta have the same acronym inside two tags, without a linebreak between them.Isaac Z. Schlueter says:fixed.BrianS says:like having two title=”View PHP…” inside of <p></p>?Isaac Z. Schlueter says:well, it’s the actual linebreak that would fix it.Isaac Z. Schlueter says:and autop would then replace that with a <br /> or <p>BrianS says:i cIsaac Z. Schlueter says:. matches any character other than a linebreakIsaac Z. Schlueter says:on line 168, replace (.*) with ([^<>]*)Isaac Z. Schlueter says:and it’s fixed.Isaac Z. Schlueter says:preg_replace matches the biggest thing it can, leading to odd results if we let it skip over < and >BrianS says:yep, that did it. well done.

  10. On August 16th, 2004 at 17:03:51, Isaac Schlueter Said:

    Actually, that won’t work either.

    I posted the AntiTagInTag function on the PHP website.

  11. On December 5th, 2004 at 17:13:11, basstech Said:

    I installed the plugin, but it doesn’t appear to be working at all. Non of my acronym’s are being highlighted. I’m running b2evo v I have this “Auto-Acronym opt-out Auto-Acronym - Automagically add titles to acronyms” listed in my plugin list. I’ve tried posted with the box checked and unchecked. Either way it does nothing.

  12. On December 5th, 2004 at 17:51:52, Isaac Schlueter Said:

    It actually is working, just not as you’d probably expect.
    Check out

    It appears to be using <span class="info" title="whatever">wtvr</span> instead of <acronym title="whatever">wtvr</acronym>

    Simple solution, add this to your {
    border-bottom:1px dotted #000;

    More involved solution:
    Open up the .php file, and change the line that adds the markup. It’s a pretty simple fix, just search for “span” and you’ll find it pretty easily, and from your site you seem to know your way around php well enough to tweak something.

    I had changed it to instead of abbr or acronym for 4 reasons:MSIE doesn’t support ABBR (it’s like it doesn’t even notice it’s there. you can’t style it, can’t read it with scripts, nothing.)ABBR is more semantically appropriate for most of the items in the list.SPANs and DIVs get semantic meaning (if any is to be had) from the className. .info is exactly what these are; some additional meta-info about the wrapped phrase.The debate has been going on since the 90s as to whether ABBR or ACRONYM is better, and a special SPAN is a way around all of the controversy.

  13. On December 5th, 2004 at 19:42:19, basstech Said:

    I should have viewed the source. I didn’t even look. I’ll probably

    How does having a span like that affect accessability?

  14. On December 5th, 2004 at 19:43:47, basstech Said:

    Don’t know what happened in the last comment I was saying “I’ll probably stick with the span for now.”

  15. On February 25th, 2005 at 11:55:46, Leo Kent Said:

    Thanks for this plugin, I am new to b2evo and blogging in general so it makes my life easier. It aslo gives me an idea on how to create my own plugins.

    Thanks Again!

Leave a Reply

Comments are moderated like crazy using a variety of plugins. There is a very high likelihood that your comment won't show up right away, especially if you have never commented here before, but it was not deleted.

Please be patient, and do not post your comment more than once. It will show up once it is approved.

You must be logged in to post a comment.