View Single Post
 
Old 10-15-2017, 05:13 AM
slaycock slaycock is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Your explanation still isn't helping.

You've clarified that

1. John 15:1-3 is a single hyperlink
2. John 15:1,2 is a single hyperlink
3. John 15:1,3 is two hyperlinks (and is not the same as the reference John 15:1-3).

So we need to find a way of differentiating cases 2 and 3 by code.

The current rules for finding references are as follows

1. Search for a stem reference.

A stem reference is an Authority name, followed by one or more spaces followed by one or more numbers terminating with a colon e.g. John 15:

2 look at the character after the range containing the reference. Depending on the character found we so one of 4 actions

a. Hypen

b,Comma

c terminating character (semi-colon, period, space, right bracket

d Character not included in a, b or c


If we have case d it is a malformed reference so currently we highlight the reference in red and then continue from 1

If we have case c we insert the hyperlink and continue from 1

if we have case b we insert the hyperlink and then look for a short form reference (which is just a number). If we don't find a number we currently ignore the fact that there was a comma and continue from 1. If we do find a number then we insert a hyperlink which is constructed using the stem reference we found in 1 plus the current number.


Based on the discussion so far I think I have to change the rules above as follows

if we have case b

Preserve the current reference range

Look ahead to see if the comma is followed by spaces then a number ( a short form reference)

Compare the verse number in the stem reference to the verse number in the short form reference.

If the verse number in the short form reference is the verse number in the stem reference +1 then insert a single hyperlink using the stem reference and the short form reference

Otherwise insert two separate hyperlinks.

If the proposal above doesn't work then we are stuck as we have no way of programatically deciding what to do after we find a reference followed by a comma.
Reply With Quote