Heal Your Church WebSite


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

Scripturizer 1.2, now with MT Plugin-ability

Hey all, love the feedback.

So much so, there’s a version 1.3 I’d rather y’all reference.

And to kill confusion, I’m removing the current code snips/examples so we’re not trying to maintain updated legacy code.

Thanks! I look forward to your comments over here:

Hyperlink Bible References using Scripturizer 1.3

49 Comments

  1. Any chance of a version 1.3 that incoporates the ESV api? I use a hacked version of 1.0 to use it, but am afraid that that’ll break for no reason at some point…
    Good work though :)

  2. Pingback: For What It's Worth

  3. What else do you imagine going into the Sermonizer:: hierarchy?

    If I were doing this, I might construct a hierarchy something like this:

    Bible – Biblical software

    Bible::Constants::en – a class that would contain different constants, such as book names, book order, names of versions, etc.

    Bible::LinkMaker – this would be what is now Sermonizer::Scripturizer

    Bible::LinkMaker::Methods::biblegateway
    Bible::LinkMaker::Methods::localKJVfile
    Bible::LinkMaker::Methods::localSwordFile

    These would be different methods that could be plugged into LinkMaker to say where it links to. This may be huge overkill, since a method is basically just a string with a spot where you substitute in the passage. (“localSwordfile” refers to a module packaged for the software sitting at http://www.crosswire.org/sword )

    At this point, though, it may be getting too abstract to actually implement…

  4. Pingback: The Journal

  5. Below is a patch which adds support for the abbreviations that bible gateway supports,
    and it fixes a bug where an extra space would be inserted in some cases (i.e. (Mark 5:5) would become ( Mark 5:5)). Just patch it into Scripturizer.pm

    — foo Tue Aug 12 11:20:37 2003
    +++ Scripturizer.pm Tue Aug 12 11:19:45 2003
    @@ -12,7 +12,7 @@

    use vars qw($volumes $books $versions);
    $volumes = qr/I+|1st|2nd|3rd|First|Second|Third|1|2|3/;
    -$books = qr/Genesis|Exodus|Leviticus|Numbers|Deuteronomy|Joshua|Judges|Ruth|Samuel|Kings|Chronicles|Ezra|Nehemiah|Esther|Job|Psalm|Proverbs|Ecclesiastes|Song\sof\sSolomon|Isaiah|Jeremiah|Lamentations|Ezekiel|Daniel|Hosea|Joel|Amos|Obadiah|Jonah|Micah|Nahum|Habakkuk|Zephaniah|Haggai|Zechariah|Malachi|Matthew|Mark|Luke|John|Acts|Romans|Corinthians|Galatians|Ephesians|Philippians|Colossians|Thessalonians|Timothy|Titus|Philemon|Hebrews|James|Peter|Jude|Revelation/;
    +$books = qr/Genesis|Exodus|Leviticus|Numbers|Deuteronomy|Joshua|Judges|Ruth|Samuel|Kings|Chronicles|Ezra|Nehemiah|Esther|Job|Psalm|Proverbs|Ecclesiastes|Song\sof\sSolomon|Isaiah|Jeremiah|Lamentations|Ezekiel|Daniel|Hosea|Joel|Amos|Obadiah|Jonah|Micah|Nahum|Habakkuk|Zephaniah|Haggai|Zechariah|Malachi|Matthew|Mark|Luke|John|Acts|Romans|Corinthians|Galatians|Ephesians|Philippians|Colossians|Thessalonians|Timothy|Titus|Philemon|Hebrews|James|Peter|Jude|Revelation|Exod\.|Lev\.|Num\.|Deut\.|Josh\.|Judg\.|Sam\.|Kgs\.|Chron\.|Ezra\.|Neh\.|Esth\.|Ps\.|Prov\.|Ecc\.|Song\.|Isa\.|Jer\.|Lam\.|Ezek\.|Dan\.|Obad\.|Hab\.|Zeph\.|Hag\.|Zech\.|Mal\.|Matt\.|Mk\.|Lk\.|Jn\.|Rom\.|Cor\.|Gal\.|Eph\.|Phil\.|Col\.|Thes\.|Tim\.|Tit\.|Philem\.|Heb\.|Jas\.|Pet\.|Rev\./;
    $versions = qr/NIV|NASB|AMP|NLT|KJV|ESV|CEV|NKJV|KJ21|ASV|WE|YLT|DARBY|WYC|NIV-UK/;

    # scripturize a single string of text
    @@ -55,13 +55,12 @@
    # don’t just match, replace
    $text =~ s/
    (?:($volumes)\s*)* # any number of vols.
    - \s*
    -
    + (\s*)
    ($books) # the book
    \s*
    ( $verses (?: \s* , \s* $verses)* )
    - /$passage = ($1 ? “$1 “:”").($2 ? $2:”").($3 ? ” $3″:”");
    - ” $passage”
    + /$passage = ($1 ? “$1 “: “”) . ($3 ? $3 : “”) . ($4 ? ” $4″ : “”);
    + “$2$passage”
    /gcex;

    return $text;

  6. Can anyone verify the patch above? I’ve tried it on my site and it doesn’t seem to be working correctly. I may have done it wrong…

    The books section seems fine, but the part that should fix the spacing errors doesn’t want to work right. Once I make the changes, the href drops it’s last part, so that the link (which looks right) just points to the book with no specific verses. What could I be doing wrong?

  7. Pingback: For What It's Worth

  8. Pingback: For What It's Worth

  9. Hey, can this plug into Typepad???? I use typepad for my blogs (and forward from the brotherphil.com site to the blog).

  10. Pingback: Andrew's Weblog

  11. Would it be possible to extend this plugin to retrieve the linked Scripture and put in a seperate module on the MT page? I would like to be able to do this, of course giving credit to BibleGateway and providing a link back to their main page. This way, you could have a sidebar appear next to the main article with the requested scripture passage without having to leave the page.

  12. Thanks, works well. I’ll be using it on Shock and Awe when I come back from hiatus.

    –Kynn

  13. Hiya,
    Just a small question. I have installed both files in my MT installation correctly.

    Now the most somple and obvious question. How do i use Scripturizer when making a post in MT?

    I’m completely befuddled as I havn’t found any information on your website to tell me how to do this.

  14. I find that with MT Scripturizer adds a space before the reference, so that if the reference is in parenthesis it will appear as ( Rom. 1:1). I found the string in Scripturizer.pm that prints the anchored link and removed the space which precedes the anchor tag, but then if the reference appears as a normal part of the sentence it lacks the space, as suchRom. 1:1.

    I guess that’s a rather minor thing, but thought you should be aware of it.

    By the way, the patch that someone provided above to enable abbreviations doesn’t work, but manually editing the perl module makes it work quite well.

  15. Yeah, it would be extra-cool if we could get that abbreviation problem fixed.

  16. I figured out how to fix the space after parenthesis. I don’t know perl but after playing with the changes given by Jason Rust I figured it out. Go to Scripturizer Changes and make the changes indicated. It works great for me.

  17. I figured out how to fix the space after parenthesis. I don’t know perl but after playing with the changes given by Jason Rust I figured it out. Go to Scripturizer Changes and make the changes indicated. It works great for me.

  18. I have installed the two files, as posted..
    Only my structure looks like this:
    ..cgi-bin/mt/plugins/Scripturizer.pl
    ..cgi-bin/mt/extlib/Sermonizer/Scripturizer.pm

    Now, I cannot find instructons anywhere on how to entere the references in our text entires in order to link them to biblegateway.com. (I’m new at this and know little to nothing about code, but I can follow explicit instructions!)

    Werner

  19. I’m going to have to echo Werner. I pico’d a new text file with the above code, wrote the files to the appropriate places, and now I’m at a loss as to what to do. I’ve read somewhere about adding “scripturizer=ESV$>” or something to the end of the tag in the main index template, but that’s only made my body text disappear! Some sort of documentation for beginning users would be really helpful, as I can’t find it anywhere.

  20. Dean-
    Great work. I got it running on my site. I have a question (forgive me if there’s a documentation page I missed): How can I get Scripturizer to correctly parse a verse range that extends over two chapters? For example, today’s Moravian texts include Genesis 46:28 – 47:31. Scripturizer parses this as Genesis 46:28-47 (though there is no verse 47), and leaves off the 31 verses of chapter 47.

    Is there a way to format it so this will be processed as intended? I suppose I could also include the closing verse of the first chapter in the citation, but then it wouldn’t come up on one page. If I paste the same verse citation into the Bible Gateway, it comes up correctly on one page, so it appears to be a matter of how Scripturizer determines when to stop looking for the end of the citation. Maybe a special character sequence could be used for multi-chapter references, like Genesis 46:28::47:31. What do you think?

  21. If not, I’ve noticed that when a hyperlink is added manually, Scripturizer doesn’t add another hyperlink to the same text. So here’s the workaround:
    1. Post the reference, though it won’t work.
    2. Hilight the reference (e.g. Genesis 46:28 – 47:31)
    3. Click the Bible Gateway link (which will not cover all of the reference text).
    4. In the box at the top of the Bible Gateway page that allows you to search by verse, paste the reference in. Hit Go.
    5. Copy the new URL (F6, ctrl+c) to the clipboard.
    6. Edit your post and add a hyperlink to the troublesome citation, pasting the URL from the clipboard. (Note: MT will not have saved the Scripturizer links in the post’s text, since these are added when publishing).
    7. Save your entry.

    Since this probably won’t happen that often, I’ll just use this workaround unless/until there is a way to avoid it. Thanks for leaving the comment on my blog. Grace and peace,
    Justin

  22. Dean-
    I’ve been using it for a few days now with my new daily texts blog, and I’ve also recently started using an RSS reader.

    When I look at my own feed (http://www.radicalcongruency.com/DailyTexts/index.xml), I notice that normal links are present, but Scripturizer links are not. I’m wondering if this is because Scripturizer and the RSS feed generator (a MT template) are both executed at the same time, or perhaps in the wrong order. If the RSS feed was generated before the post was Scripturized, the links wouldn’t be present.

    Do you know of a way to make sure the Scripturizer links get passed into the RSS 2.0 feed?
    Thanks,
    Justin

  23. Umm, Dean? This works, but when rebuilding my index I see the following error message: “MT::App::CMS=HASH(0x838a4dc) Use of /c modifier is meaningless in s/// at extlib/Sermonizer/Scripturizer.pm line 65.”

    Any ideas?

  24. Pingback: faithful.geek

  25. I was wondering … is there a way to specify what version of the Bible it links to?