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 @@
As of today, Evennia changes to use the very permissive BSD license.
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.
For the fun of it I added an "Extended Room" contrib to Evennia the other night.
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.
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.
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 @@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 @@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 @@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 @@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.
title: Emoting Systems, or how to chat up a girl
@@ -619,7 +753,7 @@ def funcname(a, b, c, d=False): """
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.
This article describes the MU* development system Evennia using pictures!
@@ -608,7 +742,7 @@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 @@
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.
@@ -578,7 +712,7 @@Happy New Years 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 @@- January 1, 2021- 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 %}- {% for year, postlist in calendar.items() %} -
- {{ year }} ({{ postlist|length }}) - {% if year == page_year %} + {% for page in blogpages %} +
- {{ page.year }} ({{ page.posts|length }}) + {% if pageyear == page.year %}
{% else %}
{% endif %} - {% for post in postlist %} -
@@ -69,12 +71,12 @@- - {{ post.date_short}} + {% for blogpost in page.posts %} +
- + {{ blogpost.date_short}} + {{ blogpost.title }} +
{% endfor %}
{% 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 }} + ¶ +
-{{ 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;- {{ blogpost.date_pretty }}