1
0
mirror of https://github.com/github/choosealicense.com synced 2024-06-08 12:17:47 +02:00

Merge pull request #293 from waldyrious/rename-category-family

rename category --> family (fix #288)
This commit is contained in:
Ben Balter 2015-11-02 09:19:36 -05:00
commit 4e9d7bca05
18 changed files with 39 additions and 39 deletions

View File

@ -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)
* `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)
* `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
### Auto-populated fields

View File

@ -59,7 +59,7 @@
description: Whether the license is a variant of a family of licenses (e.g., GPL)
required: false
- name: category
- name: family
description: If part of a license family, the name of the license family (e.g., `GPL`)
required: false

View File

@ -2,8 +2,8 @@
<div class="license-family-heading">
<h3 class="license-family-name">
<a href="{{ license.url }}">
{% if license.category %}
{{ license.category }}
{% if license.family %}
{{ license.family }}
{% else %}
{% if license.nickname %}
{{ license.nickname }}
@ -20,9 +20,9 @@
<div class="license-details">
<div class="license-variations js-license-variations">
<!-- always show this div, even w/o variations, for proper spacing -->
{% if license.category %}
{% if license.family %}
<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 %}
<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 %}
@ -36,8 +36,8 @@
{% endif %}
</div>
{% if license.category %}
{% assign variations = site.licenses | where:"hidden",false | where:"category",license.category %}
{% if license.family %}
{% assign variations = site.licenses | where:"hidden",false | where:"family",license.family %}
{% else %}
{% assign variations = site.licenses | where:"title",license.title %}
{% endif %}

View File

@ -3,7 +3,7 @@ title: GNU Affero General Public License v3.0
nickname: GNU Affero GPL v3.0
tab-slug: agpl-v3
redirect_from: /licenses/agpl/
category: GPL
family: GPL
variant: true
source: http://www.gnu.org/licenses/agpl-3.0.txt

View File

@ -3,7 +3,7 @@ title: BSD 2-clause "Simplified" License
nickname: Simplified BSD
tab-slug: bsd
redirect_from: /licenses/bsd/
category: BSD
family: BSD
variant: true
source: http://opensource.org/licenses/BSD-2-Clause

View File

@ -3,7 +3,7 @@ title: BSD 3-clause Clear License
nickname: Clear BSD
hidden: true
category: BSD
family: BSD
tab-slug: bsd-3-clear
variant: true

View File

@ -2,7 +2,7 @@
title: BSD 3-clause "New" or "Revised" License
nickname: New BSD
tab-slug: bsd-3
category: BSD
family: BSD
variant: true
source: http://opensource.org/licenses/BSD-3-Clause

View File

@ -3,7 +3,7 @@ title: Creative Commons Zero v1.0 Universal
nickname: CC0 1.0 Universal
tab-slug: cc0
redirect_from: /licenses/cc0/
category: Public Domain Dedication
family: Public Domain Dedication
variant: true
source: http://creativecommons.org/publicdomain/zero/1.0/

View File

@ -3,7 +3,7 @@ title: GNU General Public License v2.0
nickname: GNU GPL v2.0
tab-slug: gpl-v2
redirect_from: /licenses/gpl-v2/
category: GPL
family: GPL
featured: true
source: http://www.gnu.org/licenses/gpl-2.0.txt

View File

@ -3,7 +3,7 @@ title: GNU General Public License v3.0
nickname: GNU GPL v3.0
tab-slug: gpl-v3
redirect_from: /licenses/gpl-v3/
category: GPL
family: GPL
variant: true
source: http://www.gnu.org/licenses/gpl-3.0.txt

View File

@ -1,7 +1,7 @@
---
title: ISC License
tab-slug: isc
category: BSD
family: BSD
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.

View File

@ -3,7 +3,7 @@ title: GNU Lesser General Public License v2.1
nickname: GNU LGPL v2.1
tab-slug: lgpl-v2_1
redirect_from: /licenses/lgpl-v2.1/
category: LGPL
family: LGPL
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.

View File

@ -3,7 +3,7 @@ title: GNU Lesser General Public License v3.0
nickname: GNU LGPL v3.0
tab-slug: lgpl-v3
redirect_from: /licenses/lgpl-v3/
category: LGPL
family: LGPL
variant: true
source: http://www.gnu.org/licenses/lgpl-3.0.txt

View File

@ -1,7 +1,7 @@
---
title: The Unlicense
tab-slug: unlicense
category: Public Domain Dedication
family: Public Domain Dedication
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.

View File

@ -21,8 +21,8 @@ class Choosealicense
my: "top center"
at: "bottom center"
# Annotation categories as defined in `_config.yml`
categories:
# Annotation rule types as defined in `_config.yml`
ruletypes:
required: "Required"
permitted: "Permitted"
forbidden: "Forbidden"
@ -37,20 +37,20 @@ class Choosealicense
initTooltips: ->
# 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
$(".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
for category, label of @categories
$(".license-#{category} li").qtip
for ruletype, label of @ruletypes
$(".license-#{ruletype} li").qtip
content:
text: false
title:
text: label
position: @qtip_position
style:
classes: "qtip-shadow qtip-#{category}"
classes: "qtip-shadow qtip-#{ruletype}"
false

View File

@ -1,24 +1,24 @@
require 'spec_helper'
categories.each do |category|
describe "the #{category} category" do
category_licenses = licenses.select { |l| l["category"] == category }
primary = category_licenses.select { |l| l["variant"] == false }
variants = category_licenses.select { |l| l["variant"] == true }
families.each do |family|
describe "the #{family} family" do
family_licenses = licenses.select { |l| l["family"] == family }
primary = family_licenses.select { |l| l["variant"] == false }
variants = family_licenses.select { |l| l["variant"] == true }
it "should only have one primary license" do
expect(primary.count).to eql(1)
end
it "all other licenses should be variants" do
expected = category_licenses.count - 1
expected = family_licenses.count - 1
expect(variants.count).to eql(expected)
end
category_licenses.each do |license|
family_licenses.each do |license|
describe "the #{license["title"]} license" 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)
end

View File

@ -17,14 +17,14 @@ licenses.each do |license|
expect(missing).to be_empty
end
if license["category"]
if license["family"]
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
end
else
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
end
end

View File

@ -20,8 +20,8 @@ def licenses
site.collections["licenses"].docs.map { |l| l.to_liquid.merge("id" => l.basename(".txt")) }
end
def categories
licenses.map { |l| l["category"] }.compact.uniq
def families
licenses.map { |l| l["family"] }.compact.uniq
end
def site