On 21/2/2006, at 23:47, Dr. Drang wrote:
You could do this with ruby for instance: #!/usr/bin/env ruby print "[${1:description}][${2:id}]$0" + STDIN.read + "\n [${2:id}]: ${3:href}"
oops, spoke too soon. You'll want to escape all $ in STDIN.read, so: print "[${1:description}][${2:id}]$0" + STDIN.read.gsub('$','\$')
- "\n[${2:id}]: ${3:href}"
I'll give it a try tonight. Thanks.
Also remember to escape ` and . So that’d be:
STDIN.read.gsub(/[$`\]/, '\\\1')
Instead of a macro, it is also possible to set the commands input to entire document and then use TM_LINE_NUMBER and TM_LINE_INDEX as the carets location.