Initial add of multipage template processing
For the individual host pages, allow the ids to be passed in on the command line.
This commit is contained in:
parent
4e56289338
commit
1ec288bbb8
@ -109,14 +109,20 @@ sub main {
|
|||||||
@pages= grep { $_ ne 'root_template' } @pages;
|
@pages= grep { $_ ne 'root_template' } @pages;
|
||||||
};
|
};
|
||||||
foreach my $page (@pages) {
|
foreach my $page (@pages) {
|
||||||
|
my %pages = get_multiple_pages($page);
|
||||||
if (exists($config{$page})) {
|
if (exists($config{$pages{'page'}})) {
|
||||||
verbose ($verbose, "Generating page: $page");
|
if ($config{$pages{'page'}}{'multipage'}) {
|
||||||
generate_page($tt, $config{root_template}{content}, \%config, $page, $preview);
|
foreach my $id ($pages{'ids'}) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
verbose (1, "\nWarning: Page $page is not defined in the configuration file.");
|
verbose ($verbose, "Generating page: $pages{'page'}");
|
||||||
|
generate_page($tt, $config{root_template}{content}, \%config, $pages{'page'}, $preview);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
verbose (1, "\nWarning: Page $pages{'page'} is not defined in the configuration file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
verbose (1, "\nFinished processing the files.");
|
verbose (1, "\nFinished processing the files.");
|
||||||
@ -166,3 +172,32 @@ sub verbose {
|
|||||||
print ".";
|
print ".";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_multiple_pages {
|
||||||
|
my ($pages) = @_;
|
||||||
|
# Split page name from page ids if available.
|
||||||
|
my ($page, $ids) = split(/=/, $pages);
|
||||||
|
my @ids = [];
|
||||||
|
|
||||||
|
if(!$ids) {
|
||||||
|
$ids = "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Parse the page ids and push them onto @ids array
|
||||||
|
my @ids_by_comma = split(/\,/, $ids);
|
||||||
|
foreach my $id_by_comma (@ids_by_comma) {
|
||||||
|
my @ids_for_range = split(/\.\./, $id_by_comma);
|
||||||
|
if ((scalar @ids_for_range) == 2) {
|
||||||
|
push @ids, $ids_for_range[0]..$ids_for_range[1];
|
||||||
|
}
|
||||||
|
elsif ((scalar @ids_for_range) == 1) {
|
||||||
|
push @ids, $ids_for_range[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
verbose (1, "\nWarning: Page $page id range $id_by_comma could not be parsed.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ('page', $page, 'ids', @ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user