catalog: use copy of comment HTML from before running features like Linkify/Embed

This commit is contained in:
ccd0 2014-09-16 19:42:45 -07:00
parent 8a29978882
commit 58973e4651
2 changed files with 7 additions and 2 deletions

View File

@ -353,7 +353,7 @@ Build =
'<span class="thread-icons"></span>' + '<span class="thread-icons"></span>' +
'</div>' + '</div>' +
'&{subject}' + '&{subject}' +
'<div class="comment">&{thread.OP.nodes.comment}</div>' '<div class="comment">&{thread.OP.info.commentHTML}</div>'
) %> ) %>
root.dataset.fullID = thread.fullID root.dataset.fullID = thread.fullID

View File

@ -86,6 +86,7 @@ class Post
parseComment: -> parseComment: ->
# Merge text nodes and remove empty ones. # Merge text nodes and remove empty ones.
@nodes.comment.normalize() @nodes.comment.normalize()
# Get the comment's text. # Get the comment's text.
# <br> -> \n # <br> -> \n
# Remove: # Remove:
@ -98,7 +99,11 @@ class Post
for node in $$ '.abbr, .exif, b', bq for node in $$ '.abbr, .exif, b', bq
$.rm node $.rm node
@info.comment = @nodesToText bq @info.comment = @nodesToText bq
# Hide spoilers.
# Save cleaned comment HTML.
@info.commentHTML = <%= html('&{bq}') %>
# Get the comment's text with spoilers hidden.
spoilers = $$ 's', bq spoilers = $$ 's', bq
@info.commentSpoilered = if spoilers.length @info.commentSpoilered = if spoilers.length
for node in spoilers for node in spoilers