[sword-devel] How are linked verses encoded in our modules?

DM Smith dmsmith at crosswire.org
Thu Nov 15 07:22:45 MST 2018


And for an arbitrary reference you may have to check the previous verses, too. 

— DM Smith

> On Nov 15, 2018, at 9:05 AM, Greg Hellings <greg.hellings at gmail.com> wrote:
> 
> In the olden days this was detected by incrementing to the next verse, calling renderText(), and doing a string comparison between it and the previous verse to determine if they were the same.
> 
> Nowadays there is a method on SWModule named "isLinked(SWKey*, SWKey*)". It has slightly more complicated logic (it doesn't render out the text, so it's not susceptible to differences in filter and option settings, etc) and should be more efficient than just a string comparison. You can pass it two verse keys and it will tell you if they both point to the same entry or not. You need to keep two copies of two different keys, increment one, ask the module if they're linked. If they are, then keep incrementing one until you get to the next verse that isn't linked. If they are not, then set the base key equal to the incremented key and render out the next verse.
> 
> --Greg
> 
>> On Thu, Nov 15, 2018 at 5:09 AM Peter Von Kaehne <refdoc at gmx.net> wrote:
>> How are linked verses practically encoded? 
>> 
>> I would like to fix the diatheke etc at some point to not put out duplicate verses and I do know that xiphos etc do not do so, so what wouldl I need to look for?
>> 
>> Thanks
>> 
>> Peter
>> 
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20181115/7eaaea98/attachment-0001.html>


More information about the sword-devel mailing list