From f60c9fefec3d33b9dcae8024091a76252aa5716d Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Mon, 24 Feb 2025 12:22:25 +0530 Subject: [PATCH 1/2] Show author name instead of contributors --- templates/news.html.j2 | 81 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/templates/news.html.j2 b/templates/news.html.j2 index 44ae495..874910e 100644 --- a/templates/news.html.j2 +++ b/templates/news.html.j2 @@ -138,7 +138,6 @@ #} - {% if "achievement" in news['tags']%} {% endif %} - {% else %} - - {% endif %} + {# + + #} From 73e898bac6b09833d3708ebb27d67407dd9b8d19 Mon Sep 17 00:00:00 2001 From: KasukabeDefenceForce Date: Mon, 24 Feb 2025 15:45:51 +0530 Subject: [PATCH 2/2] add color to badges --- notebooks/create_htmls.ipynb | 54 ++++++++++++++++++++++++++++++++++-- templates/news.html.j2 | 2 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/notebooks/create_htmls.ipynb b/notebooks/create_htmls.ipynb index bab50c7..133288b 100644 --- a/notebooks/create_htmls.ipynb +++ b/notebooks/create_htmls.ipynb @@ -72,7 +72,38 @@ "MEMBERS_DIR_PATH = GROUP_DATA_DIR / \"members/\"\n", "SUB_RESEARCH_PATH = HOSTING_PATH / \"sub_research\"\n", "OPPORTUNITIES_PATH = WEBSITE_DATA_PATH / \"content\" / \"opportunities.json\"\n", - "ROLE_HIERARCHY_PATH = WEBSITE_DATA_PATH / \"role_hierarchy.json\"" + "ROLE_HIERARCHY_PATH = WEBSITE_DATA_PATH / \"role_hierarchy.json\"\n", + "GENERAL_TAGS = [\n", + " \"Paper\",\n", + " \"Poster\", \n", + " \"Talk\",\n", + " \"Award\",\n", + " \"New Team Member\",\n", + " \"PhD\",\n", + " \"Conference\",\n", + " \"Undergraduate\",\n", + " \"Event\",\n", + " \"Achievement\"\n", + "]\n", + "\n", + "# Define tag colors mapping\n", + "TAG_COLORS = {\n", + " 'paper': '#FF6B6B', # Coral red\n", + " 'poster': '#4ECDC4', # Turquoise\n", + " 'talk': '#45B7D1', # Light blue\n", + " 'award': '#96CEB4', # Sage green\n", + " 'new team member': '#FFBE0B', # Golden yellow\n", + " 'phd': '#9B5DE5', # Purple\n", + " 'conference': '#FF006E', # Pink\n", + " 'undergraduate': '#8338EC', # Violet\n", + " 'event': '#3A86FF', # Royal blue\n", + " 'achievement': '#FB5607', # Orange\n", + " 'astrophysics': '#2EC4B6', # Teal\n", + " 'machine learning': '#FF9F1C', # Light orange\n", + " 'software': '#E71D36', # Bright red\n", + " 'research': '#011627', # Dark blue\n", + " 'news': '#41EAD4' # Cyan\n", + "}" ] }, { @@ -86,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 92, "metadata": { "ExecuteTime": { "end_time": "2023-11-21T07:07:36.311056453Z", @@ -100,10 +131,27 @@ " \"\"\"Return the HTML file name after replacing blank spaces(\" \") with underscores(\"-\")\"\"\"\n", " return a.replace(\" \", \"_\") if \" \" in a else a\n", "\n", + "# Function to get tag color, returns a default if tag not in mapping\n", + "def get_tag_color(tag):\n", + " \"\"\"Get color for a specific tag, with fallback to default\"\"\"\n", + " tag = tag.lower()\n", + " return TAG_COLORS.get(tag, '#6c757d') # Default gray if tag not found\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 93, + "metadata": {}, + "outputs": [], + "source": [ "environment = Environment(\n", " loader=FileSystemLoader(TEMPLATE_DIR_PATH), extensions=[\"jinja2.ext.loopcontrols\", \"jinja2.ext.do\"]\n", ")\n", - "environment.globals[\"page_link\"] = page_link" + "environment.globals[\"page_link\"] = page_link\n", + "# Add tag colors to jinja environment globals\n", + "environment.globals['tag_colors'] = TAG_COLORS\n", + "environment.globals['get_tag_color'] = get_tag_color" ] }, { diff --git a/templates/news.html.j2 b/templates/news.html.j2 index 874910e..3575217 100644 --- a/templates/news.html.j2 +++ b/templates/news.html.j2 @@ -120,7 +120,7 @@
{%for tag in news['tags']%} {%if tag.lower() != "news"%} - {{tag.title()}} + {{tag.title()}} {%endif%} {%endfor%}