/* A personal favourite - convert paragraphs to very long lines, and copies the * result to the clipboard - very useful for doing text on Wikipedia. * It supresses the line collection wherever i) the preceding line ended with * a '=' (i.e. it was a title line), or the next line starts with a '*' (i.e. * it's a list element). */ command wikify_region() on reg_tab[ALT('W')] { int obuf, wbuf; char c, oc; save_spot point; fix_region(); obuf = bufnum; wbuf = zap("-wiki-"); c = '\0'; while (point < mark) { oc = c; c = curchar(); point++; if ((c != '\n') || ((curchar() == '*') || (oc == '='))) { bufnum = wbuf; insert(c); bufnum = obuf; continue; } if (curchar() != '\n') { bufnum = wbuf; insert(' '); bufnum = obuf; continue; } bufnum = wbuf; insert('\n'); insert('\n'); bufnum = obuf; point++; } bufnum = wbuf; point = 0; mark = size(); copy_to_clipboard(); bufnum = obuf; say("Region Wikified."); }