Skip to content

Commit 33c5985

Browse files
committed
2.6.2: Fix. Add also removal of H1 to clean up all titles, to insert a new one
1 parent b885fed commit 33c5985

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Pocket.recipe

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env python
22
# vim:ft=python tabstop=8 expandtab shiftwidth=4 softtabstop=4
33
from __future__ import print_function
4-
__version__ = '2.6.1'
4+
__version__ = '2.6.2'
5+
56
"""
7+
2.6.2: Fix. Add also removal of H1 to clean up all titles, to insert a new one
8+
69
**TAGS** (list of strings or empty list: []) if [] (empty list) then the plugin will connect Pocket and fetch articles based on the configuration of the plugin.
710
Next, the plugin will get tags of these articles and group them into sections in the final ebook.
811
If TAGS has elements, e.g., TAGS = ['tag1', 'tag2'] then only these tags will be fetched from Pocket.
@@ -446,10 +449,17 @@ class Pocket(BasicNewsRecipe):
446449

447450
def postprocess_html(self, soup, first):
448451
title = soup.find('title').text # get title
452+
453+
h1s = soup.findAll('h1') # get all h1 headers
454+
for h1 in h1s:
455+
if title in h1.text:
456+
h1 = h1.clear() # clean this tag, so the h1 will be there only
457+
449458
h2s = soup.findAll('h2') # get all h2 headers
450459
for h2 in h2s:
451460
if title in h2.text:
452461
h2 = h2.clear() # clean this tag, so the h1 will be there only
462+
453463
body = soup.find('body')
454464
new_tag = soup.new_tag('h1')
455465
new_tag.append(title)

0 commit comments

Comments
 (0)