jslicense/spdx-to-html.js

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

Homepage:

Size: 25

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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'



This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.