Skip to content

Commit

Permalink
Make tests pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jul 20, 2015
1 parent 378ae40 commit f30002b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions nikola/post.py
Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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
Expand Down

0 comments on commit f30002b

Please sign in to comment.