display untitled-page paths as /path rather than path.md
This commit is contained in:
parent
059108c37b
commit
05f879ab80
@ -66,5 +66,5 @@ def generate_parent_navs(path):
|
||||
with app.open_instance_resource(resolved_path, 'r') as entry_file:
|
||||
entry = entry_file.read()
|
||||
_ = Markup(md.convert(entry))
|
||||
page_name = " ".join(md.Meta.get('title')) if md.Meta.get('title') else os.path.basename(resolved_path)
|
||||
page_name = " ".join(md.Meta.get('title')) if md.Meta.get('title') else path
|
||||
return generate_parent_navs(parent_path) + [(page_name, path)]
|
||||
|
@ -58,12 +58,12 @@ def test_generate_page_navs_alternate_index(app):
|
||||
|
||||
def test_generate_page_navs_subdir_index(app):
|
||||
with app.app_context():
|
||||
assert generate_parent_navs('/subdir/') == [('incorporeal.org', '/'), ('index.md', '/subdir/')]
|
||||
assert generate_parent_navs('/subdir/') == [('incorporeal.org', '/'), ('/subdir/', '/subdir/')]
|
||||
|
||||
|
||||
def test_generate_page_navs_subdir_real_page(app):
|
||||
with app.app_context():
|
||||
assert generate_parent_navs('/subdir/page') == [('incorporeal.org', '/'), ('index.md', '/subdir/'),
|
||||
assert generate_parent_navs('/subdir/page') == [('incorporeal.org', '/'), ('/subdir/', '/subdir/'),
|
||||
('Page', '/subdir/page')]
|
||||
|
||||
|
||||
@ -71,4 +71,4 @@ def test_generate_page_navs_subdir_with_title_parsing_real_page(app):
|
||||
with app.app_context():
|
||||
assert generate_parent_navs('/subdir-with-title/page') == [('incorporeal.org', '/'),
|
||||
('SUB!', '/subdir-with-title/'),
|
||||
('page.md', '/subdir-with-title/page')]
|
||||
('/subdir-with-title/page', '/subdir-with-title/page')]
|
||||
|
Loading…
Reference in New Issue
Block a user