summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/perlconverters/zef2osis.pl51
1 files changed, 44 insertions, 7 deletions
diff --git a/modules/perlconverters/zef2osis.pl b/modules/perlconverters/zef2osis.pl
index 848a489..6a0c4d9 100644
--- a/modules/perlconverters/zef2osis.pl
+++ b/modules/perlconverters/zef2osis.pl
@@ -74,8 +74,6 @@ $year += 1900;
$mon++;
$date = sprintf("%04d\-%02d\-%02d", $year, $mon, $mday);
-print OUTF "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osis xmlns=\"http://www.bibletechnologies.net/2003/OSIS/namespace\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.bibletechnologies.net/2003/OSIS/namespace http://www.bibletechnologies.net/osisCore.$osisVersion.xsd\">\n<osisText osisRefWork=\"Bible\" xml:lang=\"en\" osisIDWork=\"$osisWork\">\n<header>\n<revisionDesc><date>$date<\/date><p>initial OSIS 2.1.1 version<\/p><\/revisionDesc>\n<work osisWork=\"$osisWork\">\n<title><\/title>\n<creator role=\"encoder\">zef2osis.pl by Chris Little www.crosswire.org<\/creator>\n<type type=\"OSIS\">Bible<\/type>\n<identifier type=\"OSIS\">$osisWork<\/identifier>\n<source>Zefania XML<\/source>\n<language type=\"IETF\"><\/language>\n<scope><\/scope>\n<refSystem>Bible<\/refSystem>\n<\/work>\n<\/header>\n";
-
open (INF, $ARGV[1]);
@data = <INF>;
close (INF);
@@ -96,14 +94,18 @@ sub delempty {
$enc = "utf8";
$q = 0;
+$hd_source = "<source>Zefania XML (http:\/\/www.zefania.de)<\/source>\n";
+$lang = "";
+$hd_title = "<title><\/title>\n";
+$hd_description = "<description><\/description>\n";
+
foreach $line (@data) {
+ if ($enc ne "utf8") {
+ utf8::encode($line);
+ }
if ($pr == 1) {
- if ($enc ne "utf8") {
- utf8::encode($line);
- }
-
$line =~ s/[\r\n]+/\n/g;
$line =~ s/^\s+//;
$line =~ s/\s+$//;
@@ -178,9 +180,44 @@ foreach $line (@data) {
$enc = "latin1";
}
elsif ($line =~ /<\/INFORMATION>/) {
+ print OUTF "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osis xmlns=\"http://www.bibletechnologies.net/2003/OSIS/namespace\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.bibletechnologies.net/2003/OSIS/namespace http://www.bibletechnologies.net/osisCore.$osisVersion.xsd\">\n<osisText osisRefWork=\"Bible\" xml:lang=\"$lang\" osisIDWork=\"$osisWork\">\n<header>\n<revisionDesc><date>$date<\/date><p>initial OSIS 2.1.1 version<\/p><\/revisionDesc>\n<work osisWork=\"$osisWork\">\n$hd_title$hd_contributor$hd_creator<creator role=\"encoder\">zef2osis.pl from http:\/\/www.crosswire.org<\/creator>\n<date><\/date>\n$hd_description$hd_publisher<type type=\"OSIS\">Bible<\/type>\n<identifier type=\"OSIS\">$osisWork<\/identifier>\n$hd_source<language type=\"IETF\">$lang<\/language>\n$hd_rights<scope><\/scope>\n<refSystem>Bible<\/refSystem>\n<\/work>\n<\/header>\n";
+
$pr = 1;
}
-
+ else {
+ if ($line =~ /(<title>.+?<\/title>)/) {
+ $hd_title = "$1\n";
+ }
+ elsif ($line =~ /(<creator>.+?<\/creator>)/) {
+ $hd_creator = "$1\n";
+ }
+ elsif ($line =~ /(<contributor>.+?<\/contributor>)/) {
+ $hd_contributor = "$1\n";
+ }
+ elsif ($line =~ /(<description>.+?<\/description>)/) {
+ $hd_description = "$1\n";
+ }
+ elsif ($line =~ /(<source>.+?<\/source>)/) {
+ $hd_source = $1;
+ $hd_source =~ s/<\/source>/\nvia Zefania XML (http:\/\/www.zefania.de)<\/source>\n/;
+ }
+ elsif ($line =~ /(<rights>.+?<\/rights>)/) {
+ $hd_rights = "$1\n";
+ }
+ elsif ($line =~ /(<publisher>.+?<\/publisher>)/) {
+ $hd_publisher = "$1\n";
+ }
+ elsif ($line =~ /<language>(.+?)<\/language>/) {
+ $lang = $1;
+ if ($lang eq "ENG") {
+ $lang = "en";
+ }
+ elsif ($lang eq "GER") {
+ $lang = "de";
+ }
+ else {$lang = ""};
+ }
+ }
}
print OUTF "<\/osisText>\n";