[I132] tags page generation issues #205
@ -4,27 +4,27 @@
|
|||||||
<!--% PERL %-->
|
<!--% PERL %-->
|
||||||
$Template::Stash::PRIVATE = undef; # Allow . in tag
|
$Template::Stash::PRIVATE = undef; # Allow . in tag
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
|
<!--% USE String %-->
|
||||||
<!--% uniq_tag_count = 0 %-->
|
<!--% uniq_tag_count = 0 %-->
|
||||||
<!--% comma_re = '(?x)(?:^|,\s*)(?:"((?>[^"]*)(?:""[^"]*)*)"|([^",]*))'; %-->
|
|
||||||
<!--# 'Moka5,interview, "computer science"' -->
|
|
||||||
<!--% FOREACH episode IN DBI.query(query_tags);
|
<!--% FOREACH episode IN DBI.query(query_tags);
|
||||||
ep_id = episode.id;
|
ep_id = episode.id;
|
||||||
ep_tags = episode.tags;
|
ep_tags = episode.tags;
|
||||||
FOREACH tag_str IN ep_tags.split(comma_re);
|
FOREACH tag_str IN ep_tags.csv_parse;
|
||||||
NEXT UNLESS tag_str;
|
NEXT UNLESS tag_str;
|
||||||
NEXT IF tag_str == '';
|
NEXT IF tag_str == '';
|
||||||
tag = tag_str.lower;
|
tag = tag_str.lower;
|
||||||
|
tag_index = String.new(tag).push('_');
|
||||||
first_char = tag.substr(0,1);
|
first_char = tag.substr(0,1);
|
||||||
IF first_char == '.';
|
IF first_char == '.';
|
||||||
first_char = '.'; # Unicode .
|
first_char = '.'; # Unicode .
|
||||||
END;
|
END;
|
||||||
IF all_tags.${first_char}.exists(tag);
|
IF all_tags.${first_char}.exists(tag_index);
|
||||||
all_tags.${first_char}.${tag}.count = all_tags.${first_char}.${tag}.count + 1;
|
all_tags.${first_char}.${tag_index}.count = all_tags.${first_char}.${tag_index}.count + 1;
|
||||||
all_tags.${first_char}.${tag}.urls.push(ep_id);
|
all_tags.${first_char}.${tag_index}.urls.push(ep_id);
|
||||||
ELSE;
|
ELSE;
|
||||||
all_tags.${first_char}.${tag}.count = 1;
|
all_tags.${first_char}.${tag_index}.count = 1;
|
||||||
uniq_tag_count = uniq_tag_count + 1;
|
uniq_tag_count = uniq_tag_count + 1;
|
||||||
all_tags.${first_char}.${tag}.urls = [ep_id];
|
all_tags.${first_char}.${tag_index}.urls = [ep_id];
|
||||||
END;
|
END;
|
||||||
END;
|
END;
|
||||||
END %-->
|
END %-->
|
||||||
@ -53,7 +53,7 @@ END %-->
|
|||||||
<ul class="columns3">
|
<ul class="columns3">
|
||||||
<!--% FOREACH first_char IN all_first %-->
|
<!--% FOREACH first_char IN all_first %-->
|
||||||
<!--% IF all_tags.${first_char} %-->
|
<!--% 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>
|
<li><a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag_to_id(String.new(all_tags.${first_char}.keys.sort.first).chop) %-->"><strong><!--% first_char %--></strong></a></li>
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
</ul>
|
</ul>
|
||||||
@ -63,11 +63,12 @@ END %-->
|
|||||||
<p class="ralign"><a href="<!--% absolute_path(baseurl) %-->tags.html#TOP">↑ Go to index</a></p>
|
<p class="ralign"><a href="<!--% absolute_path(baseurl) %-->tags.html#TOP">↑ Go to index</a></p>
|
||||||
<h3>Tags beginning with '<!--% first_char %-->'</h3>
|
<h3>Tags beginning with '<!--% first_char %-->'</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<!--% FOREACH tag IN all_tags.${first_char}.keys.sort %-->
|
<!--% FOREACH tag_index IN all_tags.${first_char}.keys.sort %-->
|
||||||
|
<!--% tag = String.new(tag_index).chop; tag_id = String.new(tag_index).chop; %-->
|
||||||
<li>
|
<li>
|
||||||
<a id="<!--% tag %-->"><strong><!--% tag %--></strong></a>:
|
<a id="<!--% tag_to_id(tag_id) %-->"><strong><!--% tag %--></strong></a>:
|
||||||
<!--% ep_links = [] %-->
|
<!--% ep_links = [] %-->
|
||||||
<!--% FOREACH ep_id IN all_tags.${first_char}.${tag}.urls.nsort;
|
<!--% FOREACH ep_id IN all_tags.${first_char}.${tag_index}.urls.nsort;
|
||||||
ep_links.push("<a href=\"${absolute_path(baseurl)}eps/hpr" _ zero_pad_left(ep_id) _ '/index.html"'
|
ep_links.push("<a href=\"${absolute_path(baseurl)}eps/hpr" _ zero_pad_left(ep_id) _ '/index.html"'
|
||||||
' target="_blank" aria-label="' _ tag _
|
' target="_blank" aria-label="' _ tag _
|
||||||
' - show ' _ ep_id _ '">' _ ep_id _ '</a>');
|
' - show ' _ ep_id _ '">' _ ep_id _ '</a>');
|
||||||
|
@ -14,7 +14,7 @@ from the series <em><a href="<!--% baseurl %-->series/<!--% zero_pad_left(series
|
|||||||
<!--% MACRO display_tags(tags) BLOCK %-->
|
<!--% MACRO display_tags(tags) BLOCK %-->
|
||||||
<span><label>Tags:</label> <em>
|
<span><label>Tags:</label> <em>
|
||||||
<!--% FOREACH tag IN tags.csv_parse %-->
|
<!--% FOREACH tag IN tags.csv_parse %-->
|
||||||
<a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag.lower %-->"><!--% tag %--></a><!--% IF loop.count == loop.size %-->.<!--% ELSE %-->,<!--% END %-->
|
<a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag_to_id(tag) %-->"><!--% tag %--></a><!--% IF loop.count == loop.size %-->.<!--% ELSE %-->,<!--% END %-->
|
||||||
<!--% END %--></em>
|
<!--% END %--></em>
|
||||||
</span>
|
</span>
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
|
@ -49,6 +49,15 @@
|
|||||||
<!--% iso8601_date.format(date_to_format) %-->
|
<!--% iso8601_date.format(date_to_format) %-->
|
||||||
<!--% END %-->
|
<!--% END %-->
|
||||||
|
|
||||||
|
<!--% MACRO tag_to_id(tag, is_index) BLOCK %-->
|
||||||
|
<!--% tag = tag.replace('\s+','_') %-->
|
||||||
|
<!--% IF is_index %-->
|
||||||
|
<!--% tag.upper %-->
|
||||||
|
<!--% ELSE %-->
|
||||||
|
<!--% tag.lower %-->
|
||||||
|
<!--% END %-->
|
||||||
|
<!--% END %-->
|
||||||
|
|
||||||
<!--% MACRO absolute_url(base, path) BLOCK %-->
|
<!--% MACRO absolute_url(base, path) BLOCK %-->
|
||||||
<!--% UNLESS base.empty %-->
|
<!--% UNLESS base.empty %-->
|
||||||
<!--% UNLESS base.substr(-1) == '/' %-->
|
<!--% UNLESS base.substr(-1) == '/' %-->
|
||||||
|
Loading…
Reference in New Issue
Block a user