forked from burakbayramli/books
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen.pl
56 lines (49 loc) · 1.34 KB
/
gen.pl
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
chdir("pub");
@ll = <slidepage*.jpg>;
$count = @ll;
print $count;
for ($i=1; $i <= $count ; $i++) {
$newfile = "slidepage" . $i . ".xml";
$image = "slidepage" . $i . ".jpg";
$p = $i-1;
$n = $i+1;
$prev = "slidepage" . $p . ".html";
$next = "slidepage" . $n . ".html";
`cp ../template.xml $newfile`;
system("perl -pi -e 's/__img__/$image/g' $newfile");
if ($i == 1) {
system("perl -pi -e 's/__prev__/#/g' $newfile");
} else {
system("perl -pi -e 's/__prev__/$prev/g' $newfile");
}
if ($i == $count) {
system("perl -pi -e 's/__next__/#/g' $newfile");
} else {
system("perl -pi -e 's/__next__/$next/g' $newfile");
}
$_ = `C:/devprogs/PDFBox-0.7.2/bin/ExtractText.exe -encoding UTF-8 -startPage $i -endPage $i -console ../kurumsaljava7.pdf`;
s/S¸/Åž/sg;
s/¸s/ÅŸ/sg;
s/¸c/ç/sg;
s/\?g/ÄŸ/sg;
s/\¨o/ö/sg;
s/¨u/ü/sg;
s/\?/ı/sg;
s/C¸/Ç/sg;
s/\"/\s/sg;
s/</\s/sg;
s/\//\s/sg;
s/¨U/Ãœ/sg;
s/¨O/Ö/sg;
s/¨U/Ãœ/sg;
s/C¸/Ç/sg;
s/ıI/İ/sg;
@array = split('\n');
$len = @array;
for ($j=0;$j<$len;$j++) {
$new = $new . "\n" . $array[ rand @array ];
}
system("perl -pi -e 's/__keywords__/$new/g' $newfile");
$new = "";
system("dos2unix $newfile");
}