[Backport] Issue 5121 github links are broken

stable
Alejandro Alonso 2017-05-03 15:26:35 +02:00 committed by Jesús Espino
parent 02c116b8d5
commit 69e6e7241d
1 changed files with 2 additions and 13 deletions

View File

@ -79,16 +79,6 @@ class WysiwygService
return '[' + title + '](' + link + ')' return '[' + title + '](' + link + ')'
linkTitleWithSpaces: (text) ->
link = /\[[^\]]*\]\(([^\)]*)\)/g # [Title-with-spaces](Title with spaces)
return text.replace link, (match, p1, offset, str) ->
if p1.indexOf(' ') >= 0
return match.replace /\(.*\)/, '(' + taiga.slugify(p1) + ')'
else
return match
replaceUrls: (html) -> replaceUrls: (html) ->
el = document.createElement( 'html' ) el = document.createElement( 'html' )
el.innerHTML = html el.innerHTML = html
@ -185,7 +175,7 @@ class WysiwygService
autoLinkHTML: (html) -> autoLinkHTML: (html) ->
# override Autolink parser # override Autolink parser
matchRegexStr = String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter) matchRegexStr = String(Autolinker.matcher.Mention.prototype.matcherRegexes.twitter)
if matchRegexStr.indexOf('.') == -1 if matchRegexStr.indexOf('.') == -1
matchRegexStr = '@[^\s]{1,50}[^.\s]' matchRegexStr = '@[^\s]{1,50}[^.\s]'
@ -222,8 +212,7 @@ class WysiwygService
} }
text = @.replaceEmojiNameByImgs(text) text = @.replaceEmojiNameByImgs(text)
text = @.pipeLinks(text) text = @.pipeLinks(text)
text = @.linkTitleWithSpaces(text)
md = window.markdownit({ md = window.markdownit({
breaks: true breaks: true