[sword-devel] patch for OSISHeadings

Nic Carter niccarter at mac.com
Fri Aug 6 22:14:20 MST 2010


Heya all,

Been looking a headers in PocketSword and trying to get them to work for an Irish module.  Then discovered that the LEB has been released to the main CrossWire repo & has the same headings issue.

After discussing it with Karl & Greg on IRC, I've found the issue & given my lack of understanding of lots of stuff to do with filters, I've hacked a solution rather than rewrite things nicely............

The "hack" bit of it means that for ABN & LEB, both the interverse & preverse headings will be set.  So, in PocketSword I simply check for a pre-verse heading.  If it is !null I display it.  & if it's !null, I then don't display an interverse heading.  However, this doesn't happen for the ESV - it will only set the appropriate heading (either interverse or preverse).  So, if this patch is applied and frontends don't take it into account, the worst that will happen is that for the LEB & ABN & other such modules, there will be double headings, whereas for the ESV, it will still work fine.  :)
Yes, this isn't a correct way of fixing this but it appears to work for both the LEB & ESV modules.  :D
It may need some more testing for interverse headings, as I believe they don't appear that often in the ESV & so it's hard to stress test it.  :)

change is for osisheadings.cpp:
@@ -119,7 +119,7 @@
 					continue;
 				}
 				if (hide && tag.isEndTag(pvDID)) {
-					if (module->isProcessEntryAttributes() && ((option || canonical) || (!preverse))) {
+					if (/*module->isProcessEntryAttributes() nicc: fixes LEB headings &&*/ ((option || canonical) || (!preverse))) {
 						if (preverse) {
 							sprintf(buf, "%i", pvHeaderNum++);
 							module->getEntryAttributes()["Heading"]["Preverse"][buf] = header;

Anyway, I'm done for the day, shoot me through thoughts, comments & suggestions.  :)


Thanks, ybic
	nic...  :)

ps: yes, I know it's a hack.  :P

----
Nic Carter
PocketSword Developer - an iPhone Bible Study app
www: http://crosswire.org/pocketsword
iTunes: http://itunes.apple.com/app/Pocketsword/id341046078
Twitter: http://twitter.com/pocketsword




More information about the sword-devel mailing list