NAME
Pod::Weaver::Section::Badges - Add (or append) a section with badges
VERSION
Version 0.0402, released 2016-02-20.
SYNOPSIS
; in weaver.ini
[Badges]
section = BUILD STATUS
formats = html
badge = Travis
badge = Gratipay
-travis_user = MyGithubUser
-travis_repo = the_repository
-travis_branch = master
-gratipay_user = ExampleName
DESCRIPTION
This inserts a section with status badges. The configuration in the synopsis would produce something similar to this:
=head1 BUILD STATUS
=begin HTML
<p>
<a href="https://travis-ci.org/MyGithubUser/the_repository"><img src="https://travis-ci.org/MyGithubUser/the_repository.svg?branch=master" /></a>
<img src="https://img.shields.io/gratipay/ExampleName.svg" />
</p>
=end HTML
This module uses badges in the Badge::Depot::Plugin
namespace. See Task::Badge::Depot for a list of available badges. The synopsis uses the Badge::Depot::Plugin::Travis and Badge::Depot::Plugin::Gratipay badges.
Attributes starting with a dash (such as, in the synopsis, -travis_user
or -gratipay_user
) are given to each badge's constructor.
Badge rendering
As a comparison with using badges and Badge::Depot directly, this is what Pod::Weaver::Section::Badges
does.
First, with this part of the synopsis:
[Badges]
badge = Gratipay
-gratipay_user = ExampleName
badge = Gratipay
means that Badge::Depot::Plugin::Gratipay is automatically used
.
Secondly, -gratipay_user = Example
means that this attribute is for the Gratipay
badge, so the prefix (-gratipay_
) is stripped and the attribute is given in the constructor:
my $gratipay_badge = Badge::Depot::Plugin::Gratipay->new(user => 'ExampleName');
And then the given formats
is used to render the pod:
my $rendered_badge = $gratipay_badge->to_html;
Which is then injected into the chosen section
.
ATTRIBUTES
formats
ArrayRef [ Enum [ "html","markdown" ] ] | required | read-only |
The formats to render the badges for. Comma separated list, not multiple rows.
badge
ArrayRef [ Str ] | optional, default: [] |
read-only |
The name of the wanted badge, lowercased. Repeat for multiple badges. The name is everything after 'Badge::Depot::Plugin::'.
main_module_only
Bool | optional, default: 1 |
read-only |
If true, the badges will only be inserted in the main module (as defined by Dist::Zilla). If false, they will be included in all modules.
section
Str | optional, default: NAME |
read-only |
The section of pod to add the badges to, identified by its heading. The section will be created if it doesn't already exist.
skip_markdown_if_html
Bool | optional, default: 1 |
read-only |
Some markdown renderers also renders '=begin html' blocks, which makes it unnecessary to set both html and markdown as output formats. Set this to a false value to produce both blocks.
SEE ALSO
BADGES
SOURCE
https://github.com/Csson/p5-Pod-Weaver-Section-Badges
HOMEPAGE
https://metacpan.org/release/Pod-Weaver-Section-Badges
AUTHOR
Erik Carlsson <info@code301.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.