summaryrefslogblamecommitdiffstats
path: root/modules/geneve/transform.pl
blob: f551fcbd58669f93d9dda19241a6ef9b5c609f3c (plain) (tree)
1
2
3
4
5
6
7
8
9








                        
                               






                                       
                                                                                           
                                                                                                        
                                                                       







                                                                                          






                                                 







                                                                                   
#!/usr/bin/perl

my @files=`ls -1 *.abw`;
my @ident=`cat books`;

foreach (@files){ 

        my @lines;
	chop;
	open USFM, ">>$_.usfm";
	chomp(@lines=`cat $_`);
	
 	@lines[1]="\\id @ident[$_-1] ";

	foreach (@lines) {
                s/<m\ .*?\/m>//;
                s/props\=\".*?\"//g;
		s/<p\ style=\"Kapitel\".*?><c.*?>(.*?)<\/c><\/p>/\n\\c\ $1\ \n\\v\ 1\ \ /g;
		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=\"Footnote Text\".*><field\ footnote-id=\".*?\"/\ \\f\ +\ /g;
		s/<\/foot>/\\f\*\ /g;
		s/type=\"footnote_anchor\"\ style=\"\"\ xid=\".*?\"\ >//g;                
		s/\\r\ Kapitel/\\mr Kapitel/g;
		if (!(/\\f.*?\[.*?\\f\*/)) {
		        s/\[/\ \\add\ /g;
		        }
		if (!(/\\f.*?\[.*?\\f\*/)) {	
		        s/\]/\ \\add\*\ /g;
		        }
		s/<p\ style=\"Kopfzeile\".*?p>//;
		s/xid\=\".*?\"//g;
                s/<.*?>//g;
			              
	}
	
	print (USFM @lines);
	close USFM;
}