forked from ruangrupa/konfluks
parent
f6a1a684c0
commit
7d3863641d
@ -5,6 +5,7 @@ from hashlib import md5
|
|||||||
from ast import literal_eval as make_tuple
|
from ast import literal_eval as make_tuple
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from re import sub
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
import feedparser
|
import feedparser
|
||||||
@ -13,8 +14,7 @@ import requests
|
|||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from slugify import slugify
|
from slugify import slugify
|
||||||
from re import compile as re_compile
|
from re import compile as re_compile
|
||||||
from re import sub
|
yamlre = re_compile('"')
|
||||||
yamlre = re_compile('[_\?:\'\[\]\{\}\#\&\*\!\|\>\`\"\%]')
|
|
||||||
|
|
||||||
|
|
||||||
def write_etag(feed_name, feed_data):
|
def write_etag(feed_name, feed_data):
|
||||||
@ -121,12 +121,12 @@ def sanitize_yaml (frontmatter):
|
|||||||
#some fields are lists
|
#some fields are lists
|
||||||
l = []
|
l = []
|
||||||
for i in v:
|
for i in v:
|
||||||
i = yamlre.sub(r'\\\g<0>', i)
|
i = yamlre.sub('\\"', i)
|
||||||
l.append(i)
|
l.append(i)
|
||||||
frontmatter[k] = l
|
frontmatter[k] = l
|
||||||
|
|
||||||
else:
|
else:
|
||||||
v = yamlre.sub(r'\\\g<0>', v)
|
v = yamlre.sub('\\"', v)
|
||||||
frontmatter[k] = v
|
frontmatter[k] = v
|
||||||
|
|
||||||
return frontmatter
|
return frontmatter
|
||||||
|
Loading…
Reference in New Issue
Block a user