[sword-devel] engine reference parsing
Troy A. Griffitts
scribe at crosswire.org
Thu Nov 4 04:20:14 MST 2010
You should get no joy from using '.' as a list separator. Currently the
engine parser uses ':' and '.' as separators between chapter and verse.
Scope should work well in your examples if you change your punctuation
to swap '.' for ',' and ',' for ':'.
When we internationalize the separator characters, as discussed about 3
weeks ago on the '-' in bookname thread, then your syntax should work
fine. Another issue DM pointed out we'll need to deal with is which
'mode' to use when parsing references. No longer can we try to handle
any mode, as frequently used characters like ',.:' will mean different
things depending on which mode you are in. I'm of the same mind that
new modules should use osisRef syntax which explicitly specifies the
list, range, and chap/verse divider character. Then in the pros, the
module can have anything they want, e.g.,
<reference osisRef="Ps.35.1 Ps.90.2 John.1.1">Ps 35,1;90,2;Joh
But currently we just throw anything at the parse and it will try to use
your currently locale AND the English locale to parse reference or
osisRef. osisRef and German, for example, if we localize the '.' as the
list separator, will no longer live happily together.
Noted. On my list to think about. Thanks for the input.
On 11/04/2010 09:01 AM, Peter von Kaehne wrote:
> A recent thread referred to some necessary/useful enhancements.
> Here are a couple of cases which get currently handled badly and would
> be really useful if handled correctly:
> 1) lists of verses within the current scope
> V. 18.104.22.168;V. 20.24.26;V. 29;
> Trying to parse this with (in Perl)
>> Sword::VerseKey::convertToOSIS($_, $scope)
> results in only the last reference being recognised but all initial ones
> being ignored or are read as Rev.22.21 depending on what separation
> markers I use.
> 2) several references from same book in row:
> Ps 35,1;90,2;Joh 1,1;
> The middle Psalm 90.2 is not recognised.
> sword-devel mailing list: sword-devel at crosswire.org
> Instructions to unsubscribe/change your settings at above page
More information about the sword-devel