diff options
author | Peter von Kaehne <refdoc@gmx.net> | 2010-01-25 14:58:53 +0000 |
---|---|---|
committer | Peter von Kaehne <refdoc@gmx.net> | 2010-01-25 14:58:53 +0000 |
commit | ec7561ea329a6a25e79994b7d94c0915cec3f686 (patch) | |
tree | 446860872740b3cd9652a0513b75c7ab6fefee8a /modules/geneve | |
parent | 894e6809eb329f05723713833638d9c7bae00380 (diff) | |
download | sword-tools-ec7561ea329a6a25e79994b7d94c0915cec3f686.tar.gz |
keywords and crossreferences
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@268 07627401-56e2-0310-80f4-f8cd0041bdcd
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; |