mirror of
https://github.com/jongracecox/anybadge.git
synced 2026-01-05 03:41:08 +01:00
Allow badges with no value or no label (#89)
This commit allows badges to be generated with only a label or only a value. Badges must provide at least a label or a value, so it is not valid to create a badge with no label and no value. This will result in a `ValueError` being raised.
This commit is contained in:
committed by
Jon Grace-Cox
parent
a076a4867a
commit
9d4470a1a0
@@ -24,7 +24,7 @@ def color_examples_table():
|
||||
)
|
||||
|
||||
|
||||
def emoji_examples():
|
||||
def other_examples():
|
||||
"""Generate emoji example badges used in documentation."""
|
||||
examples_dir = Path(__file__).parent / Path("examples")
|
||||
for label, value, file, kwargs in [
|
||||
@@ -38,6 +38,8 @@ def emoji_examples():
|
||||
("Pipeline status", "😟", "pipeline_frown.svg", {"default_color": "Red"}),
|
||||
("🔗", "Documentation", "documentation_link.svg", {}),
|
||||
("🔗", "PyPi", "pypi_link.svg", {}),
|
||||
("", "Value only", "value_only.svg", {}),
|
||||
("Label only", "", "label_only.svg", {}),
|
||||
]:
|
||||
anybadge.Badge(label=label, value=value, **kwargs).write_badge(
|
||||
examples_dir / Path(file), overwrite=True
|
||||
@@ -46,7 +48,7 @@ def emoji_examples():
|
||||
|
||||
def main():
|
||||
color_examples_table()
|
||||
emoji_examples()
|
||||
other_examples()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user