dep ver bump; clean-up; minor updates
Signed-off-by: Paul W. <lambdapaul@protonmail.com>
This commit is contained in:
parent
ff03bd50ff
commit
82ed74229b
@ -1,3 +1,5 @@
|
|||||||
|
import { JSX } from "react";
|
||||||
|
|
||||||
export type ChildrenType = JSX.Element| Array<ChildrenType>;
|
export type ChildrenType = JSX.Element| Array<ChildrenType>;
|
||||||
|
|
||||||
function Container(props: { children?: ChildrenType, ignore?: boolean }) {
|
function Container(props: { children?: ChildrenType, ignore?: boolean }) {
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useRouter } from 'next/router';
|
import { useRouter } from 'next/router';
|
||||||
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
import style from '../styles/title.module.css';
|
import style from '../styles/title.module.css';
|
||||||
import SiteMap from '../public/sitemap.json';
|
import SiteMap from '../public/sitemap.json';
|
||||||
import Head from 'next/head';
|
import Head from 'next/head';
|
||||||
import { SiteSubPages } from '../lib/site';
|
import { Sites } from '../lib/site';
|
||||||
|
|
||||||
function createPathElements(ancestors: Array<{ name: string, path: string }>) {
|
function createPathElements(ancestors: Array<{ name: string, path: string }>) {
|
||||||
let currentPath = '';
|
let currentPath = '';
|
||||||
return ancestors.map((ancestor, id) => {
|
return ancestors.map((ancestor, id) => {
|
||||||
currentPath += `/${ancestor.path}`
|
currentPath += `/${ancestor.path}`
|
||||||
return (
|
return (
|
||||||
<>
|
<Fragment key={currentPath} >
|
||||||
<Link key={currentPath} href={currentPath}>{ancestor.name}</Link>
|
<Link href={currentPath}>{ancestor.name}</Link>
|
||||||
<> / </>
|
<> / </>
|
||||||
</>
|
</Fragment>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -25,7 +26,8 @@ function Title() {
|
|||||||
const pagePath = router.asPath;
|
const pagePath = router.asPath;
|
||||||
const splitPath: Array<{ name: string, path: string }> = [];
|
const splitPath: Array<{ name: string, path: string }> = [];
|
||||||
|
|
||||||
let currRoot: SiteSubPages = SiteMap.subpages;
|
// TODO(Paul): clean this up
|
||||||
|
let currRoot: Sites = SiteMap.pages;
|
||||||
let title: string | null = null;
|
let title: string | null = null;
|
||||||
if (pagePath !== '/') {
|
if (pagePath !== '/') {
|
||||||
const subPaths = pagePath.split('?')[0].split('#')[0].split('/');
|
const subPaths = pagePath.split('?')[0].split('#')[0].split('/');
|
||||||
@ -36,9 +38,9 @@ function Title() {
|
|||||||
|
|
||||||
if (currRoot === undefined
|
if (currRoot === undefined
|
||||||
|| currRoot[p] === undefined
|
|| currRoot[p] === undefined
|
||||||
|| currRoot[p].subpages === undefined)
|
|| currRoot[p].pages === undefined)
|
||||||
break;
|
break;
|
||||||
currRoot = currRoot[p].subpages!;
|
currRoot = currRoot[p].pages!;
|
||||||
}
|
}
|
||||||
if (splitPath !== undefined && splitPath.length > 0)
|
if (splitPath !== undefined && splitPath.length > 0)
|
||||||
title = splitPath.pop()!.name;
|
title = splitPath.pop()!.name;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
export interface Site {
|
export interface Site {
|
||||||
title: string;
|
title: string;
|
||||||
subpages?: SiteSubPages;
|
pages?: Sites;
|
||||||
mtime?: string;
|
mtime?: string;
|
||||||
otime?: string;
|
otime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SiteSubPages {
|
export interface Sites {
|
||||||
[slug: string]: Site;
|
[slug: string]: Site;
|
||||||
}
|
}
|
||||||
|
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@ -2,4 +2,4 @@
|
|||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
// NOTE: This file should not be edited
|
||||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
const config = {
|
import type {NextConfig } from 'next';
|
||||||
|
import NextBundleAnalyzer from '@next/bundle-analyzer';
|
||||||
|
|
||||||
|
let config: NextConfig = {
|
||||||
|
reactStrictMode: true,
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: ['en-US'],
|
locales: ['en-US'],
|
||||||
defaultLocale: 'en-US'
|
defaultLocale: 'en-US'
|
||||||
},
|
},
|
||||||
|
// not sure why this breaks prod build in the latest version
|
||||||
|
// aah it's so frustrating to deal with an warning log that
|
||||||
|
// shows up regardless of the config but its presence halts
|
||||||
|
// the entire thing.
|
||||||
webpack: (config, _options) => {
|
webpack: (config, _options) => {
|
||||||
config.module.rules.push(
|
config.module.rules.push(
|
||||||
{
|
|
||||||
test: /\.ya?ml$/,
|
|
||||||
use: 'js-yaml-loader',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.svg$/,
|
test: /\.svg$/,
|
||||||
use: [{ loader: '@svgr/webpack' }],
|
use: [{ loader: '@svgr/webpack' }],
|
||||||
@ -25,10 +29,6 @@ const config = {
|
|||||||
test: /\.txt$/,
|
test: /\.txt$/,
|
||||||
type: 'asset/source',
|
type: 'asset/source',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
resourceQuery: /raw/,
|
|
||||||
type: 'asset/source',
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
@ -36,10 +36,9 @@ const config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.ANALYZE) {
|
if (process.env.ANALYZE) {
|
||||||
const bundleAnalyzer = require('@next/bundle-analyzer')({
|
config = NextBundleAnalyzer({
|
||||||
enabled: true
|
enabled: true
|
||||||
});
|
})(config);
|
||||||
module.exports = bundleAnalyzer(config);
|
|
||||||
} else {
|
|
||||||
module.exports = config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default config;
|
@ -1,15 +1,11 @@
|
|||||||
# Lua Programming Language
|
# Lua Programming Language
|
||||||
|
<!-- TODO ## Lua 5.4 C API-->
|
||||||
## Lua 5.4 C API
|
|
||||||
|
|
||||||
|
|
||||||
## Lua 5.4 Bytecode
|
## Lua 5.4 Bytecode
|
||||||
|
|
||||||
> [!note]
|
|
||||||
> These are **unstable** and may differ in different versions of the language.
|
> These are **unstable** and may differ in different versions of the language.
|
||||||
> They are not part of the language specification but an implementation detail, which in this case is the reference implementation.
|
> They are not part of the language specification but an implementation detail, which in this case is the reference implementation.
|
||||||
|
|
||||||
> [!note]
|
|
||||||
> The reference implementation used to have a stack based but now uses a register based VM similar to how modern real computer architectures.
|
> The reference implementation used to have a stack based but now uses a register based VM similar to how modern real computer architectures.
|
||||||
|
|
||||||
The instructions are 32 bits wide; every instruction has an opcode that takes up 7 bits, which leaves out 25 bits for the addresses and values.
|
The instructions are 32 bits wide; every instruction has an opcode that takes up 7 bits, which leaves out 25 bits for the addresses and values.
|
||||||
|
@ -33,8 +33,8 @@ Open it by exceuting the following command or saving it as a shortcut: `explorer
|
|||||||
|
|
||||||
### Video Players
|
### Video Players
|
||||||
|
|
||||||
- IINA
|
- [IINA](https://iina.io/)
|
||||||
- video player based on mpv with native macOS UI
|
- video player based on mpv with native macOS UI
|
||||||
- mpv
|
- [mpv](https://mpv.io/)
|
||||||
- mpv doesn't have a brew cask for Apple silicon; stolen-mpv exists but it is x86 only
|
- mpv doesn't have a brew cask for Apple silicon; stolen-mpv exists but it is x86 only
|
||||||
- mpv brew formula is the cli tool which works pretty well but it is not as nice as packaged applications
|
- mpv brew formula is the cli tool which works pretty well but it is not as nice as packaged applications
|
||||||
|
@ -61,3 +61,8 @@ Semi-paywalled
|
|||||||
## UTF-8 Everywhere
|
## UTF-8 Everywhere
|
||||||
|
|
||||||
- http://utf8everywhere.org
|
- http://utf8everywhere.org
|
||||||
|
|
||||||
|
## Parsing Gigabytes of JSON per Second
|
||||||
|
|
||||||
|
- https://arxiv.org/abs/1902.08318 [[PDF](https://arxiv.org/pdf/1902.08318)]
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
following XDG Desktop Configuration, for example, can be used and added as a
|
following XDG Desktop Configuration, for example, can be used and added as a
|
||||||
non-Steam game while in Desktop mode for access in gaming mode
|
non-Steam game while in Desktop mode for access in gaming mode
|
||||||
|
|
||||||
```cfg
|
```ini
|
||||||
#!/usr/bin/env xdg-open
|
#!/usr/bin/env xdg-open
|
||||||
[Desktop]
|
[Desktop]
|
||||||
Version=1.0
|
Version=1.0
|
||||||
@ -27,7 +27,8 @@ GenericName=Online Video Platform
|
|||||||
Comment=An online video-sharing, social media platform
|
Comment=An online video-sharing, social media platform
|
||||||
Exec=/usr/bin/flatpak run --branch=master --arch=x86_64 --file-forwarding org.chromium.Chrome @@ %F @@ --user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox Series X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36 Edge/20.02' --kiosk 'https://www.youtube.com/tv'
|
Exec=/usr/bin/flatpak run --branch=master --arch=x86_64 --file-forwarding org.chromium.Chrome @@ %F @@ --user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox Series X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36 Edge/20.02' --kiosk 'https://www.youtube.com/tv'
|
||||||
Terminal=false
|
Terminal=false
|
||||||
MimeType=text/plain; # $XDG_PATH contains the paths used to fetch icons, extensions for supported formats are optional Icon=com.youtube.tv
|
MimeType=text/plain;
|
||||||
|
# $XDG_PATH contains the paths used to fetch icons, extensions for supported formats are optional Icon=com.youtube.tv
|
||||||
```
|
```
|
||||||
|
|
||||||
- Firefox can also be used however the supported command-line options are
|
- Firefox can also be used however the supported command-line options are
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
- Alternatively, SteamCMD, a command-line only version of the Steam client, can
|
- Alternatively, SteamCMD, a command-line only version of the Steam client, can
|
||||||
be used
|
be used
|
||||||
- [Windows
|
- [Windows
|
||||||
Binary](https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip)
|
Binary (.zip)](https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip)
|
||||||
- [Linux
|
- [Linux
|
||||||
Binary](https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz)
|
Binary (.zip)](https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz)
|
||||||
- [macOS
|
- [macOS
|
||||||
Binary](https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz)
|
Binary (.zip)](https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz)
|
||||||
|
|
||||||
## Downloading Older Depots
|
## Downloading Older Depots
|
||||||
|
|
||||||
@ -51,4 +51,7 @@ values.
|
|||||||
- useful bot written in C# to farm trading cards for owned games that can be
|
- useful bot written in C# to farm trading cards for owned games that can be
|
||||||
sold
|
sold
|
||||||
- [SteamGridDB](https://steamgriddb.com/)
|
- [SteamGridDB](https://steamgriddb.com/)
|
||||||
- custom video game assets for games available and not available on steam
|
- custom video game assets for games available and not available on Steam
|
||||||
|
- [ProtonDB](https://www.protondb.com/)
|
||||||
|
- community-sourced Linux compatibility tracker
|
||||||
|
|
||||||
|
37
package.json
37
package.json
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
@ -7,28 +8,32 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.3.1",
|
||||||
"js-yaml-loader": "^1.2.2",
|
"highlight.js": "^11.10.0",
|
||||||
"next": "^13.5.1",
|
"next": "^15.0.4",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"react": "^18.2.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-markdown": "^9.0.0",
|
"react-markdown": "^9.0.1",
|
||||||
"react-syntax-highlighter": "^15.5.0",
|
"rehype-autolink-headings": "^7.1.0",
|
||||||
|
"rehype-highlight": "^7.0.0",
|
||||||
|
"rehype-highlight-code-lines": "^1.0.4",
|
||||||
|
"rehype-katex": "^7.0.1",
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"remark-directive": "^3.0.0",
|
"rehype-slug": "^6.0.0",
|
||||||
"remark-gfm": "^4.0.0",
|
"remark-gfm": "^4.0.0",
|
||||||
"remark-github-admonitions-to-directives": "^2.0.0",
|
"remark-loader": "^6.0.0",
|
||||||
|
"remark-math": "^6.0.0",
|
||||||
"uri-js": "^4.4.1"
|
"uri-js": "^4.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next/bundle-analyzer": "^14.0.1",
|
"@next/bundle-analyzer": "^15.0.4",
|
||||||
"@svgr/webpack": "^6.5.1",
|
"@svgr/webpack": "^8.1.0",
|
||||||
"@types/node": "^18.17.17",
|
"@types/node": "^22.7.4",
|
||||||
"@types/react": "^18.2.22",
|
"@types/react": "^19.0.1",
|
||||||
"@types/react-dom": "^18.2.7",
|
"@types/react-dom": "^19.0.1",
|
||||||
"@types/react-syntax-highlighter": "^15.5.7",
|
"@types/react-syntax-highlighter": "^15.5.7",
|
||||||
"eslint": "^8.49.0",
|
"eslint": "^9.11.1",
|
||||||
"eslint-config-next": "^13.5.1",
|
"eslint-config-next": "^15.0.4",
|
||||||
"typescript": "^4.9.5"
|
"typescript": "^5.6.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
pages/_document.tsx
Normal file
13
pages/_document.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Html, Head, Main, NextScript } from "next/document";
|
||||||
|
|
||||||
|
export default function Document() {
|
||||||
|
return (
|
||||||
|
<Html lang="en">
|
||||||
|
<Head />
|
||||||
|
<body>
|
||||||
|
<Main />
|
||||||
|
<NextScript />
|
||||||
|
</body>
|
||||||
|
</Html>
|
||||||
|
);
|
||||||
|
}
|
@ -1,10 +1,15 @@
|
|||||||
import ReactMarkdown from 'react-markdown';
|
import ReactMarkdown from 'react-markdown';
|
||||||
import SyntaxHighlighter from 'react-syntax-highlighter';
|
import { PluggableList } from 'unified';
|
||||||
import { monokaiSublime as hlTheme } from 'react-syntax-highlighter/dist/cjs/styles/hljs';
|
|
||||||
import remarkGfm from 'remark-gfm';
|
import remarkGfm from 'remark-gfm';
|
||||||
|
import remarkMath from 'remark-math';
|
||||||
|
|
||||||
|
import rehypeKatex from 'rehype-katex';
|
||||||
import rehypeRaw from 'rehype-raw';
|
import rehypeRaw from 'rehype-raw';
|
||||||
import remarkDirective from 'remark-directive';
|
import rehypeSlug from 'rehype-slug';
|
||||||
import remarkGithubAdmonitionsToDirectives from 'remark-github-admonitions-to-directives';
|
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
|
||||||
|
import rehypeHighlight from 'rehype-highlight';
|
||||||
|
import rehypeHighlightCodeLines, { type HighlightLinesOptions } from 'rehype-highlight-code-lines';
|
||||||
|
|
||||||
import Layout from '../../components/layout';
|
import Layout from '../../components/layout';
|
||||||
import readMarkdown from '../../lib/read-markdown';
|
import readMarkdown from '../../lib/read-markdown';
|
||||||
@ -12,6 +17,8 @@ import { toLocaleString } from '../../lib/date';
|
|||||||
import NotesInfo from '../../public/notes.json';
|
import NotesInfo from '../../public/notes.json';
|
||||||
|
|
||||||
import style from '../../styles/note.module.css';
|
import style from '../../styles/note.module.css';
|
||||||
|
import 'highlight.js/styles/monokai-sublime.css';
|
||||||
|
import 'katex/dist/katex.min.css';
|
||||||
|
|
||||||
interface Note {
|
interface Note {
|
||||||
title: string,
|
title: string,
|
||||||
@ -24,31 +31,20 @@ interface Notes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Markdown({ content }: any) {
|
function Markdown({ content }: any) {
|
||||||
return <ReactMarkdown
|
const remarkPlugins: PluggableList = [
|
||||||
remarkPlugins={[remarkGithubAdmonitionsToDirectives, remarkDirective, remarkGfm]}
|
remarkGfm,
|
||||||
rehypePlugins={[rehypeRaw]}
|
remarkMath,
|
||||||
components={{
|
];
|
||||||
code({ node, className, children, ...props }) {
|
const rehypePlugins: PluggableList = [
|
||||||
const match = /language-(\w+)/.exec(className || '')
|
rehypeSlug,
|
||||||
return match
|
rehypeAutolinkHeadings,
|
||||||
? (
|
rehypeRaw,
|
||||||
<SyntaxHighlighter
|
rehypeHighlight,
|
||||||
showLineNumbers={true}
|
rehypeKatex,
|
||||||
language={match[1]}
|
];
|
||||||
//@ts-ignore
|
return <ReactMarkdown remarkPlugins={remarkPlugins} rehypePlugins={rehypePlugins}>
|
||||||
style={hlTheme}
|
{content}
|
||||||
PreTag='div'
|
</ReactMarkdown>
|
||||||
codeTagProps={{ style: { display: 'block' } }}
|
|
||||||
customStyle={{ padding: '0', borderRadius: '1rem' }}
|
|
||||||
{...props}
|
|
||||||
>{String(children).replace(/\n$/, '')}</SyntaxHighlighter>
|
|
||||||
)
|
|
||||||
: <code className={className} {...props}>
|
|
||||||
{children}
|
|
||||||
</code>
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>{content}</ReactMarkdown>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function Note({ note }: { note: Note }) {
|
function Note({ note }: { note: Note }) {
|
||||||
@ -93,5 +89,4 @@ export async function getStaticPaths() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default Note;
|
export default Note;
|
||||||
|
@ -3,16 +3,16 @@ import ReactMarkdown from 'react-markdown';
|
|||||||
import style from '../../styles/post.module.css';
|
import style from '../../styles/post.module.css';
|
||||||
import PostsInfo from '../../public/posts.json';
|
import PostsInfo from '../../public/posts.json';
|
||||||
import readMarkdown from '../../lib/read-markdown';
|
import readMarkdown from '../../lib/read-markdown';
|
||||||
import DateTool from '../../lib/date';
|
import DateTool, { toLocaleString } from '../../lib/date';
|
||||||
|
|
||||||
interface Post {
|
interface IPost {
|
||||||
title: string;
|
title: string;
|
||||||
mtime: string;
|
mtime: string;
|
||||||
otime?: string;
|
otime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Posts {
|
interface IPosts {
|
||||||
[slug: string]: Post
|
[slug: string]: IPost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -51,9 +51,21 @@ function TimeBlock({ mtime, otime }: { mtime: string, otime: string }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Post({ post }: { post: Post & { content: string, cover?: string, otime: string, mtime?: string } }) {
|
function Post({ post }: { post: IPost & { content: string, cover?: string, otime: string, mtime?: string } }) {
|
||||||
|
if (!post)
|
||||||
|
return <></>;
|
||||||
return (<>
|
return (<>
|
||||||
<Layout removeContainer={true} >
|
<Layout removeContainer={true} >
|
||||||
|
<div className='container'>
|
||||||
|
{ post.otime !== post.mtime &&
|
||||||
|
<span className={style.time}>
|
||||||
|
Last updated: {toLocaleString(post.mtime)}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
<span className={style.time}>
|
||||||
|
{toLocaleString(post.otime)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
{<div className={style.imageBlock}
|
{<div className={style.imageBlock}
|
||||||
style={{
|
style={{
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
@ -64,7 +76,6 @@ function Post({ post }: { post: Post & { content: string, cover?: string, otime:
|
|||||||
<div className={`${style.spacer} ${post.cover ? style.background : ''}`}></div>
|
<div className={`${style.spacer} ${post.cover ? style.background : ''}`}></div>
|
||||||
<section className={`${style.block} block`}>
|
<section className={`${style.block} block`}>
|
||||||
<div className='container'>
|
<div className='container'>
|
||||||
<TimeBlock mtime={post.mtime} otime={post.otime} />
|
|
||||||
<ReactMarkdown>{post.content}</ReactMarkdown>
|
<ReactMarkdown>{post.content}</ReactMarkdown>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -76,8 +87,8 @@ function Post({ post }: { post: Post & { content: string, cover?: string, otime:
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getStaticProps({ params }: any) {
|
export async function getStaticProps({ params }: any) {
|
||||||
const postsInfo: Posts = PostsInfo;
|
const postsInfo: IPosts = PostsInfo;
|
||||||
const post: Post = postsInfo[params.post];
|
const post: IPost = postsInfo[params.post];
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
post: {
|
post: {
|
||||||
|
@ -12,22 +12,21 @@ function PostsPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function NoPosts() {
|
function NoPosts() {
|
||||||
return (<><div className='text center'>
|
return (<div className='text center'>
|
||||||
<div>**crickets**</div>
|
<div>**crickets**</div>
|
||||||
<div>No posts found...</div>
|
<div>No posts found...</div>
|
||||||
<div><Link href='/' className='link button green back'>Go Home</Link></div>
|
<div><Link href='/' className='link button green back'>Go Home</Link></div>
|
||||||
</div></>);
|
</div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Posts() {
|
function Posts() {
|
||||||
const posts = Object.entries(PostsInfo);
|
const posts = Object.entries(PostsInfo);
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
posts.map(([slug, post]: [string, any]) => {
|
posts.map(([slug, post]: [string, any]) => {
|
||||||
return <tr key={slug} style={{ alignItems: 'center' }}>
|
return (<tr key={slug} style={{ alignItems: 'center' }}>
|
||||||
<td style={{ display: 'inline-block', textAlign: 'right', fontSize: '0.9rem' }}>
|
<td style={{ display: 'inline-block', textAlign: 'right', fontSize: '0.9rem' }}>
|
||||||
<div style={{ fontStyle: 'italics', fontSize: '.8rem' }}>{
|
<div style={{ fontStyle: 'italics', fontSize: '.8rem' }}>{
|
||||||
post.mtime && (post.mtime != post.otime) && `Updated ${date.toRelativeDate(new Date(post.mtime))}`
|
post.mtime && (post.mtime != post.otime) && `Updated ${date.toRelativeDate(new Date(post.mtime))}`
|
||||||
@ -35,17 +34,16 @@ function Posts() {
|
|||||||
<div>{date.toRelativeDate(new Date(post.otime))}</div>
|
<div>{date.toRelativeDate(new Date(post.otime))}</div>
|
||||||
</td>
|
</td>
|
||||||
<td style={{
|
<td style={{
|
||||||
flex: '1 1 60%',
|
|
||||||
alignItems: 'center',
|
|
||||||
fontFamily: `'EB Garamond', 'Garamond', 'Times New Roman', Times, serif`
|
fontFamily: `'EB Garamond', 'Garamond', 'Times New Roman', Times, serif`
|
||||||
|
, fontSize: '1.25rem'
|
||||||
}}>
|
}}>
|
||||||
<Link href={`/posts/${slug}`} style={{ textDecoration: 'none' }}>{post.title}</Link>
|
<Link href={`/posts/${slug}`} style={{ textDecoration: 'none' }}>{post.title}</Link>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>)
|
||||||
})}
|
})
|
||||||
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,45 +1,40 @@
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import Layout from '../components/layout';
|
import Layout from '../components/layout';
|
||||||
import { Site } from '../lib/site';
|
import { Sites } from '../lib/site';
|
||||||
import SiteMap from '../public/sitemap.json';
|
import SiteMap from '../public/sitemap.json';
|
||||||
|
|
||||||
function traverseMap(head: Site, cwd = '', depth = 0) {
|
function Desc(props: any) {
|
||||||
if (head.subpages === undefined)
|
return (
|
||||||
return [];
|
<dl style={props.style}>
|
||||||
|
<dt>{props.term}</dt>
|
||||||
|
<dd>{props.details}</dd>
|
||||||
|
{props.children}
|
||||||
|
</dl>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function traverseMap(head?: Sites, cwd = '', depth = 0) {
|
||||||
|
if (!head) return [];
|
||||||
let elements = [];
|
let elements = [];
|
||||||
for (const [slug, info] of Object.entries(head.subpages)) {
|
for (const [slug, site] of Object.entries(head)) {
|
||||||
if (slug === 'sitemap')
|
if (slug === 'sitemap')
|
||||||
continue;
|
continue;
|
||||||
if (slug.startsWith('http://')) {
|
|
||||||
elements.push(<>
|
let details;
|
||||||
<dt>{info.title}</dt>
|
let list;
|
||||||
<dd><Link href={slug}>{slug.substring(7)}</Link></dd>
|
|
||||||
</>);
|
|
||||||
}
|
|
||||||
else if (slug.startsWith('https://')) {
|
|
||||||
elements.push(<>
|
|
||||||
<dt>{info.title}</dt>
|
|
||||||
<dd><Link href={slug}>{slug.substring(8)}</Link></dd>
|
|
||||||
</>);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const path = `${cwd}/${slug}`;
|
const path = `${cwd}/${slug}`;
|
||||||
const children = (<><dl style={{marginLeft: '3rem'}}> {traverseMap(info, path, depth + 1)}</dl></>);
|
details = <Link href={path}>paulw.xyz{path}</Link>;
|
||||||
elements.push(<>
|
list = traverseMap(site.pages, path, depth + 1);
|
||||||
<dt>{info.title}</dt>
|
|
||||||
<dd><Link href={path}>paulw.xyz{path}</Link></dd>
|
elements.push(<Desc style={{marginLeft: '3rem'}} key={site.title} term={site.title} details={details}>{list}</Desc>)
|
||||||
{children}
|
|
||||||
</>);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SiteMapPage() {
|
function SiteMapPage() {
|
||||||
|
|
||||||
|
|
||||||
return <Layout>
|
return <Layout>
|
||||||
<dl>{traverseMap(SiteMap)}</dl>
|
{traverseMap(SiteMap.pages)}
|
||||||
</Layout>;
|
</Layout>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,11 +10,5 @@
|
|||||||
},
|
},
|
||||||
"sitemap": {
|
"sitemap": {
|
||||||
"title": "Site Map"
|
"title": "Site Map"
|
||||||
},
|
|
||||||
"https://git.paulw.xyz": {
|
|
||||||
"title": "Git.PaulW.XYZ"
|
|
||||||
},
|
|
||||||
"https://social.paulw.xyz": {
|
|
||||||
"title": "Social.PaulW.XYZ"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
{"mos-6502":{"title":"MOS 6502 Microprocessor","mtime":"2023-10-29T18:05:52.439Z"},"browsers":{"title":"Web Browsers","mtime":"2024-09-13T08:47:57.942Z"},"zilog-z80":{"title":"Zilog Z80 Microprocessor","mtime":"2023-10-29T18:07:08.579Z"},"steam":{"title":"Steam Client","mtime":"2024-10-10T04:56:04.393Z"},"programming-resources":{"title":"Programming Resources","mtime":"2024-10-10T05:04:27.709Z"},"steam-deck":{"title":"Steam Deck","mtime":"2024-10-10T05:19:16.140Z"},"lua":{"title":"Lua Programming Language","mtime":"2024-09-13T08:45:18.515Z"},"os":{"title":"Operating Systems","mtime":"2024-05-10T16:07:32.581Z"}}
|
{"mos-6502":{"title":"MOS 6502 Microprocessor","mtime":"2023-10-29T18:05:52.439Z"},"zilog-z80":{"title":"Zilog Z80 Microprocessor","mtime":"2023-10-29T18:07:08.579Z"},"browsers":{"title":"Web Browsers","mtime":"2024-09-13T08:47:57.942Z"},"steam":{"title":"Steam Client","mtime":"2024-12-28T17:07:10.689Z"},"lua":{"title":"Lua Programming Language","mtime":"2024-12-28T17:00:55.719Z"},"os":{"title":"Operating Systems","mtime":"2024-12-06T18:53:52.620Z"},"steam-deck":{"title":"Steam Deck","mtime":"2024-12-28T17:10:01.709Z"},"programming-resources":{"title":"Programming Resources","mtime":"2024-12-06T19:02:37.710Z"}}
|
@ -1 +1 @@
|
|||||||
{"title":"PaulW.XYZ","subpages":{"posts":{"title":"Posts","subpages":{}},"notes":{"title":"Notes","subpages":{"mos-6502":{"title":"MOS 6502 Microprocessor","mtime":"2023-10-29T18:05:52.439Z"},"browsers":{"title":"Web Browsers","mtime":"2024-09-13T08:47:57.942Z"},"zilog-z80":{"title":"Zilog Z80 Microprocessor","mtime":"2023-10-29T18:07:08.579Z"},"steam":{"title":"Steam Client","mtime":"2024-10-10T04:56:04.393Z"},"programming-resources":{"title":"Programming Resources","mtime":"2024-10-10T05:04:27.709Z"},"steam-deck":{"title":"Steam Deck","mtime":"2024-10-10T05:19:16.140Z"},"lua":{"title":"Lua Programming Language","mtime":"2024-09-13T08:45:18.515Z"},"os":{"title":"Operating Systems","mtime":"2024-05-10T16:07:32.581Z"}}},"about":{"title":"About"},"sitemap":{"title":"Site Map"},"https://git.paulw.xyz":{"title":"Git.PaulW.XYZ"},"https://social.paulw.xyz":{"title":"Social.PaulW.XYZ"}}}
|
{"title":"PaulW.XYZ","pages":{"posts":{"title":"Posts","pages":{}},"notes":{"title":"Notes","pages":{"mos-6502":{"title":"MOS 6502 Microprocessor","mtime":"2023-10-29T18:05:52.439Z"},"zilog-z80":{"title":"Zilog Z80 Microprocessor","mtime":"2023-10-29T18:07:08.579Z"},"browsers":{"title":"Web Browsers","mtime":"2024-09-13T08:47:57.942Z"},"steam":{"title":"Steam Client","mtime":"2024-12-28T17:07:10.689Z"},"lua":{"title":"Lua Programming Language","mtime":"2024-12-28T17:00:55.719Z"},"os":{"title":"Operating Systems","mtime":"2024-12-06T18:53:52.620Z"},"steam-deck":{"title":"Steam Deck","mtime":"2024-12-28T17:10:01.709Z"},"programming-resources":{"title":"Programming Resources","mtime":"2024-12-06T19:02:37.710Z"}}},"about":{"title":"About"},"sitemap":{"title":"Site Map"}}}
|
@ -122,12 +122,12 @@ async function generateSiteMap() {
|
|||||||
|
|
||||||
const sitemap = {
|
const sitemap = {
|
||||||
title: 'PaulW.XYZ',
|
title: 'PaulW.XYZ',
|
||||||
subpages: await readFilesMetadata('home')
|
pages: await readFilesMetadata('home')
|
||||||
};
|
};
|
||||||
|
|
||||||
const pages = ['posts', 'notes'];
|
const pages = ['posts', 'notes'];
|
||||||
for (const page of pages) {
|
for (const page of pages) {
|
||||||
sitemap.subpages[page].subpages = await readFilesMetadata(page);
|
sitemap.pages[page].pages = await readFilesMetadata(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeFilesMetadata(jsonFilePath('sitemap'), sitemap);
|
await writeFilesMetadata(jsonFilePath('sitemap'), sitemap);
|
||||||
|
5
shims.d.ts
vendored
5
shims.d.ts
vendored
@ -1,8 +1,3 @@
|
|||||||
declare module '*.yaml' {
|
|
||||||
const record: Record<string, any>;
|
|
||||||
export default record;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.md' {
|
declare module '*.md' {
|
||||||
const rawmd: string;
|
const rawmd: string;
|
||||||
export default rawmd;
|
export default rawmd;
|
||||||
|
@ -235,9 +235,8 @@ code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
display: flex;
|
margin: 1rem auto;
|
||||||
flex-direction: column;
|
width:100%;
|
||||||
margin: 1rem 0;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
@ -258,11 +257,6 @@ table tr:last-of-type
|
|||||||
border-bottom-right-radius: 0.5rem;
|
border-bottom-right-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead tr,
|
|
||||||
table tbody tr {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
table tbody tr:nth-of-type(2n) {
|
table tbody tr:nth-of-type(2n) {
|
||||||
background-color: var(--table-even-color);
|
background-color: var(--table-even-color);
|
||||||
}
|
}
|
||||||
@ -273,12 +267,10 @@ table tbody tr:nth-of-type(2n+1) {
|
|||||||
|
|
||||||
table thead tr th,
|
table thead tr th,
|
||||||
table tbody tr td {
|
table tbody tr td {
|
||||||
display: flex;
|
|
||||||
flex: 1;
|
|
||||||
padding: .25rem 0.75rem;
|
padding: .25rem 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
li {
|
ul li {
|
||||||
list-style-type: square;
|
list-style-type: square;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,3 +31,11 @@
|
|||||||
.background.spacer {
|
.background.spacer {
|
||||||
height: 25rem;
|
height: 25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.time {
|
||||||
|
text-align: center;
|
||||||
|
display: block;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin: 0.5rem 0.75rem;
|
||||||
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2017",
|
"target": "es2023",
|
||||||
"lib": [
|
"lib": [
|
||||||
"dom",
|
"dom",
|
||||||
"dom.iterable",
|
"dom.iterable",
|
||||||
@ -13,7 +13,7 @@
|
|||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "bundler",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user