App-DocKnot

 view release on metacpan or  search on metacpan

lib/App/DocKnot/Spin/Pointer.pm  view on Meta::CPAN

=head1 REQUIREMENTS

Perl 5.24 or later and the modules File::ShareDir, Kwalify, List::SomeUtils,
Path::Tiny, Pod::Thread, and YAML::XS, all of which are available from CPAN.

=head1 DESCRIPTION

The tree of input files for App::DocKnot::Spin may contain pointers to
external files in various formats.  These files are in YAML format and end in
C<.spin>.  This module processes those files and converts them to HTML and, if
so configured, adds the links to integrate the page with the rest of the site.

For the details of the pointer file format, see L<POINTER FILES> below.

=head1 CLASS METHODS

=over 4

=item new(ARGS)

Create a new App::DocKnot::Spin::Pointer object.  A single converter object
can be used repeatedly to convert pointers in a tree of files.  ARGS should
be a hash reference with one or more of the following keys, all of which are
optional:

=over 4

=item output

The path to the root of the output tree when converting a tree of files.  This
will be used to calculate relative path names for generating inter-page links
using the provided C<sitemap> argument.  If C<sitemap> is given, this option
should also always be given.

=item sitemap

An App::DocKnot::Spin::Sitemap object.  This will be used to create inter-page
links.  For inter-page links, the C<output> argument must also be provided.

=item style-url

The base URL for style sheets.  A style sheet specified in a pointer file will
be considered to be relative to this URL and this URL will be prepended to it.
If this option is not given, the name of the style sheet will be used verbatim
as its URL, except with C<.css> appended.

=item thread

An App::DocKnot::Spin::Thread object, used for converting POD into HTML.  It
should be configured with the same App::DocKnot::Spin::Sitemap object as the
C<sitemap> argument.

=back

=back

=head1 INSTANCE METHODS

=over 4

=item is_out_of_date(POINTER, OUTPUT)

Returns true if OUTPUT is missing or if it was modified less recently than the
modification time of either POINTER or the underlying file that it points to.
Both paths must be Path::Tiny objects.

=item spin_pointer(POINTER, OUTPUT)

Convert a single pointer file to HTML.  POINTER is the path to the pointer
file, and OUTPUT is the path to where to write the output.  Both paths must
be Path::Tiny objects.

=back

=head1 POINTER FILES

A pointer file is a YAML file ending in C<.spin> that points to the source
file for a generated HTML page and provides additional configuration for its
conversion.  The valid keys for a pointer file are:

=over 4

=item format

The format of the source file.  Supported values are C<markdown>, C<pod>, and
C<text>.  Required.

=item path

The path to the source file.  It may be relative, in which case it's relative
to the pointer file.  Required.

=item options

Additional options that control the conversion to HTML.  These will be
different for each supported format.

C<markdown> has no supported options.

The supported options for a format of C<pod> are:

=over 4

=item contents

Boolean saying whether to generate a table of contents.  The default is false.

=item navbar

Boolean saying whether to generate a navigation bar at the top of the page.
The default is true.

=back

The supported options for a format of C<text> are:

=over 4

=item modified

Boolean saying whether to add a last modified header.  This will always be
done if the file contains a CVS-style C<$Id$> string, but otherwise will only
be done if this option is set to true.  The default is false.

=back

=item style

The style sheet to use for the converted output.  Optional.  If not set,
converted C<markdown> output will be unstyled, converted C<pod> output will



( run in 0.491 second using v1.01-cache-2.11-cpan-39bf76dae61 )