diff --git a/pinboardzine.py b/pinboardzine.py
index d16fae6..21343ee 100644
--- a/pinboardzine.py
+++ b/pinboardzine.py
@@ -64,6 +64,18 @@
"""
+ARTICLE_HTML = """
+
+
+
+
+
+
+
+
+ """
+
+
def contents_ncx_for_articles(articles, uid, title):
root = ElementTree.fromstring(CONTENTS_NCX_XML)
# Add head/meta name=dtb:uid
@@ -173,6 +185,39 @@ def contents_html_for_articles(articles, uid, title):
return html
+def html_for_readable_article(article, readable):
+ root = ElementTree.fromstring(ARTICLE_HTML.strip())
+
+ title_node = root.find('./head/title')
+ title_node.text = article['title']
+
+ head_node = root.find('./head')
+ if article['author']:
+ ElementTree.SubElement(head_node, 'meta', {
+ 'name': 'author',
+ 'content': article['author'],
+ })
+ if article['description']:
+ ElementTree.SubElement(head_node, 'meta', {
+ 'name': 'description',
+ 'content': article['description'],
+ })
+
+ title_node = root.find('./body/h3')
+ title_node.text = article['title']
+
+ link_node = root.find('./body/h4/a')
+ link_node.attrib['href'] = article['u']
+ link_node.text = readable['domain']
+ if article['author']:
+ link_node.tail = ' by ' + article['author']
+
+ html = ElementTree.tostring(root, encoding='unicode')
+ html = html[:-len('