fail('length of comment or goto is too great')
end
+if COMMENT_TXT.length <= 2 or COMMENT_TXT =~ /\A\s*\Z/
+ fail('not enough content in comment')
+end
+
captchad = false
if cgi.has_key?('answer') && cgi.has_key?('question')
COMMENT_TXT])
if date
- new_count = $db.execute(query + 'and date > ?',date)
+ new_count = $db.execute(query + 'and date > ?', date)
else
new_count = $db.execute(query)
end
smtp.send_message msg, opts[:from], opts[:to]
end
end
- send_email :subject => 'new comments on iankelling.org'
+ send_email :subject => "new comment on #{DN}"
end
post(md_file)
end
def comment_html(comment, date)
- inner = Redcarpet::Markdown.new(Redcarpet::Render::Safe, fenced_code_blocks: true).render(<<EOF)
-#{comment}
-<span class="comment-date">#{Time.at(date).strftime("%b %-d '%y")}</span>
-EOF
# I tried putting the time, %I:%M %p UTC, but it looks kinda
# clunky, going against my simple theme.
+ user_input = Redcarpet::Markdown.new(Redcarpet::Render::Safe,
+ fenced_code_blocks: true).render(comment)
<<EOF
<div class="comment">
- #{inner}
+ #{user_input}
+ <p class="comment-date">#{Time.at(date).strftime("%b %-d '%y")}</p>
</div>
EOF
end
--- /dev/null
+Sample comment with *formatting*.
\ No newline at end of file
line-height: 1.5; // default is too scrunched
}
-// alternative to a <br>. whatever.
-// https://stackoverflow.com/questions/7363766/how-to-insert-a-line-break-before-an-element-using-css
-.comment-date::before {
- content: "\A";
-}
-
.comment-date {
color: $comment-date-color;
font-size: 15px;
- white-space: pre;
+ margin-top: 0;
}
.post-date {
while [[ $1 ]]; do
case $1 in
-a) all=true; shift ;;
- -l) shell= ; shift ;; # -l for local
+ -l) shell= ; shift ;; # -l for local site instead of iankelling.org
esac
done
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-(defun iankmod-start ()
- (interactive)
- (shell-command "/a/h/get-comments" "*messages*")
- (find-file "/tmp/hcomments")
- (iankmod 1))
+
+;; generally, use m-x iankmod-start. c-u to run on local testing
+;; instance. Alternatively, run get-comments with whatever args,
+;; manually open /tmp/hcomments, then run (iankmod).
+
+(defun iankmod-start (arg)
+ (interactive "P")
+ (setq iankmod-last-arg (if (equal arg '(4)) " -l" ""))
+ (let ((cmd (concat "/a/h/get-comments" iankmod-last-arg)))
+ (shell-command cmd "*messages*")
+ (find-file "/tmp/hcomments")
+ (iankmod 1)))
+
(defun iankmod-save ()
(interactive)
- (shell-command "/a/h/set-comments" "*messages*"))
+ (basic-save-buffer)
+ (let ((cmd (concat "/a/h/set-comments" iankmod-last-arg)))
+ (shell-command cmd "*messages*")))
(defun iankmod-set-state (state)
shopt -s extglob
type -P a2enmod &>/dev/null || pi apache2
+type -P sqlite3 &>/dev/null || pi sqlite3
acme-tiny-wrapper $domain