diff --git a/blog/before_build.py b/blog/before_build.py
index c0195cfb..c8648ec5 100644
--- a/blog/before_build.py
+++ b/blog/before_build.py
@@ -2,12 +2,13 @@
# -*- coding: utf-8 -*-
import io
+import urllib2
+import datetime
from github import Github
-from datetime import datetime, timedelta
g = Github()
-one_month_ago = datetime.now() - timedelta(days=32)
+one_month_ago = datetime.datetime.now() - datetime.timedelta(days=32)
def filter_date(issue):
return issue.closed_at > one_month_ago
@@ -33,8 +34,8 @@ with io.open("templates/auto/recent-updates.html", 'w', encoding='utf8') as rece
link = '' + pr.title + " "
iso_date = pr.closed_at.isoformat()
readable_date = pr.closed_at.strftime("%b %d")
- datetime = ''
- recent_updates.write(u"
" + link + datetime + "\n")
+ datetime_str = ''
+ recent_updates.write(u" " + link + datetime_str + "\n")
recent_updates.write(u"")
@@ -47,3 +48,42 @@ with io.open("templates/auto/stars.html", 'w', encoding='utf8') as stars:
with io.open("templates/auto/forks.html", 'w', encoding='utf8') as forks:
forks.truncate()
forks.write(format_number(repo.forks_count))
+
+
+# query "This week in Rust OSDev posts"
+
+lines = []
+year = 2020
+month = 4
+while True:
+ url = "https://rust-osdev.com/this-month/" + str(year) + "-" + str(month).zfill(2) + "/"
+ try:
+ urllib2.urlopen(url)
+ except urllib2.HTTPError as e:
+ break
+
+ month_str = datetime.date(1900, month, 1).strftime('%B')
+
+ link = 'This Month in Rust OSDev (' + month_str + " " + str(year) + ") "
+ lines.append(u" " + link + "\n")
+
+ month = month + 1
+ if month > 12:
+ month = 0
+ year = year + 1
+
+lines.reverse()
+
+with io.open("templates/auto/status-updates.html", 'w', encoding='utf8') as status_updates:
+ status_updates.truncate()
+
+ for line in lines:
+ status_updates.write("" + line + "")
+
+with io.open("templates/auto/status-updates-truncated.html", 'w', encoding='utf8') as status_updates:
+ status_updates.truncate()
+
+ for index, line in enumerate(lines):
+ if index == 5:
+ break
+ status_updates.write(line)
diff --git a/blog/templates/auto/status-updates-truncated.html b/blog/templates/auto/status-updates-truncated.html
new file mode 100644
index 00000000..e69de29b
diff --git a/blog/templates/auto/status-updates.html b/blog/templates/auto/status-updates.html
new file mode 100644
index 00000000..e69de29b
diff --git a/blog/templates/second-edition/index.html b/blog/templates/second-edition/index.html
index 5facb3c0..37406cbe 100644
--- a/blog/templates/second-edition/index.html
+++ b/blog/templates/second-edition/index.html
@@ -59,9 +59,7 @@
{% set status_updates = get_section(path = "status-update/_index.md") %}
{{ status_updates.description }}
- {% for page in status_updates.pages | slice(end=3) %}
- - {{ page.title }}
- {% endfor %}
+ {% include "auto/status-updates-truncated.html" %}
- view all ยป
diff --git a/blog/templates/status-update-section.html b/blog/templates/status-update-section.html
index 854ac622..43e79cc1 100644
--- a/blog/templates/status-update-section.html
+++ b/blog/templates/status-update-section.html
@@ -13,6 +13,7 @@
{% endblock introduction %}
+ {% include "auto/status-updates.html" %}
{% for page in section.pages %}
- {{ page.title }}
{% endfor %}