Changeset 61
- Timestamp:
- 03/09/08 05:20:20 (10 months ago)
- Files:
-
- 1 modified
-
trunk/awkbot/src/awkpaste.awk (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/awkbot/src/awkpaste.awk
r58 r61 46 46 } 47 47 } 48 #define TEMPLATE_FILE \ 49 workfile = tempfile("paste"); \ 50 template = workfile ".html"; \ 51 \ 52 print content > workfile; \ 53 close(workfile) 48 54 55 #ifdef VIM 56 TEMPLATE_FILE 57 58 system("vim -i NONE -c \"syn on\" -c \"set syntax=awk\" -c \"set nu\"" \ 59 " -c TOhtml -c wq -c q " workfile " &> /dev/null") 60 61 while (getline content < template) { 62 #else 49 63 #ifdef GAWK 50 hilight = "highlight -I -l - S awk"64 hilight = "highlight -I -l -k monospace -S awk" 51 65 print content |& hilight 52 66 close(hilight, "to") … … 54 68 while (hilight |& getline content) { 55 69 #else 56 workfile = tempfile("paste") 57 template = workfile ".html" 70 TEMPLATE_FILE 58 71 59 print content > workfile 60 close(workfile) 72 system("highlight -I -l -k monospace -S awk -o " template " " workfile) 61 73 62 #ifdef VIM 63 system("vim -i NONE -c \"syn on\" -c \"set syntax=awk\" -c \"set nu\"" \ 64 " -c TOhtml -c wq -c q " workfile " &> /dev/null") 65 #else 66 system("highlight -I -l -S awk -o " template " " workfile) 74 while (getline content < template) { 67 75 #endif 68 while (getline content < template) {69 76 #endif 70 77 if (content ~ /<\/body>/) { … … 84 91 } 85 92 } 93 #define CLEANUP_FILE \ 94 system("rm " workfile); \ 95 system("rm " template) 96 97 #ifdef VIM 98 CLEANUP_FILE 99 #else 100 #ifndef GAWK 101 CLEANUP_FILE 102 #else 86 103 close(hilight, "from") 87 88 #ifndef GAWK 89 system("rm " workfile) 90 system("rm " template) 104 #endif 91 105 #endif 92 106 }