aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/gen.yml12
-rw-r--r--append.html146
-rw-r--r--bib.bib0
-rw-r--r--bib.csl468
-rw-r--r--common.html14
-rwxr-xr-xdev2
-rwxr-xr-xgen53
-rw-r--r--index.css21
-rw-r--r--md/2023-07-06-21.md3
-rwxr-xr-xnew10
-rw-r--r--server-katex/filter.lua23
-rw-r--r--server-katex/math.ts18
-rw-r--r--style.css49
13 files changed, 736 insertions, 83 deletions
diff --git a/.github/workflows/gen.yml b/.github/workflows/gen.yml
index d7f268f..e9148a6 100644
--- a/.github/workflows/gen.yml
+++ b/.github/workflows/gen.yml
@@ -23,14 +23,20 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
+ - name: Install deno
+ uses: denoland/setup-deno@v1
+ with:
+ deno-version: vx.x.x
+ - name: Install lua
+ uses: leafo/gh-actions-lua@v10
- name: Install pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/3.1.2/pandoc-3.1.2-1-amd64.deb
sudo dpkg -i pandoc*
- - name: Install packages
+ - name: Install node packages
run: |
- sudo npm i -g mermaid-filter
- - name: Setup Pages
+ npm i -g mermaid-filter
+ - name: Setup pages
id: pages
uses: actions/configure-pages@v3
- name: Generate files
diff --git a/append.html b/append.html
index 51c8e97..20d1afe 100644
--- a/append.html
+++ b/append.html
@@ -1,74 +1,102 @@
<div class="buttons">
- <button title="toggle theme"><svg><use href="res/feather.svg#moon"/></svg></button>
- <button title="remove distractions"><svg><use href="res/feather.svg#eye-off"/></svg></button>
- <button title="share on twitter or mastodon"><svg><use href="res/feather.svg#share-2"/></svg></button>
- <button title="open print dialog"><svg><use href="res/feather.svg#printer"/></svg></button>
- <button title="go to index"><svg><use href="res/feather.svg#home"/></svg></button>
+ <button title="toggle theme">
+ <svg><use href="res/feather.svg#moon" /></svg>
+ </button>
+ <button title="remove distractions">
+ <svg><use href="res/feather.svg#eye-off" /></svg>
+ </button>
+ <button title="share on twitter or mastodon">
+ <svg><use href="res/feather.svg#share-2" /></svg>
+ </button>
+ <button title="open print dialog">
+ <svg><use href="res/feather.svg#printer" /></svg>
+ </button>
+ <button title="go to index">
+ <svg><use href="res/feather.svg#home" /></svg>
+ </button>
</div>
<div id="share" class="popover">
- <div>
- <ul>
- <li><a href="https://twitter.com" id="twitter">Share on Twitter</a></li>
- <li><a href="https://joinmastodon.org" id="mastodon">Share on Mastodon</a></li>
- </ul>
- </div>
+ <div>
+ <ul>
+ <li><a href="https://twitter.com" id="twitter">Share on Twitter</a></li>
+ <li>
+ <a href="https://joinmastodon.org" id="mastodon">Share on Mastodon</a>
+ </li>
+ </ul>
+ </div>
</div>
<script>
- // haha i love this
- // thanks, me too
- const toggleScheme = () => {
- for (const rule of document.styleSheets[1].rules) {
- if (!rule.media || !rule.media.mediaText.includes("prefers-color-scheme"))
- continue
- if (rule.media.mediaText.includes("dark")) {
- rule.media.deleteMedium("(prefers-color-scheme: dark)");
- rule.media.appendMedium("(prefers-color-scheme: light)");
- } else {
- rule.media.deleteMedium("(prefers-color-scheme: light)");
- rule.media.appendMedium("(prefers-color-scheme: dark)");
- }
- }
- }
+ /// scripts for the sidebar
- let text = "V2tWa1YwNUhVa1pSYmxKYVYwVnZlVmxXWXpGaFYwbDZVMjVXWVZkRmJERlhhMlJXVUZFOVBRPT0=";
+ // haha i love this
+ // thanks, me too
+ const toggleScheme = () => {
+ for (const rule of document.styleSheets[1].rules) {
+ if (!rule.media || !rule.media.mediaText.includes("prefers-color-scheme"))
+ continue;
+ if (rule.media.mediaText.includes("dark")) {
+ rule.media.deleteMedium("(prefers-color-scheme: dark)");
+ rule.media.appendMedium("(prefers-color-scheme: light)");
+ } else {
+ rule.media.deleteMedium("(prefers-color-scheme: light)");
+ rule.media.appendMedium("(prefers-color-scheme: dark)");
+ }
+ }
- (() => {
- const sharePopover = document.querySelector(".popover#share");
+ if (typeof redrawPlots === "function") redrawPlots();
+ };
- const funcs = [
- () => toggleScheme(),
- () => document.querySelectorAll("nav, .buttons").forEach(e => e.remove()),
- () => sharePopover.style.display = "block",
- () => window.print(),
- () => window.location.href = "/",
- ]
+ const toggleDetails = () => {
+ document.querySelectorAll("details").forEach((e) => (e.open = !e.open));
+ };
- sharePopover.addEventListener("click", e => {
- sharePopover.style.display = "none";
- });
+ let text =
+ "V2tWa1YwNUhVa1pSYmxKYVYwVnZlVmxXWXpGaFYwbDZVMjVXWVZkRmJERlhhMlJXVUZFOVBRPT0=";
- document.querySelector("#twitter").href = `https://twitter.com/intent/tweet?text=${document.title}%0A${window.location.href}`;
- document.querySelector("#mastodon").onclick = e => {
- window.location.href = `https://${prompt("Enter your mastodon instance:", "mastodon.social")}/share?text=${document.title}%0A${window.location.href}`;
- e.preventDefault();
- }
+ (() => {
+ const sharePopover = document.querySelector(".popover#share");
- const buttons = document.querySelectorAll(".buttons button");
- for (let i = 0; i < buttons.length; i++)
- buttons[i].addEventListener("click", funcs[i]);
+ const funcs = [
+ () => toggleScheme(),
+ () =>
+ document.querySelectorAll("nav, .buttons").forEach((e) => e.remove()),
+ () => (sharePopover.style.display = "block"),
+ () => {
+ document.querySelectorAll("details").forEach((e) => (e.open = true));
+ window.print();
+ document.querySelectorAll("details").forEach((e) => (e.open = false));
+ },
+ () => (window.location.href = "/"),
+ ];
- setTimeout(() => {
- const links = document.querySelectorAll("a");
- for (let i = 0; i < links.length; i++) {
- if (links[i].getAttribute("href") == "mail") {
- for (let j = 0; j < 4; j++)
- text = atob(text);
- links[i].href = `mailto:${text}`;
- }
- }
- }, 1000);
- })();
-</script>
+ sharePopover.addEventListener("click", (e) => {
+ sharePopover.style.display = "none";
+ });
+
+ document.querySelector("#twitter").href =
+ `https://twitter.com/intent/tweet?text=${document.title}%0A${window.location.href}`;
+ document.querySelector("#mastodon").onclick = (e) => {
+ window.location.href = `https://${prompt(
+ "Enter your mastodon instance:",
+ "mastodon.social",
+ )}/share?text=${document.title}%0A${window.location.href}`;
+ e.preventDefault();
+ };
+ const buttons = document.querySelectorAll(".buttons button");
+ for (let i = 0; i < buttons.length; i++)
+ buttons[i].addEventListener("click", funcs[i]);
+
+ setTimeout(() => {
+ const links = document.querySelectorAll("a");
+ for (let i = 0; i < links.length; i++) {
+ if (links[i].getAttribute("href") == "mail") {
+ for (let j = 0; j < 4; j++) text = atob(text);
+ links[i].href = `mailto:${text}`;
+ }
+ }
+ }, 1000);
+ })();
+</script>
diff --git a/bib.bib b/bib.bib
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bib.bib
diff --git a/bib.csl b/bib.csl
new file mode 100644
index 0000000..d600a74
--- /dev/null
+++ b/bib.csl
@@ -0,0 +1,468 @@
+<?xml version="1.0" encoding="utf-8"?>
+<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
+ <info>
+ <title>IEEE</title>
+ <id>http://www.zotero.org/styles/ieee</id>
+ <link href="http://www.zotero.org/styles/ieee" rel="self"/>
+ <!-- <link href="https://ieeeauthorcenter.ieee.org/wp-content/uploads/IEEE-Reference-Guide.pdf" rel="documentation"/> - 2018 guidelines -->
+ <link href="http://journals.ieeeauthorcenter.ieee.org/wp-content/uploads/sites/7/IEEE_Reference_Guide.pdf" rel="documentation"/>
+ <link href="https://journals.ieeeauthorcenter.ieee.org/your-role-in-article-production/ieee-editorial-style-manual/" rel="documentation"/>
+ <author>
+ <name>Michael Berkowitz</name>
+ <email>mberkowi@gmu.edu</email>
+ </author>
+ <contributor>
+ <name>Julian Onions</name>
+ <email>julian.onions@gmail.com</email>
+ </contributor>
+ <contributor>
+ <name>Rintze Zelle</name>
+ <uri>http://twitter.com/rintzezelle</uri>
+ </contributor>
+ <contributor>
+ <name>Stephen Frank</name>
+ <uri>http://www.zotero.org/sfrank</uri>
+ </contributor>
+ <contributor>
+ <name>Sebastian Karcher</name>
+ </contributor>
+ <contributor>
+ <name>Giuseppe Silano</name>
+ <email>g.silano89@gmail.com</email>
+ <uri>http://giuseppesilano.net</uri>
+ </contributor>
+ <contributor>
+ <name>Patrick O'Brien</name>
+ </contributor>
+ <contributor>
+ <name>Brenton M. Wiernik</name>
+ </contributor>
+ <contributor>
+ <name>Oliver Couch</name>
+ <email>oliver.couch@gmail.com</email>
+ </contributor>
+ <category citation-format="numeric"/>
+ <category field="engineering"/>
+ <category field="generic-base"/>
+ <summary>IEEE style as per the 2021 guidelines, V 01.29.2021.</summary>
+ <updated>2023-04-18T00:52:46+10:00</updated>
+ <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
+ </info>
+ <locale xml:lang="en">
+ <date form="text">
+ <date-part name="month" form="short" suffix=" "/>
+ <date-part name="day" form="numeric-leading-zeros" suffix=", "/>
+ <date-part name="year"/>
+ </date>
+ <terms>
+ <term name="chapter" form="short">ch.</term>
+ <term name="presented at">presented at the</term>
+ <term name="available at">available</term>
+ </terms>
+ </locale>
+ <!-- Macros -->
+ <macro name="status">
+ <choose>
+ <if variable="page issue volume" match="none">
+ <text variable="status" text-case="capitalize-first" suffix="" font-weight="bold"/>
+ </if>
+ </choose>
+ </macro>
+ <macro name="edition">
+ <choose>
+ <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="any">
+ <choose>
+ <if is-numeric="edition">
+ <group delimiter=" ">
+ <number variable="edition" form="ordinal"/>
+ <text term="edition" form="short"/>
+ </group>
+ </if>
+ <else>
+ <text variable="edition" text-case="capitalize-first" suffix="."/>
+ </else>
+ </choose>
+ </if>
+ </choose>
+ </macro>
+ <macro name="issued">
+ <choose>
+ <if type="article-journal report" match="any">
+ <date variable="issued">
+ <date-part name="month" form="short" suffix=" "/>
+ <date-part name="year" form="long"/>
+ </date>
+ </if>
+ <else-if type="bill book chapter graphic legal_case legislation song thesis" match="any">
+ <date variable="issued">
+ <date-part name="year" form="long"/>
+ </date>
+ </else-if>
+ <else-if type="paper-conference" match="any">
+ <date variable="issued">
+ <date-part name="month" form="short"/>
+ <date-part name="year" prefix=" "/>
+ </date>
+ </else-if>
+ <else-if type="motion_picture" match="any">
+ <date variable="issued" form="text" prefix="(" suffix=")"/>
+ </else-if>
+ <else>
+ <date variable="issued" form="text"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="author">
+ <names variable="author">
+ <name and="text" et-al-min="7" et-al-use-first="1" initialize-with=". "/>
+ <label form="short" prefix=", " text-case="capitalize-first"/>
+ <et-al font-style="italic"/>
+ <substitute>
+ <names variable="editor"/>
+ <names variable="translator"/>
+ </substitute>
+ </names>
+ </macro>
+ <macro name="editor">
+ <names variable="editor">
+ <name initialize-with=". " delimiter=", " and="text"/>
+ <label form="short" prefix=", " text-case="capitalize-first"/>
+ </names>
+ </macro>
+ <macro name="locators">
+ <group delimiter=", ">
+ <text macro="edition"/>
+ <group delimiter=" ">
+ <text term="volume" form="short"/>
+ <number variable="volume" form="numeric"/>
+ </group>
+ <group delimiter=" ">
+ <number variable="number-of-volumes" form="numeric"/>
+ <text term="volume" form="short" plural="true"/>
+ </group>
+ <group delimiter=" ">
+ <text term="issue" form="short"/>
+ <number variable="issue" form="numeric"/>
+ </group>
+ </group>
+ </macro>
+ <macro name="title">
+ <choose>
+ <if type="bill book graphic legal_case legislation motion_picture song" match="any">
+ <text variable="title" font-style="italic"/>
+ </if>
+ <else>
+ <text variable="title" quotes="true"/>
+ </else>
+ </choose>
+ </macro>
+ <macro name="publisher">
+ <choose>
+ <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference song" match="any">
+ <group delimiter=": ">
+ <text variable="publisher-place"/>
+ <text variable="publisher"/>
+ </group>
+ </if>
+ <else>
+ <group delimiter=", ">
+ <text variable="publisher"/>
+ <text variable="publisher-place"/>
+ </group>
+ </else>
+ </choose>
+ </macro>
+ <macro name="event">
+ <choose>
+ <!-- Published Conference Paper -->
+ <if type="paper-conference speech" match="any">
+ <choose>
+ <if variable="container-title" match="any">
+ <group delimiter=" ">
+ <text term="in"/>
+ <text variable="container-title" font-style="italic"/>
+ </group>
+ </if>
+ <!-- Unpublished Conference Paper -->
+ <else>
+ <group delimiter=" ">
+ <text term="presented at"/>
+ <text variable="event"/>
+ </group>
+ </else>
+ </choose>
+ </if>
+ </choose>
+ </macro>
+ <macro name="access">
+ <choose>
+ <if type="webpage post post-weblog" match="any">
+ <!-- https://url.com/ (accessed Mon. DD, YYYY). -->
+ <choose>
+ <if variable="URL">
+ <group delimiter=". " prefix=" ">
+ <group delimiter=": ">
+ <text term="accessed" text-case="capitalize-first"/>
+ <date variable="accessed" form="text"/>
+ </group>
+ <text term="online" prefix="[" suffix="]" text-case="capitalize-first"/>
+ <group delimiter=": ">
+ <text term="available at" text-case="capitalize-first"/>
+ <text variable="URL"/>
+ </group>
+ </group>
+ </if>
+ </choose>
+ </if>
+ <else-if match="any" variable="DOI">
+ <!-- doi: 10.1000/xyz123. -->
+ <text variable="DOI" prefix=" doi: " suffix="."/>
+ </else-if>
+ <else-if variable="URL">
+ <!-- Accessed: Mon. DD, YYYY. [Medium]. Available: https://URL.com/ -->
+ <group delimiter=". " prefix=" " suffix=". ">
+ <!-- Accessed: Mon. DD, YYYY. -->
+ <group delimiter=": ">
+ <text term="accessed" text-case="capitalize-first"/>
+ <date variable="accessed" form="text"/>
+ </group>
+ <!-- [Online Video]. -->
+ <group prefix="[" suffix="]" delimiter=" ">
+ <choose>
+ <if variable="medium" match="any">
+ <text variable="medium" text-case="capitalize-first"/>
+ </if>
+ <else>
+ <text term="online" text-case="capitalize-first"/>
+ <choose>
+ <if type="motion_picture">
+ <text term="video" text-case="capitalize-first"/>
+ </if>
+ </choose>
+ </else>
+ </choose>
+ </group>
+ </group>
+ <!-- Available: https://URL.com/ -->
+ <group delimiter=": " prefix=" ">
+ <text term="available at" text-case="capitalize-first"/>
+ <text variable="URL"/>
+ </group>
+ </else-if>
+ </choose>
+ </macro>
+ <macro name="page">
+ <choose>
+ <if type="article-journal" variable="number" match="all">
+ <group delimiter=" ">
+ <text value="Art."/>
+ <text term="issue" form="short"/>
+ <text variable="number"/>
+ </group>
+ </if>
+ <else>
+ <group delimiter=" ">
+ <label variable="page" form="short"/>
+ <text variable="page"/>
+ </group>
+ </else>
+ </choose>
+ </macro>
+ <macro name="citation-locator">
+ <group delimiter=" ">
+ <choose>
+ <if locator="page">
+ <label variable="locator" form="short"/>
+ </if>
+ <else>
+ <label variable="locator" form="short" text-case="capitalize-first"/>
+ </else>
+ </choose>
+ <text variable="locator"/>
+ </group>
+ </macro>
+ <macro name="geographic-location">
+ <group delimiter=", " suffix=".">
+ <choose>
+ <if variable="publisher-place">
+ <text variable="publisher-place" text-case="title"/>
+ </if>
+ <else-if variable="event-place">
+ <text variable="event-place" text-case="title"/>
+ </else-if>
+ </choose>
+ </group>
+ </macro>
+ <!-- Series -->
+ <macro name="collection">
+ <choose>
+ <if variable="collection-title" match="any">
+ <text term="in" suffix=" "/>
+ <group delimiter=", " suffix=". ">
+ <text variable="collection-title"/>
+ <text variable="collection-number" prefix="no. "/>
+ <text variable="volume" prefix="vol. "/>
+ </group>
+ </if>
+ </choose>
+ </macro>
+ <!-- Citation -->
+ <citation collapse="citation-number">
+ <sort>
+ <key variable="citation-number"/>
+ </sort>
+ <layout delimiter=", ">
+ <group prefix="[" suffix="]" delimiter=", ">
+ <text variable="citation-number"/>
+ <text macro="citation-locator"/>
+ </group>
+ </layout>
+ </citation>
+ <!-- Bibliography -->
+ <bibliography entry-spacing="0" second-field-align="flush">
+ <layout>
+ <!-- Citation Number -->
+ <text variable="citation-number" prefix="[" suffix="]"/>
+ <!-- Author(s) -->
+ <text macro="author" suffix=", "/>
+ <!-- Rest of Citation -->
+ <choose>
+ <!-- Specific Formats -->
+ <if type="article-journal">
+ <group delimiter=", ">
+ <text macro="title"/>
+ <text variable="container-title" font-style="italic" form="short"/>
+ <text macro="locators"/>
+ <text macro="page"/>
+ <text macro="issued"/>
+ <text macro="status"/>
+ </group>
+ <choose>
+ <if variable="URL DOI" match="none">
+ <text value="."/>
+ </if>
+ <else>
+ <text value=","/>
+ </else>
+ </choose>
+ <text macro="access"/>
+ </if>
+ <else-if type="paper-conference speech" match="any">
+ <group delimiter=", " suffix=", ">
+ <text macro="title"/>
+ <text macro="event"/>
+ <text macro="editor"/>
+ </group>
+ <text macro="collection"/>
+ <group delimiter=", " suffix=".">
+ <text macro="publisher"/>
+ <text macro="issued"/>
+ <text macro="page"/>
+ <text macro="status"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="chapter">
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <group delimiter=" ">
+ <text term="in" suffix=" "/>
+ <text variable="container-title" font-style="italic"/>
+ </group>
+ <text macro="locators"/>
+ <text macro="editor"/>
+ <text macro="collection"/>
+ <text macro="publisher"/>
+ <text macro="issued"/>
+ <text macro="page"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="report">
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <text macro="publisher"/>
+ <group delimiter=" ">
+ <text variable="genre"/>
+ <text variable="number"/>
+ </group>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="thesis">
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <text variable="genre"/>
+ <text macro="publisher"/>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="webpage post-weblog post" match="any">
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <text variable="container-title"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="patent">
+ <group delimiter=", ">
+ <text macro="title"/>
+ <text variable="number"/>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <!-- Online Video -->
+ <else-if type="motion_picture">
+ <text macro="geographic-location" suffix=". "/>
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <!-- Generic/Fallback Formats -->
+ <else-if type="bill book graphic legal_case legislation report song" match="any">
+ <group delimiter=", " suffix=". ">
+ <text macro="title"/>
+ <text macro="locators"/>
+ </group>
+ <text macro="collection"/>
+ <group delimiter=", " suffix=".">
+ <text macro="publisher"/>
+ <text macro="issued"/>
+ <text macro="page"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any">
+ <group delimiter=", " suffix=".">
+ <text macro="title"/>
+ <text variable="container-title" font-style="italic"/>
+ <text macro="locators"/>
+ <text macro="publisher"/>
+ <text macro="page"/>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else-if>
+ <else>
+ <group delimiter=", " suffix=". ">
+ <text macro="title"/>
+ <text variable="container-title" font-style="italic"/>
+ <text macro="locators"/>
+ </group>
+ <text macro="collection"/>
+ <group delimiter=", " suffix=".">
+ <text macro="publisher"/>
+ <text macro="page"/>
+ <text macro="issued"/>
+ </group>
+ <text macro="access"/>
+ </else>
+ </choose>
+ </layout>
+ </bibliography>
+</style>
diff --git a/common.html b/common.html
new file mode 100644
index 0000000..24f7c2f
--- /dev/null
+++ b/common.html
@@ -0,0 +1,14 @@
+<!-- change this! -->
+<link
+ rel="alternate"
+ type="application/rss+xml"
+ title="Cool blog"
+ href="feed.rss"
+/>
+
+<link
+ rel="stylesheet"
+ href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css"
+ integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV"
+ crossorigin="anonymous"
+/>
diff --git a/dev b/dev
index c9a99df..09f414f 100755
--- a/dev
+++ b/dev
@@ -6,4 +6,4 @@ cd pub/
python -m http.server 8080 &
cd ..
-find md/ -type f -name "*.md" | entr ./gen
+find md/ md-priv/ -type f -name "*.md" | entr ./gen
diff --git a/gen b/gen
index da5dd6c..4e32dcf 100755
--- a/gen
+++ b/gen
@@ -2,8 +2,6 @@
set -e
-KATEX="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/"
-
mkdir -p pub/
rm -f res/diag/*
@@ -18,32 +16,63 @@ export MERMAID_FILTER_BACKGROUND="transparent"
export MERMAID_FILTER_LOC="res/diag"
export MERMAID_FILTER_IMAGE_CLASS="mermaid"
-ARGS="-A append.html -F mermaid-filter --toc --css style.css -t html -s --katex="$KATEX""
+ARGS="-A append.html -A common.html -F mermaid-filter --toc --css style.css -t html -s --citeproc --bibliography=bib.bib --biblatex --csl bib.csl -L ./server-katex/filter.lua"
+NHEAD=13
+
+function generate_index() {
+ pandoc --css index.css --css style.css -A common.html -t html "$1" -s -L ./server-katex/filter.lua -o "$2" &
+}
# public
+declare -A all_tags
+declare -A all_posts
for file in $(ls -1 md/*.md | sort -r); do
EXTRA=""
- plot="$(head -n10 "$file" | grep -m 1 plot | cut -c 7-)"
+ plot="$(head -n$NHEAD "$file" | grep -m 1 plot | cut -c 7-)"
[[ "$plot" = "true" ]] && EXTRA="-A plot.html"
name="$(basename $file | cut -f 1 -d '.')"
- pandoc $ARGS $EXTRA "$file" -o "pub/$name".html &
- title="$(head -n10 "$file" | grep -m 1 ^title | cut -c 8-)"
- date="$(head -n10 "$file" | grep -m 1 ^date | cut -c 6-)"
- author="$(head -n10 "$file" | grep -m 1 ^author | cut -c 8-)"
+ title="$(head -n$NHEAD "$file" | grep -m 1 ^title | cut -c 8-)"
+ tags="$(head -n$NHEAD "$file" | grep -m 1 ^tags | cut -c 7-)"
+ date="$(echo $name | rev | cut -c 4- | rev)"
+ pubdate="$(head -n$NHEAD "$file" | grep -m 1 ^date | cut -c 6-)"
+ author="$(head -n$NHEAD "$file" | grep -m 1 ^author | cut -c 8-)"
count="$(pandoc --lua-filter wordcount.lua "$file")"
- echo "- [$title]($name.html) $date · $count words · $author" >>pub/index.md
+ pandoc $ARGS $EXTRA "$file" -o "pub/$name".html &
+
+ post="- [$title]($name.html)"
+ post="$post<div>$date - $pubdate · $count words · $author</div><div class=tags>"
+
+ tags="$(echo "$tags" | tr "," "\n")"
+ while IFS= read -r tag; do
+ all_tags["$tag"]="$name"$'\n'"${all_tags["$tag"]}"
+ post="$post<a class=tag href='tag_$tag.html'>$tag</a>"
+ done <<<"$tags"
+
+ post="$post</div>"
+
+ all_posts["$name"]="$post"
+ echo "$post" >>pub/index.md
echo "generated $title"
done
+for tag in "${!all_tags[@]}"; do
+ cp index.md "pub/tag_$tag.md"
+ for name in ${all_tags[$tag]}; do
+ echo "${all_posts[$name]}" >>"pub/tag_$tag.md"
+ done
+ generate_index "pub/tag_$tag.md" "pub/tag_$tag.html"
+done
+
+generate_index pub/index.md pub/index.html
+
+echo "waiting..."
for job in $(jobs -p); do
wait "$job" || echo "$job failed"
done
-pandoc --css index.css --css style.css -t html pub/index.md -s --katex="$KATEX" -o pub/index.html
-
cp *.rss pub/
cp *.css pub/
cp -r res/ pub/
-rm pub/index.md
+echo "done!"
diff --git a/index.css b/index.css
index 4d41c21..52f0f93 100644
--- a/index.css
+++ b/index.css
@@ -31,6 +31,27 @@ ul li a:after {
white-space: pre;
}
+div.tags {
+ display: flex;
+ align-items: center;
+ text-align: center;
+ flex-wrap: wrap;
+}
+
+a.tag {
+ text-decoration: none;
+ background-color: var(--background-lighter);
+ color: var(--text-normal);
+ font-size: 0.8em;
+ padding: 5px 8px;
+ margin: 5px 5px 5px 0;
+ border-radius: 15px;
+}
+
+a.tag:visited {
+ color: var(--text-normal);
+}
+
.index-note {
display: table-footer-group;
}
diff --git a/md/2023-07-06-21.md b/md/2023-07-06-21.md
index c7a3c07..943129b 100644
--- a/md/2023-07-06-21.md
+++ b/md/2023-07-06-21.md
@@ -4,6 +4,7 @@ date: 2023-07-06
description: Showing the capabilities of Panblog!
lang: en-US
plot: true
+tags: blog,introduction
title: Capabilities of Panblog
---
@@ -33,7 +34,7 @@ void main() {
# $\LaTeX$
-Panblog supports $\LaTeX$!
+Panblog supports server-rendered $\LaTeX$!
$$\nabla x\nabla p\approx\hslash$$
$$x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$$
diff --git a/new b/new
index 1df0378..a3cba07 100755
--- a/new
+++ b/new
@@ -1,11 +1,13 @@
#!/bin/sh
+echo "Are you sure? Make sure you finished all your TODOs first!"
+
export DATE=$(date '+%Y-%m-%d')
name=$(date '+%Y-%m-%d-%H')
-cp -i template.md md/"$name".md
+cp -i template.md md-priv/"$name".md
-envsubst <md/"$name".md >md/tmp
-mv md/tmp md/"$name".md
+envsubst <md-priv/"$name".md >md-priv/tmp
+mv md-priv/tmp md-priv/"$name".md
-echo md/"$name".md
+echo md-priv/"$name".md
diff --git a/server-katex/filter.lua b/server-katex/filter.lua
new file mode 100644
index 0000000..1010217
--- /dev/null
+++ b/server-katex/filter.lua
@@ -0,0 +1,23 @@
+function Pandoc(doc)
+ local tmp_name = os.tmpname()
+ local math = assert(io.popen("deno run server-katex/math.ts > " .. tmp_name, "w"))
+ doc:walk({
+ Math = function(el)
+ if el.mathtype == 'DisplayMath' then
+ assert(math:write("d" .. el.text:gsub("\n", " ") .. "\n"))
+ else
+ assert(math:write("i" .. el.text:gsub("\n", " ") .. "\n"))
+ end
+ end
+ })
+ math:close()
+ local tmp = assert(io.open(tmp_name, "r"))
+ doc = doc:walk({
+ Math = function(el)
+ return pandoc.RawInline(FORMAT, tmp:read())
+ end
+ })
+ tmp:close()
+ os.remove(tmp_name)
+ return doc
+end
diff --git a/server-katex/math.ts b/server-katex/math.ts
new file mode 100644
index 0000000..7a5b891
--- /dev/null
+++ b/server-katex/math.ts
@@ -0,0 +1,18 @@
+import { readLines } from "https://deno.land/std@0.134.0/io/mod.ts";
+import katex from "https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.mjs";
+
+const macros = [];
+for await (const line of readLines(Deno.stdin)) {
+ try {
+ const output = katex.renderToString(line.slice(1), {
+ displayMode: line[0] == 'd',
+ throwOnError: false,
+ macros: macros,
+ strict: false,
+ fleqn: false
+ }).replace(/(\r\n|\n|\r)/gm, "");
+ console.log(output);
+ } catch (error) {
+ throw new Error(`Input: ${line}\n\nError: ${error}`);
+ }
+}
diff --git a/style.css b/style.css
index d4b0fb4..30cbf1c 100644
--- a/style.css
+++ b/style.css
@@ -9,6 +9,7 @@
--text-code: #f9f9f9;
--background-normal: #222222;
--background-code: #333333;
+ --background-lighter: #555555;
}
/* code highlighting */
@@ -41,6 +42,8 @@
code span.va { } /* Variable */
code span.vs { color: #cc9393; } /* VerbatimString */
code span.wa { color: #7f9f7f; font-weight: bold; } /* Warning */
+
+ code a.pp { color: #ffcfaf; font-weight: bold; text-decoration: underline; } /* Preprocessor */
}
@media (prefers-color-scheme: light) {
@@ -49,10 +52,11 @@
--text-code: #424242;
--background-normal: #fff;
--background-code: #eee;
+ --background-lighter: #ddd;
}
img[src$=".svg"].mermaid {
- filter: invert(1);
+ filter: invert(1) contrast(2);
}
img.graph {
@@ -88,6 +92,8 @@
code span.va { color: #000000; } /* Variable */
code span.vs { color: #4e9a06; } /* VerbatimString */
code span.wa { color: #8f5902; font-weight: bold; } /* Warning */
+
+ code a.pp { color: #8f5902; text-decoration: underline; } /* Preprocessor */
}
html {
@@ -118,6 +124,20 @@ body {
text-align: center;
}
+.smaller-font {
+ font-size: 17px;
+}
+
+.small-font {
+ font-size: 14px;
+}
+
+img[src$=".svg"].mermaid {
+ margin: 0 auto;
+ display: block;
+}
+
+
@media (max-width: 600px) {
body {
font-size: 0.86em;
@@ -282,10 +302,13 @@ hr {
}
table {
+ display: block;
margin: 1em auto;
border-collapse: collapse;
- overflow-x: auto;
font-variant-numeric: lining-nums tabular-nums;
+ overflow: auto;
+ width: fit-content;
+ max-height: 40vh;
}
table caption {
@@ -301,10 +324,14 @@ tbody {
th {
border-top: 1px solid #555555;
padding: 0.25em 0.5em 0.25em 0.5em;
+ background-color: var(--background-normal);
+ position: sticky;
+ top: 0;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
+ font-family: monospace;
}
header {
@@ -346,13 +373,20 @@ figure img[src$=".svg"] {
}
code, pre, div.sourceCode {
- white-space: pre-wrap;
background-color: var(--background-code);
color: var(--text-code);
border-radius: 8px;
margin: 0;
}
+.code-showcase, .code-showcase > * {
+ background-color: transparent;
+ margin: 0 auto;
+ width: fit-content;
+ max-width: 100%;
+ white-space: pre;
+}
+
span.smallcaps {
font-variant: small-caps;
}
@@ -431,3 +465,12 @@ div.popover div {
background-color: var(--background-code);
padding: 16px;
}
+
+details, button {
+ background-color: var(--background-code);
+ padding: 8px;
+ border-radius: 8px;
+ cursor: pointer;
+ color: var(--text-code);
+ border: 0;
+}