Skip to content

Commit 3bdc51c

Browse files
author
Martii
committed
Trying showing individual licenses. Applies to OpenUserJS#161 and **INCOMPLETE**
* Set controller to push objects needed for mustache * Normalize on `@license` for `en-US` spelling * Set page to allegedly loop through licenses
1 parent bcb0171 commit 3bdc51c

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

controllers/script.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ var getScriptPageTasks = function(options) {
7373
}
7474
}
7575

76+
// Show licensings of the script
77+
if (script.meta.license) {
78+
if (typeof script.meta.license === 'string') {
79+
options.script.meta.licenses = [{ name: script.meta.license }];
80+
} else {
81+
options.script.meta.licenses = [];
82+
script.meta.license.forEach(function (license) {
83+
options.script.meta.licenses.push({ name: license });
84+
});
85+
}
86+
} else {
87+
option.script.meta.licenses = [{ name: 'MIT License (Expat)' }];
88+
}
89+
7690
// Show the groups the script belongs to
7791
tasks.push(function (callback) {
7892
script.hasGroups = false;

controllers/scriptStorage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ function parseMeta(aString) {
119119
lineMatches = lines[line].replace(/\s+$/, '').match(re);
120120
name = lineMatches[1];
121121
value = lineMatches[2];
122+
switch (name) {
123+
case "licence":
124+
name = "license";
125+
break;
126+
}
122127
if (!headers[name] || unique[name]) {
123128
headers[name] = value || '';
124129
} else {

views/pages/scriptPage.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
{{/script.hasGroups}}
3838
{{#script.meta.homepage}}<p><i class="fa fa-fw fa-home"></i> <b>Homepage:</b> <a href="{{meta.homepage}}">{{script.meta.homepage}}</a></p>{{/script.meta.homepage}}
3939
{{#script.meta.copyright}}<p><i class="fa fa-fw fa-legal"></i> <b>Copyright:</b> {{script.meta.copyright}}</p>{{/script.meta.copyright}}
40-
{{#script.meta.license}}<p><i class="fa fa-fw fa-legal"></i> <b>License:</b> {{script.meta.license}}</p>{{/script.meta.license}}
41-
{{#script.meta.licence}}<p><i class="fa fa-fw fa-legal"></i> <b>Licence:</b> {{script.meta.licence}}</p>{{/script.meta.licence}}
40+
{{#script.meta.licenses}}<p><i class="fa fa-fw fa-legal"></i> <b>License:</b> {{.}}</p>{{/script.meta.licenses}}
4241
{{#script.meta.collaborator}}<p><i class="fa fa-fw fa-user"></i> <b>Collaborator:</b> {{.}}</p>{{/script.meta.collaborator}}
4342
{{#script.fork}}
4443
<p><b>Fork History:</b></p>

0 commit comments

Comments
 (0)