gitter-markdown-processor
Advanced tools
Comparing version 11.4.0 to 12.0.0
/*jshint globalstrict:true, trailing:false, unused:true, node:true */ | ||
"use strict"; | ||
var marked = require('gitter-marked'); | ||
var marked = require('gitter-marked'); | ||
var highlight = require('highlight.js'); | ||
var _ = require('underscore'); | ||
var util = require('util'); | ||
var katex = require('katex'); | ||
var matcher = require('./github-url-matcher'); | ||
var _ = require('underscore'); | ||
var util = require('util'); | ||
var katex = require('katex'); | ||
var matcher = require('./decoration-url-matcher'); | ||
var htmlencode = require('htmlencode'); | ||
@@ -16,3 +16,3 @@ | ||
var JAVA = 'java'; | ||
var JAVA = 'java'; | ||
var SCRIPT = 'script:'; | ||
@@ -25,3 +25,3 @@ var scriptUrl = JAVA + SCRIPT; | ||
highlight.configure( { classPrefix: '', languages : [ | ||
highlight.configure({ classPrefix: '', languages: [ | ||
"apache", | ||
@@ -118,3 +118,3 @@ "applescript", | ||
if(hrefLower.indexOf(httpUrl) !== 0 && hrefLower.indexOf(httpsUrl) !== 0 && hrefLower.indexOf(noProtocolUrl) !== 0) { | ||
if(hrefLower.indexOf(httpUrl) !== 0 && hrefLower.indexOf(httpsUrl) !== 0 && hrefLower.indexOf(noProtocolUrl) !== 0) { | ||
return httpUrl + href; | ||
@@ -159,3 +159,3 @@ } | ||
renderer.issue = function(repo, issue, text) { | ||
renderer.issuable = function(type, provider, repo, issue, href, text) { | ||
renderContext.issues.push({ | ||
@@ -166,16 +166,30 @@ number: issue, | ||
var out = '<span data-link-type="issue" data-issue="' + issue + '"'; | ||
var out = '<a href="' + href + '" target="_blank" data-link-type="' + type + '" data-provider="' + provider + '" data-issue="' + issue + '"'; | ||
if(repo) { | ||
out += util.format(' data-issue-repo="%s"', repo); | ||
} | ||
out += ' class="issue">' + text + '</span>'; | ||
out += ' class="' + type + '">' + text + '</a>'; | ||
return out; | ||
} | ||
renderer.issue = function(provider, repo, issue, href, text) { | ||
return renderer.issuable('issue', provider, repo, issue, href, text); | ||
}; | ||
renderer.commit = function(repo, sha) { | ||
renderer.mr = function(provider, repo, issue, href, text) { | ||
return renderer.issuable('mr', provider, repo, issue, href, text); | ||
}; | ||
renderer.pr = function(provider, repo, issue, href, text) { | ||
return renderer.issuable('pr', provider, repo, issue, href, text); | ||
}; | ||
renderer.commit = function(provider, repo, sha, href) { | ||
var text = repo+'@'+sha.substring(0, 7); | ||
var out = '<span data-link-type="commit" ' + | ||
var out = '<a href="' + href + '" target="_blank" ' + | ||
'data-link-type="commit" ' + | ||
'data-provider="' + provider + '" ' + | ||
'data-commit-sha="' + sha + '" ' + | ||
'data-commit-repo="' + repo + '" ' + | ||
'class="commit">' + text + '</span>'; | ||
'class="commit">' + text + '</a>'; | ||
return out; | ||
@@ -186,5 +200,5 @@ }; | ||
href = checkForIllegalUrl(href); | ||
var githubData = matcher(href); | ||
if(githubData) { | ||
return renderer[githubData.type](githubData.repo, githubData.id, githubData.text); | ||
var urlData = matcher(href); | ||
if(urlData) { | ||
return renderer[urlData.type](urlData.provider, urlData.repo, urlData.id, urlData.href, urlData.text); | ||
} else { | ||
@@ -191,0 +205,0 @@ renderContext.urls.push({ url: href }); |
{ | ||
"name": "gitter-markdown-processor", | ||
"version": "11.4.0", | ||
"version": "12.0.0", | ||
"description": "parses gitter chat messages, but in its own process", | ||
@@ -18,2 +18,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"eslint": "^4.3.0", | ||
"eslint-plugin-node": "^5.1.1", | ||
"mocha": "^2.0.1" | ||
@@ -20,0 +22,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35262
34
674
3