[sword-devel] HTMHREF footnote URL to footnote text

Barry Drake b.drake at ntlworld.com
Fri Nov 30 10:10:17 MST 2007

Hi Troy ...........

Troy A. Griffitts wrote:
> Barry, it looks like SwordIndex declares it as a static, so you should 
> be able to simply use it 
I'm probably pushing your patience to the limit here.  What you've 
suggested works just fine, and I get the SWMgr .......  but I get a 
problem when I try to show the footnote.  The code is below.  I've set 
up three MessageBox calls to show footnotes, verse text and raw verse 
text.  The raw verse text is correct ever time.  But in the other two 
messageboxes, I only get to see the first character of the footnote or 
the verse text ....  these are correct every time, so I know the call is 
getting the right information.  Am I missing something quite silly?  
Look at the bottom three lines of the code for the messageboxes.  
Apologies in advance for my lack of knowledge.

My next step is to try and get the command line version up and running, 
but I'm so close with this one that I haven't spent the time doing that 
as yet.

URL footnote(t);  // t is char* to URL string
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 = SwordIndex::manager->getModule(module);
// set that module to the correct entry
// force a parse of the entry
// grab the correct footnote from that entry
//SWBuf footnoteText = 
mod->getEntryAttributes()["Footnote"][footnoteNumber];  // this line 
doesn't get the footnote
SWBuf footnoteText = 
// either this or the line below gets exactly the same
//SWBuf footnoteText = 
// convert from base markup to display markup
footnoteText = mod->RenderText(footnoteText);
// now you can display footnoteText in your popup 
MessageBox(0, strtowstr(footnoteText), L"Footnote", MB_OK);  // this 
displays the first character of the footote correctly every time
MessageBox(0, strtowstr(mod->RenderText()), L"Verse text", MB_OK); // 
this displays the first character of the verse correctly every time
MessageBox(0, strtowstr(mod->getRawEntry()), L"mod->getRawEntry()", 
MB_OK); // this displays exactly what you'd expect and is the correct verse

God bless,

-- From Barry Drake (The Revd) minister of the Netherfield United Reformed church, Nottingham see http://www.jesusinnetherfield.org.uk for our church homepages).

Replies - b.drake at ntlworld.com

More information about the sword-devel mailing list