diff options
| author | user@node5.net <user@node5.net> | 2025-08-23 22:38:01 +0200 |
|---|---|---|
| committer | user@node5.net <user@node5.net> | 2025-08-23 22:38:01 +0200 |
| commit | 9dc138950dabfcf12a624fe400d1085046668f25 (patch) | |
| tree | 88ef3d4f9f1af480fb7c4dd5b91faafe97ac5832 /src/blog_node5_net.py | |
| parent | deaa5a3a314787f61394df2de8ba458bc5e356c5 (diff) | |
Revamp comments style like sql statements
Diffstat (limited to 'src/blog_node5_net.py')
| -rw-r--r-- | src/blog_node5_net.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/blog_node5_net.py b/src/blog_node5_net.py index 5761fc1..0c2a865 100644 --- a/src/blog_node5_net.py +++ b/src/blog_node5_net.py @@ -94,14 +94,18 @@ except FileNotFoundError as ex: @app.context_processor # Always inject site title to all render_templates def inject_common(): url = strip_trailing_slash(flask.request.path) - comments, comment_headers = db.get_comments(url) + comments, comment_headers, comments_sql = db.get_comments(url) if comments: comments_formatted = tabulate.tabulate(comments, comment_headers, tablefmt="psql") else: - comments_formatted = f"""sqlite> SELECT COUNT(comment) FROM comment WHERE page_url = '{url}'; -0""" + comments_formatted = "" + insert_sql_pretty = markdown.markdown(f"```sql\nINSERT INTO comment(nickname, visitor_url, contact, show_contact, comment, public) VALUES (\n```", extensions=['fenced_code','codehilite']) + sql_pretty = markdown.markdown(f"```sql{ comments_sql }```", extensions=['fenced_code','codehilite']) + print(sql_pretty) args = { + 'insert_sql_pretty': insert_sql_pretty, + 'comments_sql': markupsafe.Markup(markdown.markdown(sql_pretty)), 'comments': comments_formatted, 'title': config['site_root_folder_path'], 'motd': random.choice(motd_list) |
