From 43682deca0fcaf5af5808b1c7c2b4427f242c933 Mon Sep 17 00:00:00 2001 From: Apoorv Anand Date: Sun, 7 Jan 2018 01:04:49 +0530 Subject: [PATCH] Update topic names with '_' when editing content For topics which are directories, name starts with an '_' --- lib/cheat_wrapper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/cheat_wrapper.py b/lib/cheat_wrapper.py index ff50027..c47b637 100644 --- a/lib/cheat_wrapper.py +++ b/lib/cheat_wrapper.py @@ -584,6 +584,9 @@ def cheat_wrapper(query, request_options=None, html=False): edit_button = '' if editable: + # It's possible that topic directory starts with omited underscore + if '/' in topic: + topic = '_' + topic edit_page_link = 'https://github.com/chubin/cheat.sheets/edit/master/sheets/' + topic edit_button = '
[edit]
' % edit_page_link result = re.sub("
", edit_button + form_html + "
", result)