예제 #1
0
 def post(self, title, text=''):
     arg = ' '.join(title)
     try:
         with open(arg, 'r'):
             post = Post.from_file(arg)
     except Exception:
         try:
             post = Post.from_slugish(arg)
             assert post is not None
         except Exception:
             post = Post.from_title(arg, text)
     return post
예제 #2
0
파일: stag.py 프로젝트: noah/stag
 def post(self, title, text=''):
     arg = ' '.join(title)
     try:
         with open(arg, 'r'):
             post = Post.from_file(arg)
     except Exception:
         try:
             post = Post.from_slugish(arg)
             assert post is not None
         except Exception:
             post = Post.from_title(arg, text)
     return post
예제 #3
0
 def posts(self, sortby='created', reverse=True):
     s_posts = glob(path.join(config["posts_path"], "*.md"))
     return sorted([Post.from_file(path=p) for p in s_posts],
                   key=attrgetter(sortby),
                   reverse=reverse)
예제 #4
0
파일: stag.py 프로젝트: noah/stag
 def posts(self, sortby='created', reverse=True):
     s_posts = glob(path.join(config["posts_path"], "*.md"))
     return sorted([Post.from_file(path=p) for p in s_posts],
                   key=attrgetter(sortby), reverse=reverse)
예제 #5
0
 def posts(self):
     s_posts = sorted(glob("%s/*.md" % config["posts_path"]), reverse=True)
     return [Post.from_file(path=p) for p in s_posts]