当前位置: 首页>>代码示例>>Python>>正文


Python Writer.write_site方法代码示例

本文整理汇总了Python中writer.Writer.write_site方法的典型用法代码示例。如果您正苦于以下问题:Python Writer.write_site方法的具体用法?Python Writer.write_site怎么用?Python Writer.write_site使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在writer.Writer的用法示例。


在下文中一共展示了Writer.write_site方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_build

# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import write_site [as 别名]
def do_build(args):
    #load config
    config_file = os.path.join(args.src_dir,"_config.py")
    try:
        config.init(config_file)
    except config.ConfigNotFoundException:
        print >>sys.stderr, ("No configuration found: %s" % config_file)
        parser.exit(1, "Want to make a new site? Try `blogofile init`\n")

    logger.info("Running user's pre_build() function..")
    writer = Writer(output_dir="_site")
    if config.blog_enabled == True:
        config.pre_build()
        posts = post.parse_posts("_posts")
        if args.include_drafts:
            drafts = post.parse_posts("_drafts", config)
            for p in drafts:
                p.draft = True
        else:
            drafts = None
        writer.write_blog(posts, drafts)
    else:
        #Build the site without a blog
        writer.write_site()
    logger.info("Running user's post_build() function..")
    config.post_build()
开发者ID:fj,项目名称:blogofile,代码行数:28,代码来源:main.py

示例2: do_build

# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import write_site [as 别名]
def do_build(args, load_config=True):
    if load_config:
        config_init(args)
    writer = Writer(output_dir=util.path_join("_site",util.fs_site_path_helper()))
    logger.debug("Running user's pre_build() function..")
    config.pre_build()
    writer.write_site()
    logger.debug("Running user's post_build() function..")
    config.post_build()
开发者ID:jvc,项目名称:blogofile,代码行数:11,代码来源:main.py

示例3: do_build

# 需要导入模块: from writer import Writer [as 别名]
# 或者: from writer.Writer import write_site [as 别名]
def do_build(args):
    #load config
    try:
        # Always load the _config.py from the current directory.
        # We already changed to the directory specified with --src-dir
        config.init("_config.py")
    except config.ConfigNotFoundException:
        print >>sys.stderr, ("No configuration found in source dir: %s" % args.src_dir)
        parser.exit(1, "Want to make a new site? Try `blogofile init`\n")

    writer = Writer(output_dir="_site")
    logger.debug("Running user's pre_build() function..")
    config.pre_build()
    writer.write_site()
    logger.debug("Running user's post_build() function..")
    config.post_build()
开发者ID:turian,项目名称:blogofile,代码行数:18,代码来源:main.py


注:本文中的writer.Writer.write_site方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。