def get_revision(self, article_path, sha):
"""Get a single revision from a blob object for a given article
title and commit ID
"""
commit = self.get_commit(article_path, sha)
if not commit:
return None
commit_date = arrow.get(commit.committed_date)
blob = self.get_blob(article_path, commit)
raw_article_content = (
blob.data_stream.read().decode('UTF-8').replace('\u00a0', '')
if blob
else self.raw_article(article_path)
)
return {
'title': self.article_title(article_path),
'html': self.markdown_to_html(raw_article_content),
'raw': raw_article_content,
'committed': str(commit_date),
'committed_humanized': commit_date.humanize(),
}
评论列表
文章目录