Name: spdx-to-html.js
Owner: jslicense
Description: convert an SPDX expression to English text and links
Created: 2015-05-22 06:35:19.0
Updated: 2017-06-13 20:11:54.0
Pushed: 2017-07-04 19:33:15.0
Size: 25
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
spdxToHTML = require('spdx-to-html')
Returns null for invalid license expressions:
assert = require('assert')
rt.deepEqual(
dxToHTML('InvalidExpression'),
ll
Returns links for standard licenses on spdx.org:
rt.deepEqual(
dxToHTML('MIT'),
a href="http://spdx.org/licenses/MIT.html">MIT</a>'
For license references:
rt.deepEqual(
dxToHTML('LicenseRef-123ABC'),
icense Reference "LicenseRef-123ABC"'
Constructs English disjunctions for multilicensing expressions:
rt.deepEqual(
dxToHTML('(MPL-2.0 OR GPL-2.0+)'),
'<a href="http://spdx.org/licenses/MPL-2.0.html">MPL-2.0</a>' +
' or ' +
'<a href="http://spdx.org/licenses/GPL-2.0.html">GPL-2.0</a> or newer'
Describes ranges and exceptions:
rt.deepEqual(
dxToHTML('(GPL-2.0+ WITH Bison-exception-2.2)'),
'<a href="http://spdx.org/licenses/GPL-2.0.html">GPL-2.0</a>' +
' or newer' +
' with Bison-exception-2.2'