예제 #1
0
def parse_page(path, name):
    raw_content, html_content = process(os.path.join(path, name))
    raw_date = util_parse_date(name)
    raw_title = util_parse_title(name)
    nice_title = ' '.join(raw_title.split('_'))
    link = util_strip_chars('-'.join(raw_title.lower().split('_')))
    category_names = util_parse_categories(name)
    context = {
            'raw_content': raw_content,
            'html_content': html_content,
            'raw_date': raw_date,
            'raw_title': raw_title,
            'nice_title': nice_title,
            'cat_names': category_names,
            'link': link 
    }
    return context
예제 #2
0
def parse_category(path, name):
    full_path = os.path.join(path,
            name + os.extsep + 'md')
    if os.path.isfile(full_path):
        raw_content, html_content = process(full_path)
    else:
        raw_content = ''
        html_content = ''
    raw_date = ''
    raw_title = name
    nice_title = ' '.join(raw_title.split('_'))
    link = util_strip_chars('-'.join(raw_title.lower().split('_')))
    context = {
            'raw_content': raw_content,
            'html_content': html_content,
            'raw_date': raw_date,
            'raw_title': raw_title,
            'nice_title': nice_title,
            'link': link 
    }
    return context