diff options
author | Paper Mountain Studio <kodycze@gmail.com> | 2018-11-15 17:15:40 +0100 |
---|---|---|
committer | Paper Mountain Studio <kodycze@gmail.com> | 2018-11-15 17:15:40 +0100 |
commit | 274a87c8f5b65c659f3a82135216dabc87a3d340 (patch) | |
tree | ed3ed1d01fda5a373567522b817837887405ca56 /makesite.py | |
parent | 281f77b84fc0121e1327671c3f9bb4fe7ed5faea (diff) |
Solve DeprecationWarning with raw strings
Diffstat (limited to 'makesite.py')
-rwxr-xr-x | makesite.py | 6 |
1 files changed, 3 insertions, 3 deletions
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*(.+?)\s*:\s*(.+?)\s*-->\s*|.+', text): + for match in re.finditer(r'\s*<!--\s*(.+?)\s*:\s*(.+?)\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': |