# Path: henet/rst/rst2html.py
# def rst2html(rst, theme=None, opts=None, body_only=False):
#     rst_opts = default_rst_opts.copy()
#     rst_opts['warning_stream'] = StringIO()
# 
#     if body_only:
#         out = publish_parts(rst, writer_name='html',
#                             settings_overrides=rst_opts)['html_body']
# 
#         rst_opts['warning_stream'].seek(0)
#         warnings = rst_opts['warning_stream'].read()
#         return out, warnings
# 
#     if opts:
#         rst_opts.update(opts)
#     rst_opts['template'] = os.path.join(THEMES, 'template.txt')
# 
#     stylesheets = ['basic.css']
#     if theme:
#         stylesheets.append('%s/%s.css' % (theme, theme))
#     rst_opts['stylesheet'] = ','.join([J(THEMES, p) for p in stylesheets])
# 
#     out = publish_string(rst, writer_name='html', settings_overrides=rst_opts)
# 
#     rst_opts['warning_stream'].seek(0)
#     warnings = rst_opts['warning_stream'].read()
#     return out, warnings
# 
# Path: henet/util.py
# def md5(data):
#     return hashlib.md5(data).hexdigest()


from bottle import request, post, get
from bottle_utils.i18n import lazy_gettext as _
from henet.rst.rst2html import rst2html
from henet.util import md5


@get("/preview")
def get_preview():
    return _('Loading...')


# XXX make this redis

# Path: henet/rst/rst2html.py
# def rst2html(rst, theme=None, opts=None, body_only=False):
#     rst_opts = default_rst_opts.copy()
#     rst_opts['warning_stream'] = StringIO()
# 
#     if body_only:
#         out = publish_parts(rst, writer_name='html',
#                             settings_overrides=rst_opts)['html_body']
# 
#         rst_opts['warning_stream'].seek(0)
#         warnings = rst_opts['warning_stream'].read()
#         return out, warnings
# 
#     if opts:
#         rst_opts.update(opts)
#     rst_opts['template'] = os.path.join(THEMES, 'template.txt')
# 
#     stylesheets = ['basic.css']
#     if theme:
#         stylesheets.append('%s/%s.css' % (theme, theme))
#     rst_opts['stylesheet'] = ','.join([J(THEMES, p) for p in stylesheets])
# 
#     out = publish_string(rst, writer_name='html', settings_overrides=rst_opts)
# 
#     rst_opts['warning_stream'].seek(0)
#     warnings = rst_opts['warning_stream'].read()
#     return out, warnings
# 
# Path: henet/util.py
# def md5(data):
#     return hashlib.md5(data).hexdigest()


# Path: henet/views/preview.py
from bottle import request, post, get
from bottle_utils.i18n import lazy_gettext as _
from henet.rst.rst2html import rst2html
from henet.util import md5



@get("/preview")
def get_preview():
    return _('Loading...')


# XXX make this redis

_CACHE = {}