Compare commits
No commits in common. "8783ca50996f6343bdd98efd4f39b6251f4f8f5a" and "0f4fdc2d4601cea3296ca66d60e47bbdae0c8595" have entirely different histories.
8783ca5099
...
0f4fdc2d46
@ -9,7 +9,6 @@
|
|||||||
site-generator [OPTION]... PAGE|PAGE=<comma separated list of ids>...
|
site-generator [OPTION]... PAGE|PAGE=<comma separated list of ids>...
|
||||||
|
|
||||||
-a, --all generate all pages defined in configuration file
|
-a, --all generate all pages defined in configuration file
|
||||||
-c, --configure path to configuration file
|
|
||||||
-l, --list print list of configured pages
|
-l, --list print list of configured pages
|
||||||
-p, --preview print generated pages to standard out
|
-p, --preview print generated pages to standard out
|
||||||
-q, --quiet suppress progress information while generating pages
|
-q, --quiet suppress progress information while generating pages
|
||||||
@ -110,13 +109,11 @@ sub main {
|
|||||||
|
|
||||||
# Argument parsing
|
# Argument parsing
|
||||||
my $all;
|
my $all;
|
||||||
my $configuration_path;
|
|
||||||
my $preview;
|
my $preview;
|
||||||
my $verbose;
|
my $verbose;
|
||||||
my $quiet;
|
my $quiet;
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'all' => \$all,
|
'all' => \$all,
|
||||||
'configuration=s' => \$configuration_path,
|
|
||||||
'list' => \&print_available_pages,
|
'list' => \&print_available_pages,
|
||||||
'preview' => \$preview,
|
'preview' => \$preview,
|
||||||
'verbose' => \$verbose,
|
'verbose' => \$verbose,
|
||||||
@ -129,21 +126,10 @@ sub main {
|
|||||||
$verbose = 'quiet';
|
$verbose = 'quiet';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!$configuration_path) {
|
|
||||||
$configuration_path = "site.cfg";
|
|
||||||
}
|
|
||||||
|
|
||||||
my %config;
|
|
||||||
if ( -f $configuration_path ) {
|
|
||||||
# Load config file
|
# Load config file
|
||||||
read_config $configuration_path => %config;
|
read_config "site.cfg" => my %config;
|
||||||
}
|
|
||||||
else {
|
|
||||||
print STDOUT "Could not read configuration file: $configuration_path\n";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $tt = get_template_html($config{DBI}, $config{app_paths});
|
my $tt = get_template_html($config{DBI});
|
||||||
|
|
||||||
# If command line option all is set, parse configuration file
|
# If command line option all is set, parse configuration file
|
||||||
# for all pages
|
# for all pages
|
||||||
@ -154,7 +140,7 @@ sub main {
|
|||||||
# from the generated list of pages.
|
# from the generated list of pages.
|
||||||
@page_args= grep { $_ ne 'DBI' } @page_args;
|
@page_args= grep { $_ ne 'DBI' } @page_args;
|
||||||
@page_args= grep { $_ ne 'root_template' } @page_args;
|
@page_args= grep { $_ ne 'root_template' } @page_args;
|
||||||
@page_args= grep { $_ ne 'app_paths' } @page_args;
|
@page_args= grep { $_ ne 'media_hostname' } @page_args;
|
||||||
|
|
||||||
};
|
};
|
||||||
foreach my $page_arg (@page_args) {
|
foreach my $page_arg (@page_args) {
|
||||||
@ -207,8 +193,8 @@ sub get_template_html (\%@) {
|
|||||||
# HTML comments to make the template file valid HTML.
|
# HTML comments to make the template file valid HTML.
|
||||||
#
|
#
|
||||||
return Template->new({
|
return Template->new({
|
||||||
INCLUDE_PATH => $_[1]{templates_path},
|
INCLUDE_PATH => './templates',
|
||||||
OUTPUT_PATH => $_[1]{output_path},
|
OUTPUT_PATH => './public_html',
|
||||||
EVAL_PERL => 1,
|
EVAL_PERL => 1,
|
||||||
START_TAG => '<!--%',
|
START_TAG => '<!--%',
|
||||||
END_TAG => '%-->',
|
END_TAG => '%-->',
|
||||||
|
5
site.cfg
5
site.cfg
@ -13,11 +13,6 @@
|
|||||||
#user: hpr-generator (Suggested user with read-only privileges)
|
#user: hpr-generator (Suggested user with read-only privileges)
|
||||||
#password: ********* (Password for user)
|
#password: ********* (Password for user)
|
||||||
|
|
||||||
# Configure the location of the templates and the generated HTML
|
|
||||||
[app_paths]
|
|
||||||
templates_path: ./templates
|
|
||||||
output_path: ./public_html
|
|
||||||
|
|
||||||
# Configure the root template page which pulls in the navigation and
|
# Configure the root template page which pulls in the navigation and
|
||||||
# content templates used by each page. An optional baseurl property may
|
# content templates used by each page. An optional baseurl property may
|
||||||
# be defined. This is useful when opening files directly from local
|
# be defined. This is useful when opening files directly from local
|
||||||
|
Reference in New Issue
Block a user