interactive navigation headers

This commit is contained in:
2023-01-14 20:32:32 -08:00
parent f3de9214b1
commit 85b0283791
2 changed files with 14 additions and 2 deletions
+5 -2
View File
@@ -178,12 +178,13 @@ def return_dict_plain(ref, defs):
return ref.capitalize() + "<br><br>" + response return ref.capitalize() + "<br><br>" + response
def return_dict_rich(ref, defs): def return_dict_rich(ref, defs):
header = open('html/header.html', 'r')
css = open('styles/human_readable.css', 'r') css = open('styles/human_readable.css', 'r')
response_html = open('html/response.html', 'r') response_html = open('html/response.html', 'r')
response = '' response = ''
for e in defs: for e in defs:
response += e + "<br><br>" response += e + "<br><br>"
return (response_html.read().format(passage = ref.capitalize(), text = response) + css.read()) return (header.read() + response_html.read().format(passage = ref.capitalize(), text = response) + css.read())
@app.get("/show") @app.get("/show")
def show(): def show():
@@ -276,7 +277,8 @@ def response_single(scripture):
if arg_view == "plain": if arg_view == "plain":
return(response_text(scripture)) return(response_text(scripture))
elif arg_view == "rich": elif arg_view == "rich":
return(response_rich(scripture)) header = open('html/header.html', 'r')
return(header.read() + response_rich(scripture))
else: else:
response = response_dict(scripture) response = response_dict(scripture)
return jsonify(response) return jsonify(response)
@@ -289,6 +291,7 @@ def response_multi(scriptures):
for scripture in scriptures: for scripture in scriptures:
response.append(response_text(scripture)) response.append(response_text(scripture))
elif arg_view == "rich": elif arg_view == "rich":
response.append(open('html/header.html', 'r').read())
for scripture in scriptures: for scripture in scriptures:
response.append(response_rich(scripture)) response.append(response_rich(scripture))
else: else:
+9
View File
@@ -0,0 +1,9 @@
<DOCTYPE html>
<header>
<a href="/">Home</a>
<a href="/search">Bible Search</a>
<a href="/show">Bible Verses</a>
<a href="/define">Bible Define</a>
<a href="/random?view=rich">Random Verse</a>
<a href="/votd?view=rich">Verse of the Day</a>
</header>