The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Module::Format::AsHTML - generate HTML links to metacpan module/dists pages.

VERSION

version 0.0.2

SYNOPSIS

    use Module::Format::AsHTML ();
    my $cpan = Module::Format::AsHTML->new();

    $html .= $cpan->self_mod({ 'm'=> "Path::Tiny"});

DESCRIPTION

Module::Format::AsHTML is a module to generate HTML hyperlinks and other HTML fragments for CPAN modules and distributions.

It grew out of some incarnations of source codes used by some of my (= SHLOMIF) sites.

One for example can pass:

    'cpan' => Module::Format::AsHTML->new(),

As a variable to https://metacpan.org/release/Template-Toolkit and then use it in templates:

    [% cpan.self_mod('m'=>"List::Util") %]

SECURITY WARNING!

This module does not validate or sanitize its input and so may be susceptible to HTML injection / XSS issues (see https://perl-begin.org/topics/security/code-markup-injection/ ). This is expected given its origin as utility code for generating static sites.

Please do not use it with input from possibly malicious sources or without sanitising it. In the future, this issue may be fixed.

METHODS

my $cpan = Module::Format::AsHTML->new()

Returns a new object.

$cpan->b_self_dist({d=>"Path-Tiny"})

Returns a link to 'd' with bolded text.

$cpan->self_dist({d=>"Path-Tiny"})

Returns a link to 'd' with its text defaulting to its name.

$cpan->dist({d=>"Path-Tiny", body=>"$html"})

Returns a link to 'd' with the text 'body'.

$cpan->homepage({'who'=>"SHLOMIF"})

Homepage url to 'who'.

$cpan->module ({'m'=>"List::Util", body=>"$html"})

Returns a link to 'm' with the text 'body'. (aliased for tt2/etc. friendliness).

$cpan->self_mod ({'m'=>"Path::Tiny"})

Returns a link to 'm' with its text defaulting to its name.

$cpan->mod ({"m"=>"List::Util", body=>"$html"})

Returns a link to 'm' with the text 'body'. (aliased for tt2/etc. friendliness).

SUPPORT

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-module-format-ashtml at rt.cpan.org, or through the web interface at https://rt.cpan.org/Public/Bug/Report.html?Queue=Module-Format-AsHTML. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/shlomif/perl-Module-Format-AsHTML

  git clone https://github.com/shlomif/perl-Module-Format-AsHTML.git

AUTHOR

Shlomi Fish <shlomif@cpan.org>

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/shlomif/module-format-ashtml/issues

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.

COPYRIGHT AND LICENSE

This software is Copyright (c) 2020 by Shlomi Fish.

This is free software, licensed under:

  The MIT (X11) License