summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Little <chrislit@crosswire.org>2009-09-04 19:34:53 +0000
committerChris Little <chrislit@crosswire.org>2009-09-04 19:34:53 +0000
commit2d6fd0d21e34c368b16478c78724c5a53543a894 (patch)
treeb69ceca4f33c3daf094e7c7dc3128a9b39e4a575
parent7ab6b8c1a8acd1b54d3e03287ad301ad15e80762 (diff)
downloadsword-tools-2d6fd0d21e34c368b16478c78724c5a53543a894.tar.gz
made Psalm titles canonical
made subsections produce a new <div> added handling for subsections deeper than 3 levels git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@212 07627401-56e2-0310-80f4-f8cd0041bdcd
-rw-r--r--modules/perlconverters/usfm2osis.pl27
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>";