Mercurial > org-tools
comparison auto-weave.pl @ 17:6da973a6b93d
better reload caps.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 02 Nov 2011 05:14:21 -0700 |
parents | f433fae15c50 |
children | 993b8d7d9bec |
comparison
equal
deleted
inserted
replaced
16:f433fae15c50 | 17:6da973a6b93d |
---|---|
13 | 13 |
14 #@org_files = glob("./org/*.org"); | 14 #@org_files = glob("./org/*.org"); |
15 | 15 |
16 for $file(@org_files){print "$file\n";} | 16 for $file(@org_files){print "$file\n";} |
17 $ignore_next = 0; | 17 $ignore_next = 0; |
18 | 18 $last_page = ""; |
19 | 19 |
20 foreach(@org_files){ | 20 foreach(@org_files){ |
21 # add watchers | 21 # add watchers |
22 $inotify->watch ($_, IN_MODIFY, sub | 22 $inotify->watch ($_, IN_MODIFY, sub |
23 { | 23 { |
36 print "$name was modified\n" if $e->IN_MODIFY; | 36 print "$name was modified\n" if $e->IN_MODIFY; |
37 $output = `weave $name`; | 37 $output = `weave $name`; |
38 $path = `readlink -f $name`; | 38 $path = `readlink -f $name`; |
39 $path =~ s|/home/r/proj|http://aurellem.localhost|; | 39 $path =~ s|/home/r/proj|http://aurellem.localhost|; |
40 $path =~ s|org|html|g; | 40 $path =~ s|org|html|g; |
41 $mech->get($path); | 41 if ($last_page eq $path){ |
42 print "reloading current page : $path\n"; | |
43 $mech->reload(); | |
44 } | |
45 else { | |
46 print "moving to new page : $path\n"; | |
47 $last_page = $path; | |
48 $mech->get($path); | |
49 } | |
42 }); | 50 }); |
43 } | 51 } |
44 | 52 |
45 | 53 |
46 # manual event loop | 54 # manual event loop |