[sword-devel] usfm2osis.pl poor handling of minor section headings

Greg Hellings greg.hellings at gmail.com
Thu Sep 3 12:44:04 MST 2009


Peter,

On Thu, Sep 3, 2009 at 2:22 PM, Peter von Kaehne<refdoc at gmx.net> wrote:
> I will wait for Chris as the other major user of the script to say what
> he thinks, then I commit. But I agree. I changed my own script and it
> works better.
>
> I am still a bit annoyed with the position of the section head - it
> appears to be always in the verse prior. That is weird to me.

I believe this comes from SWORD's (or maybe just osis2mod's) handling
of headers/titles.  From what I understand, all material from the
opening of a chapter, until the first verse is squished into the
"verse 0" holder.  All material between the opening of a book until
the opening of the first chapter is placed in "chapter 0," and all
other material that sits outside of a verse is appended to the
previous verse.  At least, that's how I understand what DM has posted.

I am running into a similar problem with a module where section
titles, which fall outside of the scope of a chapter and verse, but
semantically represent the title for verses 1-X of a chapter >= 2 are
being displayed as part of the text of the last verse of the previous
chapter.  At this point, I have no way that makes OSIS-semantics sense
to me to overcome this, so I have to settle for the unfortunate
compromise of manually putting a non-canonical section title inside of
a chapter.  You might have to settle for the same, if your appearance
in SWORD front-ends is more important than your purely semantic and
theological representation in the OSIS XML.

--Greg

>
> Peter
>
>
> Daniel Owens wrote:
>> From my perspective (based on the USFM 2.1 reference document), all \s#
>> tags should be handled in such a way that a new <div> element is
>> created, with higher numbers being more deeply nested. If you feel
>> comfortable changing the code, please do so. It seems to me it's a bug
>> in usfm2osis.pl.
>>
>> Daniel
>>
>> Peter von Kaehne wrote:
>>> Peter von Kaehne wrote:
>>>
>>>> Currently usfm2osis.pl appears to mishandle minor section headings:
>>>>
>>>> _______________________________________
>>>>
>>> Looking at the source code it appears there is a specific difference in
>>> the handling of \s2 vs \s1 and \s3, \s4 etc.. See here:
>>>
>>>
>>>     # \s \s1 section (From Chapters and Verses)
>>>         if ($line =~ /^\\s1?\b\s*(.+)/) {
>>>             push (@outdata, closeTag("<\/p>"));
>>>             push (@outdata, closeTag("<\/div type=\"section\">"));
>>>             push (@outdata, "<div type=\"section\">\n");
>>>             openTag("<\/div type=\"section\">");
>>>             $line =~ s/\\s1?\b\s*(.+)/<title>$1<\/title>/;
>>>             if ($line =~ /HEBREW TITLE/) {
>>>                 $line =~ s/<title>/<title type=\"psalm\">/;
>>>             }
>>>         }
>>>
>>>         # \ss \s2 subSection (From Chapters and Verses)
>>>         if ($line =~ /^\\s[s2]\b\s*(.+)/) {
>>>             $line =~ s/\\s[s2]\b\s*(.+)/<title>$1<\/title>/;
>>>         }
>>>
>>>         # \sss \s3 x-subsubSection (From Chapters and Verses)
>>>         if ($line =~ /^\\s(ss|3)\b\s*(.+)/) {
>>>             push (@outdata, closeTag("<\/p>"));
>>>             push (@outdata, closeTag("<\/div
>>>
>>>      type=\"x=subSubSection\">"));
>>>             push (@outdata, "<div type=\"x-subSubSection\">\n");
>>>             openTag("<\/div type=\"x-subSubSection\">");
>>>             $line =~ s/\\s(ss|3)\b\s*(.+)/<title>$2<\/title>/;
>>>
>>>
>>> \s2 is not creating a <div>. Is there a specific reason?
>>>
>>> Peter
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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
>



More information about the sword-devel mailing list