[sword-devel] HTMHREF footnote URL to footnote text (was: SwordReader .......)

Troy A. Griffitts scribe at crosswire.org
Sun Nov 25 12:16:34 MST 2007


> The main known problem now is that although footnotes produce a popup 
> when tapped, the popup contains an html reference instead of the note.  
> Anyone suggest what I might be looking at here?

What info do you get in the html reference?  Is it enough to do a lookup 
for the entry?  If not, we need to look at the filter set used by 
swordreader, though I suspect its probably something common like 
HTMLHREF.  If so, you should be able to use the URL class provided in 
utilfuns/url.cpp to extract the values you need for the lookup, then you 
can use those to grab the footnote text to display.   Something like:

include <url.h>

...

URL footnote(your_url_string_which_displays_in_popup);
SWBuf module = footnote.getParameterValue("module");
SWBuf key = footnote.getParameterValue("passage");
SWBuf footnoteNumber = footnote.getParameterValue("value");

// Now that you have extracted all the info you need from the URL,
// you can lookup the footnote...

// get the module it's in
SWModule *mod = swmanager.getModule(module);
// set that module to the correct entry
mod->setKey(key);
// force a parse of the entry
mod->RenderText();
// grab the correct footnote from that entry
SWBuf footnoteText = mod->getEntryAttributes()["Footnote"][footnoteNumber];
// convert from base markup to display markup
footnoteText = mod->RenderText(footnoteText);
// now you can display footnoteText in your popup
...

I haven't tried compiling this, but it should be close.





More information about the sword-devel mailing list