Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #1539
  • Loading branch information
ralsina committed Jan 13, 2015
1 parent ea17d14 commit c9c7a97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -32,6 +32,7 @@ Features
Bugfixes
--------

* Handle over-and-under-lined titles in rst fr guessing title (Issue #1539)
* Respect SHOW_UNTRANSLATED_POSTS = False in archives
and for untranslated source files (Issue #1360)
* Make sure drafts don’t appear in sitemaps with multiple languages
Expand Down
6 changes: 6 additions & 0 deletions nikola/post.py
Expand Up @@ -700,6 +700,8 @@ def _get_metadata_from_file(meta_data):
>>> g = _get_metadata_from_file
>>> list(g([]).values())
[]
>>> str(g(["======","FooBar","======"])["title"])
'FooBar'
>>> str(g(["FooBar","======"])["title"])
'FooBar'
>>> str(g(["#FooBar"])["title"])
Expand Down Expand Up @@ -734,6 +736,10 @@ def _get_metadata_from_file(meta_data):
if 'title' not in meta:
if re_rst_title.findall(line) and i > 0:
meta['title'] = meta_data[i - 1].strip()
if 'title' not in meta:
if (re_rst_title.findall(line) and i >= 0 and
re_rst_title.findall(meta_data[i + 2])):
meta['title'] = meta_data[i + 1].strip()
if 'title' not in meta:
if re_md_title.findall(line):
meta['title'] = re_md_title.findall(line)[0]
Expand Down

0 comments on commit c9c7a97

Please sign in to comment.