App::DocKnot::Spin::Pointer(3pm)

App::DocKnot::Spin::Pointer3pm

Generate html from a pointer to an external file

Usage

    use App::DocKnot::Spin::Pointer;
    use App::DocKnot::Spin::Sitemap;
    use Path::Tiny qw(path);
    my $sitemap_path = path('/input/.sitemap');
    my $sitemap = App::DocKnot::Spin::Sitemap->new($sitemap_path);
    my $pointer = App::DocKnot::Spin::Pointer->new({
        output  => path('/output'),
        sitemap => $sitemap,
    });
    my $input = path('/input/file.spin');
    my $output = path('/output/file.html');
    $pointer->spin_pointer($input, $output);

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.

Overview

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 ".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 "POINTER FILES" below.

Class methods

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:

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 "sitemap" argument. If "sitemap" is given, this option should also always be given.

sitemap

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

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 ".css" appended.

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 "sitemap" argument.

Instance methods

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.

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.

Pointer files

A pointer file is a YAML file ending in ".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:

format

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

path

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

options

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

"markdown" has no supported options.

The supported options for a format of "pod" are:

contents

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

navbar

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

The supported options for a format of "text" are:

modified

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

style

The style sheet to use for the converted output. Optional. If not set, converted "markdown" output will be unstyled, converted "pod" output will use a style sheet named "pod", and converted "text" output will use a style sheet named "faq".

title

The title of the converted page. Optional. If not set, the title will be taken from the converted file in a format-specific way. For Markdown, the title will be the contents of the first top-level heading. For POD, the title will be taken from a NAME section formatted according to the conventions for manual pages.

Releases

2 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12
  2. 13

Author

Russ Allbery <[email protected]>

From docknot 8.0.1-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.