Made some changes, mainly to the BeautifulSoup Constructor to avoid printing warnings.

This commit is contained in:
ClariSys 2025-04-07 23:14:49 -07:00
parent c449f9d9ac
commit e39a0b85e7
2 changed files with 4 additions and 2 deletions

View file

@ -25,6 +25,7 @@ titles = []
for rootDir, dirs, files in os.walk(args.input_path):
for article in files:
if not article.endswith(".md"): continue
articles.append(article)
print("\nDiscovering articles...\n")
@ -54,7 +55,7 @@ for article in articles:
if parser.getMetadata(article)['draft'] == True:
if args.verbose: print('{} is a draft, skipping...'.format(article))
continue
html = bs(htmls[article]).prettify()
html = bs(htmls[article], features="lxml").prettify()
if not os.path.exists(workingDir):
os.makedirs(workingDir)
if args.verbose: print("creating directory {}".format(workingDir))
@ -80,7 +81,7 @@ for article in sorted_articles:
link = article.split("/")[-1][:-3]
titles.append([title, link])
if args.verbose: print("added {} to titles list with link {}".format(title, link))
mainPage = bs(stitcher.createMainPage(titles, args.template_path, args.site_title)).prettify()
mainPage = bs(stitcher.createMainPage(titles, args.template_path, args.site_title), features="lxml").prettify()
print("Generated main page")
print("Writing main page to {}".format(args.output_path))
open(args.output_path + "index.html", 'w').write(mainPage)