Files
wechat-dump/lib/render.py
T
2014-11-22 22:33:02 +08:00

28 lines
805 B
Python
Executable File

#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: Render.py
# Date: Sat Nov 22 22:29:56 2014 +0800
# Author: Yuxin Wu <[email protected]>
import os
LIB_PATH = os.path.dirname(os.path.abspath(__file__))
CSS_FILE = os.path.join(LIB_PATH, 'static/wx.css')
HTML_FILE = os.path.join(LIB_PATH, 'static/template.html')
class HTMLRender(object):
def __init__(self, res=None):
self.css = open(CSS_FILE).read().replace('\n', '')
self.html = open(HTML_FILE).read()
self.res = res
def render_msg(self, msg):
""" render a message"""
# TODO
pass
if __name__ == '__main__':
r = HTMLRender()
with open('/tmp/a.html', 'w') as f:
print >> f, r.html.format(style=r.css, talker='talker',
messages='haha')