Compare commits
1 Commits
c5c5dd89b9
...
86e1d73085
Author | SHA1 | Date | |
---|---|---|---|
86e1d73085 |
@ -169,10 +169,7 @@ sub main {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $database = 'sqlite';
|
||||
my $DB_driver = 'dbi:SQLite:hpr.db';
|
||||
|
||||
my $tt = get_template_html($database, $DB_driver, $config{app_paths});
|
||||
my $tt = get_template_html($config{DBI}, $config{app_paths});
|
||||
|
||||
#
|
||||
# Define a TT² vmethod called 'csv_parse', it takes a scalar value and
|
||||
@ -189,6 +186,7 @@ sub main {
|
||||
|
||||
# Remove non page sections of the configuration file
|
||||
# from the generated list of pages.
|
||||
@page_args= grep { $_ ne 'DBI' } @page_args;
|
||||
@page_args= grep { $_ ne 'root_template' } @page_args;
|
||||
@page_args= grep { $_ ne 'app_paths' } @page_args;
|
||||
|
||||
@ -243,16 +241,18 @@ sub get_template_html {
|
||||
# HTML comments to make the template file valid HTML.
|
||||
#
|
||||
return Template->new(
|
||||
{ INCLUDE_PATH => $_[2]{templates_path},
|
||||
OUTPUT_PATH => $_[2]{output_path},
|
||||
{ INCLUDE_PATH => $_[1]{templates_path},
|
||||
OUTPUT_PATH => $_[1]{output_path},
|
||||
EVAL_PERL => 1,
|
||||
START_TAG => '<!--%',
|
||||
END_TAG => '%-->',
|
||||
PRE_CHOMP => 1,
|
||||
POST_CHOMP => 1,
|
||||
CONSTANTS => {
|
||||
database => $_[0],
|
||||
driver => $_[1],
|
||||
database => $_[0]{database},
|
||||
driver => $_[0]{driver},
|
||||
user => $_[0]{user},
|
||||
password => $_[0]{password},
|
||||
}
|
||||
}
|
||||
) || die $Template::ERROR, "\n";
|
||||
|
4
site.cfg
4
site.cfg
@ -3,6 +3,10 @@
|
||||
# dbi:<driver name [SQLite, CSV, ADO, mSQL, etc.]>:<database name>
|
||||
# For more information on Perl Template Toolkit see:
|
||||
# http://template-toolkit.org/docs/manual/index.html
|
||||
[DBI]
|
||||
# Configuration settings for SQLite
|
||||
database: sqlite
|
||||
driver: dbi:SQLite:hpr.db
|
||||
|
||||
# Configure the location of the templates and the generated HTML
|
||||
[app_paths]
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
|
||||
<!--% PROCESS "queries-episode-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-episode.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
|
||||
<h2>Comment Viewer</h2>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-avatar.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-correspondent.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
|
||||
%-->
|
||||
|
@ -3,8 +3,8 @@
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
|
||||
<!--% PROCESS "queries-episode-${constants.database}.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% PROCESS "queries-episode.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
|
||||
<!--% query_episodes = DBI.prepare(query_episode_maxmin) %-->
|
||||
<!--% episode_result = query_episodes.execute(id, id, id, id, id) %-->
|
||||
<!--% FOREACH episode IN episode_result %-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
|
||||
<!--% PROCESS "queries-episodes-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-episodes.tpl.html" %-->
|
||||
<article>
|
||||
<header>
|
||||
<h1>Complete Archive of Shows.</h1>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-call_for_shows.tpl.html' %-->
|
||||
<!--% INCLUDE 'content-index-announcement.tpl.html' %-->
|
||||
<!--% PROCESS "queries-index-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-index.tpl.html" %-->
|
||||
<!--% MACRO tidy_notes(all_lines) BLOCK %-->
|
||||
<!--% lines = all_lines %-->
|
||||
<!--% after_html = all_lines %-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-series-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-series.tpl.html" %-->
|
||||
<article>
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<h1 class="title">In-Depth Series</h1>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
|
||||
<!--% PROCESS 'shared-avatar.tpl.html' %-->
|
||||
<!--% PROCESS "queries-series_episodes-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-series_episodes.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% query_series = DBI.prepare(query_series_sql)
|
||||
%-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-tags-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-tags.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% PERL %-->
|
||||
$Template::Stash::PRIVATE = undef; # Allow . in tag
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!--% PROCESS "queries-ids-episode-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-ids-episode.tpl.html" %-->
|
||||
<!--% USE DBI(constants.driver) %-->
|
||||
<!--% FOREACH episode IN DBI.query(query_ids_episode) %-->
|
||||
,<!--% episode.id %-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-item.tpl.xml' %-->
|
||||
<!--% PROCESS "rss-query-hpr-${constants.database}.tpl.xml" %-->
|
||||
<!--% PROCESS "rss-query-hpr.tpl.xml" %-->
|
||||
<!--% FOREACH episode IN feed_result %-->
|
||||
<!--% display_item(episode, media_file_extension, audio_mime_type) %-->
|
||||
<!--% END %-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-item.tpl.xml' %-->
|
||||
<!--% PROCESS "rss-query-hpr_total-${constants.database}.tpl.xml" %-->
|
||||
<!--% PROCESS "rss-query-hpr_total.tpl.xml" %-->
|
||||
<!--% FOREACH episode IN feed_result %-->
|
||||
<!--% display_item(episode, media_file_extension, audio_mime_type) %-->
|
||||
<!--% END %-->
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
|
||||
<!--% PROCESS "queries-call_for_shows-${constants.database}.tpl.html" %-->
|
||||
<!--% PROCESS "queries-call_for_shows.tpl.html" %-->
|
||||
<!--% MACRO display_call_for_shows BLOCK %-->
|
||||
<!--% result_call_for_shows = DBI.prepare(query_call_for_shows) %-->
|
||||
<!--% results_call_for_shows = result_call_for_shows.execute().get_all() %-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user