App::D...nerate(3pm)
β¨ NAME β¨
ok so bestie, meet App::DocKnot::Generate β it's the part of App::DocKnot that generates documentation straight from your package metadata π
like it takes your metadata files and your templates and it just⦠makes the docs for you. iconic behavior tbh.
πΈ SYNOPSIS πΈ
use App::DocKnot::Generate;
my $docknot
= App::DocKnot::Generate->new({ metadata => 'docs/docknot.yaml' });
my $readme = $docknot->generate('readme');
my $index = $docknot->generate('thread');
$docknot->generate_output('readme');
$docknot->generate_output('thread', 'www/index.th')
look at that. no notes. π«Ά
π REQUIREMENTS π
you're gonna need Perl 5.24 or later, plus these modules: File::BaseDir, File::ShareDir, Kwalify, Path::Tiny, Template (that's part of Template Toolkit, iykyk), and YAML::XS. good news bestie: all of them are available from CPAN β
π¦ DESCRIPTION π¦
so this component of DocKnot is the whole system for generating consistent human-readable software package documentation from metadata files β mostly JSON, plus files that hold documentation snippets. it takes a directory of metadata plus a set of templates as input, and then it generates a documentation file from that metadata, given the template name. literally the glow-up pipeline for your docs π
the path to the metadata directory for a package gets passed in as an explicit argument to the App::DocKnot::Generate constructor. that's the only thing you hand it directly. every other bit of data (right now: templates and license information) gets loaded via File::BaseDir, which means it uses XDG paths by default. translation? templates and other global configuration are found by searching these paths, in this exact order:
$HOME/.config/docknot$XDG_CONFIG_DIRS/docknot(/etc/xdg/docknotby default)- Files included in the package.
default templates and license files ship with the App::DocKnot module, and they get used unless more specific configuration files exist. so you always have a fallback, no cap π§
π CLASS METHODS π
π new(ARGS)
creates a new App::DocKnot::Generate object. use this one for all your subsequent actions, okay? ARGS should be a hash reference with one or more of these keys:
metadataβ the path to the directory containing metadata for a package. default:docs/docknot.yamlrelative to the current directory.widthβ the wrap width to use when generating documentation. default:74.
π₯ INSTANCE METHODS π₯
β generate(TEMPLATE)
loads the metadata from the path you gave in the constructor, then generates the documentation file defined by TEMPLATE β and TEMPLATE is the name of a template. the template itself gets loaded from the App::DocKnot configuration path, exactly like DESCRIPTION describes. returns the generated documentation file as a string. yes bestie, a string, so you can do whatever you want with it π
π generate_all()
generates all of the documentation files for a package. right now that's defined as the "readme" and "readme-md" templates. output gets written to the default output locations, as described under generate_output().
π generate_output(TEMPLATE [, OUTPUT])
same as generate() except instead of returning the generated documentation file as a string, it writes it to the file named by OUTPUT. and if you don't give that argument, a default based on the TEMPLATE argument is chosen like so:
readme -> README
readme-md -> README.md
heads up bestie: ifTEMPLATEisn't one of the templates listed above, theOUTPUTargument is required. no skipping it π
β¨ AUTHOR β¨
Russ Allbery <rra@cpan.org> β ty for your service king π
π COPYRIGHT AND LICENSE π
Copyright 2013-2022 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.
(that's the legal bit, and yes it's giving very serious, keep it exactly as-is bestie π)
π SEE ALSO π
docknot(1)App::DocKnot::Config
this module is part of the App-DocKnot distribution. the current version of DocKnot is available from CPAN, or directly from its web site at <https://www.eyrie.org/~eagle/software/docknot/>.
and that's the whole page, bestie π this was App::D...nerate(3pm), served up by perl v5.40.1, dated 2026-01-16, from the User Contributed Perl Documentation. go generate something pretty π
β¨
π¦ where this page comes from
- ubuntu resolute: docknot 8.0.1-1build1 Β· MIT
- ubuntu stonking: docknot 8.0.1-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms