Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix highlighting syntax bug.

  • Loading branch information...
commit 780844a63912af3c149965549d36d2cddd0cfddf 1 parent 6ab1e33
@paulmillr authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 app/lib/view_helper.coffee
View
9 app/lib/view_helper.coffee
@@ -33,7 +33,7 @@ Handlebars.registerHelper 'if_can_edit_post', (options) ->
orgs = user.get('organizations')?.pluck('login') ? []
postCreator = @user.login
repoOwner = @topic.repo.user.login
-
+
if user.isAdmin() or user.get('login') is postCreator or repoOwner in orgs
options.fn(this)
else
@@ -79,7 +79,7 @@ Handlebars.registerHelper 'with_user', (options) ->
Handlebars.helpers.with.call(this, context, options)
Handlebars.registerHelper 'gravatar', (options) ->
- "https://secure.gravatar.com/avatar/#{options.fn this}?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
+ "https://secure.gravatar.com/avatar/#{options.fn this}?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"
Handlebars.registerHelper 'date', (options) ->
date = new Date options.fn this
@@ -115,7 +115,10 @@ Handlebars.registerHelper 'markdown', (options) ->
markdown = marked string, gfm: yes, highlight: (code, language) ->
result = if language
- hljs.highlight(language, code).value
+ try
+ hljs.highlight(language, code).value
+ catch error
+ code
else
code
unescapeTags result
Please sign in to comment.
Something went wrong with that request. Please try again.