Fix generation of tags index page
Replace white-space in ID attributes with the underscore character. Fix generation of tags that start with the letter k. The tag, keys, caused issues when used as a hash key.
This commit is contained in:
parent
70d5983ede
commit
b17daba4ed
@ -4,6 +4,7 @@
|
||||
<!--% PERL %-->
|
||||
$Template::Stash::PRIVATE = undef; # Allow . in tag
|
||||
<!--% END %-->
|
||||
<!--% USE String %-->
|
||||
<!--% uniq_tag_count = 0 %-->
|
||||
<!--% FOREACH episode IN DBI.query(query_tags);
|
||||
ep_id = episode.id;
|
||||
@ -12,17 +13,18 @@ $Template::Stash::PRIVATE = undef; # Allow . in tag
|
||||
NEXT UNLESS tag_str;
|
||||
NEXT IF tag_str == '';
|
||||
tag = tag_str.lower;
|
||||
tag_index = String.new(tag).push('_');
|
||||
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);
|
||||
IF all_tags.${first_char}.exists(tag_index);
|
||||
all_tags.${first_char}.${tag_index}.count = all_tags.${first_char}.${tag_index}.count + 1;
|
||||
all_tags.${first_char}.${tag_index}.urls.push(ep_id);
|
||||
ELSE;
|
||||
all_tags.${first_char}.${tag}.count = 1;
|
||||
all_tags.${first_char}.${tag_index}.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 %-->
|
||||
@ -51,7 +53,7 @@ END %-->
|
||||
<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>
|
||||
<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 %-->
|
||||
</ul>
|
||||
@ -61,11 +63,12 @@ END %-->
|
||||
<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 %-->
|
||||
<!--% FOREACH tag_index IN all_tags.${first_char}.keys.sort %-->
|
||||
<!--% tag = String.new(tag_index).chop; tag_id = String.new(tag_index).chop; %-->
|
||||
<li>
|
||||
<a id="<!--% tag %-->"><strong><!--% tag %--></strong></a>:
|
||||
<a id="<!--% tag_to_id(tag_id) %-->"><strong><!--% tag %--></strong></a>:
|
||||
<!--% 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"'
|
||||
' target="_blank" aria-label="' _ tag _
|
||||
' - show ' _ ep_id _ '">' _ ep_id _ '</a>');
|
||||
|
Loading…
Reference in New Issue
Block a user