NAME

Dist::Zilla::Plugin::InsertDistFileLink - Insert links to distribution shared files into POD as HTML snippets

VERSION

This document describes version 0.001 of Dist::Zilla::Plugin::InsertDistFileLink (from Perl distribution Dist-Zilla-Plugin-InsertDistFileLink), released on 2023-11-09.

SYNOPSIS

In share, put some files e.g. foo.xlsx and share/img1.png.

In dist.ini:

[InsertDistFileLink]
;hosting=metacpan
;include_files=...
;exclude_files=...
;include_file_pattern=...
;exclude_file_pattern=...

In lib/Qux.pm or script/quux:

...

# FILE: share/foo.xlsx
# FILE: share/

...

After build, lib/Foo.pm will contain:

...

=begin html

<a href="https://st.aticpan.org/source/CPANID/Your-Dist-Name-0.123/share/foo.xlsx" />foo.xlsx</a><br />

=end html

=begin html

<a href="https://st.aticpan.org/source/CPANID/Your-Dist-Name-0.123/share/images/img1.png">image/img1.png</a><br />

=end html

DESCRIPTION

This plugin finds # FILE directive in your POD/code and replace it with a POD containing HTML snippet to link to the file, using the selected hosting provider's URL scheme.

Rationale: sometimes it's convenient to link to the distribution shared files in HTML documentation. In POD there's currently no mechanism to do this.

The #FILE directive must occur at the beginning of line and must be followed by path to the image (relative to the distribution's root).

Shared files deployed inside a tarball (such as one created using Dist::Zilla::Plugin::ShareDir::Tarball) are not yet supported.

CONFIGURATION

hosting => str (default: metacpan)

Choose hosting provider. For available choicese, see Dist::Zilla::Role::GetDistFileURL.

include_files => str+

exclude_files => str+

include_file_pattern => re

exclude_file_pattern => re

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Plugin-InsertDistFileLink.

SOURCE

Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Plugin-InsertDistFileLink.

SEE ALSO

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by perlancar <perlancar@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-InsertDistFileLink

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.