[sword-devel] Efficiently extracting section + chapter headers

Tobias Klein contact at tklein.info
Tue Apr 13 15:16:03 EDT 2021


Thank you so much, Troy! I appreciate it!
I'll give this a try soon! This will then probably turn into a new API 
function of node-sword-interface.

I will also check once more regarding the CMake zlib issue on Windows. 
Before that is fixed I can't really integrate new SWORD trunk versions.

Tobias

Am 12. April 2021 21:08:12 schrieb "Troy A. Griffitts" <scribe at crosswire.org>:

> Sure Tobias,
>
> module->getEntryAttributes() will allow you to pull the headings from a
> verse, and
>
> an Entry Attributes search for '/Heading' will give you only the verses
> with Heading entries attributes.
>
> I've thrown together a quick example here, which you can use with
> something like:
>
> ./showHeadings NASB Matt-John
>
> which will give you the headings from the Gospels.
>
> https://crosswire.org/svn/sword/trunk/examples/tasks/findHeadings.cpp
>
> Creating this example, I found I needed to fix a bug in the engine.  The
> engine Entry Attributes search lets you search for values in the entry
> attributes (e.g., a Strong's number 1234).  In your use case, when
> searching, you don't care about the value; you only care about
> presence.  This wasn't working, but simple presence can now be searched
> for with my latest commit.
>
> Hope this helps,
>
> Troy
>
>
> On 4/12/21 9:31 AM, Tobias Klein wrote:
>> Hi,
>>
>> I have been getting a request from a user to render section headings 
>> independently of the currently opened bible translation module.
>>
>> So for example when opening the KJV still using the section/chapter headers 
>> of the NASB.
>>
>> This would be useful in those cases when the respective bible translation 
>> module does not come with section/chapter headers, but another one does.
>>
>> A requirement would be to efficiently extract section/chapter headers from 
>> a module using the SWORD API. As of now I only see that you can iterate 
>> over the verses of a book and individually scan each verse for the headers. 
>> Is there a more efficient way of doing that?
>>
>> Another use case could be to render a book outline. This is what I am 
>> already doing now in Ezra, but in a way that is not so clean (I am 
>> traversing the DOM looking for all section header elements of the current 
>> book).
>>
>> Best regards,
>> Tobias
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
> _______________________________________________
> sword-devel mailing list: sword-devel at crosswire.org
> http://crosswire.org/mailman/listinfo/sword-devel
> Instructions to unsubscribe/change your settings at above page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://crosswire.org/pipermail/sword-devel/attachments/20210413/f1b1b1ce/attachment.html>


More information about the sword-devel mailing list