Discussion:
[sword-devel] Problem with Intros
Manfred Bergmann
2014-10-06 13:41:48 UTC
Permalink
Hi.

Since once of the larger refactorings in SWORD my code for retrieving mod, book, chapter introductions doesn't work anymore.
So I've tried to adapt according to introtest.cpp.
But I can only get it to work for book introductions. Chapter and module doesn't work.
This basically is the code for module introductions:

- (NSString *)moduleIntro {
sword::VerseKey key;
key.setIntros(true);
key.setPersist(true);
key.setAutoNormalize(false);
[self setSwordKey:[SwordKey swordKeyWithSWKey:&key]];

key.setVerse(0);
key.setChapter(0);
key.setBook(0);
key.setTestament(0);

return [self renderedText];
}

But -renderedText or the SWORD function it calls: renderText() returns nothing.

Are there any known issues I have to be aware of?



Manfred
Troy A. Griffitts
2014-10-07 00:17:54 UTC
Permalink
Hi Manfred,

I am not sure if this has anything to do with your problems but the code snippet you sent uses the old methodology of constructing a standalone VerseKey and using setPersist, which has been deprecated due to av11n. When you construct an instance of VerseKey standalone like that, the best we can do is assume KJV versification scheme. It's best to either simply grab the module's key with module.getKey(), which will already have v11n set appropriately for the module and changing this key's position will adjust your module location, as in the old persist methodology before, or else construct and delete a new key if you need a separate one using module.createKey().

Hope this helps some,

Troy
Post by Manfred Bergmann
Hi.
Since once of the larger refactorings in SWORD my code for retrieving
mod, book, chapter introductions doesn't work anymore.
So I've tried to adapt according to introtest.cpp.
But I can only get it to work for book introductions. Chapter and module doesn't work.
- (NSString *)moduleIntro {
sword::VerseKey key;
key.setIntros(true);
key.setPersist(true);
key.setAutoNormalize(false);
[self setSwordKey:[SwordKey swordKeyWithSWKey:&key]];
key.setVerse(0);
key.setChapter(0);
key.setBook(0);
key.setTestament(0);
return [self renderedText];
}
But -renderedText or the SWORD function it calls: renderText() returns nothing.
Are there any known issues I have to be aware of?
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
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20141007/e6362a33/attachment-0001.html>
Manfred Bergmann
2014-10-09 06:49:08 UTC
Permalink
Got it sorted, thanks.


Manfred
Post by Troy A. Griffitts
Hi Manfred,
I am not sure if this has anything to do with your problems but the code snippet you sent uses the old methodology of constructing a standalone VerseKey and using setPersist, which has been deprecated due to av11n. When you construct an instance of VerseKey standalone like that, the best we can do is assume KJV versification scheme. It's best to either simply grab the module's key with module.getKey(), which will already have v11n set appropriately for the module and changing this key's position will adjust your module location, as in the old persist methodology before, or else construct and delete a new key if you need a separate one using module.createKey().
Hope this helps some,
Troy
Hi.
Since once of the larger refactorings in SWORD my code for retrieving mod, book, chapter introductions doesn't work anymore.
So I've tried to adapt according to introtest.cpp.
But I can only get it to work for book introductions. Chapter and module doesn't work.
- (NSString *)moduleIntro {
sword::VerseKey key;
key.setIntros(true);
key.setPersist(true);
key.setAutoNormalize(false);
[self setSwordKey:[SwordKey swordKeyWithSWKey:&key]];
key.setVerse(0);
key.setChapter(0);
key.setBook(0);
key.setTestament(0);
return [self renderedText];
}
But -renderedText or the SWORD function it calls: renderText() returns nothing.
Are there any known issues I have to be aware of?
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
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
_______________________________________________
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
Loading...