diff options
author | mjfernez <mjfernez@gmail.com> | 2021-06-17 00:25:03 -0400 |
---|---|---|
committer | mjfernez <mjfernez@gmail.com> | 2021-06-17 00:28:18 -0400 |
commit | 4972877f8ef0e0e3664d3dd0edd651107ddc026f (patch) | |
tree | 2add06d4cd1e8479c7632c7e82f69bc7e5058068 /views.py | |
parent | 03e3f1d478866c68be79adb5d555d8d0d77a312b (diff) | |
download | ezcms-4972877f8ef0e0e3664d3dd0edd651107ddc026f.tar.gz |
.description is now rendered as html
.description was previously read as a text file, but this is cumbersome
and limits the user. This allows the user to embed html in their
.description files by adding the "cur_path" variable to context.
'index.html' has been updated to render the template located in cur_path
if a description file exists
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -41,13 +41,13 @@ def index_dir(path): Lists are sorted alphabetically. *Special files include '.links' and '.description' the format of these - files is unquoted CSV and free text. Both are displayed on the index.html + files is unquoted CSV and text/html. Both are displayed on the index.html for the given `path` """ dirs = [] files = [] links = [] - description = "" + description = False contents = os.listdir(path) for obj in contents: if os.path.isfile(path + '/' + obj): @@ -55,8 +55,7 @@ def index_dir(path): with open(path + '/' + obj) as f: links = f.readlines() elif obj == siteconfig.DESC_FILE: - with open(path + '/' + obj) as f: - description = f.read() + description = True elif obj.startswith('.'): continue else: @@ -140,6 +139,7 @@ def render_file(path): dirs, files, links, description = index_dir(abs_path) context.update( { + 'cur_path': 'site/' + path, 'cur_dir': path.split('/')[-1] + '/', 'dirs': dirs, 'files': files, |