def init_post(): ns.storage.projectdir = os.getcwd() postdir = os.path.join(ns.storage.projectdir, ns.site.postdir) for f in walk_dir(postdir): reader = detect_reader(f) if reader: post = reader.render() if post: # ignore invalid post ns.storage.posts.append(post) else: ns.storage.files.append(f) return ns
def init_post(): ns.storage.projectdir = os.getcwd() postdir = os.path.join(ns.storage.projectdir, ns.site.postdir) for f in walk_dir(postdir): reader = detect_reader(f) if reader: post = reader.render() if post: # ignore invalid post ns.storage.posts.append(post) else: ns.storage.files.append(f) ns.storage.posts = sorted( ns.storage.posts, key=lambda o: o.date, reverse=True) ns.storage.public_posts = filter( lambda post: post.public, ns.storage.posts) return ns
def init_post(): ns.storage.projectdir = os.getcwd() postdir = os.path.join(ns.storage.projectdir, ns.site.postdir) for f in walk_dir(postdir): reader = detect_reader(f) if reader: post = reader.render() if post: # ignore invalid post ns.storage.posts.append(post) else: ns.storage.files.append(f) ns.storage.posts = sorted(ns.storage.posts, key=lambda o: o.date, reverse=True) ns.storage.public_posts = filter(lambda post: post.public, ns.storage.posts) return ns