コード例 #1
0
ファイル: categories.py プロジェクト: dmr/StrangeCase
def category_index_processor(config, source_path, target_path):
    categories_name = 'categories'

    folder_config = deepcopy(config)
    folder_config['target_name'] = categories_name
    folder_config['name'] = categories_name
    folder = FolderNode(folder_config, None, target_path)

    index_config = deepcopy(config)
    index_config['target_name'] = config['index']
    index_config['name'] = 'index'
    categories_target_path = os.path.join(target_path, categories_name)
    index = JinjaNode(index_config, source_path, categories_target_path)

    folder.append(index)
    folder.append(CategoryFolderProcesser(config, categories_target_path))
    return (folder, )
コード例 #2
0
ファイル: category.py プロジェクト: wichert/StrangeCase
def processor(config, source_path, target_path):
    Registry.configurate(source_path, config)
    categories_name = config.get('name', 'categories')

    folder_config = config.copy()
    folder_config['target_name'] = categories_name
    folder_config['name'] = categories_name
    Registry.configurate(source_path, folder_config)
    folder = FolderNode(folder_config, None, target_path)
    categories_folder_target_path = os.path.join(target_path, categories_name)

    config['dont_inherit'] = [key for key in config['dont_inherit'] if key != 'title']
    index_config = config.copy()
    index_config['target_name'] = config['index.html']
    index_config['name'] = 'index'
    Registry.configurate(os.path.join(source_path, index_config['target_name']), index_config)
    index_node = JinjaNode(index_config, source_path, categories_folder_target_path)
    folder.append(index_node)
    CategoryDetail.index_node = index_node

    # attach Processor node - this is the class that will scan the pages for
    # the `category` property:
    folder.append(CategoryFolderProcesser(config, categories_folder_target_path))
    return (folder, )