跳转到主要内容

徽章图片类

项目描述

安装

$ [sudo] pip install badges

特性

  • mdrst 支持
  • 使用实例和类变量自动格式化字符串
  • 极简设计,易于子类化
  • 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?branch=master.svg)](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?branch=master.svg)](https://site.com/owner/repo)'

源代码

项目详情


下载文件

下载适合您平台的项目文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

badges-0.0.1.tar.gz (3.3 kB 查看哈希值)

上传时间 源代码

支持