Merge branch 'master' into pages
This commit is contained in:
43
index.ts
43
index.ts
@@ -7,30 +7,31 @@ import _posts_metadata from "./posts/_metadata.json";
|
|||||||
import _site_info from "./site_info.json";
|
import _site_info from "./site_info.json";
|
||||||
|
|
||||||
export interface PostMetadata {
|
export interface PostMetadata {
|
||||||
title: string,
|
title: string;
|
||||||
slug: string,
|
slug: string;
|
||||||
filename: string,
|
filename: string;
|
||||||
date: string,
|
date: string;
|
||||||
author: string,
|
author: string;
|
||||||
tags: string[],
|
tags: string[];
|
||||||
|
archived: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Post extends PostMetadata {
|
export interface Post extends PostMetadata {
|
||||||
md_lines: string[],
|
md_lines: string[];
|
||||||
html: string,
|
html: string;
|
||||||
tags_exist: boolean,
|
tags_exist: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RSSPost extends PostMetadata {
|
export interface RSSPost extends PostMetadata {
|
||||||
url: string,
|
url: string;
|
||||||
last_updated: string,
|
last_updated: string;
|
||||||
html: string,
|
html: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SiteInfo {
|
export interface SiteInfo {
|
||||||
title: string,
|
title: string;
|
||||||
url: string,
|
url: string;
|
||||||
icon: string,
|
icon: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let renderer: Renderer = new Renderer("templates", "components");
|
let renderer: Renderer = new Renderer("templates", "components");
|
||||||
@@ -42,7 +43,13 @@ builder.serve_static_folder("static");
|
|||||||
|
|
||||||
//home page
|
//home page
|
||||||
builder.serve_template(renderer, "/", "index", {
|
builder.serve_template(renderer, "/", "index", {
|
||||||
posts: posts_metadata,
|
posts: posts_metadata.filter((post) => !post.archived),
|
||||||
|
});
|
||||||
|
|
||||||
|
//archive page
|
||||||
|
builder.serve_template(renderer, "/archive", "archive", {
|
||||||
|
archived_posts: posts_metadata.filter((post) => post.archived),
|
||||||
|
no_archived_posts: posts_metadata.filter((post) => post.archived).length === 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
//404 page (github pages)
|
//404 page (github pages)
|
||||||
@@ -86,7 +93,7 @@ for (let i=0; i < posts_metadata.length; i++) {
|
|||||||
{
|
{
|
||||||
post,
|
post,
|
||||||
next_post,
|
next_post,
|
||||||
author_expected: post.author.toLowerCase().startsWith("jetstream0") || post.author.toLowerCase().startsWith("prussia"),
|
author_expected: post.author.toLowerCase().startsWith("jetstream0") || post.author.toLowerCase().startsWith("prussia") || post.author.toLowerCase().startsWith("stjet"),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -110,7 +117,7 @@ for (let i=0; i < tags.length; i++) {
|
|||||||
builder.serve_templates(renderer, tags_serve_paths, "tags", tags_vars);
|
builder.serve_templates(renderer, tags_serve_paths, "tags", tags_vars);
|
||||||
|
|
||||||
//build rss feed
|
//build rss feed
|
||||||
let first_posts: PostMetadata[] = posts_metadata.slice(0, 5); //not truly the recents, actually the first 5 posts in the json file, which is decided by me and usually the most recent posts
|
let first_posts: PostMetadata[] = posts_metadata.filter((post) => !post.archived).slice(0, 5); //not truly the recents, actually the first 5 posts in the json file, which is decided by me and usually the most recent posts
|
||||||
|
|
||||||
const site_info: SiteInfo = _site_info;
|
const site_info: SiteInfo = _site_info;
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/jetstream0/hedgeblog.git"
|
"url": "git+https://github.com/stjet/hedgeblog.git"
|
||||||
},
|
},
|
||||||
"author": "jetstream0/prussia",
|
"author": "stjet/prussia",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/jetstream0/hedgeblog/issues"
|
"url": "https://github.com/stjet/hedgeblog/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/jetstream0/hedgeblog#readme",
|
"homepage": "https://github.com/stjet/hedgeblog#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"makoto": "^1.0.1"
|
"makoto": "^1.0.1"
|
||||||
},
|
},
|
||||||
|
|||||||
1
posts/archived_post.md
Normal file
1
posts/archived_post.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This post is *archived*.
|
||||||
11
ryuji.ts
11
ryuji.ts
@@ -1,6 +1,6 @@
|
|||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
|
|
||||||
export const SYNTAX_REGEX = /\[\[ [a-zA-Z0-9.:/\-_!]+ \]\]/g;
|
export const SYNTAX_REGEX = /\[\[ [a-zA-Z0-9.:/\*\-_!]+ \]\]/g;
|
||||||
|
|
||||||
export type file_extension = `.${string}`;
|
export type file_extension = `.${string}`;
|
||||||
|
|
||||||
@@ -185,12 +185,21 @@ export class Renderer {
|
|||||||
} else {
|
} else {
|
||||||
//compare with second var
|
//compare with second var
|
||||||
let var_name2: string = exp_parts[2];
|
let var_name2: string = exp_parts[2];
|
||||||
|
let if_in: boolean = false;
|
||||||
let if_not: boolean = false;
|
let if_not: boolean = false;
|
||||||
|
//*! is valid
|
||||||
|
if (var_name2.startsWith("*")) {
|
||||||
|
var_name2 = var_name2.slice(1, var_name2.length);
|
||||||
|
if_in = true;
|
||||||
|
}
|
||||||
if (var_name2.startsWith("!")) {
|
if (var_name2.startsWith("!")) {
|
||||||
var_name2 = var_name2.slice(1, var_name2.length);
|
var_name2 = var_name2.slice(1, var_name2.length);
|
||||||
if_not = true;
|
if_not = true;
|
||||||
}
|
}
|
||||||
let var_value2 = Renderer.get_var(var_name2, vars);
|
let var_value2 = Renderer.get_var(var_name2, vars);
|
||||||
|
if (if_in) {
|
||||||
|
var_value2 = var_value2.find((ele) => ele === var_value);
|
||||||
|
}
|
||||||
if (if_not) {
|
if (if_not) {
|
||||||
//make sure the two compared variables are NOT equal
|
//make sure the two compared variables are NOT equal
|
||||||
if (var_value !== var_value2) {
|
if (var_value !== var_value2) {
|
||||||
|
|||||||
39
templates/archive.html
Normal file
39
templates/archive.html
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>prussia fan club</title>
|
||||||
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||||
|
<link rel="stylesheet" href="/styles/global.css">
|
||||||
|
<link rel="stylesheet" href="/styles/index.css">
|
||||||
|
<link rel="alternate" type="application/atom+xml" title="atom/rss feed for prussia fan club" href="/atom.xml"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
[[ component:return ]]
|
||||||
|
[[ component:dark-mode-checkbox ]]
|
||||||
|
<div id="main">
|
||||||
|
<div>
|
||||||
|
<input id="fancy-title" type="checkbox"/><label for="fancy-title">Fancy Title</label>
|
||||||
|
<br>
|
||||||
|
<h2>prussiafan.club</h2>
|
||||||
|
<br>
|
||||||
|
<p>This is the archive of my blog, where posts bad enough to be hidden, but not terrible enough to be deleted, live.</p>
|
||||||
|
<p>Ah, what else? Uhhh... My favourite projects at the moment are <a href="https://github.com/stjet/pla-den-tor">pla-den-tor</a>, <a href="https://ztmy.prussia.dev">ztmy</a>, <a href="https://github.com/stjet/bananopie">bananopie</a>, <a href="https://mingde.prussia.dev">mingde</a>, and <a href="https://github.com/stjet/hedgeblog">this blog</a>. My favourite language is probably Lisp Scheme, but Typescript is nice too, except when it isn't.</p>
|
||||||
|
<p>You can also hire me!</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
[[ for:archived_posts:post ]]
|
||||||
|
[[ component:post-listing ]]
|
||||||
|
[[ endfor ]]
|
||||||
|
[[ if:no_archived_posts ]]
|
||||||
|
<li>No archived posts yet</li>
|
||||||
|
[[ endif ]]
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
//, and a place where you can <a href="https://prussia.dev/sample">hire me</a>
|
||||||
6
templates/components/random/archive.html
Normal file
6
templates/components/random/archive.html
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<div class="random" id="archive">
|
||||||
|
<div class="random-content">
|
||||||
|
<a href="/archive">Visit the archives</a>
|
||||||
|
</div>
|
||||||
|
<a href="/#quote1">More random stuff</a>
|
||||||
|
</div>
|
||||||
@@ -8,5 +8,5 @@
|
|||||||
<img src="88x31/mh.gif" alt="Certified mostly harmless" loading="lazy"/>
|
<img src="88x31/mh.gif" alt="Certified mostly harmless" loading="lazy"/>
|
||||||
<img src="88x31/salt.gif" alt="Salt your passwords, OR ELSE!" loading="lazy"/>
|
<img src="88x31/salt.gif" alt="Salt your passwords, OR ELSE!" loading="lazy"/>
|
||||||
</div>
|
</div>
|
||||||
<a href="/#quote1">More random stuff</a>
|
<a href="/#archive">More random stuff</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<link rel="icon" type="image/png" href="/favicon.ico">
|
<link rel="icon" type="image/png" href="/favicon.ico">
|
||||||
<link rel="stylesheet" href="/styles/global.css">
|
<link rel="stylesheet" href="/styles/global.css">
|
||||||
<link rel="stylesheet" href="/styles/index.css">
|
<link rel="stylesheet" href="/styles/index.css">
|
||||||
|
<link rel="alternate" type="application/atom+xml" title="atom/rss feed for prussia fan club" href="/atom.xml"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
[[ component:dark-mode-checkbox ]]
|
[[ component:dark-mode-checkbox ]]
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<h2>prussiafan.club</h2>
|
<h2>prussiafan.club</h2>
|
||||||
<br>
|
<br>
|
||||||
<p>This is my blog. I also have a <a href="https://prussia.dev">portfolio</a>, <a href="https://prussia.dev/retro">retro style personal website</a>, and a place where you can <a href="https://prussia.dev/sample">hire me</a>.</p>
|
<p>This is my blog. I also have a <a href="https://prussia.dev">portfolio</a>, <a href="https://prussia.dev/retro">retro style personal website</a>. I like free software, privacy, yada yada.</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
[[ component:random/badges ]]
|
[[ component:random/badges ]]
|
||||||
|
[[ component:random/archive ]]
|
||||||
[[ component:random/quote1 ]]
|
[[ component:random/quote1 ]]
|
||||||
[[ component:random/quote2 ]]
|
[[ component:random/quote2 ]]
|
||||||
[[ component:random/minesweeper ]]
|
[[ component:random/minesweeper ]]
|
||||||
|
|||||||
Reference in New Issue
Block a user