From 5cb694de140d3a310675efa1b279c3d868ddd736 Mon Sep 17 00:00:00 2001 From: Roan Horning Date: Tue, 28 Jun 2022 05:25:36 -0400 Subject: [PATCH] Initial add of site-generator app and config file A Perl program which uses Template Toolkit to generate static html files for Hacker Public Radio. Signed-off-by: Roan Horning --- site-generator | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ site.cfg | 23 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100755 site-generator create mode 100644 site.cfg diff --git a/site-generator b/site-generator new file mode 100755 index 0000000..8793909 --- /dev/null +++ b/site-generator @@ -0,0 +1,61 @@ +#!/usr/bin/perl + +=head1 NAME + +siteGenerator - HPR Site Generator + +=head1 SYNOPSIS + + siteGenerator [OPTION]... PAGE... + + -v, --verbose use verbose mode + --help print this help message + + Where I is a file name of a web page. + + Examples: + + Generate two specific pages: + siteGenerator index about + + Generate the whole site: + siteGenerator ALL + +=head1 DESCRIPTION + +This is a site generator based upon the Perl Templates Toolkit. + +=head1 AUTHOR + +Roan Horning + +=cut + +use strict; +use warnings; + +use Getopt::Long qw(:config auto_help); +use Pod::Usage; +use Config::Std; + +exit main(); + +sub main { + + # Argument parsing + my $verbose; + GetOptions( + 'verbose' => \$verbose, + ) or pod2usage(1); + pod2usage(1) unless @ARGV; + my (@pages) = @ARGV; + + # Load config file + read_config "site.cfg" => my %config; + + use Data::Dumper 'Dumper'; + warn Dumper [ \%config ]; + + return 0; +} + diff --git a/site.cfg b/site.cfg new file mode 100644 index 0000000..c984ad4 --- /dev/null +++ b/site.cfg @@ -0,0 +1,23 @@ +# Configure the navigation menu and the content templates for each page +# of the site: +# [page_name] +# navigation: +# content: + +[index] +naviation: navigation-main.tpl.html +content: content-index.tpl.html + +[about] +navigation: navigation-about.tpl.html +content: content-about.tpl.html + +[correspondents] +navigation: navigation-about.tpl.html +content: content-correspondents.tpl.html + +[contact] +navigation: navigation-about.tpl.html +content: content-contact.tpl.html + +