1
0
mirror of https://github.com/github/choosealicense.com synced 2024-06-29 15:13:04 +02:00

first pass at jekyll2ification

This commit is contained in:
Ben Balter 2014-07-31 12:36:56 -04:00
parent a7f23839df
commit 22cc77f12b
30 changed files with 178 additions and 301 deletions

View File

@ -2,104 +2,124 @@ GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
RedCloth (4.2.9) RedCloth (4.2.9)
activesupport (4.1.1) activesupport (4.1.4)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
blankslate (2.1.2.4) blankslate (2.1.2.4)
celluloid (0.15.2)
timers (~> 1.1.0)
classifier (1.3.4) classifier (1.3.4)
fast-stemmer (>= 1.0.0) fast-stemmer (>= 1.0.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.7.1)
colorator (0.1) colorator (0.1)
colored (1.2) colored (1.2)
commander (4.1.6) ethon (0.7.1)
highline (~> 1.6.11)
ethon (0.7.0)
ffi (>= 1.3.0) ffi (>= 1.3.0)
execjs (2.2.1)
fast-stemmer (1.0.2) fast-stemmer (1.0.2)
ffi (1.9.3) ffi (1.9.3)
gemoji (1.5.0) gemoji (2.0.0)
github-pages (18) github-pages (21)
RedCloth (= 4.2.9) RedCloth (= 4.2.9)
jekyll (= 1.5.1) jekyll (= 2.2.0)
jekyll-mentions (= 0.0.6) jekyll-coffeescript (= 1.0.0)
jekyll-redirect-from (= 0.3.1) jekyll-mentions (= 0.1.3)
jekyll-sitemap (= 0.2.0) jekyll-redirect-from (= 0.4.0)
jemoji (= 0.1.0) jekyll-sass-converter (= 1.1.0)
jekyll-sitemap (= 0.5.0)
jemoji (= 0.3.0)
kramdown (= 1.3.1) kramdown (= 1.3.1)
liquid (= 2.5.5) liquid (= 2.6.1)
maruku (= 0.7.0) maruku (= 0.7.0)
pygments.rb (= 0.6.0)
rdiscount (= 2.1.7) rdiscount (= 2.1.7)
redcarpet (= 2.3.0) redcarpet (= 3.1.2)
highline (1.6.21) html-pipeline (1.9.0)
html-pipeline (1.5.0)
activesupport (>= 2) activesupport (>= 2)
nokogiri (~> 1.4) nokogiri (~> 1.4)
html-proofer (0.6.7) html-proofer (1.1.4)
colored (~> 1.2) colored (~> 1.2)
mercenary (~> 0.3.2) mercenary (~> 0.3.2)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
typhoeus (~> 0.6.7) typhoeus (~> 0.6.7)
i18n (0.6.9) yell (~> 2.0)
jekyll (1.5.1) i18n (0.6.11)
jekyll (2.2.0)
classifier (~> 1.3) classifier (~> 1.3)
colorator (~> 0.1) colorator (~> 0.1)
commander (~> 4.1.3) jekyll-coffeescript (~> 1.0)
liquid (~> 2.5.5) jekyll-gist (~> 1.0)
listen (~> 1.3) jekyll-paginate (~> 1.0)
maruku (= 0.7.0) jekyll-sass-converter (~> 1.0)
pygments.rb (~> 0.5.0) jekyll-watch (~> 1.0)
redcarpet (~> 2.3.0) kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0) safe_yaml (~> 1.0)
toml (~> 0.1.0) toml (~> 0.1.0)
jekyll-mentions (0.0.6) jekyll-coffeescript (1.0.0)
html-pipeline (~> 1.5.0) coffee-script (~> 2.2)
jekyll (~> 1.4) jekyll-gist (1.1.0)
jekyll-redirect-from (0.3.1) jekyll-mentions (0.1.3)
jekyll (~> 1.4) html-pipeline (~> 1.9.0)
jekyll-sitemap (0.2.0) jekyll (~> 2.0)
jekyll (~> 1.4) jekyll-paginate (1.0.0)
jemoji (0.1.0) jekyll-redirect-from (0.4.0)
gemoji (~> 1.5.0) jekyll (~> 2.0)
html-pipeline (~> 1.5.0) jekyll-sass-converter (1.1.0)
jekyll (~> 1.4) sass (~> 3.2)
jekyll-sitemap (0.5.0)
jekyll-watch (1.0.0)
listen (~> 2.7)
jemoji (0.3.0)
gemoji (~> 2.0)
html-pipeline (~> 1.9)
jekyll (~> 2.0)
json (1.8.1) json (1.8.1)
kramdown (1.3.1) kramdown (1.3.1)
liquid (2.5.5) liquid (2.6.1)
listen (1.3.1) listen (2.7.9)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
maruku (0.7.0) maruku (0.7.0)
mercenary (0.3.3) mercenary (0.3.4)
mini_portile (0.5.3) mini_portile (0.6.0)
minitest (5.3.3) minitest (5.4.0)
nokogiri (1.6.1) nokogiri (1.6.3.1)
mini_portile (~> 0.5.0) mini_portile (= 0.6.0)
parslet (1.5.0) parslet (1.5.0)
blankslate (~> 2.0) blankslate (~> 2.0)
posix-spawn (0.3.8) posix-spawn (0.3.8)
pygments.rb (0.5.4) pygments.rb (0.6.0)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0) yajl-ruby (~> 1.1.0)
rake (10.3.1) rake (10.3.2)
rb-fsevent (0.9.4) rb-fsevent (0.9.4)
rb-inotify (0.9.4) rb-inotify (0.9.5)
ffi (>= 0.5.0)
rb-kqueue (0.2.2)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdiscount (2.1.7) rdiscount (2.1.7)
redcarpet (2.3.0) redcarpet (3.1.2)
safe_yaml (1.0.3) safe_yaml (1.0.3)
thread_safe (0.3.3) sass (3.3.12)
thread_safe (0.3.4)
timers (1.1.0)
toml (0.1.1) toml (0.1.1)
parslet (~> 1.5.0) parslet (~> 1.5.0)
typhoeus (0.6.8) typhoeus (0.6.9)
ethon (>= 0.7.0) ethon (>= 0.7.1)
tzinfo (1.1.0) tzinfo (1.2.1)
thread_safe (~> 0.1) thread_safe (~> 0.1)
yajl-ruby (1.1.0) yajl-ruby (1.1.0)
yell (2.0.4)
PLATFORMS PLATFORMS
ruby ruby

View File

@ -4,67 +4,20 @@ relative_permalinks: false
markdown: kramdown markdown: kramdown
url: "http://choosealicense.com" url: "http://choosealicense.com"
rules: collections:
licenses:
output: true
permalink: /licenses/:path/
required: defaults:
- description: Include a copy of the license and copyright notice with the code. -
label: License and copyright notice scope:
tag: include-copyright path: ""
- description: Indicate significant changes made to the code. type: "licenses"
label: State Changes values:
tag: document-changes layout: license
- description: Source code must be made available when distributing the software. In the case of LGPL, the source for the library (and not the entire program) must be made available. featured: false
label: Disclose Source "hide-from-license-list": false
tag: disclose-source
- description: Users who interact with the software via network are given the right to receive a copy of the corresponding source code.
label: Network Use is Distribution
tag: network-use-disclose
- description: The library may be used within a non-open-source application.
label: Library usage
tag: library-usage
- description: You must change the name of the software if you modify it.
label: Rename
tag: rename
permitted:
- description: This software and derivatives may be used for commercial purposes.
label: Commercial Use
tag: commercial-use
- description: This software may be modified.
label: Modification
tag: modifications
- description: You may distribute this software.
label: Distribution
tag: distribution
- description: You may grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: sublicense
- description: You may use and modify the software without distributing it.
label: Private Use
tag: private-use
- description: This license provides an express grant of patent rights from the contributor to the recipient.
label: Patent Grant
tag: patent-grant
forbidden:
- description: While this may be implicitly true of all licenses, this license explicitly states that you may NOT use the names, logos, or trademarks of contributors.
label: Use Trademark
tag: trademark-use
- description: Software is provided without warranty and the software author/license owner cannot be held liable for damages.
label: Hold Liable
tag: no-liability
- description: You may not grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: no-sublicense
- description: This software may not be modified.
label: Modification
tag: modifications
- description: You may not distribute this software.
label: Distribution
tag: distribution
- description: You may not grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: sublicense
exclude: exclude:
- app.coffee - app.coffee
@ -76,7 +29,7 @@ exclude:
- Rakefile - Rakefile
- README.md - README.md
- script - script
- bundle - vendor/bundle
- test - test
- tests - tests

59
_data/rules.yml Normal file
View File

@ -0,0 +1,59 @@
required:
- description: Include a copy of the license and copyright notice with the code.
label: License and copyright notice
tag: include-copyright
- description: Indicate significant changes made to the code.
label: State Changes
tag: document-changes
- description: Source code must be made available when distributing the software. In the case of LGPL, the source for the library (and not the entire program) must be made available.
label: Disclose Source
tag: disclose-source
- description: Users who interact with the software via network are given the right to receive a copy of the corresponding source code.
label: Network Use is Distribution
tag: network-use-disclose
- description: The library may be used within a non-open-source application.
label: Library usage
tag: library-usage
- description: You must change the name of the software if you modify it.
label: Rename
tag: rename
permitted:
- description: This software and derivatives may be used for commercial purposes.
label: Commercial Use
tag: commercial-use
- description: This software may be modified.
label: Modification
tag: modifications
- description: You may distribute this software.
label: Distribution
tag: distribution
- description: You may grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: sublicense
- description: You may use and modify the software without distributing it.
label: Private Use
tag: private-use
- description: This license provides an express grant of patent rights from the contributor to the recipient.
label: Patent Grant
tag: patent-grant
forbidden:
- description: While this may be implicitly true of all licenses, this license explicitly states that you may NOT use the names, logos, or trademarks of contributors.
label: Use Trademark
tag: trademark-use
- description: Software is provided without warranty and the software author/license owner cannot be held liable for damages.
label: Hold Liable
tag: no-liability
- description: You may not grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: no-sublicense
- description: This software may not be modified.
label: Modification
tag: modifications
- description: You may not distribute this software.
label: Distribution
tag: distribution
- description: You may not grant a sublicense to modify and distribute this software to third parties not included in the license.
label: Sublicensing
tag: sublicense

View File

@ -15,11 +15,14 @@
</div> <!-- /container --> </div> <!-- /container -->
{% if page.layout == "license" or page.class == "license-types" %} {% if page.collection == "licenses" or page.class == "license-types" %}
<script src="/assets/vendor/jquery/jquery.min.js"></script> <script src="/assets/vendor/jquery/jquery.min.js"></script>
<script src="/assets/vendor/qtip2/jquery.qtip.min.js"></script> <script src="/assets/vendor/qtip2/jquery.qtip.min.js"></script>
<script src="/assets/vendor/zeroclipboard/ZeroClipboard.min.js"></script> <script src="/assets/vendor/zeroclipboard/ZeroClipboard.min.js"></script>
<script src="/assets/js/javascript.js"></script> <script>
var window.annotations = {{ site.data.rules | jsonify }};
</script>
<script src="/assets/js/app.js"></script>
{% endif %} {% endif %}
<script> <script>

View File

@ -1,9 +0,0 @@
var annotations = {
{% for type_hash in site.rules %}
"{{ type_hash[0] }}": {
{% for rule_hash in type_hash[1] %}
"{{ rule_hash.tag }}" : "{{ rule_hash.description }}"{% if forloop.rindex0 > 0 %},{% endif %}
{% endfor %}
}{% if forloop.rindex0 > 0 %},{% endif %}
{% endfor %}
};

View File

@ -1,132 +0,0 @@
// Generated by CoffeeScript 1.7.1
(function() {
var Choosealicense;
Choosealicense = (function() {
Choosealicense.prototype.flashAvailable = function() {
if (typeof ActiveXObject !== "undefined" && ActiveXObject !== null) {
return !!(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"));
} else {
return !!navigator.mimeTypes["application/x-shockwave-flash"];
}
};
Choosealicense.prototype.selectText = function(element) {
var range, selection;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(element);
return range.select();
} else if (window.getSelection) {
selection = window.getSelection();
range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
return selection.addRange(range);
}
};
Choosealicense.prototype.qtip_position = {
my: "top center",
at: "bottom center"
};
Choosealicense.prototype.categories = {
required: "Required",
permitted: "Permitted",
forbidden: "Forbidden"
};
function Choosealicense() {
this.initTooltips();
this.initClipboard();
this.initLicenseVariationNav();
}
Choosealicense.prototype.initTooltips = function() {
var category, label, rules, text, _ref;
for (category in annotations) {
rules = annotations[category];
for (label in rules) {
text = rules[label];
$(".license-rules ul.license-" + category + " li." + label).attr("title", text);
}
}
_ref = this.categories;
for (category in _ref) {
label = _ref[category];
$(".license-" + category + " li").qtip({
content: {
text: false,
title: {
text: label
}
},
position: this.qtip_position,
style: {
classes: "qtip-shadow qtip-" + category
}
});
}
return false;
};
Choosealicense.prototype.initZeroClipboard = function() {
var clip;
$(".js-clipboard-button").data("clipboard-prompt", $(".js-clipboard-button").text());
clip = new ZeroClipboard($(".js-clipboard-button"), {
moviePath: "/assets/vendor/zeroclipboard/ZeroClipboard.swf"
});
clip.on("mouseout", this.clipboardMouseout);
clip.on("complete", this.clipboardComplete);
return clip;
};
Choosealicense.prototype.initAlternativeClipboard = function() {
return $(".js-clipboard-button").click((function(_this) {
return function(e) {
var target;
target = "#" + $(e.target).data("clipboard-target");
return _this.selectText($(target)[0]);
};
})(this));
};
Choosealicense.prototype.initClipboard = function() {
if ((typeof ZeroClipboard !== "undefined" && ZeroClipboard !== null) && this.flashAvailable()) {
return this.initZeroClipboard();
} else {
return this.initAlternativeClipboard();
}
};
Choosealicense.prototype.clipboardMouseout = function(client, args) {
return this.innerText = $(this).data("clipboard-prompt");
};
Choosealicense.prototype.clipboardComplete = function(client, args) {
return this.innerText = "Copied!";
};
Choosealicense.prototype.initLicenseVariationNav = function() {
return $(".js-nav-pills a").click(function(e) {
var nav, selectedTab;
selectedTab = $(this).data("selected-tab");
nav = $(this).closest(".js-nav-pills");
nav.find("li").removeClass("active");
nav.closest(".js-license-variations").siblings(".js-variation-tab").removeClass("active");
$(this).parent("li").addClass("active");
$("." + selectedTab).addClass("active");
return e.preventDefault();
});
};
return Choosealicense;
})();
$(function() {
return new Choosealicense();
});
}).call(this);

View File

@ -1,26 +1,30 @@
<div class="license-family clearfix"> <div class="license-family clearfix">
<div class="license-family-heading"> <div class="license-family-heading">
<h3 class="license-family-name"><a href="{{ page.permalink }}">{% if page.category %}{{ page.category }}{% else %}{{ page.title }}{% endif %}</a></h3> <h3 class="license-family-name">
<a href="{{ license.permalink }}">
{% if license.category %}{{ license.category }}{% else %}{{ license.title }}{% endif %}
</a>
</h3>
<p class="license-family-description">{{ page.description }}</p> <p class="license-family-description">{{ license.description }}</p>
</div> </div>
<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 page.tab-slug %} {% if license.tab-slug %}
<ul class="nav-pills js-nav-pills"> <ul class="nav-pills js-nav-pills">
{% for variation in site.pages %} {% for variation in site.licenses %}
{% if variation.category and variation.category == page.category %} {% if variation.category and variation.category == license.category %}
<li{% if page.tab-slug == variation.tab-slug %} class="active"{% endif %}><a href="#{{ variation.tab-slug }}" data-selected-tab="variation-{{ variation.tab-slug }}">{{ variation.title }}</a></li> <li{% if license.tab-slug == variation.tab-slug %} class="active"{% endif %}><a href="#{{ variation.tab-slug }}" data-selected-tab="variation-{{ variation.tab-slug }}">{{ variation.title }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
</div> </div>
{% for variation in site.pages %} {% for variation in site.licenses %}
{% if variation.category and variation.category == page.category %} {% if variation.category and variation.category == license.category %}
<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 page.tab-slug == variation.tab-slug %} active{% endif %}"> <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 %}">
<table class="license-rules"> <table class="license-rules">
<tr> <tr>
{% assign types = "required|permitted|forbidden" | split: "|" %} {% assign types = "required|permitted|forbidden" | split: "|" %}
@ -32,7 +36,7 @@
{% for type in types %} {% for type in types %}
<td> <td>
<ul class="license-{{ type }}"> <ul class="license-{{ type }}">
{% assign rules = site.rules[type] | sort: "label" %} {% assign rules = site.data.rules[type] | sort: "label" %}
{% for rule_obj in rules %} {% for rule_obj in rules %}
{% assign req = rule_obj.tag %} {% assign req = rule_obj.tag %}
{% if variation[type] contains req %} {% if variation[type] contains req %}

View File

@ -27,7 +27,7 @@
{% for type in types %} {% for type in types %}
<h3>{{ type | capitalize }}</h3> <h3>{{ type | capitalize }}</h3>
<ul class="license-{{ type }}"> <ul class="license-{{ type }}">
{% assign rules = site.rules[type] | sort: "label" %} {% assign rules = site.data.rules[type] | sort: "label" %}
{% for rule_obj in rules %} {% for rule_obj in rules %}
{% assign req = rule_obj.tag %} {% assign req = rule_obj.tag %}
{% if page[type] contains req %} {% if page[type] contains req %}

View File

@ -1,3 +1,6 @@
---
---
class Choosealicense class Choosealicense
# Checks if Flash is available in the client. # Checks if Flash is available in the client.
@ -42,7 +45,7 @@ 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 annotations for category, rules of window.annotations
for label, text of rules for label, text of rules
$(".license-rules ul.license-#{category} li.#{label}").attr "title", text $(".license-rules ul.license-#{category} li.#{label}").attr "title", text

View File

@ -1,6 +0,0 @@
---
layout: nil
---
{% include js/annotations.js %}
{% include js/app.js %}

View File

@ -7,14 +7,9 @@ title: Licenses
<h2>Featured Licenses</h2> <h2>Featured Licenses</h2>
{% assign sorted_pages = site.pages | sort: 'path' %} {% assign featured_licenses = site.licenses | where:"featured",true %}
{% for license in featured_licenses | sort: 'path' %}
{% for page in sorted_pages %}
{% if page.layout == "license" %}
{% if page.featured %}
{% include license-overview.html %} {% include license-overview.html %}
{% endif %}
{% endif %}
{% endfor %} {% endfor %}
<h2>Other licenses</h2> <h2>Other licenses</h2>
@ -22,11 +17,7 @@ title: Licenses
Some communities tend to have specific licenses preferred by the Some communities tend to have specific licenses preferred by the
community. For example, Perl developers often choose the Artistic License. community. For example, Perl developers often choose the Artistic License.
</p> </p>
{% assign licenses = site.licenses | where:"featured",false | where:"hide-from-license-list",false %}
{% for page in sorted_pages %} {% for license in licenses %}
{% if page.layout == "license" %}
{% if page.featured != true and page.hide-from-license-list != true %}
{% include license-overview.html %} {% include license-overview.html %}
{% endif %}
{% endif %}
{% endfor %} {% endfor %}

View File

@ -6,8 +6,5 @@ echo "bundling installin'"
gem install bundler gem install bundler
bundle install bundle install
echo "npm installin'"
npm install coffee-script
echo echo
echo "You're all set. Just run script/server and you can play license roulette!" echo "You're all set. Just run script/server and you can play license roulette!"

View File

@ -2,8 +2,5 @@
set -e set -e
echo "compiling javascript..."
./node_modules/.bin/coffee -c _includes/js/app.coffee
echo "building the site..." echo "building the site..."
bundle exec rake test bundle exec rake test

View File

@ -2,9 +2,6 @@
set -e set -e
echo "compiling javascript..."
./node_modules/.bin/coffee -c _includes/js/app.coffee
echo "spinning up the server..." echo "spinning up the server..."
bundle exec jekyll serve -w bundle exec jekyll serve -w