mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
Merge pull request #293 from waldyrious/rename-category-family
rename category --> family (fix #288)
This commit is contained in:
commit
4e9d7bca05
@ -53,7 +53,7 @@ Licenses sit in the `/_licenses` folder. The text of the license should be wrapp
|
|||||||
* `featured` - Whether the license should be featured on the main page (defaults to false)
|
* `featured` - Whether the license should be featured on the main page (defaults to false)
|
||||||
* `nickname` - A shorter, human-readable license name where the SPDX license name is long
|
* `nickname` - A shorter, human-readable license name where the SPDX license name is long
|
||||||
* `variant` - Whether the license is a variant of a family of licenses (e.g., GPL)
|
* `variant` - Whether the license is a variant of a family of licenses (e.g., GPL)
|
||||||
* `category` - If part of a license family, the name of the license family (e.g., `GPL`)
|
* `family` - If part of a license family, the name of the license family (e.g., `GPL`)
|
||||||
* `tab-slug` - If part of a license family, a license slug containing only `a-z`, `0-9`, and `_` characters
|
* `tab-slug` - If part of a license family, a license slug containing only `a-z`, `0-9`, and `_` characters
|
||||||
|
|
||||||
### Auto-populated fields
|
### Auto-populated fields
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
description: Whether the license is a variant of a family of licenses (e.g., GPL)
|
description: Whether the license is a variant of a family of licenses (e.g., GPL)
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
- name: category
|
- name: family
|
||||||
description: If part of a license family, the name of the license family (e.g., `GPL`)
|
description: If part of a license family, the name of the license family (e.g., `GPL`)
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<div class="license-family-heading">
|
<div class="license-family-heading">
|
||||||
<h3 class="license-family-name">
|
<h3 class="license-family-name">
|
||||||
<a href="{{ license.url }}">
|
<a href="{{ license.url }}">
|
||||||
{% if license.category %}
|
{% if license.family %}
|
||||||
{{ license.category }}
|
{{ license.family }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if license.nickname %}
|
{% if license.nickname %}
|
||||||
{{ license.nickname }}
|
{{ license.nickname }}
|
||||||
@ -20,9 +20,9 @@
|
|||||||
<div class="license-details">
|
<div class="license-details">
|
||||||
<div class="license-variations js-license-variations">
|
<div class="license-variations js-license-variations">
|
||||||
<!-- always show this div, even w/o variations, for proper spacing -->
|
<!-- always show this div, even w/o variations, for proper spacing -->
|
||||||
{% if license.category %}
|
{% if license.family %}
|
||||||
<ul class="nav-pills js-nav-pills">
|
<ul class="nav-pills js-nav-pills">
|
||||||
{% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %}
|
{% assign variations = site.licenses | where:"hidden",false | where:"family",license.family %}
|
||||||
{% for variation in variations %}
|
{% for variation in variations %}
|
||||||
<li{% if license.tab-slug == variation.tab-slug %} class="active"{% endif %}><a href="#{{ variation.tab-slug }}" data-selected-tab="variation-{{ variation.tab-slug }}">
|
<li{% if license.tab-slug == variation.tab-slug %} class="active"{% endif %}><a href="#{{ variation.tab-slug }}" data-selected-tab="variation-{{ variation.tab-slug }}">
|
||||||
{% if variation.nickname != nil %}
|
{% if variation.nickname != nil %}
|
||||||
@ -36,8 +36,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if license.category %}
|
{% if license.family %}
|
||||||
{% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %}
|
{% assign variations = site.licenses | where:"hidden",false | where:"family",license.family %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% assign variations = site.licenses | where:"title",license.title %}
|
{% assign variations = site.licenses | where:"title",license.title %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -3,7 +3,7 @@ title: GNU Affero General Public License v3.0
|
|||||||
nickname: GNU Affero GPL v3.0
|
nickname: GNU Affero GPL v3.0
|
||||||
tab-slug: agpl-v3
|
tab-slug: agpl-v3
|
||||||
redirect_from: /licenses/agpl/
|
redirect_from: /licenses/agpl/
|
||||||
category: GPL
|
family: GPL
|
||||||
variant: true
|
variant: true
|
||||||
source: http://www.gnu.org/licenses/agpl-3.0.txt
|
source: http://www.gnu.org/licenses/agpl-3.0.txt
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ title: BSD 2-clause "Simplified" License
|
|||||||
nickname: Simplified BSD
|
nickname: Simplified BSD
|
||||||
tab-slug: bsd
|
tab-slug: bsd
|
||||||
redirect_from: /licenses/bsd/
|
redirect_from: /licenses/bsd/
|
||||||
category: BSD
|
family: BSD
|
||||||
variant: true
|
variant: true
|
||||||
source: http://opensource.org/licenses/BSD-2-Clause
|
source: http://opensource.org/licenses/BSD-2-Clause
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ title: BSD 3-clause Clear License
|
|||||||
nickname: Clear BSD
|
nickname: Clear BSD
|
||||||
hidden: true
|
hidden: true
|
||||||
|
|
||||||
category: BSD
|
family: BSD
|
||||||
tab-slug: bsd-3-clear
|
tab-slug: bsd-3-clear
|
||||||
variant: true
|
variant: true
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
title: BSD 3-clause "New" or "Revised" License
|
title: BSD 3-clause "New" or "Revised" License
|
||||||
nickname: New BSD
|
nickname: New BSD
|
||||||
tab-slug: bsd-3
|
tab-slug: bsd-3
|
||||||
category: BSD
|
family: BSD
|
||||||
variant: true
|
variant: true
|
||||||
source: http://opensource.org/licenses/BSD-3-Clause
|
source: http://opensource.org/licenses/BSD-3-Clause
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ title: Creative Commons Zero v1.0 Universal
|
|||||||
nickname: CC0 1.0 Universal
|
nickname: CC0 1.0 Universal
|
||||||
tab-slug: cc0
|
tab-slug: cc0
|
||||||
redirect_from: /licenses/cc0/
|
redirect_from: /licenses/cc0/
|
||||||
category: Public Domain Dedication
|
family: Public Domain Dedication
|
||||||
variant: true
|
variant: true
|
||||||
source: http://creativecommons.org/publicdomain/zero/1.0/
|
source: http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ title: GNU General Public License v2.0
|
|||||||
nickname: GNU GPL v2.0
|
nickname: GNU GPL v2.0
|
||||||
tab-slug: gpl-v2
|
tab-slug: gpl-v2
|
||||||
redirect_from: /licenses/gpl-v2/
|
redirect_from: /licenses/gpl-v2/
|
||||||
category: GPL
|
family: GPL
|
||||||
featured: true
|
featured: true
|
||||||
source: http://www.gnu.org/licenses/gpl-2.0.txt
|
source: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ title: GNU General Public License v3.0
|
|||||||
nickname: GNU GPL v3.0
|
nickname: GNU GPL v3.0
|
||||||
tab-slug: gpl-v3
|
tab-slug: gpl-v3
|
||||||
redirect_from: /licenses/gpl-v3/
|
redirect_from: /licenses/gpl-v3/
|
||||||
category: GPL
|
family: GPL
|
||||||
variant: true
|
variant: true
|
||||||
source: http://www.gnu.org/licenses/gpl-3.0.txt
|
source: http://www.gnu.org/licenses/gpl-3.0.txt
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: ISC License
|
title: ISC License
|
||||||
tab-slug: isc
|
tab-slug: isc
|
||||||
category: BSD
|
family: BSD
|
||||||
source: http://opensource.org/licenses/isc-license
|
source: http://opensource.org/licenses/isc-license
|
||||||
|
|
||||||
description: A permissive license lets people do anything with your code with proper attribution and without warranty. The ISC license is functionally equivalent to the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/mit">MIT</a> licenses, removing some language that is no longer necessary.
|
description: A permissive license lets people do anything with your code with proper attribution and without warranty. The ISC license is functionally equivalent to the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/mit">MIT</a> licenses, removing some language that is no longer necessary.
|
||||||
|
@ -3,7 +3,7 @@ title: GNU Lesser General Public License v2.1
|
|||||||
nickname: GNU LGPL v2.1
|
nickname: GNU LGPL v2.1
|
||||||
tab-slug: lgpl-v2_1
|
tab-slug: lgpl-v2_1
|
||||||
redirect_from: /licenses/lgpl-v2.1/
|
redirect_from: /licenses/lgpl-v2.1/
|
||||||
category: LGPL
|
family: LGPL
|
||||||
source: http://www.gnu.org/licenses/lgpl-2.1.txt
|
source: http://www.gnu.org/licenses/lgpl-2.1.txt
|
||||||
|
|
||||||
description: Primarily used for software libraries, LGPL requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. There are two commonly used versions of the LGPL.
|
description: Primarily used for software libraries, LGPL requires that derived works be licensed under the same license, but works that only link to it do not fall under this restriction. There are two commonly used versions of the LGPL.
|
||||||
|
@ -3,7 +3,7 @@ title: GNU Lesser General Public License v3.0
|
|||||||
nickname: GNU LGPL v3.0
|
nickname: GNU LGPL v3.0
|
||||||
tab-slug: lgpl-v3
|
tab-slug: lgpl-v3
|
||||||
redirect_from: /licenses/lgpl-v3/
|
redirect_from: /licenses/lgpl-v3/
|
||||||
category: LGPL
|
family: LGPL
|
||||||
variant: true
|
variant: true
|
||||||
source: http://www.gnu.org/licenses/lgpl-3.0.txt
|
source: http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: The Unlicense
|
title: The Unlicense
|
||||||
tab-slug: unlicense
|
tab-slug: unlicense
|
||||||
category: Public Domain Dedication
|
family: Public Domain Dedication
|
||||||
source: http://unlicense.org/UNLICENSE
|
source: http://unlicense.org/UNLICENSE
|
||||||
|
|
||||||
description: Because copyright is automatic in most countries, <a href="http://unlicense.org">the Unlicense</a> is a template to waive copyright interest in software you've written and dedicate it to the public domain. Use the Unlicense to opt out of copyright entirely. It also includes the no-warranty statement from the MIT/X11 license.
|
description: Because copyright is automatic in most countries, <a href="http://unlicense.org">the Unlicense</a> is a template to waive copyright interest in software you've written and dedicate it to the public domain. Use the Unlicense to opt out of copyright entirely. It also includes the no-warranty statement from the MIT/X11 license.
|
||||||
|
@ -21,8 +21,8 @@ class Choosealicense
|
|||||||
my: "top center"
|
my: "top center"
|
||||||
at: "bottom center"
|
at: "bottom center"
|
||||||
|
|
||||||
# Annotation categories as defined in `_config.yml`
|
# Annotation rule types as defined in `_config.yml`
|
||||||
categories:
|
ruletypes:
|
||||||
required: "Required"
|
required: "Required"
|
||||||
permitted: "Permitted"
|
permitted: "Permitted"
|
||||||
forbidden: "Forbidden"
|
forbidden: "Forbidden"
|
||||||
@ -37,20 +37,20 @@ class Choosealicense
|
|||||||
initTooltips: ->
|
initTooltips: ->
|
||||||
|
|
||||||
# Dynamically add annotations as title attribute to rule list items
|
# Dynamically add annotations as title attribute to rule list items
|
||||||
for category, rules of window.annotations
|
for ruletype, rules of window.annotations
|
||||||
for rule in rules
|
for rule in rules
|
||||||
$(".license-rules ul.license-#{category} li.#{rule["tag"]}").attr "title", rule["description"]
|
$(".license-rules ul.license-#{ruletype} li.#{rule["tag"]}").attr "title", rule["description"]
|
||||||
|
|
||||||
# Init tooltips on all rule list items
|
# Init tooltips on all rule list items
|
||||||
for category, label of @categories
|
for ruletype, label of @ruletypes
|
||||||
$(".license-#{category} li").qtip
|
$(".license-#{ruletype} li").qtip
|
||||||
content:
|
content:
|
||||||
text: false
|
text: false
|
||||||
title:
|
title:
|
||||||
text: label
|
text: label
|
||||||
position: @qtip_position
|
position: @qtip_position
|
||||||
style:
|
style:
|
||||||
classes: "qtip-shadow qtip-#{category}"
|
classes: "qtip-shadow qtip-#{ruletype}"
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
categories.each do |category|
|
families.each do |family|
|
||||||
describe "the #{category} category" do
|
describe "the #{family} family" do
|
||||||
category_licenses = licenses.select { |l| l["category"] == category }
|
family_licenses = licenses.select { |l| l["family"] == family }
|
||||||
primary = category_licenses.select { |l| l["variant"] == false }
|
primary = family_licenses.select { |l| l["variant"] == false }
|
||||||
variants = category_licenses.select { |l| l["variant"] == true }
|
variants = family_licenses.select { |l| l["variant"] == true }
|
||||||
|
|
||||||
it "should only have one primary license" do
|
it "should only have one primary license" do
|
||||||
expect(primary.count).to eql(1)
|
expect(primary.count).to eql(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "all other licenses should be variants" do
|
it "all other licenses should be variants" do
|
||||||
expected = category_licenses.count - 1
|
expected = family_licenses.count - 1
|
||||||
expect(variants.count).to eql(expected)
|
expect(variants.count).to eql(expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
category_licenses.each do |license|
|
family_licenses.each do |license|
|
||||||
describe "the #{license["title"]} license" do
|
describe "the #{license["title"]} license" do
|
||||||
it "should have a unique slug" do
|
it "should have a unique slug" do
|
||||||
dupes = category_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
|
dupes = family_licenses.select { |l| l["tab-slug"] == license["tab-slug"] }.count
|
||||||
expect(dupes).to eql(1)
|
expect(dupes).to eql(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@ licenses.each do |license|
|
|||||||
expect(missing).to be_empty
|
expect(missing).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
if license["category"]
|
if license["family"]
|
||||||
it "should contain the required license variant fields" do
|
it "should contain the required license variant fields" do
|
||||||
missing = ["category", "tab-slug"] - license.keys
|
missing = ["family", "tab-slug"] - license.keys
|
||||||
expect(missing).to be_empty
|
expect(missing).to be_empty
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
it "should not contain license family specific fields" do
|
it "should not contain license family specific fields" do
|
||||||
extra = ["variant", "category", "tab-slug"].select{ |f| raw_fields.keys.include?(f) }
|
extra = ["variant", "family", "tab-slug"].select{ |f| raw_fields.keys.include?(f) }
|
||||||
expect(extra).to be_empty
|
expect(extra).to be_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,8 +20,8 @@ def licenses
|
|||||||
site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) }
|
site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def categories
|
def families
|
||||||
licenses.map { |l| l["category"] }.compact.uniq
|
licenses.map { |l| l["family"] }.compact.uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def site
|
def site
|
||||||
|
Loading…
x
Reference in New Issue
Block a user