#!/usr/bin/perl sub vs2osis { my $context = $_[0]; $context =~ s/([12345]?[A-Z][a-z]+)\ .*/$1/; my $ref = $_[0]; $ref =~ s/,/:/; my $return = `vs2osisref "$ref" $context de`; $return =~ s/\n$//; $return; } my @files=`ls -1 wb.abw`; foreach (@files){ my @lines; chop; open USFM, ">>$_.tei"; @lines=`cat $_`; foreach (@lines) { s/props\=\".*?\"//g; # entry (ordinary) s/(.*?)<\/c><\/c><\/p>/<\/entryFree>\n$1<\/orth><\/form>/g; # entry (referring somewhere else) s/(.*?)<\/c><\/c>s\.(.*?)<\/c><\/p>/<\/entryFree>\n$1<\/orth><\/form>\n\ts\.\ $2<\/ref>/g; # content s/(.*?)<\/p>/\t\n\t\t$1\n\t<\/def>/; s/(.*?)<\/c>/$1<\/hi>/g; # references s/(([12345]?[A-Z][a-z]+)(;?\ [0-9]+(,[0-9]+(\-[0-9]+)?)?)+)(\ |\)|;)/ &vs2osis("$1").$^N/eg; # s/(.*?)<\/r>/&vs2osisref($1)/eg; # clean up s///g; s/<\/c\s*>//g; } print (USFM "\n Worterklaerung Schlachter

http://sourceforge.net/project/showfiles.php?group_id=89078&package_id=93370&release_id=278981

initial conversion to TEI
"); print (USFM @lines,"\n"); print (USFM "\n\n"); close USFM; }