diff --git a/rtv/docs.py b/rtv/docs.py index 6497ad9..f6d72b7 100644 --- a/rtv/docs.py +++ b/rtv/docs.py @@ -45,15 +45,11 @@ Submission Mode """ COMMENT_FILE = """ ---% {0} %-- -Do not edit the line above. -Type your comment above the line. -All text below the line will be discarded. - -If there is nothing but whitespace above the line -then the comment will be discarded. - -Replying to {1}'s {2} - -{3} +# All lines starting with a # will be ignored +# +# If there is only whitespace left then the comment +# will not be posted. +# +# Replying to {author}'s {type} +{content} """ diff --git a/rtv/submission.py b/rtv/submission.py index bcea194..b31e136 100644 --- a/rtv/submission.py +++ b/rtv/submission.py @@ -2,7 +2,6 @@ import curses import sys import time import os -from uuid import uuid4 from tempfile import NamedTemporaryFile from subprocess import Popen @@ -248,13 +247,19 @@ class SubmissionPage(BasePage): curses.flash() return - - cid = str(uuid4()) - if data['type'] == 'Submission': - info = (data['author'], 'submission', data['text']) + if data['type'] is 'Submission': + content = data['text'] else: - info = (data['author'], 'comment', data['body']) - comment_info = COMMENT_FILE.format(cid, *info) + content = data['body'] + + # Comment out every line of the content + content = '\n'.join(['#|' + line for line in content.split('\n')]) + + info = {'author': data['author'], + 'type': data['type'], + 'content': content} + + comment_info = COMMENT_FILE.format(**info) with NamedTemporaryFile(prefix='rtv-comment-', mode='w+') as fp: fp.write(comment_info) @@ -270,8 +275,8 @@ class SubmissionPage(BasePage): curses.doupdate() fp.seek(0) - comment_text = fp.read().split('--% ' + cid + ' %--')[0] - + comment_text = '\n'.join([line for line in fp.read().split('\n') + if not line.startswith("#")]) if comment_text is None or comment_text.isspace(): return