aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2015-06-09 10:12:59 -0700
committerZhiming Wang <zmwangx@gmail.com>2015-06-09 10:12:59 -0700
commit420c4fd7aeb9c4685d0c7e0f285f323130bc5b8c (patch)
treea24c54c7700a4449ff215d5eabf035ceab9a3263
parentf23eba63dfcc6ba51b16a3112ab7c9c9dd2f8fe2 (diff)
downloadmy_new_personal_website-420c4fd7aeb9c4685d0c7e0f285f323130bc5b8c.tar.xz
my_new_personal_website-420c4fd7aeb9c4685d0c7e0f285f323130bc5b8c.zip
pyblog: do not include line-number classes in feed
For one thing, the top attribute is not recommended in feeds (see https://github.com/zmwangx/zmwangx.github.io/issues/2). Also, extracting line numbers (which are useless in feeds) make the feeds smaller.
Diffstat (limited to '')
-rwxr-xr-xpyblog3
1 files changed, 3 insertions, 0 deletions
diff --git a/pyblog b/pyblog
index eca043ff..1ace53e8 100755
--- a/pyblog
+++ b/pyblog
@@ -385,6 +385,9 @@ def generate_index_and_feed():
article.header.extract()
if article.footer is not None:
article.footer.extract()
+ # remove line numbers
+ for line_number_span in article.find_all("span", attrs={"class": "line-number"}):
+ line_number_span.extract()
entry.content_html = ''.join([str(content)
for content in article.contents])
entry.content = ET.Element("content", type="html")