An open API service indexing awesome lists of open source software.

https://github.com/preaction/mojolicious-plugin-podviewer

View Perldoc in your Mojolicious website (forked from PODRenderer)
https://github.com/preaction/mojolicious-plugin-podviewer

Last synced: about 1 year ago
JSON representation

View Perldoc in your Mojolicious website (forked from PODRenderer)

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/preaction/Mojolicious-Plugin-PODViewer.svg?branch=master)](https://travis-ci.org/preaction/Mojolicious-Plugin-PODViewer)
[![Coverage Status](https://coveralls.io/repos/preaction/Mojolicious-Plugin-PODViewer/badge.svg?branch=master)](https://coveralls.io/r/preaction/Mojolicious-Plugin-PODViewer?branch=master)

# NAME

Mojolicious::Plugin::PODViewer - POD renderer plugin

# VERSION

version 0.007

# SYNOPSIS

# Mojolicious (with documentation browser under "/perldoc")
my $route = $app->plugin('PODViewer');
my $route = $app->plugin(PODViewer => {name => 'foo'});
my $route = $app->plugin(PODViewer => {preprocess => 'epl'});

# Mojolicious::Lite (with documentation browser under "/perldoc")
my $route = plugin 'PODViewer';
my $route = plugin PODViewer => {name => 'foo'};
my $route = plugin PODViewer => {preprocess => 'epl'};

# Without documentation browser
plugin PODViewer => {no_perldoc => 1};

# foo.html.ep
%= pod_to_html "=head1 TEST\n\nC<123>"

# foo.html.pod
=head1 <%= uc 'test' %>

# DESCRIPTION

[Mojolicious::Plugin::PODViewer](https://metacpan.org/pod/Mojolicious::Plugin::PODViewer) is a renderer for Perl's POD (Plain
Old Documentation) format. It includes a browser to browse the Perl
module documentation as a website.

This is a fork of the (deprecated) [Mojolicious::Plugin::PODRenderer](https://metacpan.org/pod/Mojolicious::Plugin::PODRenderer).

# OPTIONS

[Mojolicious::Plugin::PODViewer](https://metacpan.org/pod/Mojolicious::Plugin::PODViewer) supports the following options.

## name

# Mojolicious::Lite
plugin PODViewer => {name => 'foo'};

Handler name, defaults to `pod`.

## route

The [route](https://metacpan.org/pod/Mojolicious::Routes::Route) to add documentation to. Defaults to
`$app->routes->any('/perldoc')`. The new route will have a name of
`plugin.podviewer`.

## default\_module

The default module to show. Defaults to `Mojolicious::Guides`.

## allow\_modules

An arrayref of regular expressions that match modules to allow. At least
one of the regular expressions must match. Disallowed modules will be
redirected to the appropriate page on [http://metacpan.org](http://metacpan.org).

## layout

The layout to use. Defaults to `podviewer`.

## no\_perldoc

# Mojolicious::Lite
plugin PODViewer => {no_perldoc => 1};

Disable [Mojolicious::Guides](https://metacpan.org/pod/Mojolicious::Guides) documentation browser that will otherwise be
available under `/perldoc`.

## preprocess

# Mojolicious::Lite
plugin PODViewer => {preprocess => 'epl'};

Name of handler used to preprocess POD, defaults to `ep`.

# HELPERS

[Mojolicious::Plugin::PODViewer](https://metacpan.org/pod/Mojolicious::Plugin::PODViewer) implements the following helpers.

## pod\_to\_html

%= pod_to_html '=head2 lalala'
<%= pod_to_html begin %>=head2 lalala<% end %>

Render POD to HTML without preprocessing.

# TEMPLATES

[Mojolicious::Plugin::PODViewer](https://metacpan.org/pod/Mojolicious::Plugin::PODViewer) bundles the following templates. To
override this template with your own, create a template with the same name.

## podviewer/perldoc.html.ep

This template displays the POD for a module. The HTML for the documentation
is in the `perldoc` content section (`<%= content 'perldoc' %>`).
The template has the following stash values:

- module

The current module, with parts separated by `/`.

- cpan

A link to [http://metacpan.org](http://metacpan.org) for the current module.

- topics

An array of arrays of topics in the documentation. Each inner array is
a set of pairs of `link text` and `link href` suitable to be passed
directly to the `link_to` helper. New topics are started by a `=head1`
tag, and include all lower-level headings.

## layouts/podviewer.html.ep

The layout for rendering POD pages. Use this to add stylesheets,
JavaScript, and additional navigation. Set the `layout` option to
change this template.

# METHODS

[Mojolicious::Plugin::PODViewer](https://metacpan.org/pod/Mojolicious::Plugin::PODViewer) inherits all methods from
[Mojolicious::Plugin](https://metacpan.org/pod/Mojolicious::Plugin) and implements the following new ones.

## register

my $route = $plugin->register(Mojolicious->new);
my $route = $plugin->register(Mojolicious->new, {name => 'foo'});

Register renderer and helper in [Mojolicious](https://metacpan.org/pod/Mojolicious) application.

# SEE ALSO

[Mojolicious](https://metacpan.org/pod/Mojolicious), [Mojolicious::Guides](https://metacpan.org/pod/Mojolicious::Guides), [https://mojolicious.org](https://mojolicious.org).

# AUTHORS

- Sebastian Riedel
- Doug Bell

# CONTRIBUTORS

- brad
- CandyAngel
- Luc Didry
- Oleg
- Tekki
- Zoffix Znet

# COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Sebastian Riedel, Doug Bell.

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