diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..32fe4a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +# Copyright (C) 2022 Ivan Polyakov +# +# This file is part of vilor's website. +# +# Vilor's website is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Vilor's website is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +include config.mk + +DIRS := $(shell find $(SRCDIR)/pages/* -type d | sed 's/$(SRCDIR)\/pages/$(OUTDIR)/') + +SRCPAGES := $(shell find $(SRCDIR)/pages/* -name '*.scm') + +SRCSTYLES := $(shell find $(SRCDIR)/styles/* -name '*.scm') +OUTSTYLES := $(shell find $(SRCDIR)/styles/ -type f -name '*.scm' | sed 's/$(SRCDIR)\/styles/$(OUTDIR)/') +OUTSTYLES := $(OUTSTYLES:%.scm=%.css) + +SRCJS := $(shell find $(SRCDIR)/scripts/* -name '*.js') +OUTJS := $(shell find $(SRCDIR)/scripts/ -type f -name '*.js' | sed 's/$(SRCDIR)\/scripts/$(OUTDIR)/') + +all: $(OUTDIR) $(STATICDIR) pages $(OUTSTYLES) $(OUTJS) + +pages: $(SRCPAGES) + for page in $(SRCPAGES) ; do \ + $(SCHEME) $(SCHEMEFLAGS) $$page \ + | sed -f scripts/minify-html.sed \ + > $$(echo $$page | sed 's/.*\/pages/dist/' | sed 's/scm/xhtml/') \ + ; done + +$(OUTSTYLES): $(SRCSTYLES) + $(SCHEME) $(SCHEMEFLAGS) $< > $@ + +$(OUTJS): $(SRCJS) + for script in $(SRCJS) ; do \ + cp $$script $$(echo $$script | sed 's/.*\/scripts/dist/') \ + ; done + +$(OUTDIR): + mkdir -p $(OUTDIR) + mkdir -p $(DIRS) + +$(STATICDIR): $(OUTDIR) + cp -rf $@/* $< || echo $(STATICDIR) "dir is empty" + cp COPYING dist/ + +clean: + rm -rf $(OUTDIR) + +.PHONY: all $(OUTDIR) $(STATICDIR) clean diff --git a/README.md b/README.md index 1702d69..91c3905 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,14 @@ website Dependencies ------------ Chicken Scheme: http://www.call-cc.org/ -Hyde egg: http://wiki.call-cc.org/eggref/5/hyde +sxml-serializer egg: http://wiki.call-cc.org/eggref/5/sxml-serializer +scss egg: http://wiki.call-cc.org/eggref/5/scss -Usage ------ -See `hyde --help`. +Building +-------- +``` + make +``` License ------- diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..4294469 --- /dev/null +++ b/config.mk @@ -0,0 +1,23 @@ +# Copyright (C) 2022 Ivan Polyakov +# +# This file is part of vilor's website. +# +# Vilor's website is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Vilor's website is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SCHEME=csi +SCHEMEFLAGS=-s + +SRCDIR=src +STATICDIR=public +OUTDIR=dist diff --git a/hyde.scm b/hyde.scm deleted file mode 100644 index 154d81f..0000000 --- a/hyde.scm +++ /dev/null @@ -1,20 +0,0 @@ -;; Copyright (C) 2022 Ivan Polyakov -;; -;; This file is part of vilor's website. -;; -;; Vilor's website is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; Vilor's website is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -(import hyde) - -(output-dir "dist") diff --git a/scripts/minify-html.sed b/scripts/minify-html.sed new file mode 100644 index 0000000..5edf340 --- /dev/null +++ b/scripts/minify-html.sed @@ -0,0 +1 @@ +:a;N;$!ba;s/>\s*