Browse Source

put the whole content in the Atom feed

main
Colin McMillen 3 years ago
parent
commit
494c7aac6a
  1. 16
      build.py

16
build.py

@ -7,7 +7,6 @@
# TODO: replace gallery.tinyletterapp.com images with locally hosted content. # TODO: replace gallery.tinyletterapp.com images with locally hosted content.
# TODO: in template.html, add apple touch icon, maybe other favicon sizes. # TODO: in template.html, add apple touch icon, maybe other favicon sizes.
# TODO: local mirrors of all papers in publications.html # TODO: local mirrors of all papers in publications.html
# TODO: just put the whole HTML content in the Atom feed?
# TODO: atom feed logo in the top-right. # TODO: atom feed logo in the top-right.
# Requirements: # Requirements:
@ -118,6 +117,7 @@ def process_markdown_files():
blog_entry['url'] = 'https://www.mcmillen.dev/' + page_url blog_entry['url'] = 'https://www.mcmillen.dev/' + page_url
blog_entry['date'] = update_date blog_entry['date'] = update_date
blog_entry['summary'] = find_summary(html_content) blog_entry['summary'] = find_summary(html_content)
blog_entry['content'] = html_content
blog_entries.append(blog_entry) blog_entries.append(blog_entry)
os.makedirs(out_dirpath, exist_ok=True) os.makedirs(out_dirpath, exist_ok=True)
@ -144,7 +144,7 @@ def make_atom_feed():
<title>Colin McMillen's Blog</title> <title>Colin McMillen's Blog</title>
<link href="https://www.mcmillen.dev"/> <link href="https://www.mcmillen.dev"/>
<link rel="self" href="https://www.mcmillen.dev/atom.xml"/>
<link rel="self" href="https://www.mcmillen.dev/feed.atom"/>
<updated>{last_update}</updated> <updated>{last_update}</updated>
<author> <author>
<name>Colin McMillen</name> <name>Colin McMillen</name>
@ -160,9 +160,12 @@ def make_atom_feed():
<title>{title}</title> <title>{title}</title>
<id>{url}</id> <id>{url}</id>
<link rel="alternate" href="{url}"/> <link rel="alternate" href="{url}"/>
<content type="text/html" src="{url}"/>
<content type="html">
<![CDATA[
{content}
]]>
</content>
<updated>{updated}</updated> <updated>{updated}</updated>
<summary>{summary} (...)</summary>
</entry> </entry>
''' '''
@ -178,7 +181,8 @@ def make_atom_feed():
url=entry['url'], url=entry['url'],
title=entry['title'], title=entry['title'],
updated=update_date, updated=update_date,
summary=entry['summary']))
summary=entry['summary'],
content=entry['content']))
entries_text = entries_io.getvalue() entries_text = entries_io.getvalue()
@ -187,7 +191,7 @@ def make_atom_feed():
entries=entries_io.getvalue()) entries=entries_io.getvalue())
entries_io.close() entries_io.close()
atom_filename = os.path.join(output_directory, 'atom.xml')
atom_filename = os.path.join(output_directory, 'feed.atom')
print_file('', atom_filename) print_file('', atom_filename)
atom_file = open(atom_filename, 'w') atom_file = open(atom_filename, 'w')
atom_file.write(atom_feed) atom_file.write(atom_feed)

Loading…
Cancel
Save