Heal Your Church WebSite


Teaching, rebuking, correcting & training in righteous web design.

Hyperlink Bible References using Scripturizer 1.3

After almost a year of people emailing me and leaving comments, I’ve finally made the time to update my Scripturizer Perl Module. The changes aren’t big, but they provide dramatic relief to a series of annoyances that have encumbered some of you from adding more Scripture references to your blogs, church websites and other electronically distributed information. I apologize for taking so long to get around to such an important issue.

Addition of Abbreviations:

I think a comment by Werner Peters (no relation) on Rob Hulson’s blog sums up the need for this addition best when he writes:

“It gets a little tedious writing out Deuteronomy every time!”

Yeah, you’ve said a mouth full. So I’ve added various abbreviations to the new and improved version. I’ve done so a more hard-coded format than I like, but the regular expressions are complex enough. I want a novice to be able to look at the existing expressions for Books in the Bible and add or alter their own (expressions) as they need.

This was a painstaking process I automated to some degree with some Perl to split book names after the first three characters, then again at the fourth or fifth character depending on the length and vowel placement. I then went through each of the expressions and added or subtracted based upon a list of common Bible queries over at the ESV Bible. Many thanks to Stephen Smith for directing my attention to this data, it was incredibly helpful!

Finally, I took care of a small handful of typos, involving pluralization. I still need to write a “mop-up” option to weed-out typos such as “revalations” and “mathew.”

Eliminate the addition of a space before non-white space bug.

This bug is exceptionally annoying to those who like to encapsulate their scripture references between brackets or parenthesis, such as (1 John 1:9). So annoying that back last August, Jason Rust left a comment on my blog with a fix. A fix later tried and tested and nicely documented by Joseph Markey.

Essentially, the bug was introduced when evaluating the space between a volume reference, e.g. 1 John 1:9, which in turn put a space in front of a non-volume reference such as John 1:9. The bug occurred when the character directly before the non-volume number scripture reference was anything other than a space.

What the fix does is it pushes the evaluation for the space into a variable, then pushes it in front of the hyperlink. An approach that works much better than a hard-coded space as nothing before the reference is then accurately rendered as nothing just before the hyperlink.

Eliminate the ‘c’ in the gcex modifier in the regular expression.

This regular expression mode modifier did nothing in this context, except possibily eat up CPU and sometimes throw errors in the latest version of Perl.

ESV Bible flip-flop

The great people at the ESV Bible have been so helpful and responsive in the past, I figured why not say thanks in the form of directing those who select the English Standard Version option to the ESV online Bible website.

In MovableType, that would be <$MTBodyEntry scripturize=”ESV”$>

Using Scripturizer as a Perl Module, that would be print scripturize(”Phil. 4:6-7″, “ESV”).

XHTML compliant hyperlinks

Ampersands are now represented as &amp;

Usage Notes

Well, this is sorta a no-brainer. For those of you using the MovableType Scripturizer plug-in, leave the file /plugins/Scripturizer.pl alone.

Replace the file /extlib/Sermonizer/Scripture.pm with the referenced code below. That should be it, but first make a backup of the old one just in case.

Here is where I have it set-up on my PC for general purposes using ActiveState’s Perl Dev Kit: c:\perl\site\lib\Sermonizer\Scripturizer.pm.

Future Iterations

That’s pretty much it. If you can think of anything else, let me know and we’ll see about adding it.

Otherwise, I’d like to work on something else Stephen Smith of ESV sent me, a routine that fetches a snippet via their webservice. His code works but I have some MT centric things I want to tackle when slicing-n-dicing an XML stream of Matthew 5. That and I feel a full-blown ESV.pm module coming on. Well, Stephen has already created one, but I’ve got these ideas … and this compiler … well, you get the picture.

There is also a much needed death-blow to typos method subroutine that needs to be written. The question is, do I write it into the same pass, or do I run first a clean-up pass filter, then scripturize? Any thoughts would be appreciated.

Again, thanks to everyone for their input. I couldn’t have done any of this without your valuable input. Even if I could, it wouldn’t have been as much fun.

Download the PM … Sermonizer::Scripturizer.pm

view it as text: Sermonizer::Scripturizer.pm

Find a bug? Have a suggestion? Leave a comment. We’ll do our best to see it gets taken care of … quickly. Get it to me in the next couple of days and I’ll try to add it as an update to this article.

58 Comments

  1. Neat. If you want to add an NRSV option then you can link to the one I maintain at bible.oremus.org. Shouldn’t be too hard to point to a different site for a different bible version.

    (That site is also written in perl. I match the minimum unique abbreviation of any book name — but I supose I have the advantage of being able to do that via a SQL query rather than a perl regexp.)

  2. Hey Dean, did you notice that Biblegateway has changed the formatting of their URL’s with their latest site re-do? They’ve a nice breakdown here. The links created with scripturizer still seem to work, though, for now.

  3. i’m using this in MovableType 3.121 and this plugin seems to work perfectly for static pages, but for my dynamically generated archive pages, the plugin doesn’t work. has anyone found a solution to fix this?

  4. I just upgraded to MT 3.15 but haven’t turned on dynamic pages, and I won’t for this reason (from the guide to MT 3.1):

    Please note that at this time, only the standard Movable Type tags are supported with the dynamic rendering option. Existing plugins are not compatible with this new feature, since they are written in Perl and not PHP. If you are seeing errors due to using plugin tags, you will either need to remove the tag(s) or change that template to render statically.

  5. Does this work in verion 3.17?

    I have not been able to get it working.

    Please advise.

  6. One question. My templatees for Movable Type 3.2 don’t seem to have . Any idea how I get Scripturizer to process the extended entries?

  7. We are currently using Scripturizer 1.5fork (live) and 1.55 (test) and wish to continue to do so. We need a solution however for the multiple chapter span references. Over the weekend, I installed the ESV version on our test site. It has some nice features, especially the ability to span chapters which is why I tried it out in the first place. Our church, however, uses the NIV translation throughout our web site and CMS tools. The wysiwyg editor for our CMS FckEditor uses Scripturizer plugin as well. We found a hack to fix the chapter span problem here:

    http://www.healyourchurchwebsite.com/archives/001176.shtml

    Where…Changing line 67 of Scripturizer.pm to the following should fix the extra space in the link and allow for an extra space between the colon and the verse numbers which was also requested:

    my $verses = qr{ \d (: \s* \d )* (?: \s* [-&] \s* \d )* }x;

    Perhaps this info helps, or speeds along the process for allowing references that span more than one chapter (ex Genesis 1:1-2:3).

    We value your tool and would like to continue to use it to help spread the Word!

  8. Solution: New download for scripturizer fixes multiple chapter references may be downloaded here:

    http://scripturizer.wordpress.com/download/