the-holy-scripturizer
Opened 18 years ago
Last modified 18 years ago
#890 assigned defect
4 digit chapter numbers incorrectly recognised as a bible reference
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| 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)
Change History (4)
#1
follow-up:
↓ 3
@
18 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
#2
@
18 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?(?:&|–|[-&,])?\s?\d+))*";
---
> $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&|–|[-&,])+\s?\d+))*\b";
Jon
#3
in reply to:
↑ 1
@
18 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?(?:&|–|[-&,])?\s?\d+))*";
---
> $verse_regex="\d{1,3}(?:[:.]\d{1,3})?(?:\s?(?:\s?(?:&|–|[-&,])+\s?\d+))*\b";
Jon
patch