Ejemplo n.º 1
0
def new_post(filename):
    try:
        load_config()
        load_base()
        load_path()
        initial_content = 'title: Your post title\ndate: %s\n\nStart writing here...' % datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        write(g.path.posts, filename + '.md', initial_content)
        puts(colored.green('New post is written successfully.'))
    except:
        puts(colored.red('Post cannot be written.'))
Ejemplo n.º 2
0
def generate():
    try:
        load_config()
        load_base()
        load_path()
        load_template_config()
        load_jinja()
        reset()
        handle_posts()
        handle_pages()
        copy_assets()
        puts(colored.green('Complete.'))
    except:
        puts(colored.red('Generated fail, please check if all files are in the directory.'))