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

Peter von Kaehne refdoc at gmx.net
Thu Sep 3 12:22:42 MST 2009


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.

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




More information about the sword-devel mailing list