# HG changeset patch # User Ludovic Chabant # Date 1484240049 28800 # Node ID 7981f2140c14bf3654ffdcf7dea198232a97d4e7 # Parent a2ed337652e77b7c56071c693b4f24e917ea3e6b web: Move custom head stuff to the front-end. diff -r a2ed337652e7 -r 7981f2140c14 wikked/views/read.py --- a/wikked/views/read.py Thu Jan 12 08:44:02 2017 -0800 +++ b/wikked/views/read.py Thu Jan 12 08:54:09 2017 -0800 @@ -25,6 +25,11 @@ user = current_user.get_id() no_redirect = 'no_redirect' in request.args data = read_page(wiki, user, url, no_redirect=no_redirect) + + if data['format']: + custom_head = wiki.custom_heads.get(data['format'], '') + data['custom_head'] = custom_head + add_auth_data(data) add_navigation_data( url, data, diff -r a2ed337652e7 -r 7981f2140c14 wikked/webimpl/read.py --- a/wikked/webimpl/read.py Thu Jan 12 08:44:02 2017 -0800 +++ b/wikked/webimpl/read.py Thu Jan 12 08:54:09 2017 -0800 @@ -25,10 +25,9 @@ additional_info['redirected_from'] = visited_paths[:-1] ext = os.path.splitext(page.path)[1].lstrip('.') - custom_head = wiki.custom_heads.get(ext) result = {'meta': get_page_meta(page), 'text': page.text, - 'page_title': page.title, 'custom_head': custom_head} + 'page_title': page.title, 'format': ext} result.update(additional_info) return result @@ -54,10 +53,9 @@ fields=['url', 'path', 'title', 'text', 'meta'], check_perms=(user, CHECK_FOR_READ)) - custom_head = None + ext = None if info_page is not None: ext = os.path.splitext(info_page.path)[1].lstrip('.') - custom_head = wiki.custom_heads.get(ext) if (endpoint_info is not None and not endpoint_info.query @@ -69,7 +67,7 @@ 'meta': get_page_meta(info_page), 'text': info_page.text, 'page_title': info_page.title, - 'custom_head': custom_head} + 'format': ext} result.update(additional_info) return result @@ -105,7 +103,7 @@ 'title': value }, 'page_title': page_title, - 'custom_head': custom_head + 'format': ext } if info_page: result['text'] = info_page.text