From 274a87c8f5b65c659f3a82135216dabc87a3d340 Mon Sep 17 00:00:00 2001 From: Paper Mountain Studio Date: Thu, 15 Nov 2018 17:15:40 +0100 Subject: Solve DeprecationWarning with raw strings --- makesite.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'makesite.py') diff --git a/makesite.py b/makesite.py index f4dcf0f..7ae80fe 100755 --- a/makesite.py +++ b/makesite.py @@ -64,7 +64,7 @@ def truncate(text, words=25): def read_headers(text): """Parse headers in text and yield (key, value, end-index) tuples.""" - for match in re.finditer('\s*\s*|.+', text): + for match in re.finditer(r'\s*\s*|.+', text): if not match.group(1): break yield match.group(1), match.group(2), match.end() @@ -83,7 +83,7 @@ def read_content(filename): # Read metadata and save it in a dictionary. date_slug = os.path.basename(filename).split('.')[0] - match = re.search('^(?:(\d\d\d\d-\d\d-\d\d)-)?(.+)$', date_slug) + match = re.search(r'^(?:(\d\d\d\d-\d\d-\d\d)-)?(.+)$', date_slug) content = { 'date': match.group(1) or '1970-01-01', 'slug': match.group(2), @@ -130,7 +130,7 @@ def make_pages(src, dst, layout, **params): for src_path in glob.glob(src): content = read_content(src_path) - page_params = dict(params, **content) + page_params = dict(params, **content) # Populate placeholders in content if content-rendering is enabled. if page_params.get('render') == 'yes': -- cgit v1.2.3