diff options
-rw-r--r-- | modules/perlconverters/usfm2osis.pl | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/modules/perlconverters/usfm2osis.pl b/modules/perlconverters/usfm2osis.pl index ddb113a..1826600 100644 --- a/modules/perlconverters/usfm2osis.pl +++ b/modules/perlconverters/usfm2osis.pl @@ -359,23 +359,36 @@ foreach $file (@files) { openTag("<\/div type=\"section\">"); $line =~ s/\\s1?\b\s*(.+)/<title>$1<\/title>/; if ($line =~ /HEBREW TITLE/) { - $line =~ s/<title>/<title type=\"psalm\">/; + $line =~ s/<title>/<title type=\"psalm\" canonical=\"true\">/; } } # \ss \s2 subSection (From Chapters and Verses) if ($line =~ /^\\s[s2]\b\s*(.+)/) { + push (@outdata, closeTag("<\/p>")); + push (@outdata, closeTag("<\/div type=\"subSection\">")); + push (@outdata, "<div type=\"subSection\">\n"); + openTag("<\/div type=\"subSection\">"); $line =~ s/\\s[s2]\b\s*(.+)/<title>$1<\/title>/; } - # \sss \s3 x-subsubSection (From Chapters and Verses) - if ($line =~ /^\\s(ss|3)\b\s*(.+)/) { + # \sss \s3 x-subSubSection (From Chapters and Verses) + # This will also handle deeper levels (4+) of subsections. + if ($line =~ /^\\s(ss|\d+)\b\s*(.+)/) { + my $ssLvl = $1; + my $ssType = ""; + while ($ssLvl > 2) { + $ssLvl--; + $ssType .= "Sub"; + } + $ssType = "x-sub" . $ssType . "Section"; 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>/; + push (@outdata, closeTag("<\/div type=\"$ssType\">")); + push (@outdata, "<div type=\"$ssType\">\n"); + openTag("<\/div type=\"$ssType\">"); + $line =~ s/\\s(ss|\d+)\b\s*(.+)/<title>$2<\/title>/; } + # \mt\mt1 title if ($line =~ /^\\mt[1234]?\b\s*(.+)/) { $line = "<title type=\"main\">$1<\/title>"; |