forked from tinyclub/tinylab.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategories.html
156 lines (130 loc) · 5.13 KB
/
categories.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
---
layout: page
title: 分类
tagline: 按照所属类别展示
header: Posts By Category
ctg: true
comments: false
---
{% include JB/setup %}
{% assign x_label = '分类' %}
{% assign y_label = '数目' %}
{% assign list = nil %}
{% assign p_ctg_list = "" %}
{% for category in site.data.categories %}
{% assign name = category.name %}
{% assign downcase_name = name | downcase %}
{% assign categories = site.categories[downcase_name] %}
{% assign size = categories.size %}
<h2 id="{{ downcase_name | replace:" ","-" | replace:"/","-" }}-ref">{{ name }}{% if size %} <sup>({{ size }})</sup>{% endif %}</h2>
{% if size %}
{% assign p_ctg_list = p_ctg_list | append:"," | append:downcase_name %}
<ul>
{% assign pages_list = categories %}
{% include JB/pages_list %}
</ul>
{% assign list0 = size | append:',' | append: name %}
{% if list == nil %}
{% assign list = list0 %}
{% else %}
{% assign list = list | append:';' | append: list0 %}
{% endif %}
{% endif %}
<!-- top -->
{% if category.categories %}
{% for child in category.categories %}
{% assign name = child.name %}
{% assign downcase_name = name | downcase %}
{% assign child_categories = site.categories[downcase_name] %}
{% assign size = child_categories.size %}
<h3 id ="{{ downcase_name | replace:" ","-" | replace:"/","-" }}-ref">{{ name }}{% if child_size %} <sup>({{ size }})</sup>{% endif %}</h3>
{% if size %}
{% assign p_ctg_list = p_ctg_list | append:"," | append:downcase_name %}
<ul>
{% assign pages_list = child_categories %}
{% include JB/pages_list %}
</ul>
{% assign list0 = size | append:',' | append: name %}
{% if list == nil %}
{% assign list = list0 %}
{% else %}
{% assign list = list | append:';' | append: list0 %}
{% endif %}
{% endif %}
<!-- child -->
{% if child.categories %}
{% for g in child.categories %}
{% assign name = g.name %}
{% assign downcase_name = name | downcase %}
{% assign g_categories = site.categories[downcase_name] %}
{% assign size = g_categories.size %}
<h4 id="{{ downcase_name | replace:" ","-" | replace:"/","-" }}-ref">{{ name }}{% if size %} <sup>({{ size }})</sup>{% endif %}</h4>
{% if size %}
{% assign p_ctg_list = p_ctg_list | append:"," | append:downcase_name %}
<ul>
{% assign pages_list = g_categories %}
{% include JB/pages_list %}
</ul>
{% assign list0 = size | append:',' | append: name %}
{% if list == nil %}
{% assign list = list0 %}
{% else %}
{% assign list = list | append:';' | append: list0 %}
{% endif %}
{% endif %}
<!-- g -->
{% if g.categories %}
{% for gg in g.categories %}
{% assign name = gg.name %}
{% assign downcase_name = name | downcase %}
{% assign gg_categories = site.categories[downcase_name] %}
{% assign size = gg_categories.size %}
<h5 id="{{ downcase_name | replace:" ","-" | replace:"/","-" }}-ref">{{ name }}{% if size %} <sup>({{ size }})</sup>{% endif %}</h5>
{% if size %}
{% assign p_ctg_list = p_ctg_list | append:"," | append:downcase_name %}
<ul>
{% assign pages_list = gg_categories %}
{% include JB/pages_list %}
</ul>
{% assign list0 = size | append:',' | append: name %}
{% if list == nil %}
{% assign list = list0 %}
{% else %}
{% assign list = list | append:';' | append: list0 %}
{% endif %}
{% endif %}
{% endfor %}
<!-- child end -->
{% endif %}
{% endfor %}
<!-- child end -->
{% endif %}
{% endfor %}
<!-- top end -->
{% endif %}
{% endfor %}
<h2 id="其他分类-ref">其他分类</h2>
{% assign p_ctg_list = p_ctg_list | split:"," %}
{% for category in site.categories %}
{% assign name = category[0] %}
{% if p_ctg_list contains name %}
{% continue %}
{% endif %}
{% assign size = category[1].size %}
<h3 id="{{ name | downcase | replace:" ","-" | replace:"/","-" }}-ref">{{ name | join: "/" }} <sup>({{ size }})</sup></h3>
<ul>
{% assign pages_list = category[1] %}
{% include JB/pages_list %}
</ul>
{% if size %}
{% assign list0 = size | append:',' | append: name %}
{% if list == nil %}
{% assign list = list0 %}
{% else %}
{% assign list = list | append:';' | append: list0 %}
{% endif %}
{% endif %}
{% endfor %}
{% assign list = list | split:';' | sort | reverse | join:';' %}
<h2 id="{{x_label}}统计-ref">{{ x_label}}统计 <sup>({{ site.posts.size }})</sup></h2>
{% include widgets/svg_statistic %}