App::DocKnot

(Generate human-readable documentation from package metadata)

SYNOPSIS

    my $docknot = App::DocKnot->new({ metadata => 'docs/metadata' });
    my $readme = $docknot->generate('readme');
    my $index = $docknot->generate('thread');

REQUIREMENTS

Perl 5.18 or later and the modules File::BaseDir, File::ShareDir, JSON, Perl6::Slurp, and Template (part of Template Toolkit), all of which are available from CPAN.

DESCRIPTION

DocKnot is a system for generating consistent human-readable software package documentation from metadata files, primarily JSON and files containing documentation snippets. It takes as input a directory of metadata and a set of templates and generates a documentation file from the metadata given the template name.

The path to the metadata directory for a package is given as an explicit argument to the App::DocKnot constructor. All other data (currently templates and license information) is loaded via File::BaseDir and therefore uses XDG paths by default. This means that templates and other global configuration are found by searching the following paths in order:

  1. $HOME/.config/docknot

  2. $XDG_CONFIG_DIRS/docknot (/etc/xdg/docknot by default)

  3. Files included in the package.

As noted above, default templates and license files are included with the App::DocKnot module and are used unless more specific configuration files exist.

CLASS METHODS

new(ARGS)

Create a new App::DocKnot object. This should be used for all subsequent actions. ARGS should be a hash reference with one or more of the following keys:

metadata

The path to the directory containing metadata for a package. This argument is required.

width

The wrap width to use when generating documentation. Default is 74.

INSTANCE METHODS

generate(TEMPLATE)

Load the metadata from the path given in the constructor and generate the documentation file defined by TEMPLATE, which is the name of a template. The template itself will be loaded from the App::DocKnot configuration path as described in DESCRIPTION. Returns the generated documentation file as a string.

AUTHOR

Russ Allbery <rra@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2013, 2014, 2015, 2016 Russ Allbery <rra@cpan.org>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SEE ALSO

docknot(1)

This module is part of the DocKnot distribution. The current version of App::DocKnot is available from CPAN, or directly from its web site at <https://www.eyrie.org/~eagle/software/docknot/>.

Last modified and spun 2016-12-25