fix: Properly display ISC license in plain text and correctly parse requested license from URL.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
This commit is contained in:
Richie Bendall 2019-06-23 12:45:43 +12:00
parent fd54e7198d
commit 8a47aa09f8
No known key found for this signature in database
GPG key ID: 1C6A99DFA9D306FC
5 changed files with 55 additions and 53 deletions

View file

@ -1,12 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html id="home" lang="en"> <html id="home" lang="en">
<% include components/header %> <% include components/header %>
<body> <body>
<article> <article>
<%- gravatar %> <%- gravatar %>
<h1>The ISC License (ISC)</h1> <h1>The ISC License (ISC)</h1>
<p>Copyright © <%- info %></p> <p>Copyright © <%- info %></p>
<p>Permission to use, copy, modify, and/or distribute this software for any <p>Permission to use, copy, modify, and/or distribute this software for any

View file

@ -3,8 +3,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="description" <meta name="description" content="The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. As a permissive license, it puts only very limited restriction on reuse and has, therefore, an excellent license compatibility.">
content="The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. As a permissive license, it puts only very limited restriction on reuse and has, therefore, an excellent license compatibility.">
<!-- <!--
Welcome fellow open source developer. This project is here for you to Welcome fellow open source developer. This project is here for you to
link to if you're like me and keep forgetting to include the link to if you're like me and keep forgetting to include the
@ -23,8 +22,7 @@
copyright holder. Namespaces will be on a first come first serve basis, copyright holder. Namespaces will be on a first come first serve basis,
and I'm open to folk joining the GitHub project. and I'm open to folk joining the GitHub project.
For more options (including linking and license version targeting) For more options see the README in the github hosted project.
see the README in the github hosted project.
Hope you find this useful too! Hope you find this useful too!

View file

@ -5,14 +5,12 @@ module.exports = (req, res, next) => {
res.locals.options = parts.reduce( res.locals.options = parts.reduce(
(acc, curr) => { (acc, curr) => {
if (!curr) { if (!curr) return acc;
return acc;
}
let match = curr.match(/^@?(\d{4})$/) || []; let match = curr.match(/^@?(\d{4})$/) || [];
if (match.length) { if (match.length) {
// pinned year // Pinned year
if (curr.startsWith('@')) { if (curr.startsWith('@')) {
acc.pinnedYear = parseInt(curr.substr(1), 10); acc.pinnedYear = parseInt(curr.substr(1), 10);
} else { } else {
@ -38,6 +36,13 @@ module.exports = (req, res, next) => {
return acc; return acc;
} }
if (curr.startsWith('+')) {
acc.license = curr
.substr(1)
.toUpperCase();
return acc;
}
acc.sha = curr; // not actually supported now - 2019-06-19 acc.sha = curr; // not actually supported now - 2019-06-19
return acc; return acc;
}, },

View file

@ -58,7 +58,7 @@ module.exports = (req, res) => {
const year = options.pinnedYear const year = options.pinnedYear
? options.pinnedYear ? options.pinnedYear
: [options.startYear, options.endYear].filter(Boolean).join('-'); : [options.startYear, options.endYear].filter(Boolean).join('-');
const license = (user.license || 'MIT').toUpperCase(); const license = (options.license || user.license || 'MIT').toUpperCase();
const format = options.format || user.format || 'html'; const format = options.format || user.format || 'html';
const args = { const args = {