diff --git a/__pycache__/contextualise.cpython-35.pyc b/__pycache__/contextualise.cpython-35.pyc index c54d451..a7ade1b 100644 Binary files a/__pycache__/contextualise.cpython-35.pyc and b/__pycache__/contextualise.cpython-35.pyc differ diff --git a/contextualise.py b/contextualise.py index 340646b..43f1424 100644 --- a/contextualise.py +++ b/contextualise.py @@ -5,6 +5,7 @@ import json import os from time import gmtime, strftime from pprint import pprint +import re app = Flask(__name__, static_url_path='', static_folder="static", template_folder="templates") @@ -81,7 +82,7 @@ def all(): # print(dict) counter2=0 return render_template('all.html', file=thefile, listingfiles=listingfiles, jsonfiles=jsonfiles, listofdicts=listofdicts, counter2=counter2) - + @app.route('/description') def description(): @@ -93,40 +94,24 @@ def description(): for file in datafromjson: - # # assigning html tag on the basis of extension, to be finished when all the files have been sent - # if file.lower().endswith(('.png', '.jpg', '.jpeg')): - # file = Markup('
') - - # #if sound - # elif file.lower().endswith(('.mp3')): - # file = Markup('''''') - #if txtfile - # if file.lower().endswith(('.txt')): - # # print(thefile) - # with open("static/"+file,"r") as f: - # textfile = f.readlines() - if file.lower().endswith(('.html')): - # print(thefile) with open("static/"+file,"r", encoding='utf-8') as f: textfile = f.read() - textfile = Markup(textfile) - + word = "way" + wordlinked = ""+word+"" + textfile = re.sub(word, wordlinked, textfile) - # #ifvid to be added - # elif file.lower().endswith(('.mp4')): - # file = Markup(''' ''') +# go into the textfile content, find the words, +# replace word with word + + textfile = Markup(textfile) - return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfile=textfile) +@app.route('/diverge') +def diverge(): + return render_template('diverge.html') if __name__ == '__main__': - app.run(debug=True) \ No newline at end of file + app.run(debug=True) diff --git a/templates/description.html b/templates/description.html index fabf6ba..afcca10 100644 --- a/templates/description.html +++ b/templates/description.html @@ -15,13 +15,13 @@
- + {% elif item.lower().endswith(('.mp4')) %}
- + {% elif item.lower().endswith(('.mp3')) %}