# Path: runserver.py
# DEFAULT_HOST = 'http://static.localhost:8001'
# DEFAULT_KEY = ''
# def shell_command():
# def runserver():
# def init():
#     def random_sep(n=6):
#     def random_word(n=20, sep=True):
# def clear_cache():
# def initdb():
# def babel_init(lang):
# def babel_update():
# def babel_compile():
# def create_user(username, email, password):
# def password(username, password):
# def token(username):
# def upload(host, bucket, path, key, files, force):
#     def list_files(upath):
# def upload_shell(host, bucket, path, key):
# def list_routers():
# 
# Path: maple/model.py
# class User(db.Model, UserMixin):
# class Group(db.Model, GroupMixin):
# class Permission(db.Model, PermissionMixin):
#     def is_admin(self):
#     def token(self):
#     def check_token(cls, token, max_age=24 * 3600 * 30):


import os
from datetime import datetime
from re import compile
from runserver import app
from maple.model import Blog, Category, Tag, User
    if not blog:
        blog = Blog(
            title=_title,
            category_id=category.id,
            content=_content,
            created_at=_date,
            tags=tags,
            content_type='1' if file_type == 'org' else '0',
            user_id=user.id)
        blog.save()

    return blog


def org_to_blog(filename):
    filename = os.path.join(page_path, 'org', filename)
    print(filename)
    with open(filename, 'r') as f:
        text = f.readlines()
    lines = text[:15]
    attr = {}
    for name, regex in org_regex.items():
        for line in lines:
            if regex.match(line):
                attr[name] = regex.match(line).group(1).strip()
                break
    for index, line in enumerate(text):
        if not line.startswith("#+"):
            break
    attr['content'] = ''.join(text[index:])

# Path: runserver.py
# DEFAULT_HOST = 'http://static.localhost:8001'
# DEFAULT_KEY = ''
# def shell_command():
# def runserver():
# def init():
#     def random_sep(n=6):
#     def random_word(n=20, sep=True):
# def clear_cache():
# def initdb():
# def babel_init(lang):
# def babel_update():
# def babel_compile():
# def create_user(username, email, password):
# def password(username, password):
# def token(username):
# def upload(host, bucket, path, key, files, force):
#     def list_files(upath):
# def upload_shell(host, bucket, path, key):
# def list_routers():
# 
# Path: maple/model.py
# class User(db.Model, UserMixin):
# class Group(db.Model, GroupMixin):
# class Permission(db.Model, PermissionMixin):
#     def is_admin(self):
#     def token(self):
#     def check_token(cls, token, max_age=24 * 3600 * 30):


# Path: script/convert.py
import os
from datetime import datetime
from re import compile
from runserver import app
from maple.model import Blog, Category, Tag, User

    if not blog:
        blog = Blog(
            title=_title,
            category_id=category.id,
            content=_content,
            created_at=_date,
            tags=tags,
            content_type='1' if file_type == 'org' else '0',
            user_id=user.id)
        blog.save()

    return blog


def org_to_blog(filename):
    filename = os.path.join(page_path, 'org', filename)
    print(filename)
    with open(filename, 'r') as f:
        text = f.readlines()
    lines = text[:15]
    attr = {}
    for name, regex in org_regex.items():
        for line in lines:
            if regex.match(line):
                attr[name] = regex.match(line).group(1).strip()
                break
    for index, line in enumerate(text):
        if not line.startswith("#+"):
            break
    attr['content'] = ''.join(text[index:])

    with app.app_context():