From eef8221073a92c448bec35750db3e5c711d0147e Mon Sep 17 00:00:00 2001 From: Phyks Date: Fri, 6 Dec 2013 15:07:26 +0100 Subject: [PATCH] Added ability to link stylesheet to RSS file + flake8 compliant --- pre-commit.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pre-commit.py b/pre-commit.py index 7570b55..e1b0713 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -148,8 +148,9 @@ def get_text_rss(content): title.extract() return str(soup.div) + def remove_tags(html): - return ''.join( BeautifulSoup(html).findAll(text = True)) + return ''.join(BeautifulSoup(html).findAll(text=True)) # Set locale locale.setlocale(locale.LC_ALL, '') @@ -364,7 +365,7 @@ for filename in list(deleted_files): pass if ((not filename.endswith("html") and not filename.endswith("ignore")) - or (isset("direct_delete") and direct_delete == True)): + or (isset("direct_delete") and direct_delete is True)): print("[INFO] (Deleted file) Delete directly copied file " + filename[4:]+" in blog dir.") try: @@ -450,7 +451,9 @@ for filename in modified_files: sys.exit("[ERROR] (TAGS) An error occurred when parsing tags " " of article "+filename[4:]+".") - for tag in [x for x in tags if "gen/tags/"+x+".tmp" not in list_directory("gen/tags")]: # New tags created + # New tags created + for tag in [x for x in tags if "gen/tags/"+x+".tmp" + not in list_directory("gen/tags")]: try: auto_dir("gen/tags/"+tag+".tmp") with open("gen/tags/"+tag+".tmp", "a+") as tag_file: @@ -577,7 +580,7 @@ for filename in added_files+modified_files: "href=\""+params["BLOG_URL"]+"/"+filename[4:] + "\">"+title+"\n" "\t\t"+article+"\n" - "\t\t