FunctionalPerl

 view release on metacpan or  search on metacpan

website/gen-config.pl  view on Meta::CPAN

use strict;
use warnings;
use warnings FATAL => 'uninitialized';
use utf8;
use experimental "signatures";

our ($mydir, $gitrepository);    # 'import' from main

use PXML::XHTML ":all";
use Clone 'clone';
use FP::Lazy;

# htmlgen is run with CWD set to website/
my $logocfg = require "./logo.pl";

my $css_path0 = "FP.css";

my $version_numrevisions = lazy {
    my $describe = $gitrepository->describe();
    my ($version, $maybe_numrevisions, $maybe_shorthash)
        = $describe =~ /^(.*?)(?:-(\d+)-g(.*))?\z/s
        or die "huh describe '$describe'";
    [$version, $maybe_numrevisions]
};

my $year = (localtime)[5] + 1900;

my $email = "copying\@christianjaeger.ch";    # ? or ch@?

+{
    map_code_body => sub ($str, $uplist, $path0) {
        my ($version, $maybe_numrevisions) = @{ force $version_numrevisions};
        my $version_underscores = $version;
        $version_underscores =~ tr/./_/;
        my $commits
            = $maybe_numrevisions
            ? ($maybe_numrevisions == 1
            ? "$maybe_numrevisions commit"
            : "$maybe_numrevisions commits")
            : "zero commits";

        $str =~ s|\$FP_VERSION\b|$version|sg;
        $str =~ s|\$FP_VERSION_UNDERSCORES\b|$version_underscores|sg;
        $str =~ s|\$FP_COMMITS_DIFFERENCE\b|$commits|sg;
        $str
    },

    #copy_paths => [], optional, for path0s from the main source root
    copy_paths_separate =>

        # source_root => path0s
        +{ "." => ["FP-logo.png", $css_path0,] },
    path0_handlers => +{},
    title          => sub($filetitle) {
        (
            $filetitle eq "Readme"
            ? "Functional programming in Perl"
            : $filetitle,
            " - functional-perl.org"
        )
    },
    head => sub($path0) {

        # HTML to add to the <head> section
        LINK(
            {
                rel  => "stylesheet",
                href => path_diff($path0, $css_path0),
                type => "text/css"
            }
        )
    },

    header => sub($path0) {



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