From 9ff3b168d9055637caef8b4a7e00412785b4a69f Mon Sep 17 00:00:00 2001 From: Ezhil Shanmugham Date: Fri, 10 Nov 2023 00:24:19 +0530 Subject: [PATCH] Minor fixes --- website/_includes/related-posts.html | 138 ++++++------------ website/_layouts/home.html | 4 +- .../Zypher_2023/level-11-zypher-re.md | 2 +- 3 files changed, 49 insertions(+), 95 deletions(-) diff --git a/website/_includes/related-posts.html b/website/_includes/related-posts.html index 6e361f7..3bfd87e 100644 --- a/website/_includes/related-posts.html +++ b/website/_includes/related-posts.html @@ -10,98 +10,52 @@ {% assign TAG_SCORE = 1 %} -{% assign CATEGORY_SCORE = 0.5 %} - -{% assign SEPARATOR = ':' %} - -{% assign score_list = '' | split: '' %} -{% assign last_index = site.posts.size | minus: 1 %} - -{% for i in (0..last_index) %} - {% assign post = site.posts[i] %} - - {% if post.url == page.url %} - {% continue %} - {% endif %} - - {% assign score = 0 %} - - {% for tag in post.tags %} - {% if page.tags contains tag %} - {% assign score = score | plus: TAG_SCORE %} - {% endif %} - {% endfor %} - - {% for category in post.categories %} - {% if page.categories contains category %} - {% assign score = score | plus: CATEGORY_SCORE %} - {% endif %} - {% endfor %} - - {% if score > 0 %} - {% capture score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %} - {% assign score_list = score_list | push: score_item %} - {% endif %} -{% endfor %} - -{% assign index_list = '' | split: '' %} - -{% if score_list.size > 0 %} - {% assign score_list = score_list | sort | reverse %} - {% for entry in score_list limit: TOTAL_SIZE %} - {% assign index = entry | split: SEPARATOR | last %} - {% assign index_list = index_list | push: index %} - {% endfor %} -{% endif %} +{% assign CATEGORY_SCORE = 0.5 %} {% assign SEPARATOR = ':' %} {% assign +score_list = '' | split: '' %} {% assign last_index = site.posts.size | minus: 1 +%} {% for i in (0..last_index) %} {% assign post = site.posts[i] %} {% if +post.url == page.url %} {% continue %} {% endif %} {% assign score = 0 %} {% for +tag in post.tags %} {% if page.tags contains tag %} {% assign score = score | +plus: TAG_SCORE %} {% endif %} {% endfor %} {% for category in post.categories +%} {% if page.categories contains category %} {% assign score = score | plus: +CATEGORY_SCORE %} {% endif %} {% endfor %} {% if score > 0 %} {% capture +score_item %}{{ score }}{{ SEPARATOR }}{{ i }}{% endcapture %} {% assign +score_list = score_list | push: score_item %} {% endif %} {% endfor %} {% assign +index_list = '' | split: '' %} {% if score_list.size > 0 %} {% assign score_list += score_list | sort | reverse %} {% for entry in score_list limit: TOTAL_SIZE %} +{% assign index = entry | split: SEPARATOR | last %} {% assign index_list = +index_list | push: index %} {% endfor %} {% endif %} -{% assign less = TOTAL_SIZE | minus: index_list.size %} - -{% if less > 0 %} - {% for i in (0..last_index) %} - {% assign post = site.posts[i] %} - {% if post.url != page.url %} - {% capture cur_index %}{{ i }}{% endcapture %} - {% unless index_list contains cur_index %} - {% assign index_list = index_list | push: cur_index %} - {% assign less = less | minus: 1 %} - {% if less <= 0 %} - {% break %} - {% endif %} - {% endunless %} - {% endif %} - {% endfor %} -{% endif %} - -{% if index_list.size > 0 %} - - +{% assign less = TOTAL_SIZE | minus: index_list.size %} {% if less > 0 %} {% for +i in (0..last_index) %} {% assign post = site.posts[i] %} {% if post.url != +page.url %} {% capture cur_index %}{{ i }}{% endcapture %} {% unless index_list +contains cur_index %} {% assign index_list = index_list | push: cur_index %} {% +assign less = less | minus: 1 %} {% if less <= 0 %} {% break %} {% endif %} {% +endunless %} {% endif %} {% endfor %} {% endif %} {% if index_list.size > 0 %} + + {% endif %} diff --git a/website/_layouts/home.html b/website/_layouts/home.html index a82bccb..73bb023 100644 --- a/website/_layouts/home.html +++ b/website/_layouts/home.html @@ -31,13 +31,13 @@
Event Logo
-
+

{{ post.title }}

diff --git a/website/writeups/Zypher_2023/level-11-zypher-re.md b/website/writeups/Zypher_2023/level-11-zypher-re.md index b1c4911..9357ba0 100644 --- a/website/writeups/Zypher_2023/level-11-zypher-re.md +++ b/website/writeups/Zypher_2023/level-11-zypher-re.md @@ -12,7 +12,7 @@ flag: zyp{S4NI5Y_17T6CT_} ## Challenge -You are given a [ZypherRE.py](writeupfiles/level11/ZypherRE.py) file +You are given a [Zypher_RE.py](writeupfiles/level11/Zypher_RE.py) file ## Solution