Skip to content
Permalink
Browse files
Make tests pass again
  • Loading branch information
ralsina committed Jul 20, 2015
1 parent 378ae40 commit f30002b5bf42528192f38bb5993d60719edbe285
Showing with 3 additions and 4 deletions.
  1. +3 −4 nikola/post.py
@@ -842,7 +842,7 @@ def _get_metadata_from_file(meta_data):
meta = {}
if not meta_data:
return meta

re_md_title = re.compile(r'^{0}([^{0}].*)'.format(re.escape('#')))
# Assuming rst titles are going to be at least 4 chars long
# otherwise this detects things like ''' wich breaks other markups.
@@ -853,7 +853,6 @@ def _get_metadata_from_file(meta_data):
if not meta_data[0]:
meta_data = meta_data[1:]


# First, get metadata from the beginning of the file,
# up to first empty line

@@ -863,11 +862,11 @@ def _get_metadata_from_file(meta_data):
match = re_meta(line)
if match[0]:
meta[match[0]] = match[1]
seen_meta_flag = True

# If we have no title, try to get it from document
if 'title' not in meta:
for j, line in enumerate(meta_data[i:]):
piece = meta_data[:]
for i, line in enumerate(piece):
if re_rst_title.findall(line) and i > 0:
meta['title'] = meta_data[i - 1].strip()
break

0 comments on commit f30002b

Please sign in to comment.