[sword-devel] Cross-references module

Troy A. Griffitts scribe at crosswire.org
Mon Jun 23 09:42:18 MST 2008


You can get all the xrefs from an entry by grabbing the note type xref 
entry attributes.  Have a look at sword/examples/cmdline/lookup.cpp  Run 
it on the ESV like this:

./lookup ESV jn1.1

it dynamically iterates the entry attributes. You'll see how the xrefs 
are stored.  Once you know what attributes you want, you don't have to 
use the dynamic code, it's easier to just use something like:

SWBuf fnNumber;
int i = 1;
while (true) {
   fnNumber.setFormatted("%d", i);
   SWBuf type = module->getEntryAttributes()["Footnote"][fnNumber]["type"];
   if (!type.length()) break;
   if (type == "crossReference") {
     SWBuf refList = 

That should do it.  You might have to add a little more error checking, 
in case no footnotes at all exist for an entry, but should give you what 
you want.

Hope this helps,


asrael wrote:
> jhphx wrote:
>> Manfred Bergmann wrote:
>>> I would like to have a subview somewhere in the bible view that shows  
>>> the cross-references of the verses that are currently displayed. When  
>>> the bible view is scrolled, the cross-reference view is synched in  
>>> scrolling so that one can always see cross-references to the currently  
>>> displayed verses.
>> I think this would be a front end feature and not a module structure. Do 
>> a lookup in the commentary module and find the info for all the verses 
>> of the passage being displayed in the bible module and strip out the 
>> comments and use just the cross-references to produce a list of verses 
>> to display.
> That sounds like a good idea.
> How would you strip out the comments? Do you mean in the module source or
> while using the commentary module in the front-end?
> To get the text from a module I would call stripText() or renderText(). I'm
> not sure whether I would distinguish between keys in comments and
> cross-references.
> Manfred

More information about the sword-devel mailing list