kopia lustrzana https://github.com/badgen/badgen
Merge branch 'master' into emoji
commit
52cc8bb198
|
@ -3,7 +3,7 @@ const badgen = require('..')
|
||||||
|
|
||||||
const longParams = { subject: 'build-build-build', status: 'passing-passing-passing' }
|
const longParams = { subject: 'build-build-build', status: 'passing-passing-passing' }
|
||||||
const fullParams = { subject: 'license', status: 'MIT', color: 'cyan' }
|
const fullParams = { subject: 'license', status: 'MIT', color: 'cyan' }
|
||||||
const emojiParams = { subject: 'emojis', status: '💩🤱🦄' }
|
const emojiParams = { subject: 'emojis', status: '💩🤱🦄', color: 'cyan' }
|
||||||
|
|
||||||
new Suite()
|
new Suite()
|
||||||
.add('[classic] style, long params ', () => badgen(longParams))
|
.add('[classic] style, long params ', () => badgen(longParams))
|
||||||
|
|
|
@ -4588,9 +4588,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"serve-marked": {
|
"serve-marked": {
|
||||||
"version": "0.0.1",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/serve-marked/-/serve-marked-0.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/serve-marked/-/serve-marked-0.2.0.tgz",
|
||||||
"integrity": "sha512-2SG8gKKcl9RZE6SEKj2Tm2d+FnF28JRSFZ7fLCkjgPKIb7WslFiqoBi0YG/RtkVSb2vXKOSnCXwmxPi+4JbZvw==",
|
"integrity": "sha512-BkFgYKzajiR2Knx8mvQSWY6Z7npNKakw6qWjJNTVWGEa+68gWLdXnS5scwGK7+T0G48Q043jv7PweVxW8AigAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"marked": "^0.4.0"
|
"marked": "^0.4.0"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"name": "badgen",
|
"name": "badgen",
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"description": "Fast svg badge generator.",
|
"description": "Fast svg badge generator.",
|
||||||
|
"repository": "amio/badgen",
|
||||||
"author": "Amio <amio.cn@gmail.com>",
|
"author": "Amio <amio.cn@gmail.com>",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
@ -10,11 +11,11 @@
|
||||||
"bench": "node bench/index.js",
|
"bench": "node bench/index.js",
|
||||||
"preview": "node preview/serve.js",
|
"preview": "node preview/serve.js",
|
||||||
"pretest": "npm run lint",
|
"pretest": "npm run lint",
|
||||||
"test": "tap test/*.spec.js --reporter spec"
|
"test": "tap test/*.spec.js --reporter spec --coverage"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4",
|
||||||
"serve-marked": "0.0.1",
|
"serve-marked": "0.2.0",
|
||||||
"standard": "^11.0.1",
|
"standard": "^11.0.1",
|
||||||
"tap": "^12.0.1"
|
"tap": "^12.0.1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
|
|
||||||
| Badge (flat) | URL |
|
| Badge (flat) | URL |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| | [/chat/gitter/cyan/flat](/chat/gitter/cyan/flat) |
|
| | [/chat/gitter/cyan?style=flat](/chat/gitter/cyan?style=flat) |
|
||||||
| | [/style/standard/f2a/flat](/style/standard/f2a/flat) |
|
| | [/style/standard/f2a?style=flat](/style/standard/f2a?style=flat) |
|
||||||
| | [/license/Apache-2.0/blue/flat](/license/Apache-2.0/blue/flat) |
|
| | [/license/Apache-2.0/blue?style=flat](/license/Apache-2.0/blue?style=flat) |
|
||||||
| | [/Language/Swift%203.0.1/orange/flat](/Language/Swift%203.0.1/orange/flat) |
|
| | [/Language/Swift%203.0.1/orange?style=flat](/Language/Swift%203.0.1/orange?style=flat) |
|
||||||
|
|
||||||
## Multibytes unicode
|
## Multibytes unicode
|
||||||
|
|
||||||
| Badge | URL |
|
| Badge | URL |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| | [/emoji/💩🤱🦄/cyan/flat?unicode=1](/emoji/💩🤱🦄/cyan/flat?unicode=1) |
|
| | [/emoji/💩🤱🦄/cyan?style=flat&unicode=1](/emoji/💩🤱🦄/cyan?style=flat&unicode=1) |
|
||||||
| | [/emoji/💩🤱🦄/cyan/?unicode=1](/emoji/💩🤱🦄/cyan/?unicode=1) |
|
| | [/emoji/💩🤱🦄/cyan?unicode=1](/emoji/💩🤱🦄/cyan?unicode=1) |
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const url = require('url')
|
||||||
const qs = require('querystring')
|
const qs = require('querystring')
|
||||||
const serveMarked = require('serve-marked')
|
const serveMarked = require('serve-marked')
|
||||||
const badgen = require('..')
|
const badgen = require('..')
|
||||||
|
@ -7,8 +8,9 @@ const badgen = require('..')
|
||||||
// @example
|
// @example
|
||||||
// http://localhost:3000/npm/v1.2.3
|
// http://localhost:3000/npm/v1.2.3
|
||||||
const serveBadge = (req, res) => {
|
const serveBadge = (req, res) => {
|
||||||
const unicode = Boolean(qs.parse(req.url.split('?')[1]).unicode)
|
const { pathname, query } = url.parse(req.url)
|
||||||
const [ subject, status, color, style ] = req.url.split('/')
|
const { style, unicode } = qs.parse(query)
|
||||||
|
const [ subject, status, color ] = pathname.split('/')
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(s => qs.unescape(s))
|
.map(s => qs.unescape(s))
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue