徽章图片类
项目描述
安装
$ [sudo] pip install badges
特性
- md,rst 支持
- 使用实例和类变量自动格式化字符串
- 极简设计,易于子类化
- CircleCI,Travis,... 徽章类
示例
# format attributes - {attrname}
>>> class CustomBadge(badges.Badge):
branch = "master"
link = "https://site.com/{fullname}"
image = "https://site.com/{fullname}?branch={branch}.svg"
>>> CustomBadge(fullname="owner/repo")
'[](https://site.com/owner/repo)'
# format @property - {0.propname}
>>> class CustomBadge(badges.Badge):
branch = "master"
link = "https://site.com/{0.fullname}"
image = "https://site.com/{0.fullname}?branch={branch}.svg"
@property
def fullname(self):
return "/".join(os.getcwd().split("/")[-2:])
>>> CustomBadge()
'[](https://site.com/owner/repo)'
源代码
badges/badge.Badge
badges/bettercodehub.Bettercodehub(GitBadge)
badges/circleci.Circleci(GitBadge)
badges/codeclimate.Codeclimate(GitBadge)
badges/codecov.Codecov(GitBadge)
badges/codefactor.Codefactor(GitBadge)
badges/gitbadge.GitBadge(Badge)
badges/scrutinizer.Scrutinizer(GitBadge)
badges/semaphoreci.Semaphoreci(GitBadge)
badges/sonarcloud.Sonarcloud(Badge)
badges/travis.Travis(GitBadge)