hpr_generator/templates/content-index.tpl.html

134 lines
4.9 KiB
HTML

<!--% PROCESS 'shared-avatar.tpl.html' %-->
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS 'shared-listen-now.tpl.html' %-->
<!--% PROCESS 'shared-show-transcript.tpl.html' %-->
<!--% PROCESS 'shared-call_for_shows.tpl.html' %-->
<!--% INCLUDE 'content-index-announcement.tpl.html' %-->
<!--% PROCESS "queries-index.tpl.html" %-->
<!--% MACRO tidy_notes(all_lines) BLOCK %-->
<!--% lines = all_lines %-->
<!--% after_html = all_lines %-->
<!--% img_re = '(?six)^(.*?)\<img ([^\>]+\>)(.+)$' %-->
<!--% lazy_re = '(?i)loading="lazy"' %-->
<!--% WHILE (matches = lines.match(img_re)) %-->
<!--% img_tag = matches.1 %-->
<!--% after_html = matches.2 %-->
<!--% matches.0 %-->
<!--% IF (img_tag.search(lazy_re)) %-->
<img <!--% img_tag %-->
<!--% ELSE %-->
<img loading="lazy" <!--% img_tag %-->
<!--% END %-->
<!--% lines = after_html %-->
<!--% END %-->
<!--% after_html %-->
<!--% END %-->
<!--% days_till_next_episode = 0 %-->
<!--% USE DBI(constants.driver) %-->
<!--% USE date %-->
<!--% calc = date.calc %-->
<!--% episodes = DBI.query(query_next_available_episode).get_all() %-->
<!--% last_date = episodes.0.date.split('-') %-->
<!--% offset = (calc.Day_of_Week(last_date.0,last_date.1,last_date.2) == 5 ? 3 : 1) %-->
<!--% slot_date = calc.Add_Delta_Days(last_date.0,last_date.1,last_date.2,offset) %-->
<!--% now = calc.Today() %-->
<!--% days_till_next_episode = calc.Delta_Days(now.0,now.1,now.2,slot_date.0,slot_date.1,slot_date.2) %-->
<!--% delta = date.calc.N_Delta_YMD(2005,9,19, date.format(date.now, '%Y'),date.format(date.now, '%m'),date.format(date.now, '%d')) %-->
<section id="welcome">
<header>Welcome</header>
<p>Hacker Public Radio is a podcast that releases shows every weekday Monday to Friday. The shows are contributed by the public and can be on any topic that is of interest to hackers, makers, hobbyists, etc.</p>
<div id="call_for_shows">
<!--% display_call_for_shows() %-->
</div>
</section>
<section id="podcast_lane">
<header>Podcast</header>
<div class="lane">
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->about.html#recording_a_podcast">
<img src="<!--% absolute_path(baseurl) %-->" alt="Microphone icon">
Record
</a>
<a class="lane-button" href="https://hub.hackerpublicradio.org/calendar.php">
<img src="" alt="Calendar icon">
Schedule
</a>
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->syndication.html">
<img src="<!--% absolute_path(baseurl) %-->" alt="RSS icon">
Subscribe
</a>
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->eps/index.html">
<img src="" alt="Speaker icon">
Listen
</a>
</div>
</section>
<section id="project_lane">
<header>Project</header>
<div class="lane">
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->correspondents/index.html">
<img src="<!--% absolute_path(baseurl) %-->" alt="Person icon">
Host
</a>
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->series/index.html">
<img src="" alt="Stack of Books icon">
Series
</a>
<a class="lane-button" href="<!--% absolute_path(baseurl) %-->about.html">
<img src="<!--% absolute_path(baseurl) %-->" alt="Question Mark icon">
About
</a>
</div>
</section>
<section id="latest_lane">
<!--% PROCESS 'shared-episode-summary.tpl.html' %-->
<section id="latest_shows">
<header>Latest Shows</header>
<!--% host_cnt = 0 %-->
<ul>
<!--% FOREACH latest_episodes IN DBI.query(query_latest_episodes)
%-->
<li><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(latest_episodes.id) %-->/index.html">hpr<!--% latest_episodes.id %--> :: <!--% latest_episodes.title %--></a></li>
<!--% host_cnt = host_cnt + 1 %-->
<!--% END %-->
</ul>
</section>
<section id="latest_comments">
<header>Latest Comments</header>
<ul>
<!--% FOREACH item IN DBI.query('
WITH episode_comment_rank AS (
SELECT
comments.eps_id
, comments.id as comment_id
, comments.comment_author_name
, comments.comment_timestamp
, comments.comment_title
, RANK() OVER (PARTITION BY eps_id ORDER BY id ) AS comment_number
FROM comments
)
SELECT
episode_comment_rank.*
, hosts.host
, eps.title AS episode_title
, eps.date AS episode_date
FROM episode_comment_rank
INNER JOIN eps
ON episode_comment_rank.eps_id = eps.id
INNER JOIN hosts
ON eps.hostid = hosts.hostid
ORDER BY episode_comment_rank.comment_timestamp DESC
LIMIT 10;
')
%-->
<li>hpr<!--% item.eps_id %--> (<!--% item.episode_date %-->) "<!--% item.episode_title %-->" by <!--% item.host %-->
<ul>
<li><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(item.eps_id) %-->/index.html#comment_<!--% item.comment_id%-->">Comment <!--% item.comment_number %-->: <!--% item.comment_author_name %--> on <!--% item.comment_timestamp %-->: "<!--% item.comment_title %-->"</a>
</li>
</ul>
</li>
<!--% END %-->
</ul>
</section>