本文整理汇总了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()
示例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()
示例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()