¶ tryt2t.py
2006-01-21 23:23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | PREFORMATTER_ID = 'txt2tags' #tags Zen,pythonic FILE_EXT = 't2t' __version__ = '$Id: tryt2t.py,v 2872b22e2ace 2011/10/27 07:08:25 zoomquiet+hg $' __author__ = 'Zoom.Quiet <zoom dot="" quiet="" at="" gmail.com="">' #T2T = "/usr/local/bin/txt2tags" T2T = "t2t" def cb_entryparser(args): args[ 't2t' ] = parse #args[FILE_EXT] = readfile return args """ def parse(filename): #html = publish_string(story, writer_name='html') import os act = T2T+" -t html -H --toc %s"%filename html = act html += os.popen(act).read().strip() #return html[html.find('') + 6:html.find('')] return html """ #def parse(filename, request): def parse(filename): import os, sys from StringIO import StringIO # open own source #config = request.getConfiguration() act = T2T + " -t html -H --toc -o - %s" % filename #source = open(filename).read() #out = StringIO() #html = os.popen(act).read().strip() print act #print os.popen(act).read().strip() # write colorized version to "python.html" #Parser(source, out).format(None, None) #print out.getvalue() """ entryData = {'body' : out.getvalue(), 'title' : filename.replace(config['datadir'], '')} return entryData """ parse( "py-code-rule.t2t" ) < / zoom> |