Strip comments

Insert link to comment when it's referenced with #comment_number
This commit is contained in:
Gregory Soutade
2014-03-16 18:55:50 +01:00
parent 22b8c96fe3
commit 726d247632
14 changed files with 15 additions and 11 deletions

0
dynastie/sites/blog.soutade.fr/_all_posts.html Executable file → Normal file
View File

View File

@@ -6,7 +6,7 @@
<div class="post_header">
<dyn:title link="1"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

0
dynastie/sites/blog.soutade.fr/_base_post.html Executable file → Normal file
View File

View File

@@ -6,7 +6,7 @@
<div class="post_header">
<dyn:title link="1"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

View File

@@ -5,7 +5,7 @@
<div class="post_header">
<dyn:title link="1"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

View File

@@ -6,7 +6,7 @@
<div class="post_header">
<dyn:title link="0"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

View File

@@ -5,7 +5,7 @@
<div class="post_header">
<dyn:title link="1"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

2
dynastie/sites/blog.soutade.fr/_tag.html Executable file → Normal file
View File

@@ -6,7 +6,7 @@
<div class="post_header">
<dyn:title link="1"/>
<div class="post_sub_header">
<dyn:date/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
<dyn:date format="%A, %d %B %Y"/> | <div class="author_icon"> Écrit par <dyn:author/> </div>
</div>
<dyn:tags link="1"/>
</div>

View File

@@ -406,7 +406,6 @@ ul li
.comment_author, .comment_date
{
margin-left:5px;
margin-right:5px;
}
.comment_author

0
dynastie/sites/blog.soutade.fr/js/blog.js Executable file → Normal file
View File

View File

@@ -22,7 +22,7 @@
</head>
<body>
<div class="logo">
<a href="http://indefero.soutade.fr/p/dynastie>"><img src="{{ STATIC_URL }}images/logo.png"/></a>
<a href="http://indefero.soutade.fr/p/dynastie"><img src="{{ STATIC_URL }}images/logo.png"/></a>
</div>
<div class="form">
<form method="post" action="/index">

View File

@@ -18,6 +18,7 @@
along with Dynastie. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import re
from datetime import datetime, date, time
from django.shortcuts import render
from django.contrib.auth import authenticate, login, logout
@@ -710,10 +711,11 @@ def add_comment(request, post_id, parent_id):
ip = request.META['REMOTE_ADDR']
# Avoid script injection
the_comment = request.POST['the_comment']
the_comment = request.POST['the_comment'].strip()
the_comment = the_comment.replace('<', '&lt;')
the_comment = the_comment.replace('>', '&gt;')
the_comment = the_comment.replace('\n', '<br />')
the_comment = re.sub('#([0-9]+)', '<a href=\"#comment_\\1\">#\\1</a>', the_comment)
if 'mel' in request.POST:
mel = request.POST['mel'].strip()