about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2023-03-18 04:28:55 +0900
committerNguyễn Gia Phong <mcsinyx@disroot.org>2023-03-18 04:28:55 +0900
commit38972ae499826bc61e56f52fa74ced447c5dd056 (patch)
tree41d999d3c96986a58a7871ca9015fb1ffe3236dd
parent5b56f1c5e757fc7165efac2b0c9e14583095ad81 (diff)
downloadsite-38972ae499826bc61e56f52fa74ced447c5dd056.tar.gz
Automate generation process
-rw-r--r--.gitignore3
-rw-r--r--Makefile25
-rw-r--r--README.md4
-rw-r--r--shell.nix2
-rw-r--r--xhtml.xslt19
5 files changed, 50 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 2d19fc7..ab47213 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-*.html
+gemini/
+www/
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d865ae7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+SHELL = /bin/sh
+
+MD = $(shell find . -name '[!README]*.md')
+GMI := $(patsubst %.md,gemini/%.gmi,$(MD:./%=%))
+XHTML := $(patsubst %.md,www/%.xhtml,$(MD:./%=%))
+
+all: gemini www
+
+%/:
+	mkdir $@
+
+gemini/%.gmi: %.md
+	md2gemini --links=paragraph < $< > $@
+
+gemini: gemini/ $(GMI)
+
+www/%.xhtml: %.md
+	makepage < $< | xsltproc xhtml.xslt - > $@
+
+www: www/ $(XHTML)
+
+clean:
+	rm -f $(GMI) $(XHTML)
+
+.PHONY: all gemini www
diff --git a/README.md b/README.md
index 952f856..035689a 100644
--- a/README.md
+++ b/README.md
@@ -10,11 +10,13 @@ interoperability, privacy and reproducibility
 
 ## services
 
+* cgit (git web frontend) at [trong.loang.net](https://trong.loang.net)
 * dendrite (matrix server)
   at [loang.net](https://loang.net/_matrix/federation/v1/version)
 * element (matrix client) at [than.loang.net](https://than.loang.net)
 * ipfs node and gateway at [loang.net](https://loang.net)
 * knot (authoritative name server) at danh.loang.net
+* laminar (automation logs) at [xong.loang.net](https://xong.loang.net)
 * molly brown (gemini server) at [loang.net](gemini://loang.net)
 * nginx (web server) at [loang.net](https://loang.net)
 * nix environment (through ssh) at [loang.net:2211](ssh://loang.net:2211)
@@ -23,7 +25,7 @@ interoperability, privacy and reproducibility
 
 ## contacts
 
-* matrix room: [#meta:loang.net](matrix:r/meta:loang.net)
+* matrix room: [#chung:loang.net](matrix:r/chung:loang.net)
 * mailing list: [~cnx/loang@lists.sr.ht](https://lists.sr.ht/~cnx/loang)
 * tickets: [~cnx/loang@todo.sr.ht](https://todo.sr.ht/~cnx/loang)
 
diff --git a/shell.nix b/shell.nix
index d9a4d65..bbadc58 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,4 +1,4 @@
 with import <nixpkgs> {};
 mkShell {
-  nativeBuildInputs = [ discount md2gemini ];
+  nativeBuildInputs = [ discount libxslt md2gemini ];
 }
diff --git a/xhtml.xslt b/xhtml.xslt
new file mode 100644
index 0000000..2bdb370
--- /dev/null
+++ b/xhtml.xslt
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:xhtml="http://www.w3.org/1999/xhtml"
+                xmlns="http://www.w3.org/1999/xhtml"
+                exclude-result-prefixes="xhtml">
+  <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
+  <xsl:strip-space elements="*"/>
+  <xsl:template match="/xhtml:html">
+    <html lang="en">
+      <head>
+        <meta name="color-scheme" content="dark light"/>
+        <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
+        <link rel="icon" href="data:,"/>
+        <title><xsl:value-of select="(//xhtml:h1)[1]"/></title>
+      </head>
+      <xsl:copy-of select="xhtml:body"/>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>