From b3e6fc56f7fd4f30476e3be2b1639e77ca8f456b Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 16 Jun 2020 15:55:22 +0800 Subject: [PATCH] Improved the generation rules of Categories ID. Avoid invalidation of icon animations for closed and opened top categories when category names contain a dot. --- tabs/categories.md | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tabs/categories.md b/tabs/categories.md index b6c2382..fed6b98 100644 --- a/tabs/categories.md +++ b/tabs/categories.md @@ -11,6 +11,8 @@ title: Categories {% assign HEAD_PREFIX = "h_" %} {% assign LIST_PREFIX = "l_" %} +{% assign group_index = 0 %} + {% assign sort_categories = site.categories | sort %} {% for category in sort_categories %} @@ -36,47 +38,47 @@ title: Categories
+ id="{{ HEAD_PREFIX }}{{ group_index }}"> - {% if sub_categories_size > 0 %} - - {% else %} - - {% endif %} - - {{ category_name }} - + {% if sub_categories_size > 0 %} + + {% else %} + + {% endif %} + + {{ category_name }} + {% assign top_posts_size = site.categories[category_name] | size %} - + {% if sub_categories_size > 0 %} {{ sub_categories_size }} {% if sub_categories_size > 1 %}categories{% else %}category{% endif %}, {% endif %} {{ top_posts_size }} post{% if top_posts_size > 1 %}s{% endif %} - + {% if sub_categories_size > 0%} - - - + + + {% else %} - - - + + + {% endif %}
{% if sub_categories_size > 0 %} -
+
    {% for sub_category in sub_categories %}
  • @@ -95,5 +97,7 @@ title: Categories
+ {% assign group_index = group_index | plus: 1 %} + {% endif %} {% endfor %}