core.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:bock 作者: afreeorange 项目源码 文件源码
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(),
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号