Merge pull request 'Implement Tags page' (#106) from I6_Implement_Tags_page into main
Reviewed-on: rho_n/hpr_generator#106
This commit is contained in:
		
							
								
								
									
										4
									
								
								site.cfg
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								site.cfg
									
									
									
									
									
								
							@@ -146,6 +146,10 @@ content: content-promote.tpl.html
 | 
			
		||||
navigation: navigation-about.tpl.html
 | 
			
		||||
content: content-sitemap.tpl.html
 | 
			
		||||
 | 
			
		||||
[tags]
 | 
			
		||||
navigation: navigation-main.tpl.html
 | 
			
		||||
content: content-tags.tpl.html
 | 
			
		||||
 | 
			
		||||
[twat_episode]
 | 
			
		||||
navigation: navigation-get-shows.tpl.html
 | 
			
		||||
content: content-twat_episode.tpl.html
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										85
									
								
								templates/content-tags.tpl.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										85
									
								
								templates/content-tags.tpl.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,85 @@
 | 
			
		||||
<!--% PROCESS 'shared-utils.tpl.html' %-->
 | 
			
		||||
<!--% PROCESS "queries-tags-${constants.database}.tpl.html" %-->
 | 
			
		||||
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
 | 
			
		||||
<!--% PERL %-->
 | 
			
		||||
$Template::Stash::PRIVATE = undef; # Allow . in tag
 | 
			
		||||
<!--% END %-->
 | 
			
		||||
<!--% uniq_tag_count = 0 %-->
 | 
			
		||||
<!--% comma_re = '(?x)(?:^|,\s*)(?:"((?>[^"]*)(?:""[^"]*)*)"|([^",]*))'; %-->
 | 
			
		||||
<!--# 'Moka5,interview, "computer science"' -->
 | 
			
		||||
<!--% FOREACH episode IN DBI.query(query_tags);
 | 
			
		||||
    ep_id = episode.id;
 | 
			
		||||
    ep_tags = episode.tags;
 | 
			
		||||
    FOREACH tag_str IN ep_tags.split(comma_re);
 | 
			
		||||
        NEXT UNLESS tag_str;
 | 
			
		||||
        NEXT IF tag_str == '';
 | 
			
		||||
        tag = tag_str.lower;
 | 
			
		||||
        first_char = tag.substr(0,1);
 | 
			
		||||
        IF first_char == '.';
 | 
			
		||||
            first_char = '.'; # Unicode .
 | 
			
		||||
        END;
 | 
			
		||||
        IF all_tags.${first_char}.exists(tag);
 | 
			
		||||
            all_tags.${first_char}.${tag}.count = all_tags.${first_char}.${tag}.count + 1;
 | 
			
		||||
            all_tags.${first_char}.${tag}.urls.push(ep_id);
 | 
			
		||||
        ELSE;
 | 
			
		||||
            all_tags.${first_char}.${tag}.count = 1;
 | 
			
		||||
            uniq_tag_count = uniq_tag_count + 1;
 | 
			
		||||
            all_tags.${first_char}.${tag}.urls = [ep_id];
 | 
			
		||||
        END;
 | 
			
		||||
    END;
 | 
			
		||||
END %-->
 | 
			
		||||
<!--% USE date %-->
 | 
			
		||||
<!--% all_first = ['#','.','/','0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] %-->
 | 
			
		||||
 | 
			
		||||
<style>
 | 
			
		||||
    .columns3 { columns: 3 auto; list-style-type: none }
 | 
			
		||||
    hr.thin {
 | 
			
		||||
        border: 0;
 | 
			
		||||
        height: 0;
 | 
			
		||||
        border-top: 1px solid rgba(0, 0, 0, 0.1);
 | 
			
		||||
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
 | 
			
		||||
    }
 | 
			
		||||
    p.ralign { text-align: right }
 | 
			
		||||
</style>
 | 
			
		||||
<article>
 | 
			
		||||
	<a id="TOP"><h1 class="title">Tag summary</h1></a>
 | 
			
		||||
	<h4 class="date">Page generated on <!--% date.format(date.now, format => '%Y-%m-%d at %H:%M:%S UTC', gmt => 1) %--></h4>
 | 
			
		||||
	<p>This section summarises all of the tags currently used throughout the
 | 
			
		||||
	database. The tags are in alphabetical order and each is followed by links to
 | 
			
		||||
	the show numbers where it is used so you can see the context the author used
 | 
			
		||||
	it in. There are currently <!--% uniq_tag_count %--> unique tags in the system.</p>
 | 
			
		||||
	<h4>Alphabetical index</h4>
 | 
			
		||||
	<p>This is an index to the initial letters of the tags below.</p>
 | 
			
		||||
	<ul class="columns3">
 | 
			
		||||
    <!--% FOREACH first_char IN all_first %-->
 | 
			
		||||
        <!--% IF all_tags.${first_char} %-->
 | 
			
		||||
            <li><a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% all_tags.${first_char}.keys.sort.first %-->"><strong><!--% first_char %--></strong></a></li>
 | 
			
		||||
        <!--% END %-->
 | 
			
		||||
    <!--% END %-->
 | 
			
		||||
	</ul>
 | 
			
		||||
	<hr>
 | 
			
		||||
    <!--% FOREACH first_char IN all_first %-->
 | 
			
		||||
        <!--% IF all_tags.${first_char} %-->
 | 
			
		||||
		<p class="ralign"><a href="<!--% absolute_path(baseurl) %-->tags.html#TOP">↑ Go to index</a></p>
 | 
			
		||||
	        <h3>Tags beginning with '<!--% first_char %-->'</h3>
 | 
			
		||||
	        <ul>
 | 
			
		||||
                <!--% FOREACH tag IN all_tags.${first_char}.keys.sort %-->
 | 
			
		||||
    	        	<li>
 | 
			
		||||
    	        		<a id="<!--% tag %-->"><strong><!--% tag %--></strong></a>: 
 | 
			
		||||
                        <!--% ep_links = [] %-->
 | 
			
		||||
                        <!--% FOREACH ep_id IN all_tags.${first_char}.${tag}.urls.nsort;
 | 
			
		||||
							ep_links.push("<a href=\"${absolute_path(baseurl)}eps/hpr" _ zero_pad_left(ep_id) _ '/index.html"'
 | 
			
		||||
                                ' target="_blank" aria-label="' _ tag _
 | 
			
		||||
                                ' - show ' _ ep_id _ '">' _ ep_id _ '</a>');
 | 
			
		||||
                        END %-->
 | 
			
		||||
                        <!--% ep_links.join(', ') %-->
 | 
			
		||||
    	        	</li>
 | 
			
		||||
                <!--% END %-->
 | 
			
		||||
	        </ul>
 | 
			
		||||
        <!--% END %-->
 | 
			
		||||
    <!--% END %-->
 | 
			
		||||
	<p><a href="#TOP">Go to TOP of page</a></p>
 | 
			
		||||
</article>
 | 
			
		||||
<!--% PERL %-->
 | 
			
		||||
$Template::Stash::PRIVATE = 1;
 | 
			
		||||
<!--% END %-->
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->syndication.html">Get Shows</a></li>
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->contribute.html">Give Shows</a></li>
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->help_out.html">Contribute</a></li>
 | 
			
		||||
			<li><a href="http://www.hackerpublicradio.org/tags.php">Tags</a></li>
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->tags.html">Tags</a></li>
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->about.html">About</a></li>
 | 
			
		||||
			<li><a href="<!--% absolute_path(baseurl) %-->search.html">Search</a></li>
 | 
			
		||||
		</ul>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								templates/queries-tags-mysql.tpl.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								templates/queries-tags-mysql.tpl.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
<!--% query_tags = 'SELECT id, tags FROM eps' %-->
 | 
			
		||||
							
								
								
									
										1
									
								
								templates/queries-tags-sqlite.tpl.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								templates/queries-tags-sqlite.tpl.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
<!--% query_tags = 'SELECT id, tags FROM eps' %-->
 | 
			
		||||
		Reference in New Issue
	
	Block a user