From d35427d29ff246087a6ad385c84a51693a9a7848 Mon Sep 17 00:00:00 2001 From: Sunaina Pai Date: Sat, 24 Mar 2018 10:16:45 +0530 Subject: Add missing comments --- makesite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'makesite.py') diff --git a/makesite.py b/makesite.py index e0caa0f..20a3f54 100755 --- a/makesite.py +++ b/makesite.py @@ -57,6 +57,7 @@ def log(msg, *args): def truncate(text, words=25): + """Remove tags and truncate text to the specified number of words.""" return ' '.join(re.sub('(?s)<.*?>', ' ', text).split()[:words]) @@ -73,7 +74,7 @@ def read_content(filename): # Read file content. text = fread(filename) - # Read metadata. + # Read metadata and save it in a dictionary. date_slug = os.path.basename(filename).split('.')[0] match = re.search('^(?:(\d\d\d\d-\d\d-\d\d)-)?(.+)$', date_slug) content = { @@ -99,6 +100,7 @@ def read_content(filename): except ImportError as e: log('WARNING: Cannot render Markdown in {}: {}', filename, str(e)) + # Update the dictionary with content text and summary text. content.update({ 'content': text, 'summary': truncate(text), @@ -199,6 +201,7 @@ def main(): make_list(news_posts, '_site/news/index.html', list_layout, item_layout, blog='news', title='News', **params) + # Create RSS feeds. make_list(blog_posts, '_site/blog/rss.xml', feed_xml, item_xml, blog='blog', title='Blog', **params) make_list(news_posts, '_site/news/rss.xml', -- cgit v1.2.3