Revert "feed: move to saneyaml"

This reverts commit a809433410.
This commit is contained in:
decentral1se
2022-04-13 12:48:13 +02:00
parent 19ab610dfc
commit 58afd189a7
3 changed files with 5 additions and 67 deletions

View File

@ -13,7 +13,8 @@ import requests
from bs4 import BeautifulSoup
from slugify import slugify
from re import compile as re_compile
import saneyaml
from re import sub
yamlre = re_compile('[_\'\[\]\{\}\#\&\*\!\|\>\`\"\%]')
def write_etag(feed_name, feed_data):
@ -120,12 +121,12 @@ def sanitize_yaml (frontmatter):
#some fields are lists
l = []
for i in v:
i = saneyaml.load(i)
i = yamlre.sub(r'\\\g<0>', i)
l.append(i)
frontmatter[k] = l
else:
v = saneyaml.load(v)
v = yamlre.sub(r'\\\g<0>', v)
frontmatter[k] = v
return frontmatter