[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
HTMLREF set:
// 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
==Raw=Entry===============
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.
==Render=Entry============
Jesus also was invited to the wedding with <a
href="passagestudy.jsp?action=showNote&type=x&value=1&module=ESV&passage=John+2%3A2"><small><sup>*x</sup></small></a>his
disciples.
==========================
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.setKey(key);
mod.RenderText(); // force processing of entry-- kindof silly
SWBuf refList =
mod.getEntryAttributes()["Footnote"][noteNumber]["refList"];
VerseKey parser(key);
ListKey refs = parser.ParseVerseList(refList, parser, true);
for (refs = TOP; !refs.Error(); refs++) {
mod.setKey(refs);
// do something with the verse text
cout << mod.getKeyText << ": " << mod << "\n";
}
}
}
Hope this helps (and works).
-Troy.
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