<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Thank you, Troy!</p>
<p>The setIntros call on the VerseKey does not help in getting the
chapter headers in the context of the entry attribute search. I am
getting the same results as without setting it.<br>
</p>
<p>Best regards,<br>
Tobias<br>
</p>
<div class="moz-cite-prefix">On 1/8/22 3:58 PM, Troy A. Griffitts
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:A9FDA7B3-F9FE-4A62-9B00-0DB229CDF54D@crosswire.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Sorry Tobias,<br>
<br>
Yes, I incorrectly told you to call setIntros on SWModule instead
of VerseKey.<br>
<br>
- module->setIntros(true);<br>
+ ((VerseKey *)module->getKey())->setIntros(true);<br>
<br>
That's a bit ugly typed from my phone, with no check to be sure
the cast succeeds, but should get the point across.<br>
<br>
I should actually have some time this weekend to try some of these
suggestions before emailing you 🙂<br>
<br>
Troy<br>
<br>
<div class="gmail_quote">On January 8, 2022 1:15:18 AM MST, Tobias
Klein <a class="moz-txt-link-rfc2396E" href="mailto:contact@tklein.info"><contact@tklein.info></a> wrote:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<p>Hi Troy,</p>
<p>Thank you so much for looking into this!</p>
<p>setIntros is not available on SWModule, but only on SWKey.</p>
<p>I suppose the setIntros must be used like this?<br>
</p>
<div style="color: #d4d4d4;background-color: #1e1e1e;font-family: 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback';font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">SWKey</span><span style="color: #d4d4d4;"> *</span><span style="color: #9cdcfe;">key</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">module</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">getKey</span><span style="color: #d4d4d4;">();</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">VerseKey</span><span style="color: #d4d4d4;"> *</span><span style="color: #9cdcfe;">verseKey</span><span style="color: #d4d4d4;"> = </span><span style="color: #569cd6;">SWDYNAMIC_CAST</span><span style="color: #d4d4d4;">(</span><span style="color: #4ec9b0;">VerseKey</span><span style="color: #d4d4d4;">, </span><span style="color: #9cdcfe;">key</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><b><span style="color: #9cdcfe;">verseKey</span></b><b><span style="color: #d4d4d4;">-></span></b><b><span style="color: #dcdcaa;">setIntros</span></b><b><span style="color: #d4d4d4;">(</span></b><b><span style="color: #569cd6;">true</span></b><b><span style="color: #d4d4d4;">);</span></b></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">ListKey</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">scope</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">verseKey</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">parseVerseList</span><span style="color: #d4d4d4;">(</span><span style="color: #9cdcfe;">bookCode</span><span style="color: #d4d4d4;">, *</span><span style="color: #9cdcfe;">verseKey</span><span style="color: #d4d4d4;">, </span><span style="color: #569cd6;">true</span><span style="color: #d4d4d4;">);</span></div><div><span style="color: #d4d4d4;"> </span><span style="color: #4ec9b0;">ListKey</span><span style="color: #d4d4d4;"> </span><span style="color: #9cdcfe;">resultKey</span><span style="color: #d4d4d4;"> = </span><span style="color: #9cdcfe;">module</span><span style="color: #d4d4d4;">-></span><span style="color: #dcdcaa;">search</span><span style="color: #d4d4d4;">(</span><span style="color: #ce9178;">"/Heading"</span><span style="color: #d4d4d4;">, </span><span style="color: #4ec9b0;">SWModule</span><span style="color: #d4d4d4;">::</span><span style="color: #9cdcfe;">SEARCHTYPE_ENTRYATTR</span><span style="color: #d4d4d4;">, </span><span style="color: #b5cea8;">0</span><span style="color: #d4d4d4;">, &</span><span style="color: #9cdcfe;">scope</span><span style="color: #d4d4d4;">);</span></div></div>
<p>When I did that I still did not get the chapter headings,
though.<br>
<br>
Best regards,<br>
Tobias<br>
</p>
<div class="moz-cite-prefix">On 1/7/22 3:44 PM, Troy A.
Griffitts wrote:<br>
</div>
<blockquote type="cite"
cite="mid:A5A84EB5-5900-4FB5-A7B5-03520B8D2346@crosswire.org">
<meta http-equiv="content-type" content="text/html;
charset=UTF-8">
Dear Tobias,<br>
<br>
I haven't had a chance to dig into this yet, but my first
guess is that you may be missing the intro slots from the
module.<br>
<br>
VerseKey modules have intro entries:<br>
<br>
for the chapter if you set verse to 0<br>
for the book, if you set chapter to 0<br>
for the testament, if you set book to 0<br>
for the module, if you set testament to 0<br>
<br>
You'll need to module->setIntros(true) if you want to
access these.<br>
<br>
Actually, maybe even just try setIntros(true) before your
headings search. The content in these entries is likely
marked up as headings, as well. For your purposes, you'll
need to decide if you want anything in these entries. They
might be a long book introduction. The presence of intro
entries, length, and type of content varies greatly between
modules.<br>
<br>
Hope this give something to try,<br>
<br>
Troy<br>
<br>
<div class="gmail_quote">On January 6, 2022 9:41:31 AM MST,
Tobias Klein <a class="moz-txt-link-rfc2396E"
href="mailto:contact@tklein.info" moz-do-not-send="true"><contact@tklein.info></a>
wrote:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<pre dir="auto" class="k9mail">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:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> 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.
<a href="https://crosswire.org/svn/sword/trunk/examples/tasks/findHeadings.cpp" moz-do-not-send="true">https://crosswire.org/svn/sword/trunk/examples/tasks/findHeadings.cpp</a>
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:
<blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> 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<hr> sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a href="http://crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</blockquote><hr>sword-devel mailing list: <a class="moz-txt-link-abbreviated" href="mailto:sword-devel@crosswire.org" moz-do-not-send="true">sword-devel@crosswire.org</a>
<a href="http://crosswire.org/mailman/listinfo/sword-devel" moz-do-not-send="true">http://crosswire.org/mailman/listinfo/sword-devel</a>
Instructions to unsubscribe/change your settings at above page
</blockquote></pre>
</blockquote>
</div>
<div style="white-space: pre-wrap"><div class="k9mail-signature">--
Sent from my Android device with K-9 Mail. Please excuse my brevity.</div></div>
</blockquote>
</blockquote>
</div>
<div style="white-space: pre-wrap"><div class="k9mail-signature">--
Sent from my Android device with K-9 Mail. Please excuse my brevity.</div></div>
</blockquote>
</body>
</html>