M quiescent/feed.py +1 -1
@@ 26,7 26,6 @@ ET.register_namespace('', 'http://www.w3
def _feed(all_posts, date=None, name=None, domain=None, feed_link=None, feed_author=None):
_feed = ET.Element('{http://www.w3.org/2005/Atom}feed')
- _feed.attrib['xml:base'] = domain
title = ET.SubElement(_feed, 'title')
title.text = name
link = ET.SubElement(_feed, 'link')
@@ 56,6 55,7 @@ def _feed_entry(parent_element, post, do
updated = ET.SubElement(entry, 'updated')
updated.text = post.date_time.isoformat()
content = ET.SubElement(entry, 'content')
+ content.attrib['xml:base'] = urljoin(domain, post.file_path)
content.attrib['type'] = 'html'
content.text = post.html_body
return entry
M quiescent/post.py +13 -3
@@ 39,10 39,18 @@ class PostParser(HTMLParser):
self.tag_stack.append(tag)
elif tag == 'span':
self.tag_stack.append(tag)
- elif self.tag_stack and (tag == self.tag_stack[-1]):
- self.DONE = True
elif tag == 'p':
self.tag_stack.append(tag)
+ elif tag == 'div':
+ self.tag_stack.append(tag)
+ elif (tag == 'a' and not self.DONE
+ and # hack to avoid org-mode table of contents
+ 'div' not in self.tag_stack):
+ self.tag_stack.append(tag)
+ self.leader.append('<a ') # grab links in leaders
+ for k,v in attributes:
+ self.leader.append(f'{k}="{v}"')
+ self.leader.append('>')
def handle_endtag(self, tag):
if self.tag_stack and (tag == self.tag_stack[-1]):
@@ 56,8 64,10 @@ class PostParser(HTMLParser):
self.title = data
elif self.tag_stack[-1] == 'span' and not self.date:
self.date = data
- elif not self.DONE:
+ elif not self.DONE and 'div' not in self.tag_stack: # steadfastly ignore table of contents links
self.leader.append(data)
+ if self.tag_stack[-1] == 'a':
+ self.leader.append('</a>')
def post_data(self):
leader = "".join(self.leader).strip()