Changeset 61

Show
Ignore:
Timestamp:
03/09/08 05:20:20 (10 months ago)
Author:
scott
Message:

Full support for VIM/Hilight and non-gvim-coprocesses settings

  • Finally got the kinks worked out.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/awkbot/src/awkpaste.awk

    r58 r61  
    4646        } 
    4747    } 
     48#define TEMPLATE_FILE               \ 
     49    workfile = tempfile("paste");   \ 
     50    template = workfile ".html";    \ 
     51                                    \ 
     52    print content > workfile;       \ 
     53    close(workfile) 
    4854 
     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 
    4963#ifdef GAWK 
    50     hilight = "highlight -I -l -S awk" 
     64    hilight = "highlight -I -l -k monospace -S awk" 
    5165    print content |& hilight 
    5266    close(hilight, "to") 
     
    5468    while (hilight |& getline content) { 
    5569#else 
    56     workfile = tempfile("paste") 
    57     template = workfile ".html" 
     70    TEMPLATE_FILE 
    5871 
    59     print content > workfile 
    60     close(workfile) 
     72    system("highlight -I -l -k monospace -S awk -o " template " " workfile) 
    6173 
    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) { 
    6775#endif 
    68     while (getline content < template) { 
    6976#endif 
    7077        if (content ~ /<\/body>/) { 
     
    8491        } 
    8592    } 
     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 
    86103    close(hilight, "from") 
    87  
    88 #ifndef GAWK 
    89     system("rm " workfile) 
    90     system("rm " template) 
     104#endif 
    91105#endif 
    92106}