summaryrefslogtreecommitdiffstats
path: root/modules/geneve/paralist.pl
blob: d6f15176dfdbf554553d1d64c513be8c1a3a2922 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/perl

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

foreach (@files){ 

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

	foreach (@lines) {
                s/<m\ .*?\/m>//;
                
		s/<p\ style=\"Parallelen [Ü]*bers Kapitel\".*?><c.*?>\ *[K|P]\ (.*?)<\/c><\/p>/\n\n\\c\ $1\ /g;

                s/<p\ style=\"Parallelenverweise\" xid=\"[0-9]+\"\ props=\"text-align:left; line-height:1.0; dom-dir:ltr; orphans:0; widows:0\"><\/p>//g;
 
                s/<p\ style=\"Parallelenverweise\" xid=\"[1-7]\".+?><c.+?>.*?<\/c><\/p>//g;
                s/<p style=\"Parallelenverweise\".*?>(.*?)<\/p>/\n$1\ \\x\*/g;
		s/<c style=\"Verszahl\ Parallelensignal\".*?>(.*?)<\/c>/\\v\ $1\ \ /g;
		s/<c style=\"Parallelentext Leerz\".*?>\ <\/c>/\ \\x\ /g;
		s/<c style=\"Parallelentext kursiv\".*?>(.*?)<\/c>/\ \\xk\ $1\ /g;
		s/<c .*?props=\"lang:de-DE;\ font-size:8pt;\ font-family:(Utopia|Times\ New\ Roman)\".*?>(.*?)<\/c>/\ \\xt\ $2/g;
		s/^.*?style=\"Normal.*?$//g;
		s/^.*?style=\"En-tête.*?$//g;
		s/<br\ *\/>//g;
		s/xid\=\".*?\"//g;
		s/^\ x\*//;
                s/<.*?>//g;
                s/(\\xt.*?)(\\xk)/$1\ \\x\*\ \\x\ $2/g;
                

}
        $book = join ("", @lines);	
        
        @lines = split("\n",$book);
        
        my $chapter, $verse =1;

        foreach (@lines) {
                
                if (/^\\c\ ([0-9]+)\ /) {
                        
                        $chapter=$1;
                        }
                         
                if (/^\\v\ ([0-9]+)\ /) {
                        
                        $verse=$1;
                        }
                        
                s/^\\v\ ([0-9]+)\ /$chapter.":".$verse."|"/e;
                s/\\x\*\ \\x\ /\\x\*\n$chapter:$verse\|\ \\x\ /g;
                s/\ (\\x\ +\\xk)\ +(.*?)(\\xt)/":".substr($2,0,4)."\| ".$1." ".$2.$3/eg;
                s/$/\n/;
                }

        @lines=split("\n",join("",@lines));
        
        foreach (@lines) {
                s/\\c\ .*?$//;
                s/^\s*$//;
                s/\ :/:/;
                s/\s+\|/\|/;
                s/\|:/:/; 
                s/\ +/\ /;
                s/$/\n/;
                }


        foreach (@lines) {
        
                if (/^[0-9]+:[0-9]+\|/) {
                        print (VS $_);
                        }
                elsif (/^[0-9]+:[0-9]+:/) {
                        print (KW $_);
                        }
                else {print (USFM $_);}
                }                        

#	print (USFM @lines);
	close USFM,VS,KW;
}