aboutsummaryrefslogtreecommitdiff
path: root/pastebin
diff options
context:
space:
mode:
Diffstat (limited to 'pastebin')
-rwxr-xr-xpastebin/new.sh23
-rw-r--r--pastebin/skeleton.org5
-rw-r--r--pastebin/template.org3
3 files changed, 31 insertions, 0 deletions
diff --git a/pastebin/new.sh b/pastebin/new.sh
new file mode 100755
index 0000000..b792e33
--- /dev/null
+++ b/pastebin/new.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -eo pipefail
+cd "$(dirname ${BASH_SOURCE[0]})"
+
+OUTDIR="../site/pastebin"
+
+# Taken from:
+# https://stackoverflow.com/a/49035906
+slugify () {
+ echo "$1" | iconv -t ascii//TRANSLIT | sed -r s/[~\^]+//g | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
+}
+
+if [[ -z "$1" ]]; then
+ printf "Type the pastebin title: "
+ read title
+else
+ title="$1"
+fi
+
+slug=$(slugify "$title")
+
+export title
+cat skeleton.org | envsubst > "$OUTDIR/$slug.org"
diff --git a/pastebin/skeleton.org b/pastebin/skeleton.org
new file mode 100644
index 0000000..8349906
--- /dev/null
+++ b/pastebin/skeleton.org
@@ -0,0 +1,5 @@
+#+SETUPFILE: ../../pastebin/template.org
+#+TITLE: $title
+#+BEGIN_SRC FIXME -n
+FIXME
+#+END_SRC
diff --git a/pastebin/template.org b/pastebin/template.org
new file mode 100644
index 0000000..3856724
--- /dev/null
+++ b/pastebin/template.org
@@ -0,0 +1,3 @@
+#+BIND: org-html-postamble-format (("en" "<p class=\"postamble\">%T</p>")))
+#+HTML_HEAD: <style>#postamble{ text-align: center; }</style>
+#+HTML_HEAD: <style>pre {white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;}</style>