1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 04:40:09 +01:00

Merge pull request #348 from github/tab-slug-bye

Remove need for tab-slug
This commit is contained in:
Mike Linksvayer 2016-02-13 18:15:34 -08:00
commit d5828d5318
18 changed files with 4 additions and 35 deletions

View File

@ -57,7 +57,6 @@ Licenses sit in the `/_licenses` folder. Each license has YAML front matter desc
* `nickname` - A shorter, human-readable license name where the SPDX license name (`title` above) is long * `nickname` - A shorter, human-readable license name where the SPDX license name (`title` above) is long
* `variant` - Whether the license is a variant of a family of licenses (defaults to false) * `variant` - Whether the license is a variant of a family of licenses (defaults to false)
* `family` - 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, used for internal links on the licenses page
### Auto-populated fields ### Auto-populated fields

View File

@ -62,7 +62,3 @@
- name: family - 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
- name: tab-slug
description: If part of a license family, a license slug containing only `a-z`, `0-9`, and `_` characters, used for internal links on the licenses page
required: false

View File

@ -24,7 +24,7 @@
<ul class="nav-pills js-nav-pills"> <ul class="nav-pills js-nav-pills">
{% assign variations = site.licenses | where:"hidden",false | where:"family",license.family %} {% 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.id == variation.id %} class="active"{% endif %}><a href="#{{ variation.id | remove: '/licenses/' | slugify }}" data-selected-tab="variation-{{ variation.id | remove: '/licenses/' | slugify }}">
{% if variation.nickname != nil %} {% if variation.nickname != nil %}
{{ variation.nickname }} {{ variation.nickname }}
{% else %} {% else %}
@ -43,7 +43,7 @@
{% endif %} {% endif %}
{% for variation in variations %} {% for variation in variations %}
<div {% if variation.tab-slug %}id="{{ variation.tab-slug }}" {% endif %}class="variation-tab {% if variation.tab-slug %}variation-{{ variation.tab-slug }}{% endif %} js-variation-tab{% if license.tab-slug == variation.tab-slug %} active{% endif %}"> <div {% if variation.id %}id="{{ variation.id | remove: '/licenses/' | slugify }}" {% endif %}class="variation-tab {% if variation.id %}variation-{{ variation.id | remove: '/licenses/' | slugify }}{% endif %} js-variation-tab{% if license.id == variation.id %} active{% endif %}">
<table class="license-rules"> <table class="license-rules">
<tr> <tr>
{% assign types = "required|permitted|forbidden" | split: "|" %} {% assign types = "required|permitted|forbidden" | split: "|" %}

View File

@ -1,7 +1,6 @@
--- ---
title: GNU Affero General Public License v3.0 title: GNU Affero General Public License v3.0
nickname: GNU Affero GPL v3.0 nickname: GNU Affero GPL v3.0
tab-slug: agpl-v3
redirect_from: /licenses/agpl/ redirect_from: /licenses/agpl/
family: GPL family: GPL
variant: true variant: true

View File

@ -1,7 +1,6 @@
--- ---
title: BSD 2-clause "Simplified" License title: BSD 2-clause "Simplified" License
nickname: Simplified BSD nickname: Simplified BSD
tab-slug: bsd
redirect_from: /licenses/bsd/ redirect_from: /licenses/bsd/
family: BSD family: BSD
variant: true variant: true

View File

@ -3,7 +3,6 @@ title: BSD 3-clause Clear License
nickname: Clear BSD nickname: Clear BSD
family: BSD family: BSD
tab-slug: bsd-3-clear
variant: true variant: true
description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. Both have very minute differences to the MIT license. The three clause variant prohibits others from using the name of the project or its contributors to promote derivative works without written consent. description: A permissive license that comes in two variants, the <a href="/licenses/bsd">BSD 2-Clause</a> and <a href="/licenses/bsd-3-clause">BSD 3-Clause</a>. Both have very minute differences to the MIT license. The three clause variant prohibits others from using the name of the project or its contributors to promote derivative works without written consent.

View File

@ -1,7 +1,6 @@
--- ---
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
family: BSD family: BSD
variant: true variant: true
source: http://opensource.org/licenses/BSD-3-Clause source: http://opensource.org/licenses/BSD-3-Clause

View File

@ -1,7 +1,6 @@
--- ---
title: Creative Commons Zero v1.0 Universal title: Creative Commons Zero v1.0 Universal
nickname: CC0 1.0 Universal nickname: CC0 1.0 Universal
tab-slug: cc0
redirect_from: /licenses/cc0/ redirect_from: /licenses/cc0/
family: Public Domain Dedication family: Public Domain Dedication
variant: true variant: true

View File

@ -1,7 +1,6 @@
--- ---
title: European Union Public License 1.1 title: European Union Public License 1.1
nickname: EUPL-1.1 nickname: EUPL-1.1
tab-slug: eupl-v1.1
redirect_from: /licenses/eupl-v1.1/ redirect_from: /licenses/eupl-v1.1/
family: EUPL family: EUPL
featured: false featured: false

View File

@ -1,7 +1,6 @@
--- ---
title: GNU General Public License v2.0 title: GNU General Public License v2.0
nickname: GNU GPL v2.0 nickname: GNU GPL v2.0
tab-slug: gpl-v2
redirect_from: /licenses/gpl-v2/ redirect_from: /licenses/gpl-v2/
family: GPL family: GPL
variant: true variant: true

View File

@ -1,7 +1,6 @@
--- ---
title: GNU General Public License v3.0 title: GNU General Public License v3.0
nickname: GNU GPL v3.0 nickname: GNU GPL v3.0
tab-slug: gpl-v3
redirect_from: /licenses/gpl-v3/ redirect_from: /licenses/gpl-v3/
family: GPL family: GPL
featured: true featured: true

View File

@ -1,6 +1,5 @@
--- ---
title: ISC License title: ISC License
tab-slug: isc
family: BSD family: BSD
source: http://opensource.org/licenses/isc-license source: http://opensource.org/licenses/isc-license

View File

@ -1,7 +1,6 @@
--- ---
title: GNU Lesser General Public License v2.1 title: GNU Lesser General Public License v2.1
nickname: GNU LGPL v2.1 nickname: GNU LGPL v2.1
tab-slug: lgpl-v2_1
redirect_from: /licenses/lgpl-v2.1/ redirect_from: /licenses/lgpl-v2.1/
family: LGPL family: LGPL
variant: true variant: true

View File

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

View File

@ -2,7 +2,6 @@
title: LaTeX Project Public License v1.3c title: LaTeX Project Public License v1.3c
hidden: true hidden: true
nickname: LPPL-1.3c nickname: LPPL-1.3c
tab-slug: lppl-v1.3c
family: LPPL family: LPPL
source: https://latex-project.org/lppl/lppl-1-3c.html source: https://latex-project.org/lppl/lppl-1-3c.html

View File

@ -1,6 +1,5 @@
--- ---
title: The Unlicense title: The Unlicense
tab-slug: unlicense
family: Public Domain Dedication family: Public Domain Dedication
source: http://unlicense.org/UNLICENSE source: http://unlicense.org/UNLICENSE

View File

@ -15,19 +15,6 @@ describe 'license categories' do
expected = family_licenses.count - 1 expected = family_licenses.count - 1
expect(variants.count).to eql(expected) expect(variants.count).to eql(expected)
end end
family_licenses.each do |license|
context "the #{license['title']} license" do
it 'should have a unique slug' do
dupes = family_licenses.count { |l| l['tab-slug'] == license['tab-slug'] }
expect(dupes).to eql(1)
end
it 'should have a valid tab-slug' do
expect(license['tab-slug']).to match(/[a-z0-9_]/)
end
end
end
end end
end end
end end

View File

@ -19,12 +19,12 @@ describe 'license meta' do
if license['family'] if license['family']
it 'should contain the required license variant fields' do it 'should contain the required license variant fields' do
missing = ['family', 'tab-slug'] - license.keys missing = %w(family) - 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', 'family', 'tab-slug'].select { |f| raw_fields.keys.include?(f) } extra = %w(variant family).select { |f| raw_fields.keys.include?(f) }
expect(extra).to be_empty expect(extra).to be_empty
end end
end end