modules/licence/spdx.zzm

zuzubox-0.0.1 documentation

Package

Name
zuzubox
Version
0.0.1
Uploaded
2026-06-16 22:33:57
Repository
https://github.com/tobyink/zuzu-zuzubox
Dependencies
Metadata
zuzu-distribution.json
Archive
Download .tar.gz

NAME

licence/spdx - SPDX licence expression parsing and licence-list helpers.

SYNOPSIS

  from licence/spdx import is_spdx_expression, licence_expression_text;

  if ( is_spdx_expression("MIT OR Apache-2.0") ) {
    say( licence_expression_text("MIT") );
  }

DESCRIPTION

licence/spdx parses SPDX licence expressions locally, following the SPDX 3.0 licence expression grammar. It can also fetch and parse the SPDX license-list-data licenses.md file to validate short identifiers and fetch the matching full licence text.

EXPORTS

normalize_spdx_expression(value)

Returns a whitespace-normalized SPDX expression if value parses, or null otherwise.

validate_spdx_expression(value, options?)

Returns a result dictionary. Without options, validation checks expression syntax. If online is true, or licences and exceptions maps are supplied, short identifiers are checked against the SPDX licence-list data.

is_spdx_expression(value, options?)

Boolean wrapper around validate_spdx_expression.

fetch_spdx_licence_list(options?)

Downloads SPDX licenses.md.

parse_spdx_licence_list(markdown)

Parses SPDX licenses.md into licences, exceptions, and paths dictionaries.

licence_expression_text(expression, options?)

Fetches full text for every fetchable SPDX licence identifier in an expression and concatenates it for a LICENCE file. Returns null if the expression is not valid, contains local LicenseRef identifiers, or the needed text path is unavailable.

COPYRIGHT AND LICENCE

licence/spdx is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.