¶ tryt2t.py

2006-01-21 23:23

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 '
#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")

§ 写于: Sat, 21 Jan 2006 | 永久链接;源文: rdf ,rss ,raw | 分类: /Zen/pythonic §
[MailMe] [Print] Creative Commons License

作品Zoom.Quiet创作,采用知识共享署名-相同方式共享 2.5 中国大陆许可协议进行许可。 基于zoomquiet.org上的作品创作。