git ssb

30+

cel / git-ssb-web



Commit 9a0cb9753aa09409d5e2c0281ea1c6fe95dbdd12

Strip markdown from issue and pull request titles.

Stephen Whitmore committed on 12/23/2016, 9:39:39 PM
Parent: 843b716024394e2e1d8f44552cbcd044a9305d0a

Files changed

lib/repos/issues.jschanged
lib/repos/pulls.jschanged
lib/util.jschanged
package.jsonchanged
lib/repos/issues.jsView
@@ -66,9 +66,9 @@
6666 return '<section class="collapse">' +
6767 '<i class="issue-state issue-state-' + state + '"' +
6868 ' title="' + stateStr + '">◼</i> ' +
6969 '<a href="' + u.encodeLink(issue.id) + '">' +
70- u.escape(issue.title) +
70 + u.formatMarkdownTitle(issue.title) +
7171 '<span class="right-bar">' +
7272 new Date(issue.created_at).toLocaleString(req._locale) +
7373 '</span>' +
7474 '</a>' +
@@ -99,12 +99,12 @@
9999
100100 I.serveRepoIssue = function (req, repo, issue, path, postId) {
101101 var self = this
102102 var newestMsg = {key: issue.id, value: {timestamp: issue.created_at}}
103- var title = u.escape(issue.title) + ' · %{author}/%{repo}'
103 + var title = u.formatMarkdownTitle(issue.title) + ' · %{author}/%{repo}'
104104 return self.repo.serveRepoTemplate(req, repo, 'issues', null, title, cat([
105105 pull.once(
106- '<h3>' + u.link([issue.id], issue.title) + '</h3>' +
106 + '<h3>' + u.link([issue.id], u.formatMarkdownTitle(issue.title)) + '</h3>' +
107107 '<code>' + issue.id + '</code>' +
108108 '<section class="collapse">' +
109109 (issue.open
110110 ? '<strong class="issue-status open">' +
lib/repos/pulls.jsView
@@ -25,12 +25,12 @@
2525 P.serveRepoPullReq = function (req, repo, pr, path, postId) {
2626 var self = this
2727 var headRepo, authorLink
2828 var page = path[0] || 'activity'
29- var title = u.escape(pr.title) + ' · %{author}/%{repo}'
29 + var title = u.formatMarkdownTitle(pr.title)) + ' · %{author}/%{repo}'
3030 return self.repo.serveRepoTemplate(req, repo, 'pulls', null, title, cat([
3131 pull.once('<div class="pull-request">' +
32- '<h3>' + u.link([pr.id], pr.title) + '</h3>' +
32 + '<h3>' + u.link([pr.id], u.formatMarkdownTitle(pr.title)) + '</h3>' +
3333 '<code>' + pr.id + '</code>'),
3434 u.readOnce(function (cb) {
3535 var done = multicb({ pluck: 1, spread: true })
3636 var gotHeadRepo = done()
lib/util.jsView
@@ -1,8 +1,9 @@
11 var pull = require('pull-stream')
22 var h = require('pull-hyperscript')
33 var paramap = require('pull-paramap')
44 var Highlight = require('highlight.js')
5 +var removeMd = require('remove-markdown')
56 var u = exports
67
78 u.imgMimes = {
89 png: 'image/png',
@@ -217,4 +218,8 @@
217218 })
218219 } else cb(null, msg)
219220 }, 4)
220221 }
222 +
223 +u.formatMarkdownTitle = function (title) {
224 + return u.escape(removeMd(title))
225 +}
package.jsonView
@@ -20,8 +20,9 @@
2020 "pull-identify-filetype": "^1.1.0",
2121 "pull-many": "^1.0.8",
2222 "pull-paramap": "^1.2.1",
2323 "pull-stream": "^3.5.0",
24 + "remove-markdown": "^0.1.0",
2425 "ssb-client": "^4.2.1",
2526 "ssb-config": "^2.2.0",
2627 "ssb-git-repo": "^2.4.0",
2728 "ssb-issues": "^1.0.0",

Built with git-ssb-web