WordPress.org

Plugin Directory

the-holy-scripturizer

Opened 9 years ago

Last modified 9 years ago

#890 assigned defect

4 digit chapter numbers incorrectly recognised as a bible reference

Reported by: jon47 Owned by: petervcook
Priority: normal Severity: normal
Plugin: the-holy-scripturizer Keywords:
Cc: jon@…

Description

v1.8.2 recognizes 4 digit numbers as being a potential chapter number, which is a problem for reference to, for example, the Children Act 1989, where Act 1989 is turned into a bible reference.

I've attached a patch which changes the verse_regex in two ways:

  • the [-&,] pattern must appear at least once, instead of 0 or 1 times
  • the verse must be followed by a word break

The first of these is necessary because everything was optional between the first match 1-3 digits for the chapter, and the final match 1+ digits of a follow on verse. This meant that it would match Act 123456789 as a reference to Acts chapter 123456789.

The second is necessary because just the first change matches Act 1989 as a ref to Acts 198, with a non-hyperlinked 9 immediately following.

Attachments (1)

scripturizer.php.diff (196 bytes) - added by jon47 9 years ago.
patch

Download all attachments as: .zip

Change History (4)

@jon479 years ago

patch

comment:1 follow-up: @petervcook9 years ago

  • Owner changed from laurence0 to petervcook
  • Status changed from new to assigned

Good find. Could you re-upload your solution. The .diff file is just showing one blank line

comment:2 @jon479 years ago

The diff shows some real content if you download it in "original format". I don't know why it's showing as a blank line in trac.

Here's the diff:

471c471
<     $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&amp;|&ndash;|[-&,])?\s?\d+))*";
---
>     $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&amp;|&ndash;|[-&,])+\s?\d+))*\b";

Jon

comment:3 in reply to: ↑ 1 @jon479 years ago

  • Cc jon@… added

Replying to petervcook:

Could you re-upload your solution. The .diff file is just showing one blank line

The diff shows some real content if you download it in "original format". I don't know why it's showing as a blank line in trac.

Here's the diff:

471c471
<     $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&amp;|&ndash;|[-&,])?\s?\d+))*";
---
>     $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&amp;|&ndash;|[-&,])+\s?\d+))*\b";

Jon

Note: See TracTickets for help on using tickets.