Tomboy to html converter hack

2004/10/15 18:51:00

I have been using “Tomboy”:http://www.beatniksoftware.com/tomboy/ almost exclusively for my note taking recently and I just wanted to be able to have a quick summary of my notes available in html format so that I could read them on the “iplayer”:http://www.netgem.com/ or print them out.

So here it is a simple awk script the creates some really bad html from your tomboy notes. You need to copy it to a file change the two directories at the top and you are cooking with gas.

I am calling this John’s Tomboy note to html convert script. Catchy no?

Note: This is all messed up at the moment because wordpress is trying to be clever and reformat my code, I think I need to normaise this so stand by…


#!/usr/bin/awk
BEGIN {
tomboyhome="/home/johnc/.tomboy.old/"
htmlout="/home/johnc/tom/"

while ((("ls " tomboyhome"*.note") | getline file) >0 ){
    outfile= gensub(".*/(.+).note",htmlout"1.html","g",file)
    print "
” >outfile inhead=1 done=0 while ((getline < file) >0 ){ if ( inhead==1 ) { if ( /
/) { print $0 >outfile print “
</>
gsub(”title>”,”h1>”,$0) print $0 >outfile inhead=0 } } else if ( done == 0 ) { if ( / /) { print gensub(” (.+)“,”1 “,$0) >outfile print “” >outfile } else if (/< /text>/){ done=1 } else { print $0 >outfile print “” >outfile } } } } close(filelist) } </>Listen to this podcast Listen to this podcast