[sword-devel] Efficiently extracting section + chapter headers

Tobias Klein contact at tklein.info
Thu Jan 6 11:41:31 EST 2022


Hi Troy,

I have started looking again into extracting book headings, so that I 
can generate a book outline in Ezra Bible App even when looking at 
individual chapters only. I had stopped looking at it when I was not 
successfully generating a Windows build any longer last year - but I 
could fix that, so now the work continues.

I based my code on your example findHeadings.cpp.

It seems like the list of extracted headings is not complete, though.

When running this with the module GerNeUe and the book Acts I find that 
the headers returned are only section headers, but not chapter headers. 
Could you have another look based on the example and GerNeUe/Acts and 
advise?

I have attached a list of headers that I get from the Bible text of 
GerNeUe/Acts - just for reference.

Best regards,
Tobias

On 4/12/21 9:07 PM, Troy A. Griffitts wrote:
> 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 --------------
DIE TATEN DER APOSTEL, AUFGESCHRIEBEN VON LUKAS (Apostelgeschichte)
Zwischen Himmelfahrt und Pfingsten
Ersatz für Judas
Das Eintreffen des versprochenen Geistes
Die Pfingstpredigt des Petrus
Die Entstehung der ersten Gemeinde
Die ersten glücklichen Tage
Die Folgen einer Heilung
Stegreifrede auf dem Tempelplatz
Aufforderung zur Umkehr
Vor Gericht
Die Urteilsverkündigung
Gebet der Gemeinde
Harmonie in der Gemeinde
Selbstsucht und Heuchelei
Das Ansehen der Gemeinde wächst
Verhaftungsgrund: Neid
Spannung in der Gemeinde
Anklage gegen die Wahrheit
Verteidigung als Bekenntnis
Die Rache der Rasenden
Die erste Christenverfolgung
Verfolgung als Missionsstrategie
Der erste Nichtjude wird Christ
Der Verfolger wird Christ
Saulus wird nach Hause geschickt
Zwischenbilanz in Israel
Mission in Judäa
Dürfen Nichtjuden zur Gemeinde gehören? 
Petrus muss sich rechtfertigen
Gemeinde aus Nichtjuden
Barnabas in Antiochia
Gewalt gegen die Führer
Tod von Herodes Agrippa I. 
Die Ältesten von Antiochia
Beginn der ersten Missionsreise
Im südlichen Galatiena: Antiochia
Auch Nichtjuden gilt die Botschaft
Im südlichen Galatien: Ikonion
Im südlichen Galatien: Lystra
Im südlichen Galatien: Derbe
Rückreise nach Antiochia in Syrien
Die Apostelversammlung in Jerusalem
Beginn der zweiten Missionsreise
Der Ruf aus Mazedonien
Das Evangelium kommt nach Europa
Im Gefängnis
Die Arbeit in Thessalonich
In Athen
In Korinth
Rückreise nach Antiochia
Aufbruch zur dritten Missionsreise
Missionsarbeit in Ephesus
Aufstand der Silberschmiede
Paulus in Mazedonien und Griechenland
Abschiedsbesuch in Troas
Treffen mit den Ältesten von Ephesus
Reise nach Jerusalem
Der Rat des Jakobus
Verhaftung des Paulus
Rede an eine tobende Menge
Paulus und der Kommandant
Rede vor dem Hohen Rat
Verschwörung gegen Paulus
Überführung nach Cäsarea
Paulus und Felix
Paulus und Festus
Agrippa interessiert sich für Paulus
Rede vor Agrippa und Gästen des Festus
Abreise nach Rom
Im Sturm
Der Schiffbruch
Winter auf Melite
Von Melite nach Rom
Als Gefangener in Rom


More information about the sword-devel mailing list