This issue is about a very longstanding feature request to see the module inject the actual Bible text into the HTML of the page, so that it can be displayed in a popup / lightbox in some way.

Comments

andykemp’s picture

Title: Updateing Scripture Filter to take advantage of the ESV API » And the INC File
StatusFileSize
new10.63 KB
andykemp’s picture

Title: And the INC File » And the First JS File
StatusFileSize
new4.75 KB
andykemp’s picture

Title: And the First JS File » And the Second JS File
StatusFileSize
new718 bytes
andykemp’s picture

Title: And the Second JS File » And the CSS File

I'm sure there must be quicker way to upload more than one file!
Test page where you can see the module working (currently set to collapsing block display)

andykemp’s picture

Title: And the CSS File » Updateing Scripture Filter to take advantage of the ESV API

Sorry didn't notice that changing the title for the comment would change the whole title... Still learning!

andykemp’s picture

Title: Updateing Scripture Filter to take advantage of the ESV API » Updating Scripture Filter to take advantage of the ESV API
StatusFileSize
new0 bytes

Two little tweaks to make the code XHTML Strict Compliant, and to clear out the Input_filter cache so changes to setting are visible straight away.

andykemp’s picture

StatusFileSize
new14.28 KB

File didn't upload...

andykemp’s picture

StatusFileSize
new10.73 KB

And the inc file

andykemp’s picture

The changes to the inc file, replacing the span with a div, causing the module to break the paragraph where the text occours if you have the ESV text displaying in a collasible block...

It might be possible to replace all the p, h etc tags with span tags and give them the same properties as the paragraph tags which are not compliant if within a span tag... I will try and take another look at it later...

andykemp’s picture

Some more changes! To make it (mostly) compliant, I have replaced all the h2,h3 and p tags that the esv feed generates, and replaced them with span tags with display:block. However the flash audio player they inject isn't compliant, so if you plan on using that you should be aware. Currently flash is VERY difficult to insert and remain compliant if you want it to work on most players...

Rather than continue to upload odd files here and there as I make changes I thought I would upload the whole lot as a zip file and host it on my website for a while...

Latest Version can be found: here

If anyone has any thoughts and/or suggestions, let me know and I'll try and work them in... The problem is there is so much extra code now it is more new than old. If people feel this is too much bloat, should I consider forking this off into another module?

Cheers,
Andy

andykemp’s picture

The latest version now takes advantage of the work Chris did on the Regex, so it will now accept references like - Romans 1:5-2:7...

Any body fancy doing some testing and letting me know if it works on other systems...

Latest Version: Download - Same link as above...

Andy

andykemp’s picture

Errors on IE7 are now fixed! Trying to get rid of the p tags I ended up removing the param tags as well!

The new regex also allows you to enter things like Matthew 5:3;7;8;12!

Andy

andykemp’s picture

I have been playing around with jQuery and have managed to trim down the module a little by doing away with one of the js files and replacing it with a graphically more insteresting and code-wise much smaller piece of jquery script.

I have also tidyed up the menu's a little...

Latest version is at the same links as above.

Any comments?

andykemp’s picture

StatusFileSize
new40.34 KB

Incase this is preferable to anyone this is a patch version.

I amworking on getting a sandbox version together so people can have a play!

andykemp’s picture

I have now also created a sandbox site where people can have a play and get a better idea for the changes I have made to this module and the extra features which are now available.

Sandbox site can be found at http://sandbox.1kemp.co.uk/

andykemp’s picture

StatusFileSize
new40.2 KB

Spotted a little error... New patch attached

andykemp’s picture

StatusFileSize
new41.3 KB

First attempt as making the collapsing block gracefully degrade when js not available.

andykemp’s picture

the .html() jQuery command seems to crash IE, so I have had to rewrite it as an .after followed by a .remove which seems to work...
I'll do a fresh patch when I get home.

andykemp’s picture

the .html() jQuery command seems to crash IE, so I have had to rewrite it as an .after followed by a .remove which seems to work...
I'll do a fresh patch when I get home.

andykemp’s picture

StatusFileSize
new46.83 KB

Sorry about the double post! Here is the patch which now inlcudes the js files... finally worked out how to use patch properly within turtoiseCVS!

andykemp’s picture

StatusFileSize
new44.19 KB

I have done quite a bit of an initial tidyup of the code. I have also attempted to make it compliant with Bibleref Semantic Markup. It is not fully compliant as it doesn't correctly follow this following, as these are embeded within A tags anyway:

The title attribute format specification does not allow discontinuous spans of verses as a single reference. For example, a reference like "2Tim 2:14-19, 3:16-17" should be marked as two references.

I have also changed it so that there is now an option to just display the verse as a link for the ESV, and have got the Translation Regex happy (problem with NIV-UK being read as NIV) so you can enter passages as 1 Tim 2:3 NIV-UK or Romans 12:8 ESV. Because of this change the module now calls the necessary code for collapsible block or tooltip even when the default translation isn't the ESV that way if you add ESV after a quote it will still benefit from the js advantages following the style implied in the settings.

Default setting could be set to display verse as a link to reduce the overhead for those not planning on using the ESV - thoughts??

Would still really like to hear someone elses thoughts on this module? Am I wasting my time or are other people interested?

Cheers
Andy

andykemp’s picture

StatusFileSize
new56.44 KB

Okay! I think we are finally finished!

I have added in a couple of new translations NLV from bible gateway and the NRSV and Greek LXX - with a nice flash player which hides itself away in a collapsed div!

I'm sure there are probably still a few bugs in it, and a few bits that could be coded a little neater, but it is now basically finished.

Latest version is running on sandbox site: http://sandbox.1kemp.co.uk and the zip file is there as well.

Attached is a patch file.

Let me know any thoughts/ problems.

Cheers
Andy

andykemp’s picture

StatusFileSize
new56.45 KB

Sorry!! Couple of silly typo's now fixed

mfer’s picture

Some of these features look great. I love it.

I'm going to be on vacation (my honeymoon) and basically out of the loop for the next 3 weeks. When I get back I'll give this a good review of functionality, UI, and a code review. This is great. Keep up the good work.

gwhit’s picture

Thanks, Andy! I have scripturefilter incorporated into our church's website which is set to go live in less than a week. It's working just fine, and it fills a very real need. A couple observations:

  • the module doesn't show up in the 'Access control' listing; as a result, only 'user one' can administer the Scripture Filter options, since you can't give rights to any other user (such as the administrator role we have).
  • I added an crude hack on line 150 in scripturefilter.inc, adding 'target="_blank"' to the href so that links to Bible Gateway would open in a new window or tab rather than hijacking the drupal window. It would be nice to have a checkbox option to enable this behavior in the admin area. ( I'd be glad to try to implement this if you'd like--but only AFTER we have our site up and live!)
  • My original thought--before I ran across your discussion with Matt on the Geeks & God site--was to try to implement a CCK field that accepted a scripture reference and filtered it very much like this module does. My thought was that it might be useful to have the reference available as a field, allowing it's use in Views, etc. with more options for placement and theming... What do you think?

Keep up the great work! Thanks again, --Gary

andykemp’s picture

Thanks for the comments!

I'm not sure what happened to the access controls... They were definatly there at one point, I must have deleted them by accident! I'll take another look and add them back in!

With regard to the target="_BLANK", Ithough about this but left it out as this is no longer standards compliant, we could easily add a class id, and then use js to do this if you think it is a worthwhile addition.

The CCK field idea sounds interesting, and I would love to hear your ideas fleshed out as I am not quite certain how it would work.

Thanks again.
Andy

mfer’s picture

target="_blank" should not be used anymore. There are a lot of us who just don't like this. It's more of a let the user decide thing these days. Right click a link and choose new window or tab if that's what you want.

The compliant thing to do is use javascript to make this happen if you want to force it.

andykemp’s picture

StatusFileSize
new58.48 KB

Thanks for the comments.

I have added the option to have links open a new window/tab it uses a js file which is called when that option is selected and then adds the "ref=external" attribute to the link. The JS then adds the target=_blank afterwards...

Follows the system outlined here

Also added back the admin level option.

Any more comments/thoughts?

Patch File and Zip on Sandbox site have both been updated.

Cheers
Andy

gwhit’s picture

Thanks for the updates, Andy. I'll update our scripturefilter with the new code soon. The link you provided was helpful for understanding the issue, as well.

It turns out that the idea of a "scripture reference" CCK field is largely moot--you've already provided it! I just added regular text fields to my "Daily Reading" content type labeled "Reading" and "Key Verse", and then selected Filtered Input rather than plain text. Works great. Probably the additional functionality that would go into a dedicated scripture field-type would have to do with ensuring that the input was a valid Scripture reference (or try to tweak it into one). I couldn't justify the dev time, since scripturefilter meets the need quite well already.

andykemp’s picture

Thanks for the update! I'll give some more thought to the scripturefilter CCK field. It shouldn't be that hard to write a field which validates the field as a scripture passage and then runs it through the input filter. Most of the code should already exist for this within scripture filter...

I would envisage it being an add-on module with CCK and Scripture Filter as dependencies... But I am gladfor now you have found a satisfactory workaround!

Cheers
Andy

andykemp’s picture

StatusFileSize
new58.48 KB

John Staffin spotted a little mistake in that references were being prefixed with a space (due to the space between volume and book), which was causing problems...

I have added a trim around the $displaybook variable which fixes this

Patch attached.

mfer’s picture

Were you ever able to get ahold of Steve Simms about this?

andykemp’s picture

No I emailed him several times and he promised to look at it but I never heard anything else... I got the code to a point where I was happy with it and am using it regularly on my own site. It is just a shame it couldn't have been shared more widely.

I actually wonder now though if it isn't time for a complete rewrite in light of the eBible API which would enable us to do some of the nice things we are currently able to do for the ESV for a much wider range of translations (and I suspect for less work)...

Steve Simms’s picture

Hi Andy,

Sorry for not ever getting back to you on this. With all of the revisions and added features, it's basically an entirely different module, so I'm not sure how I could go about reviewing it -- I should have mentioned that a lot sooner, rather than letting it stand and hoping I'd get the chance to look at it in depth. That clearly hasn't happened.

If you're still interested in working on this module vs. creating your own as you mentioned elsewhere, could you split this patch up into smaller chunks, with one issue per patch, and create separate issues here for each one? As I mentioned in #221485: Port to 6.0, I'd especially like patches that make the code simpler and easier to maintain, and will probably not approve changes that add a lot of complexity -- that might help in your decision whether to work with this module or create your own.

What do you think?

Steve Simms’s picture

(I've also just updated all of the other open issues, so you can find some other thoughts there on possible improvements to the module.)

bbodenmiller’s picture

@Andy: What's the status here? Maybe it is time to breakout and create your own module. I like many of the things at http://drupal.org/node/202907 also that have not been added to this module. From the work I see here it looks like you would be a good guy to main a module. Also your sandbox is giving me a 500 error.

jamesoakley’s picture

Title: Updating Scripture Filter to take advantage of the ESV API » Updating Scripture Filter to take advantage of the ESV or eBible API
Version: 5.x-1.1 » 7.x-1.x-dev
Assigned: andykemp » Unassigned
Status: Needs review » Active

Having recently taken over maintaining this module, I'm looking at all the issues in the queue to take stock of the feature requests (and bug reports) that are outstanding.

It strikes me that this particular issue has become a little tangled, drawing in many separate changes and improvements into one growing patch. Patched, as it was, against 5.x, (two major core releases ago), that patch would need to be rerolled. However the usual Drupal way of having one feature or bug per issue is far cleaner and makes reviewing and committing code much easier.

The original proposal, however, was to take advantage of the ESV API, so that as the user hovers over the text, or clicks on / near the Bible reference, the actual verse(s) are displayed. I like that proposal, and it would be a good feature to implement in a later release of this module. The comment thread above also mentions that eBible.com have also developed an API, so it may be that something similar is possible for other translations too.

I'm therefore marking this issue as for version 7.x-1.x, and changing the status back to "active". It would be good to get a patch that would implement a feature like that.

I'm slightly lost as to which other new features were being suggested in the various comments above. If there were other new features in this issue thread that someone wants to see, please could they open a new issue for each one. That way, this issue can now be kept clean to refer only to using online Bible APIs to embed the verse-text itself in the node output.

jamesoakley’s picture

Title: Updating Scripture Filter to take advantage of the ESV or eBible API » Updating Scripture Filter to load verse text into the page itself

Changing the title of this issue, to make it clearer what it's about. This is about taking a website that provides an API to retrieve the actual text of the verses in question and then embed that text in the page itself. The text would then be displayed in a popup, tooltip, or something like that.

This is distinct from, e.g., reftagger, which is one of a few javascript libraries that exist which will do this kind of lookup in the client. There is a place for that, but those javascript libraries do their own pattern matching to find Bible references. The benefit of this input filter is that it is not dependent on the web browser having javascript enabled, so this would be about looking up the verse text on the server.

Clearly a feature like this would need to be optional on any given site. It would be a fair bit of work to get it working, as some kind of cache would need to be implemented to avoid flooding the API.

The only site I'm aware of that provides this kind of API is http://bibles.org/pages/api. eBible (see earlier issue titles) used to, but no longer does. http://www.esvapi.org/ does, but only for the ESV.

jamesoakley’s picture

Status: Active » Postponed

Postponing this issue.

This is a feature request. The highest priority feature for Scripture Filter is preparing a Drupal 8 version. Once a Drupal 8 version is ready, I can then turn my attention to working on improvements. Those would be developed for Drupal 8 first, and then backported.

jamesoakley’s picture

Version: 7.x-1.x-dev » 2.0.x-dev
Issue summary: View changes
Status: Postponed » Active
jamesoakley’s picture

Issue summary: View changes

@tonytheferg expressed an interest in developing exactly this feature over at #3300103: Scripture in pop up. Tony, let's continue this conversation over here.

My main question would be: What API / data source would you use to pull the Bible text in? See #38: bibles.org is the only one I've found. This had new owners; I reached out to them in 2014 and they suggested this could be done using their API. They pointed me to a webpage that now redirects to https://scripture.api.bible/. It's free for non-commercial use, up to 500 consecutive verses at a time, up to 5,000 queries a day.

  1. So the code would need some kind of mechanism to check that only short enough passages are being requested. (Long passages aren't really suitable for display like this anyway).
  2. Some kind of caching mechanism would be needed to prevent the server requesting the same verses repeatedly - both to prevent slowness and to avoid hitting the 5k queries limit.
  3. Indeed, would we want time to first byte ever to be slowed down by the server potentially waiting for multiple API calls? Probably not. So either we do this lazily then insert with AJAX. Or the cache is checked. Verses that are already in the cache are inserted; others are added to a processing queue in the hope that subsequent page visits would find the verse is ready.
  4. It would need to fail elegantly if there's any error. But if this isn't synchronous this becomes less of an issue.
  5. The Bible text returned would need sanitising to make sure malicious code can't be injected in the page.

Those are the thoughts already in my head. Now someone other than me has expressed an interest in working on this, I'll put those thoughts here, and invite you to share yours.

tonytheferg’s picture

Maybe we can have a look at this
https://faithlife.com/products/reftagger

jamesoakley’s picture

reftagger

See my comment in #38 above