From 2e69392807f126cd243d15ff76f771ab15fbaf31 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 15 Nov 2021 23:51:01 +0100 Subject: [PATCH] Fixed devblog calendar --- devblog/build_blog.py | 79 ++- .../{devblog2012.html => devblogs_2012.html} | 450 ++++++++++++------ .../{devblog2013.html => devblogs_2013.html} | 434 +++++++++++------ .../{devblog2014.html => devblogs_2014.html} | 438 +++++++++++------ .../{devblog2015.html => devblogs_2015.html} | 450 ++++++++++++------ .../{devblog2016.html => devblogs_2016.html} | 438 +++++++++++------ .../{devblog2017.html => devblogs_2017.html} | 436 +++++++++++------ .../{devblog2018.html => devblogs_2018.html} | 432 +++++++++++------ .../{devblog2019.html => devblogs_2019.html} | 438 +++++++++++------ .../{devblog2020.html => devblogs_2020.html} | 430 +++++++++++------ .../{devblog2021.html => devblogs_2021.html} | 428 +++++++++++------ devblog/html/index.html | 2 +- devblog/templates/blog.html | 20 +- devblog/templates/post.html | 12 +- stylesheets/styles.css | 29 +- 15 files changed, 2950 insertions(+), 1566 deletions(-) rename devblog/html/{devblog2012.html => devblogs_2012.html} (80%) rename devblog/html/{devblog2013.html => devblogs_2013.html} (68%) rename devblog/html/{devblog2014.html => devblogs_2014.html} (75%) rename devblog/html/{devblog2015.html => devblogs_2015.html} (79%) rename devblog/html/{devblog2016.html => devblogs_2016.html} (74%) rename devblog/html/{devblog2017.html => devblogs_2017.html} (79%) rename devblog/html/{devblog2018.html => devblogs_2018.html} (70%) rename devblog/html/{devblog2019.html => devblogs_2019.html} (79%) rename devblog/html/{devblog2020.html => devblogs_2020.html} (68%) rename devblog/html/{devblog2021.html => devblogs_2021.html} (67%) diff --git a/devblog/build_blog.py b/devblog/build_blog.py index b85799042d..54d75be7eb 100644 --- a/devblog/build_blog.py +++ b/devblog/build_blog.py @@ -37,7 +37,7 @@ TEMPLATE_DIR = pathjoin(CURRDIR, "templates") IMG_DIR = pathjoin(SOURCE_DIR, "images") OUTDIR = pathjoin(CURRDIR, "html") -OUTFILE_TEMPLATE = "devblog{year}.html" +OUTFILE_TEMPLATE = "devblogs_{year}.html" OUT_IMG_DIR = pathjoin(OUTDIR, "images") START_PAGE = "index.html" @@ -48,9 +48,15 @@ CURRENT_YEAR = datetime.now().year @dataclass -class Post: +class BlogPost: + """ + A single blog post. + + """ title: str + blurb: str permalink: str + pagelink: str anchor: str date_pretty: str @@ -61,6 +67,18 @@ class Post: html: str +@dataclass +class BlogPage: + """ + Represents one year/html page of blog posts. + + """ + year: int + permalink: str + posts: list + calendar: dict + + def md2html(): """ Generate all blog pages, with one page per year. @@ -72,7 +90,6 @@ def md2html(): blog_template = jinja_env.get_template(BLOG_TEMPLATE) post_template = jinja_env.get_template(POST_TEMPLATE) - pages = {} calendar = defaultdict(list) for file_path in glob.glob(pathjoin(SOURCE_DIR, "*.md")): @@ -87,6 +104,7 @@ def md2html(): print(f"Processing {filename}...") title = title[:-3] # remove .md ending + blurb = title[:11] + "..." title = " ".join(title.split("-")) date = datetime(year=int(year), month=int(month), day=int(day)) image_copyrights = "" @@ -94,7 +112,7 @@ def md2html(): with open(file_path) as fil: lines = fil.readlines() - # check if there is a meta header in the first 5 lines + # check if there is a meta header in the first 6 lines meta = None try: meta_end = [lin.strip() for lin in lines[:5]].index("---") @@ -112,6 +130,8 @@ def md2html(): elif line.startswith("copyrights:"): image_copyrights = line[12:] image_copyrights = mistletoe.markdown(image_copyrights) + elif line.startswith("blurb:"): + blurb = line[6:].strip() markdown_post = "\n".join(lines) # convert markdown to html @@ -121,49 +141,56 @@ def md2html(): anchor = "{}".format( date.strftime("%Y-%m-%d-" + "-".join(title.strip().lower().split())) ) - permalink = "{}#{}".format( - OUTFILE_TEMPLATE.format(year=date.year), - anchor - ) - post = Post( + pagelink = OUTFILE_TEMPLATE.format(year=date.year) + permalink = "{}#{}".format(pagelink, anchor) + + blogpost = BlogPost( title=title, + blurb=blurb, permalink=permalink, + pagelink=pagelink, anchor=anchor, date_pretty=date.strftime("%B %e, %Y"), - date_short=date.strftime("%B %e"), + date_short=date.strftime("%b %e"), date_sort=date.toordinal(), image_copyrights=image_copyrights, html=html ) - # populate template with jinja + # populate template with jinja and readd to blogpost context = { - "post": post + "blogpost": blogpost } - post.html = post_template.render(context) + blogpost.html = post_template.render(context) # store - calendar[date.year].append(post) + calendar[date.year].append(blogpost) # make sure to sort all entries by date - for year in sorted(calendar): - calendar[year] = list(sorted(calendar[year], key=lambda post: -post.date_sort)) - - calendar = {year: calendar[year] for year in sorted(calendar, reverse=True)} - - # pair pages with years/filenames - for year, posts in calendar.items(): + blogpages = [] + for year in sorted(calendar, reverse=True): + blogpages.append( + BlogPage( + year=year, + permalink=OUTFILE_TEMPLATE.format(year=year), + posts=list(sorted(calendar[year], key=lambda post: -post.date_sort)), + calendar=calendar + ) + ) + # build the blog pages, per year + html_pages = {} + for blogpage in blogpages: context = { - "page_year": year, - "posts": posts, - "calendar": calendar + "pageyear": blogpage.year, + "blogpage": blogpage, + "blogpages": blogpages } html_page = blog_template.render(context) - pages[year] = html_page + html_pages[blogpage.year] = html_page - return pages + return html_pages def build_pages(blog_pages): diff --git a/devblog/html/devblog2012.html b/devblog/html/devblogs_2012.html similarity index 80% rename from devblog/html/devblog2012.html rename to devblog/html/devblogs_2012.html index 198fcdbc88..1da6013294 100644 --- a/devblog/html/devblog2012.html +++ b/devblog/html/devblogs_2012.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Evennia changes to BSD license - +
- October 28, 2012

As of today, Evennia changes to use the very permissive BSD license.

@@ -429,7 +563,7 @@

Community interest - +
- October 5, 2012

@@ -454,7 +588,7 @@

Combining Twisted and Django - +
- August 31, 2012

Combining Twisted and Django

@@ -505,7 +639,7 @@

Taking command - +
- August 16, 2012

Commands are the bread and butter of any game. Commands are the instructions coming in from the player telling the game (or their avatar in the game) to do stuff. This post will outline the reasoning leading up to Evennia's somewhat (I think) non-standard way of handling commands.

@@ -569,7 +703,7 @@

Extending time and details - +
- June 26, 2012

For the fun of it I added an "Extended Room" contrib to Evennia the other night.

@@ -602,7 +736,7 @@

Coding from the inside - +
- June 11, 2012

@@ -636,7 +770,7 @@

Dummies doing (even more) dummy things - +
- May 30, 2012

@@ -665,7 +799,7 @@

Shortcuts to goodness - +
- March 26, 2012

Evennia, being a MUD-design system, needs to take some special considerations with its source code - its sole purpose is after all to be read, understood and extended.

@@ -688,7 +822,7 @@

Dummies doing dummy things - +
- February 22, 2012

It can often be interesting to test hypothetical situations. So the other day I did a little stress test to see how Evennia handles many players. This is a follow-up to the open bottlenecks post.

@@ -774,7 +908,7 @@

Commands and you - +
- February 17, 2012

Commands define how a Player interacts with a given game. In a text-based game it's not amiss to say that the available commands are paramount to the user experience. In principle commands could represent mouse clicks and other modernistic GUI sugar - but for this blog I'll stick with the traditional entered text.

@@ -817,7 +951,7 @@

Such a small thing ... - +
- February 15, 2012

Lately I went back to clean up and optimize the workings of Evennia's Attributes. I had a nice idea for making the code easier to read and also faster by caching more aggressively. The end result was of course that I managed to break things. In the end it took me two weeks to get my new scheme to a state where it did what it already did before (although faster).

@@ -884,7 +1018,7 @@

Evennia's open bottlenecks - +
- February 5, 2012

Since Evennia hit beta I have been mostly looking behind the scenes to see what can be cleaned up and not in the core server. One way to do that is to check where the bottlenecks are. Since a few commits, Evennia's runner has additions for launching the Python cProfiler at startup. This can be done for both the Portal and the Server separately.

@@ -904,7 +1038,7 @@

About this dev blog - +
- February 5, 2012

This is to be my Evennia dev blog, but it will also cover various other musings concerning programming in general and mud designing in particular. Whereas the Evennia mailing list remains the main venue for discussion, I will probably use this blog for announcing features too.

diff --git a/devblog/html/devblog2013.html b/devblog/html/devblogs_2013.html similarity index 68% rename from devblog/html/devblog2013.html rename to devblog/html/devblogs_2013.html index 5b0b54c2d5..15d530e806 100644 --- a/devblog/html/devblog2013.html +++ b/devblog/html/devblogs_2013.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Imaginary Realities is back - +
- December 16, 2013

The Imaginariy Realities webzine was the place to go to for MUD game design articles in the late 90's. Last released in 2001, its articles are still worth the read for any game designers today.

@@ -459,7 +593,7 @@

Out of band mergings - +
- November 28, 2013

@@ -496,7 +630,7 @@

A list of Evennia topics - +
- October 22, 2013

@@ -526,7 +660,7 @@

One to Many - +
- May 13, 2013

@@ -550,7 +684,7 @@

Churning behind the scenes - +
- January 29, 2013

diff --git a/devblog/html/devblog2014.html b/devblog/html/devblogs_2014.html similarity index 75% rename from devblog/html/devblog2014.html rename to devblog/html/devblogs_2014.html index f0a5af0f17..944b4ce0a4 100644 --- a/devblog/html/devblog2014.html +++ b/devblog/html/devblogs_2014.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Slowly moving through town - +
- October 2, 2014

@@ -457,7 +591,7 @@

Dance my puppets - +
- August 4, 2014

@@ -491,7 +625,7 @@

Webby stuff - +
- June 30, 2014

@@ -513,7 +647,7 @@

Bringing back Python memory - +
- June 15, 2014

@@ -542,7 +676,7 @@

Imaginary Realities volume 6, issue 1 - +
- May 16, 2014

@@ -584,7 +718,7 @@

Moving from Google Code to Github - +
- February 8, 2014

@@ -712,7 +846,7 @@

Looking forwards and backwards - +
- January 24, 2014

diff --git a/devblog/html/devblog2015.html b/devblog/html/devblogs_2015.html similarity index 79% rename from devblog/html/devblog2015.html rename to devblog/html/devblogs_2015.html index f016f8e645..c17f39c6bb 100644 --- a/devblog/html/devblog2015.html +++ b/devblog/html/devblogs_2015.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

A summary of a year - +
- December 17, 2015

A summary of a year

@@ -514,7 +648,7 @@ def funcname(a, b, c, d=False): """

MIT uses Evennia! - +
- November 12, 2015

@@ -553,7 +687,7 @@ def funcname(a, b, c, d=False): """

Illustrations and soaps - +
- October 11, 2015

@@ -575,7 +709,7 @@ def funcname(a, b, c, d=False): """

Emoting System - +
- October 2, 2015

title: Emoting Systems, or how to chat up a girl

@@ -619,7 +753,7 @@ def funcname(a, b, c, d=False): """

Evennia on `podcast.__init__` - +
- September 29, 2015

@@ -653,7 +787,7 @@ def funcname(a, b, c, d=False): """

Pushing through a straw - +
- September 24, 2015

@@ -687,7 +821,7 @@ def funcname(a, b, c, d=False): """

A wagon load of post summer updates - +
- August 27, 2015

@@ -735,7 +869,7 @@ def funcname(a, b, c, d=False): """

Announcing the Evennia example-game project "Ainneve" - +
- June 22, 2015

@@ -760,7 +894,7 @@ def funcname(a, b, c, d=False): """

Need your help! - +
- June 15, 2015

This for all you developers out there who want to make a game with Evennia but are not sure about what game to make or where to start off.

@@ -829,7 +963,7 @@ def funcname(a, b, c, d=False): """

Dreaming big? - +
- May 30, 2015

@@ -848,7 +982,7 @@ def funcname(a, b, c, d=False): """

Things goin on - +
- May 11, 2015

@@ -871,7 +1005,7 @@ def funcname(a, b, c, d=False): """

Documenting Python without Sphinx - +
- May 9, 2015

@@ -926,7 +1060,7 @@ def funcname(a, b, c, d=False): """

Building Django proxies and MUD libraries - +
- January 19, 2015

diff --git a/devblog/html/devblog2016.html b/devblog/html/devblogs_2016.html similarity index 74% rename from devblog/html/devblog2016.html rename to devblog/html/devblogs_2016.html index f816c7fffd..8331750779 100644 --- a/devblog/html/devblog2016.html +++ b/devblog/html/devblogs_2016.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Birthday retrospective - +
- November 30, 2016

@@ -441,7 +575,7 @@

Season of fixes - +
- October 13, 2016

@@ -492,7 +626,7 @@

The art of sharing nicks and descriptions - +
- July 1, 2016

@@ -543,7 +677,7 @@

Evennia in Pictures - +
- May 31, 2016

This article describes the MU* development system Evennia using pictures!

@@ -608,7 +742,7 @@

Evennia 0.6! - +
- May 22, 2016

@@ -638,7 +772,7 @@

Technical stuff happening - +
- March 24, 2016

@@ -685,7 +819,7 @@

Climbing up Branches - +
- February 14, 2016

diff --git a/devblog/html/devblog2017.html b/devblog/html/devblogs_2017.html similarity index 79% rename from devblog/html/devblog2017.html rename to devblog/html/devblogs_2017.html index fdeb56e6f2..4da404570c 100644 --- a/devblog/html/devblog2017.html +++ b/devblog/html/devblogs_2017.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Getting a MUD RP scene going - +
- October 29, 2017

This article is a little different from the normal more technical Evennia-specific content of this blog. It was originally published as a light-hearted addition to the Imaginary Realities e-zine many years ago. While IR is still online it has since dozed off. So I'm reposting it here to bring it to a new audience.

@@ -501,7 +635,7 @@

Evennia in Hacktobergest 2017 - +
- October 1, 2017

@@ -520,7 +654,7 @@

Evennia 0.7 released - +
- September 20, 2017

Evennia 0.7 released

@@ -624,7 +758,7 @@

Renaming Django's Auth User and App - +
- August 25, 2017

@@ -787,7 +921,7 @@

The luxury of a creative community - +
- April 23, 2017

@@ -851,7 +985,7 @@

News items from the new year - +
- February 5, 2017

diff --git a/devblog/html/devblog2018.html b/devblog/html/devblogs_2018.html similarity index 70% rename from devblog/html/devblog2018.html rename to devblog/html/devblogs_2018.html index d613445b85..a5655dbc27 100644 --- a/devblog/html/devblog2018.html +++ b/devblog/html/devblogs_2018.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Evennia 0.8 released - +
- September 30, 2018

After about a year of work and almost 540 commits from close to 20 contributors, Evennia 0.8 is out! Evennia is a Python game server for creating text-based multiplayer games (MUDs, Mushes, etc) using Django and Twisted.

@@ -439,7 +573,7 @@

Inline building in upcoming Evennia 0.8 - +
- August 18, 2018

@@ -501,7 +635,7 @@

Kicking into gear from a distance - +
- January 27, 2018

@@ -562,7 +696,7 @@

New year, new stuff - +
- January 5, 2018

diff --git a/devblog/html/devblog2019.html b/devblog/html/devblogs_2019.html similarity index 79% rename from devblog/html/devblog2019.html rename to devblog/html/devblogs_2019.html index 2e6cfe9361..5075a233c2 100644 --- a/devblog/html/devblog2019.html +++ b/devblog/html/devblogs_2019.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Blackifying and fixing bugs - +
- September 30, 2019

@@ -452,7 +586,7 @@

Evennia 0.9 released - +
- July 4, 2019

@@ -479,7 +613,7 @@

Creating Evscaperoom Part 2 - +
- May 26, 2019

Jester smiling oh so sweetly

@@ -695,7 +829,7 @@ class State(BaseState):

Creating Evscaperoom Part 1 - +
- May 18, 2019

@@ -816,7 +950,7 @@ class State(BaseState):

Podcast about Evennia - +
- May 9, 2019

@@ -835,7 +969,7 @@ class State(BaseState):

Steaming on Eating Jam - +
- April 25, 2019

@@ -868,7 +1002,7 @@ class State(BaseState):

Into 2019 - +
- January 2, 2019

diff --git a/devblog/html/devblog2020.html b/devblog/html/devblogs_2020.html similarity index 68% rename from devblog/html/devblog2020.html rename to devblog/html/devblogs_2020.html index 19a0ebd8be..97b7b1f66c 100644 --- a/devblog/html/devblog2020.html +++ b/devblog/html/devblogs_2020.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Evennia 0.9.5 released - +
- November 14, 2020

@@ -523,7 +657,7 @@

On using Markdown with Sphinx - +
- October 20, 2020

@@ -598,7 +732,7 @@

Spring updates while trying to stay healthy - +
- April 14, 2020

diff --git a/devblog/html/devblog2021.html b/devblog/html/devblogs_2021.html similarity index 67% rename from devblog/html/devblog2021.html rename to devblog/html/devblogs_2021.html index 73cd507537..bd67104c9a 100644 --- a/devblog/html/devblog2021.html +++ b/devblog/html/devblogs_2021.html @@ -35,349 +35,483 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer.

Where do I begin? - +
- March 21, 2021

@@ -578,7 +712,7 @@

Happy New Years 2021! - +
- January 1, 2021

diff --git a/devblog/html/index.html b/devblog/html/index.html index b9c47f135d..13f793b6ef 120000 --- a/devblog/html/index.html +++ b/devblog/html/index.html @@ -1 +1 @@ -/home/griatch/Devel/Home/evennia/evennia/devblog/html/devblog2021.html \ No newline at end of file +/home/griatch/Devel/Home/evennia/evennia/devblog/html/devblogs_2021.html \ No newline at end of file diff --git a/devblog/templates/blog.html b/devblog/templates/blog.html index eef9bc533a..4b13b22604 100644 --- a/devblog/templates/blog.html +++ b/devblog/templates/blog.html @@ -34,16 +34,18 @@
- Random Evennia- and MUD-related musings of Griatch, the Evennia lead developer. + Various Evennia- and MUD-related musings by Griatch, the Evennia lead developer. - {% for post in posts %} + {% for blogpost in blogpage.posts %} {% if not loop.first %}
{% endif %}
- {{ post.html }} + {{ blogpost.html }}
{% endfor %} diff --git a/devblog/templates/post.html b/devblog/templates/post.html index 8d5e4162a1..07e39c3f4b 100644 --- a/devblog/templates/post.html +++ b/devblog/templates/post.html @@ -1,11 +1,11 @@ -

- {{ post.title }} - -
- {{ post.date_pretty }}
+

+ {{ blogpost.title }} + +
- {{ blogpost.date_pretty }}

-{{ post.html }} +{{ blogpost.html }} diff --git a/stylesheets/styles.css b/stylesheets/styles.css index 1a337f16cf..1614c8c18d 100644 --- a/stylesheets/styles.css +++ b/stylesheets/styles.css @@ -474,14 +474,29 @@ h1:hover > a.devblog-headerlink { .devblog-title-date { font-size: small; } -.devblog-calendar > ul a + .devblog-calendar-closed { - max-height: 0; - overflow: hidden; - transition: 0.1s linear; - margin-bottom:0px; +.devblog-calendar-closed { + max-height: 0px; + visibility: hidden; + margin-bottom: 0.4em; } -.devblog-calendar > ul a:focus + .devblog-calendar-closed { - max-height: 15em; +.devblog-calendar-open { + max-height: 21em; + margin-bottom: 0.4em; +} +.devblog-calendar-tooltip .devblog-calendar-tooltip-text { + visibility: hidden; + width: 120px; + background-color: #8e8e8e; + color: #fff; + text-align: center; + padding: 5px 0; + margin-left: 3px; + border-radius: 6px; + position: absolute; + z-index: 1; +} +.devblog-calendar-tooltip:hover .devblog-calendar-tooltip-text { + visibility: visible; } a[href="devblog-posts"]:focus { pointer-events: none;