If the spaces in scripture references use &nbsp instead of a plain space, then the Scripture Filter module doesn't add a hyperlink.

This was reported back in 2009, and not acted on. The issue was then closed "feature by design", but the OP returned to the issue in July 2014 to argue the merits of handling non-breaking spaces.

A patch was proposed in #6 that needs reviewing.

Comments

cmcqueen1975’s picture

Is the attached file any good as an improvement?

cmcqueen1975’s picture

StatusFileSize
new2.59 KB

Is the attached file any good as an improvement?

jamesoakley’s picture

Status: Active » Closed (works as designed)

This feature is by design.

Let me explain:

The aim of a filter like this is to enable people to type in ordinary, unformatted text and to have it rendered for them in a smarter way - in this case adding in hyperlinks where there are Scripture references. Once someone starts entering things like " ", they are not entering plain text any more, but have turned it into the HTML they want. Whilst it's theoretically possible to detect such things within a filter like this, and handle them all the same, it complicates what is quite a simple module. Also, there are other character entities, so where does one stop?

The other consideration is that people are using this module on live sites and have discovered that sometimes the filter has false positives - it picks out Scripture references that aren't. E.g., see #238898: String "The" is being mistaken as an abbreviation for "Thessalonians". To deal with that, people are using work-arounds like escaping some characters to "trick" Scripture Filter into not making that mistake. If we change the level at which the module works at this point, we would break all those sites that people have built. How to handle entities like   was a design decision that had to be made when the module was first written, and we need to stick with the decision now we've taken it.

craig.mcqueen’s picture

In my case, I would prefer the handling as I have described, for reasons which I think are also quite legitimate. It would be nice if we could make it configurable.

...people are using this module on live sites and have discovered that sometimes the filter has false positives - it picks out Scripture references that aren't. E.g., see #238898: String "The" is being mistaken as an abbreviation for "Thessalonians". To deal with that, people are using work-arounds like escaping some characters to "trick" Scripture Filter into not making that mistake. If we change the level at which the module works at this point, we would break all those sites that people have built.

The false match for "The" sounds like a bug, if it wasn't requiring a preceding "1" or "2". "The 2008" isn't a valid scripture reference, so that's really a non-issue. Though I could imagine something like "John 4 Tess 4 eva & eva" producing a false match on the "John 4" part.

You've got a point, so I can see why you'd at least want to make it a configurable feature. I suppose <!-- --> could still be a valid work-around.

Also, there are other character entities, so where does one stop?

Maybe use PHP html_entity_decode() function.

Once someone starts entering things like " ", they are not entering plain text any more, but have turned it into the HTML they want.

Well, not really. I want to enter &nbsp; for typographic reasons. But I don't want to have to manually put in links, because it would be a pain to have to update them all manually. It's much better to use a Scripture filter module to automate that.

But now that I think about it, it could also be a good feature for the Scripture filter to insert the &nbsp; for me. Hmm a possible extra feature.

Would you reconsider this, or would someone else need to code it and offer it as an alternative scripture filter module?

jamesoakley’s picture

Version: 6.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Needs work

Hi Craig

I think you've argued it well, and ideally the module would (a) match &nbsp as though it were " "; (b) turn " " into &nbsp within matched Scripture references - typographically the result looks better.

Thanks for making the case so clearly.

Would you reconsider this, or would someone else need to code it and offer it as an alternative scripture filter module?

Yes, I'd reconsider it.

(Not being sure how familiar you are with the Drupal issue queues...) The way Drupal works is that anyone can propose a patch for a module that will introduce a new feature or change the way it works. (They set the issue to "Needs Review" when they've done that). Others can then review to check the code works as intended, and report back here when they've done that. Once more than one person thinks it's OK, they can mark it as "Reviewed and Tested".

But for the patch to be committed, a module maintainer has to commit it.

So saying I'd reconsider it translates into: (a) Someone else is welcome to code it, other people are welcome to review it, and I'd gladly commit it, or (b) Someone else is welcome to code it, and I'll see if I can find the time to review it and then commit it, (c) When I get time, I'll work on it myself, and either post a patch for review or just commit (if I'm confident I've got it right).

I'll set this issue back to "needs work", as that then invites anyone who wishes to work on it. (Also setting the version back to 7.x-1.x-dev, because we always work on the most recent version first then backport to older versions).

jamesoakley’s picture

Status: Needs work » Needs review
StatusFileSize
new3.83 KB

I think this does both:

It allows non-breaking spaces in the Scripture references;
it inserts non-breaking spaces into the HTML when a Scripture reference is detected.

It was quite a few changes; would anyone care to review it?

jamesoakley’s picture

Issue summary: View changes

Updated issue summary

jamesoakley’s picture

Category: Bug report » Feature request