jekyll-spdx_licenses 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e542725bfb96976b7d4ce7402ea2adcdf79d68939d85e77c4cb138a97a7a0f2e
4
- data.tar.gz: e20fc9c3eaaec6aa69014a81cea742628859dfc5fa13bee3566533644d943289
3
+ metadata.gz: adc19ad5992f4bbf911b42daf5e92d78bc5bd5d8b4eab31bb599fb448856c376
4
+ data.tar.gz: 69514878274391a5097782515225537f177085a4271a7169656521397b223086
5
5
  SHA512:
6
- metadata.gz: 485da0d12aedf2d2b43d058dd084045b9162eedaca910f814387f5877b58235abc64b0f169ad76ae15549f0aa7669a487e26bf0d88d913c7b1d7ff40024421ab
7
- data.tar.gz: 1cea463ea4c2b968a5a1a688f93db6f9663afa3e1c8a3a420a609212322ba95e8e75a93ac975cc058ee99259cf05dbd7b99c8c82c5be9ac626231e23c2122126
6
+ metadata.gz: e682bf03b18f3889855312706dcb616793504df41093a12f15603a649fcabff0195b4003904d6add1035f0aad1a4975d92c84549cbe9431ac29eaa71685beef5
7
+ data.tar.gz: 3949765722f6a44089c90fdfec16e38855581d90c9556d039ded56674ffd6138f001ac3353b5a1468c3d01ff0122cc8039c393a6cf3b00ba9a84ae8fbcba018d
data/README.md CHANGED
@@ -25,17 +25,24 @@ Or install it yourself as:
25
25
  To convert a SPDX license ID to its full name:
26
26
 
27
27
  ```
28
- {% spdx_name Apache-2.0 %}
28
+ {{ Apache-2.0 | spdx_name }}
29
29
  => Apache License 2.0
30
30
  ```
31
31
 
32
32
  To convert the SPDX license ID to a link:
33
33
 
34
34
  ```
35
- {% spdx_link Apache-2.0 %}
35
+ {{ Apache-2.0 | spdx_link_name }}
36
36
  => <a href="https://spdx.org/licenses/Apache-2.0">Apache License 2.0</a>
37
37
  ```
38
38
 
39
+ To convert the SPDX license ID to a link, with just the ID:
40
+
41
+ ```
42
+ {{ Apache-2.0 | spdx_link_id }}
43
+ => <a href="https://spdx.org/licenses/Apache-2.0">Apache-2.0</a>
44
+ ```
45
+
39
46
  ## Development
40
47
 
41
48
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -10,6 +10,4 @@ module Jekyll
10
10
  end
11
11
  end
12
12
 
13
- Liquid::Template.register_tag('spdx_link', Jekyll::SpdxLicenses::SpdxLinkTag)
14
- Liquid::Template.register_tag('spdx_link_id', Jekyll::SpdxLicenses::SpdxLinkIdTag)
15
- Liquid::Template.register_tag('spdx_name', Jekyll::SpdxLicenses::SpdxNameTag)
13
+ Liquid::Template.register_filter(Jekyll::SpdxLicenses::SpdxFilter)
@@ -0,0 +1,23 @@
1
+ module Jekyll
2
+ module SpdxLicenses
3
+ class SpdxFilter
4
+ def spdx_link_id(license_id)
5
+ license = ::SpdxLicenses.lookup(license_id)
6
+ raise 'License ID not valid according to SPDX licenses' unless license
7
+ "<a href=\"https://spdx.org/licenses/#{license.id}.html\">#{license.id}</a>"
8
+ end
9
+
10
+ def spdx_link_name(license_id)
11
+ license = ::SpdxLicenses.lookup(license_id)
12
+ raise 'License ID not valid according to SPDX licenses' unless license
13
+ "<a href=\"https://spdx.org/licenses/#{license.id}.html\">#{license.name}</a>"
14
+ end
15
+
16
+ def spdx_name(license_id)
17
+ license = ::SpdxLicenses.lookup(license_id)
18
+ raise 'License ID not valid according to SPDX licenses' unless license
19
+ license.name
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module SpdxLicenses
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-spdx_licenses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Tanna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2018-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -99,6 +99,7 @@ files:
99
99
  - jekyll-spdx_licenses.gemspec
100
100
  - lib/jekyll-spdx_licenses.rb
101
101
  - lib/jekyll/spdx_licenses.rb
102
+ - lib/jekyll/spdx_licenses/spdx_filter.rb
102
103
  - lib/jekyll/spdx_licenses/spdx_link_id_tag.rb
103
104
  - lib/jekyll/spdx_licenses/spdx_link_tag.rb
104
105
  - lib/jekyll/spdx_licenses/spdx_name_tag.rb