It didn't take me long when collecting verses for the Imperatives of Jesus project to get tired of all the cutting and pasting. Once i found the English Standard Version web services API, it was clear that provided a better way to compose the content. I had some programming time this weekend, so i worked out some code that i hope will get the project moving again.
My ideal would be a Radio Userland macro to convert a reference into the text. I've done some work on this, but i haven't figured out how to use Radio to transform the XHTML format it returns into what i want. But i also wanted an authoring tool, not something that does hands-off conversion at publish-time.
Here's the current process:
- i prepare an index file in XML that lists the scripture references
- i use a Perl program to process the index file, contact the ESV web service, return the content for each verse in the index, and compose HTML
- i edit the resulting HTML and include it in an entry
Here's a fragment of the index file.
<item ref="Luke.6.23" description="Rejoice when you're hated">
<comment placement="after">when you are hated because of the son of Man</comment>
<item ref="Luke.6.27a" description="love your enemies"/>
You can see how it's rendered (after editing) in the current version for Luke (still incompete). I wanted to keep the actual texts brief and focused, so i added a comment element to add just a little context. I haven't used this enough yet to standardize on a DTD: the format is so simple it hardly seems worth the trouble (but eventually i probably will). The description is just to help me remember which verse is which: it's not used in the output.
The Perl program is here, though you'll need to substitute your own access key (the included TEST key produces garbled text). In addition to Perl, you need the XML::Twig module: otherwise there's nothing fancy here. I added a query counter to make sure i stayed below the 500 queries per day limit required by ESV.
Please let me know if you find this helpful.
Copyright 2004 sean boisen
Theme Design by Bryan Bell