diff options
Diffstat (limited to 'modules/geneve')
-rwxr-xr-x | modules/geneve/transform.pl | 61 |
1 files changed, 57 insertions, 4 deletions
diff --git a/modules/geneve/transform.pl b/modules/geneve/transform.pl index f551fcb..fb745c7 100755 --- a/modules/geneve/transform.pl +++ b/modules/geneve/transform.pl @@ -1,16 +1,45 @@ #!/usr/bin/perl + my @files=`ls -1 *.abw`; my @ident=`cat books`; + + + + + + foreach (@files){ + + + my @lines; + my %vs; + my %kw; + chop; open USFM, ">>$_.usfm"; chomp(@lines=`cat $_`); - @lines[1]="\\id @ident[$_-1] "; + + open KW, "<$_.keywords"; + open VS, "<$_.verse"; + + + while (<KW>) { + my @content = split(/\|/,$_); + chop($kw{@content[0]} = @content[1]); + } + + while (<VS>) { + + my @content = split(/\|/,$_); + $vs {@content[0]} = @content[1]; + } + + foreach (@lines) { s/<m\ .*?\/m>//; @@ -19,9 +48,9 @@ foreach (@files){ s/<p\ style=\"Psalm Nr\".*?><c.*?>Psalm\ (.*?)<\/c><\/p>/\n\\c\ $1\n\\s1\ Psalm\ $1\n/g; s/<c\ style=\"Verszahl\".*?>(.*?)<\/c>/\n\\v\ $1\ \ /g; s/<p\ style=\"Buchtitel\".*?>/\n\\mt\ /g; - s/<p\ style=\"Bucheinleitung\".*?>/\n\\imt\n\\ip\ /g; - s/<p\ style=\"Spaltentitel\".*?>(.*?)<\/p>/\n\\s2\ $1\n\\p/g; - s/<p\ style=\"Spaltenparallelen\".*?>(.*?)<\/p>/\n\\r\ $1\n\\p/g; + s/<p\ style=\"Bucheinleitung\".*?>/\n\\imt\ Einleitung\n\\ip\ /g; + s/<p\ style=\"Spaltentitel\".*?>(.*?)<\/p>/\n\\s2\ $1\n\\p\ /g; + s/<p\ style=\"Spaltenparallelen\".*?>(.*?)<\/p>/\n\\r\ $1\n\\p\ /g; s/<p style=\"Footnote Text\".*><field\ footnote-id=\".*?\"/\ \\f\ +\ /g; s/<\/foot>/\\f\*\ /g; s/type=\"footnote_anchor\"\ style=\"\"\ xid=\".*?\"\ >//g; @@ -33,10 +62,34 @@ foreach (@files){ s/\]/\ \\add\*\ /g; } s/<p\ style=\"Kopfzeile\".*?p>//; + + s/<c\ style=\"Verweiswort\".*?><\/c>//g; + s/<c\ style=\"Verweiswort\".*?>(.*?)<\/c>/$1\ \\x\ \\xk\ $1\\x\*\ /g; + s/xid\=\".*?\"//g; s/<.*?>//g; +# s/$/\n/; } + @lines=split("\n",join("",@lines)); + + my $chapter, $verse=0; + + foreach (@lines) { + + if (/\\c\s+([0-9]+)\s/) { + $chapter=$1; + } + if (/\\v\s+([0-9]+)\s/) { + $verse=$1; + s/$/$vs{$chapter.":".$verse}/e; + + } + + s/\\x\s+\\xk\s+(.+?)\s*\\x\*/$kw{$chapter.":".$verse.":".substr($1,0,4)}/eg; + s/$/\n/; + + } print (USFM @lines); close USFM; |