# Path: _helpers.py
# ONLINE_LAST_MINUTES = 5
# def force_int(value,default=1):
#     def block_code(self,text,lang):
# def fill_with_user(items):
# def fill_with_node(items):
# def fill_object(items,objects,*args,**kwargs):
# def _add_attr(item,objects_dict,arg,kwargs):
# def mark_online(user_id):
# def get_online_users():
# class BleepRenderer(HtmlRenderer,SmartyPants):
# class MaxinObject(object):


from flask import Flask
from _helpers import db,cache,BleepRenderer,login_manager,mark_online
from flask.ext.login import login_required,current_user 
    from views.admin import load_sidebar_notice
    from views.focus import getNodes
    from views import index,topic,account,node,admin,user,notice,focus
import os,codecs
import misaka as m
import datetime
    #mail.init_app(app)

    if not os.path.exists('announcement'):
        os.mknod('announcement')
    cache.init_app(app,config={'CACHE_TYPE': 'simple'})

    @login_required
    @app.before_request
    def mark_current_user_online():
        if current_user is not None and current_user.is_authenticated():
            mark_online(current_user.id)
    return app

def register_jinja(app):

    @app.template_filter('renderToGFM')
    def renderToGFM(data):
        renderer = BleepRenderer()
        md = m.Markdown(renderer,
                extensions=m.EXT_FENCED_CODE | m.EXT_NO_INTRA_EMPHASIS)
        return md.render(data)

    @app.template_filter('xmldatetime')
    def xmldatetime(value):
        if not isinstance(value, datetime.datetime):
            return value
        return value.strftime('%Y-%m-%dT%H:%M:%SZ')

    @app.template_filter('timesince')
    def timesince(value):

# Path: _helpers.py
# ONLINE_LAST_MINUTES = 5
# def force_int(value,default=1):
#     def block_code(self,text,lang):
# def fill_with_user(items):
# def fill_with_node(items):
# def fill_object(items,objects,*args,**kwargs):
# def _add_attr(item,objects_dict,arg,kwargs):
# def mark_online(user_id):
# def get_online_users():
# class BleepRenderer(HtmlRenderer,SmartyPants):
# class MaxinObject(object):


# Path: app.py
from flask import Flask
from _helpers import db,cache,BleepRenderer,login_manager,mark_online
from flask.ext.login import login_required,current_user 
    from views.admin import load_sidebar_notice
    from views.focus import getNodes
    from views import index,topic,account,node,admin,user,notice,focus
import os,codecs
import misaka as m
import datetime

    #mail.init_app(app)

    if not os.path.exists('announcement'):
        os.mknod('announcement')
    cache.init_app(app,config={'CACHE_TYPE': 'simple'})

    @login_required
    @app.before_request
    def mark_current_user_online():
        if current_user is not None and current_user.is_authenticated():
            mark_online(current_user.id)
    return app

def register_jinja(app):

    @app.template_filter('renderToGFM')
    def renderToGFM(data):
        renderer = BleepRenderer()
        md = m.Markdown(renderer,
                extensions=m.EXT_FENCED_CODE | m.EXT_NO_INTRA_EMPHASIS)
        return md.render(data)

    @app.template_filter('xmldatetime')
    def xmldatetime(value):
        if not isinstance(value, datetime.datetime):
            return value
        return value.strftime('%Y-%m-%dT%H:%M:%SZ')

    @app.template_filter('timesince')
    def timesince(value):

        now = datetime.datetime.utcnow()