From f7720b2207b33fd60ef945662c261c1468e377f7 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 26 Jan 2023 00:30:53 +0900 Subject: Add feed and build recipe --- .gitignore | 4 ++++ Makefile | 38 ++++++++++++++++++++++++++++++++++++++ atom.xslt | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 13 +++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 atom.xslt create mode 100644 default.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..936e539 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.small.jpg +*/index.xhtml +atom.xml +result diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dcbd345 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +# Makefile for px.cnx.gdn +# Copyright (C) 2023 Nguyễn Gia Phong +# +# This program is licensed under CC BY-SA 4.0. + +SHELL = /bin/sh +PREFIX ?= /tmp/px.cnx.gdn + +PICTURES := $(filter-out %.small.jpg $(PREFIX)/%.jpg, $(wildcard */*.jpg)) +THUMBNAILS := $(patsubst %.jpg,%.small.jpg,$(PICTURES)) +DATA := $(wildcard */index.xml) +PAGES := $(patsubst %.xml,%.xhtml,$(DATA)) +OUTPUTS := $(THUMBNAILS) $(PAGES) atom.xml +ALL := $(OUTPUTS) $(PICTURES) index.xhtml favicon.png style.css + +all: $(OUTPUTS) + +%.small.jpg: %.jpg + epeg -w 1024 -p -q 80 $< $@ + +%.xhtml: %.xml page.xslt + xsltproc page.xslt $< > $@ + +atom.xml: atom.xslt $(DATA) $(wildcard *.svg) + xsltproc atom.xslt > atom.xml + +clean: + rm -f atom.xml */{index.xhtml,*.small.jpg} + +$(PREFIX)/%: % + install -Dm644 $< $@ + +install: all $(addprefix $(PREFIX)/,$(ALL)) + +uninstall: + rm -fr $(PREFIX) + +.PHONY: all clean install uninstall diff --git a/atom.xslt b/atom.xslt new file mode 100644 index 0000000..1bb4ecd --- /dev/null +++ b/atom.xslt @@ -0,0 +1,59 @@ + + + + + https://px.cnx.gdn/ + + + + + / + + + + + # + + + + + + <xsl:value-of select="translate(@id, '-', ' ')"/> + +
+ + {@desc} + +
+
+ +
+
+
+ + + + + + + favicon.png + + pix by cnx + + Nguyễn Gia Phong + https://cnx.gdn/ + mcsinyx@disroot.org + + CC BY-SA 4.0 + + + + + + + 2023-01-25T10:50:00Z + + +
diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..aba6cf9 --- /dev/null +++ b/default.nix @@ -0,0 +1,13 @@ +{ epeg, lib, libxslt, nix-gitignore, stdenvNoCC }: +stdenvNoCC.mkDerivation rec { + pname = "px.cnx.gdn"; + version = "latest"; + src = nix-gitignore.gitignoreSource [ ] ./.; + makeFlags = [ "PREFIX=$(out)" ]; + buildInputs = [ epeg libxslt ]; + enableParallelBuilding = true; + meta = { + homepage = "https://px.cnx.gdn"; + license = lib.licenses.cc-by-sa-40; + }; +} -- cgit 1.4.1