[sword-devel] HTML filter cross references link

Troy A. Griffitts scribe at crosswire.org
Fri Jul 25 04:57:06 MST 2008

Dear Manfred,

Changing a line near the top of lookup.cpp swapping the filter use the 

//   SWMgr manager(new MarkupFilterMgr(FMT_WEBIF));
      SWMgr manager(new MarkupFilterMgr(FMT_HTMLHREF));

and running:

./lookup ESV jn2.2

Produces this:

[scribe at laptop cmdline]$ ./lookup ESV jn2.2
John 2:2:
Jesus also was invited to the wedding with <note type="crossReference" 
osisID="John.2.2.xref_j" n="j"><reference 
osisRef="John.1.40-John.1.49">ch. 1:40-49</reference></note>his disciples.
Jesus also was invited to the wedding with <a 
Entry Attributes:

[ Footnote ]
	[ 1 ]
		body = <reference osisRef="John.1.40-John.1.49">ch. 1:40-49</reference>
		n = j
		osisID = John.2.2.xref_j
		refList = John.1.40-John.1.49
		type = crossReference

 From looking at this, I see in the Render Entry section a *x 
superscript link.  If you add a link click handler which receives the 
href data from that link you can get the footnote information with code 
something like:

void linkClickHandler(const char *href) {
   URL url(href);
   SWBuf type = url.getParameterValue("type");
   SWBuf module = url.getParameterValue("module");
   SWBuf key = url.getParameterValue("passage");
   SWBuf noteNumber = url.getParameterValue("value");

   // be sure it's a crossref
   if (type =="x") {
     SWModule *mod = swordManager.getModule(module);
     mod.RenderText();  // force processing of entry-- kindof silly
     SWBuf refList = 
     VerseKey parser(key);
     ListKey refs = parser.ParseVerseList(refList, parser, true);
     for (refs = TOP; !refs.Error(); refs++) {
       // do something with the verse text
       cout << mod.getKeyText << ": " << mod << "\n";

Hope this helps (and works).


Manfred Bergmann wrote:
> Hi.
> I trying to figure out how to get or show cross-references.
> If I use ESV and apply the OSISHTMLHREF filter a link is displayed  
> next to the word that has a cross reference attached.
> But the link data doesn't give the actual cross-reference, there is a  
> passage attribute which is the current verse.
> I think I need some help.
> Regards,
> Manfred
> _______________________________________________
> 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

More information about the sword-devel mailing list