commit 7b4d8efbf7235f3466936751530c52382615afb0 from: Omar Polo date: Fri Feb 04 16:50:03 2022 UTC initial import commit - /dev/null commit + 7b4d8efbf7235f3466936751530c52382615afb0 blob - /dev/null blob + 4de1a4ea84f7a428e8af311110ce585f30531a32 (mode 644) --- /dev/null +++ .gitignore @@ -0,0 +1 @@ +Makefile.local blob - /dev/null blob + 009f6dcf186d7888a558be5b95c5636355d4a093 (mode 644) --- /dev/null +++ Makefile @@ -0,0 +1,38 @@ +# sed -n 's/^ //p' $? > $@ + +.PHONY: all install publish + +all: + @echo "usage:" + @echo " - install: install/replace the files in the system" + @echo " - publish: generate gemini and www version of the files" + @echo " - serve-gem: serve the gem directory" + @echo " - serve-www: serve the www directory" + @echo " - upload: publish the files on the geminispace and the web" + @echo " - clean: undo publish" + +include Makefile.local + +install: ${DOTFILES} + +www: style.css + mkdir -p www + cp style.css www + +gem: + mkdir gem + +publish: gem ${GEMFILES} www ${WWWFILES} + +serve-gem: publish + gmid -p 1966 gem + +serve-www: publish + python3 -m http.server --directory www 8888 + +upload: + rsync --delete -a gem/ op:gemini/dots.omarpolo.com + rsync --delete -a www/ op:sites/dots.omarpolo.com + +clean: + rm -rf gem www blob - /dev/null blob + 7fb2bd61bf20fdc022eeaaff4aa91f4763fd9df2 (mode 644) --- /dev/null +++ footer.html @@ -0,0 +1,2 @@ + + blob - /dev/null blob + 9df578d621d4569af579205413567aab897d2467 (mode 755) --- /dev/null +++ gc @@ -0,0 +1,22 @@ +#!/usr/bin/awk -f +# +# gc - gemini-fy code + +/^\t/ { + if (!pre) { + pre = 1 + print "```" + } + print substr($0, 2) + next +} + +// { + if (pre) { + pre = 0 + print "```" + } + print $0 +} + +END { if (pre) print "```" } blob - /dev/null blob + 61c3f929155e7eb519489c8869706b0dfc703a5a (mode 755) --- /dev/null +++ gem2html @@ -0,0 +1,102 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2022 Omar Polo +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +use v5.10; +use strict; +use warnings; + +my $in_pre = 0; +my $in_list = 0; + +while (<>) { + chomp; + if ($in_pre && m/^```/) { + $in_pre = 0; + say ""; + } elsif (!$in_pre && m/^```/) { + if ($in_list) { + $in_list = 0; + say ""; + } + $in_pre = 1; + print "
";
+	} elsif ($in_pre) {
+		say san($_);
+	} elsif ($in_list && m/^$/) {
+		say "";
+		$in_list = 0;
+	} elsif (m/^\*\s+(.*)/) { # NB: at least one space
+		if (!$in_list) {
+			$in_list = "item";
+			say "
    "; + } elsif ($in_list eq "link") { + $in_list = "item"; + say "
"; + say "
    "; + } + output("li", $1); + } elsif (m/^=>\s*([^\s]*)\s*(.*)$/) { + if (!$in_list) { + $in_list = "link"; + say ""; + say "