Add license page, update LICENSE file, and link license page on the base
layout instead of ext. MIT license.
This commit is contained in:
parent
8aa67df5c7
commit
84261c9537
3 changed files with 64 additions and 7 deletions
35
src/pages/license.astro
Normal file
35
src/pages/license.astro
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
import Layout from "@layouts/BaseLayout.astro";
|
||||
import fs from "node:fs";
|
||||
|
||||
const txtToHtml = (string: string) => {
|
||||
return string
|
||||
.replace(/[^\x0A\x20-\x7E]/g, "") //remove non-printable ascii chars, except newline
|
||||
.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll('"', """)
|
||||
.replaceAll("'", "'")
|
||||
.replaceAll("\n\n", "<br><br>");
|
||||
};
|
||||
|
||||
const license_file_contents = txtToHtml(
|
||||
fs.readFileSync("./LICENSE", {
|
||||
encoding: "utf8",
|
||||
}),
|
||||
);
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<title slot="head">LICENSE</title>
|
||||
<Fragment slot="main">
|
||||
<header>
|
||||
<h1>
|
||||
<a href="https://opensource.org/license/mit" target="_blank"
|
||||
>MIT License</a
|
||||
>
|
||||
</h1>
|
||||
</header>
|
||||
<p set:html={license_file_contents} />
|
||||
</Fragment>
|
||||
</Layout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue