diff options
author | Pjotr Prins | 2020-07-16 10:53:19 +0100 |
---|---|---|
committer | Pjotr Prins | 2020-07-16 10:53:19 +0100 |
commit | f0dd283c31acfcc34b967b7a81167e0543d06364 (patch) | |
tree | d7dc4aeeba3d235c6469ecb4d24eb3ed4d7b1750 /bh20simplewebuploader/main.py | |
parent | 6b4503da47e77984d00dacf827ab69e2582a3902 (diff) | |
download | bh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.tar.gz bh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.tar.lz bh20-seq-resource-f0dd283c31acfcc34b967b7a81167e0543d06364.zip |
Add edit icon to text on github
Closes #76
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r-- | bh20simplewebuploader/main.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 8a6794e..0f521d0 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -444,8 +444,12 @@ def receive_files(): finally: shutil.rmtree(dest_dir) -def get_html_body(fn): - buf = "" + +def edit_button(url,text="Edit text!"): + return '<p class="editbutton"><a href="'+url+'">'+text+'!<img src="static/image/edit.png"></a></p>' + +def get_html_body(fn,source="https://github.com/arvados/bh20-seq-resource/tree/master/doc"): + buf = edit_button(source) in_body = False begin_body = re.compile(r"<body>",re.IGNORECASE) end_body = re.compile(r"(</body>|.*=\"postamble\")",re.IGNORECASE) @@ -457,6 +461,7 @@ def get_html_body(fn): buf += line elif begin_body.match(line): in_body = True + buf += edit_button(source) return buf @app.route('/download') @@ -549,13 +554,13 @@ def blog_page(): blog_content = request.args.get('id') # e.g. using-covid-19-pubseq-part3 buf = None; if blog_content: - buf = get_html_body('doc/blog/'+blog_content+'.html') + buf = get_html_body('doc/blog/'+blog_content+'.html',"https://github.com/arvados/bh20-seq-resource/blob/master/doc/blog/"+blog_content+".org") return render_template('blog.html',menu='BLOG',embed=buf,blog=blog_content) @app.route('/about') def about_page(): - buf = get_html_body('doc/web/about.html') + buf = get_html_body('doc/web/about.html','https://github.com/arvados/bh20-seq-resource/blob/master/doc/web/about.org') return render_template('about.html',menu='ABOUT',embed=buf) ## |