diff --git a/lms/static/coffee/src/customwmd.coffee b/lms/static/coffee/src/customwmd.coffee index 0590a0679b..7efcddb90a 100644 --- a/lms/static/coffee/src/customwmd.coffee +++ b/lms/static/coffee/src/customwmd.coffee @@ -105,7 +105,6 @@ $ -> replaceMath: (text) -> text = text.replace /@@(\d+)@@/g, ($0, $1) => @math[$1] @math = null - console.log text text @replaceMathWrapper: (_this) -> @@ -163,7 +162,6 @@ $ -> $('#file-upload').unbind('change').change(startUploadHandler) imageUploadHandler = (elem, input) -> - console.log "here" ajaxFileUpload(imageUploadUrl, input, imageUploadHandler) editor = new Markdown.Editor( diff --git a/lms/static/coffee/src/discussion/content.coffee b/lms/static/coffee/src/discussion/content.coffee index b98c5eb7f0..058872c172 100644 --- a/lms/static/coffee/src/discussion/content.coffee +++ b/lms/static/coffee/src/discussion/content.coffee @@ -278,15 +278,36 @@ initializeFollowThread = (thread) -> handleEditComment(this) initializeContent: (content) -> + + unescapeHighlightTag = (text) -> + text.replace(/\<\;highlight\>\;/g, "") + .replace(/\<\;\/highlight\>\;/g, "") + + stripLatexHighlight = (text) -> + text + + markdownWithHighlight = (text) -> + converter = Markdown.getMathCompatibleConverter() + unescapeHighlightTag stripLatexHighlight converter.makeHtml text + $content = $(content) initializeVote $content if $content.hasClass("thread") initializeFollowThread $content $local = Discussion.generateLocal($content.children(".discussion-content")) + + $contentTitle = $local(".thread-title") + + if $contentTitle.length + $contentTitle.html unescapeHighlightTag stripLatexHighlight $contentTitle.html() + $contentBody = $local(".content-body") - raw_text = $contentBody.html() - converter = Markdown.getMathCompatibleConverter() - $contentBody.html(converter.makeHtml(raw_text)) + + console.log "raw html:" + console.log $contentBody.html() + + $contentBody.html markdownWithHighlight $contentBody.html() + MathJax.Hub.Queue ["Typeset", MathJax.Hub, $contentBody.attr("id")] id = $content.attr("_id") if not Discussion.getContentInfo id, 'editable' diff --git a/lms/templates/discussion/_thread.html b/lms/templates/discussion/_thread.html index 1b9fcbadc3..9878cadc08 100644 --- a/lms/templates/discussion/_thread.html +++ b/lms/templates/discussion/_thread.html @@ -42,7 +42,11 @@
${render_title(content, type, **kwargs)}
-
${content['body'] | h}
+ % if content.get('highlighted_body', None): +
${content['highlighted_body'] | h}
+ % else: +
${content['body'] | h}
+ % endif ${render_tags(content, type, **kwargs)} ${render_bottom_bar(content, type, **kwargs)} @@ -54,7 +58,11 @@ <%def name="render_title(content, type, **kwargs)"> % if type == "thread": - ${content['title'] | h} + % if content.get('highlighted_title', None): + ${content['highlighted_title'] | h} + % else: + ${content['title'] | h} + % endif % endif