summaryrefslogtreecommitdiff
path: root/http/bin
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-08-13 16:33:51 +0100
committerJoe Carstairs <me@joeac.net>2026-08-13 16:33:51 +0100
commit62e6bab910297aa15d76eb735ce3dd9b5417e26e (patch)
treea98b5fb2c2663e08c21475b1092ccec395e2d87e /http/bin
parentf9272fdf3ea23070583c944b110a7b8f16c5a4ff (diff)
remove website/capsule content
Diffstat (limited to 'http/bin')
-rwxr-xr-xhttp/bin/blog110
-rwxr-xr-xhttp/bin/cut_longlog_meta34
-rwxr-xr-xhttp/bin/extract_longlog_meta34
-rwxr-xr-xhttp/bin/gmi2upphtml184
-rwxr-xr-xhttp/bin/lmtbin953744 -> 0 bytes
-rwxr-xr-xhttp/bin/mkws72
6 files changed, 0 insertions, 434 deletions
diff --git a/http/bin/blog b/http/bin/blog
deleted file mode 100755
index 46be82f..0000000
--- a/http/bin/blog
+++ /dev/null
@@ -1,110 +0,0 @@
-#!/bin/sh -e
-export PATH="$(dirname $(realpath $0)):$PATH"
-export BLOGS="$(realpath blogs)"
-export SRC="$(realpath src)"
-export LAYOUTS="$(realpath share/layouts)"
-
-usage()
-{
- >&2 cat << USAGE
-usage: blog -i LOG [-p POSTPROCESS_CMD] [-a EXTRACT_ARGS_CMD] [-l LAYOUT] [-t] [-f FILE_PATTERN]
-
-options:
-
- -a EXTRACT_ARGS_CMD
- If provided, a shell command to extract arguments to the layout from the
- source files. The shell will be provided with a variable, POST_TITLE.
-
- -f FILE
- If provided, a pattern for the files to process. Default: *.
-
- -i LOG
- The name of the source directory under \$BLOGS where log posts live.
-
- -l LAYOUT
- If provided, the layout under \$LAYOUTS to use for the generated
- upphtml files. If not provided, uses the default layout.
-
- -p POSTPROCESS_CMD
- If provided, a shell command to post-process the source files into
- upphtml. The shell will be provided with a variable, POST_TITLE.
-
- -t
- If enabled, use filenames as post titles
-USAGE
-}
-
-extract_args_cmd="head -n 0 | echo \"POST_TITLE=\\\"\${POST_TITLE}\\\"\""
-file_pattern="*"
-log_name=""
-layout_name="default"
-postprocess_cmd="echo"
-use_filenames_for_titles=0
-
-while getopts "a:f:i:l:p:t" opt
-do
- case $opt in
- a)
- extract_args_cmd="$OPTARG"
- ;;
- f)
- file_pattern="$OPTARG"
- ;;
- i)
- log_name="$OPTARG"
- ;;
- l)
- layout_name="$OPTARG"
- ;;
- p)
- postprocess_cmd="$OPTARG"
- ;;
- t)
- use_filenames_for_titles=1
- ;;
- esac
-done
-
-if [ -z "${log_name}" ]
-then
- usage
- exit 1
-fi
-
-if ! [ -d "${BLOGS}/${log_name}" ]
-then
- >&2 echo "there is no directory '${input_log}' under ${BLOGS}. options: $(ls common)"
- usage
- exit 1
-fi
-
-layout="${LAYOUTS}/${layout_name}.layout.upphtml"
-if [ "${layout_name}" = "default" ]
-then
- layout_ext=""
-else
- layout_ext=".${layout_name}"
-fi
-if ! [ -f "${layout}" ]
-then
- echo >&2 "Warning: no layout found at $(basename "${LAYOUTS}")/${layout_name}.layout.upphtml"
-fi
-
-mkdir -p "${SRC}/${log_name}"
-
-for entry in $(find -L "${BLOGS}/${log_name}" -type f -name "${file_pattern}")
-do
- basename="$(basename "$entry")"
- name="${basename%\.*}"
- dest="${SRC}/${log_name}/${name}${layout_ext}.upphtml"
- if [ $use_filenames_for_titles -eq 1 ]
- then
- export POST_TITLE="$name"
- cat "$entry" | eval "${postprocess_cmd}" > "$dest"
- else
- export POST_TITLE="$(grep -e "^# " -m 1 "$entry" | cut -c3-)"
- cat "$entry" | grep -e "^# " -v | eval "$postprocess_cmd" > "$dest"
- fi
- cat "$entry" | eval "$extract_args_cmd" > "${dest}.args"
- echo "Processed ${entry#$(dirname ${BLOGS})/} to ${dest#$(dirname ${SRC})/}"
-done
diff --git a/http/bin/cut_longlog_meta b/http/bin/cut_longlog_meta
deleted file mode 100755
index 914f455..0000000
--- a/http/bin/cut_longlog_meta
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh -e
-
-meta=""
-read_published_on=0
-while read line
-do
- meta="${meta}
-${line}"
- if [ "$(echo "$line" | cut -c1-14)" = "Published on: " ]
- then
- read_published_on=1
- break
- fi
-done
-
-if [ "$read_published_on" -eq 0 ]
-then
- echo "$meta"
- exit 0
-fi
-
-read line
-if [ "$(echo "$line" | cut -c1-14)" = "Updated: " ]
-then
- meta="${meta}
-${line}"
-else
- echo "$line"
-fi
-
-while read line
-do
- echo "$line"
-done
diff --git a/http/bin/extract_longlog_meta b/http/bin/extract_longlog_meta
deleted file mode 100755
index 054c994..0000000
--- a/http/bin/extract_longlog_meta
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh -e
-
-POST_TITLE="${POST_TITLE:-}"
-DATE_PUBLISHED=""
-DATE_UPDATED=""
-
-while read line
-do
- if [ "$(echo "$line" | cut -c1-2)" = "# " ]
- then
- POST_TITLE="$(echo "$line" | cut -c3-)"
- elif [ "$(echo "$line" | cut -c1-14)" = "Published on: " ]
- then
- DATE_PUBLISHED="$(date --date="$(echo "$line" | cut -c15-)" +%Y-%m-%d)"
- elif [ "$(echo "$line" | cut -c1-12)" = "Updated on: " ]
- then
- DATE_UPDATED="$(date --date="$(echo "$line" | cut -c13-)" +%Y-%m-%d)"
- fi
-done
-
-if [ -n "$POST_TITLE" ]
-then
- echo "POST_TITLE=\"${POST_TITLE}\""
-fi
-
-if [ -n "$DATE_PUBLISHED" ]
-then
- echo "DATE_PUBLISHED=\"${DATE_PUBLISHED}\""
-fi
-
-if [ -n "$DATE_UPDATED" ]
-then
- echo "DATE_UPDATED=\"${DATE_UPDATED}\""
-fi
diff --git a/http/bin/gmi2upphtml b/http/bin/gmi2upphtml
deleted file mode 100755
index 1631037..0000000
--- a/http/bin/gmi2upphtml
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/bin/sh -e
-
-post_title="${POST_TITLE:-}"
-
-is_in_list=0
-is_in_link_block=0
-is_in_preformatted_block=0
-is_in_blockquote=0
-
-if_in_list_then_close()
-{
- if [ $is_in_list -ne 0 ]
- then
- echo "</ul>"
- is_in_list=0
- fi
-}
-
-if_in_link_block_then_close()
-{
- if [ $is_in_link_block -ne 0 ]
- then
- echo "</p>"
- is_in_link_block=0
- fi
-}
-
-if_in_preformatted_block_then_close()
-{
- if [ $is_in_preformatted_block -ne 0 ]
- then
- echo "</pre>"
- is_in_preformatted_block=0
- fi
-}
-
-if_in_blockquote_then_close()
-{
- if [ $is_in_blockquote -ne 0 ]
- then
- echo "</blockquote>"
- is_in_blockquote=0
- fi
-}
-
-close_all_open_blocks()
-{
- if_in_list_then_close
- if_in_link_block_then_close
- if_in_preformatted_block_then_close
- if_in_blockquote_then_close
-}
-
-escape_upphtml()
-{
- echo "$1" \
- | sed "s/&/\\&amp;/g" \
- | sed "s/</\\&lt;/g" \
- | sed "s/>/\\&gt;/g" \
- | sed "s/\"/\\&quot;/g" \
- | sed "s/'/\\&#x27;/g" \
- | sed "s/\`/\\&#x60;/g" \
- | sed "s/\\\$/\\\\\$/g"
-}
-
-close_all_open_blocks_except()
-{
- except="$1"
- if [ "$except" != "list" ]
- then
- if_in_list_then_close
- fi
- if [ "$except" != "link" ]
- then
- if_in_link_block_then_close
- fi
- if [ "$except" != "pre" ]
- then
- if_in_preformatted_block_then_close
- fi
- if [ "$except" != "blockquote" ]
- then
- if_in_blockquote_then_close
- fi
-}
-
-if [ -z "$post_title" ]
-then
- read first_line
- if [ "$(echo "$first_line" | cut -c1-2)" != "# " ]
- then
- echo >&2 "Error: no [post_title] argument provided and no top-level heading at top of the document."
- exit 1
- fi
- post_title="${first_line### }"
-fi
-
-echo "#!
-export TITLE=\"${post_title} | joeac's blog\"
-export DESCRIPTION=\"${post_title} | joeac's blog\"
-pp \"\${SHARE}\"/components/meta.upphtml
-#!"
-
-while read line
-do
- if [ "$(echo $line | sed "s/[[:space:]]//g")" = "" ]
- then
- continue
- fi
-
- if [ "$(echo $line | cut -c1)" = "#" ]
- then
- title="$(escape_upphtml "${line#*# }")"
- heading="${line%%$title}"
- heading="${heading%% }"
- heading_level="${#heading}"
- if [ "$(echo "$line" | cut -c$(( $heading_level + 1 )) )" = " " ]
- then
- close_all_open_blocks
- echo "<h${heading_level}>${title}</h${heading_level}>"
- continue
- fi
- fi
-
- if [ "$(echo "$line" | cut -c1-2)" = "=>" ]
- then
- close_all_open_blocks_except link
- href="$(escape_upphtml "$(echo "$line" | sed "s/^=>[[:space:]]\+//" | sed "s/[[:space:]]\+.*//")")"
- title="$(escape_upphtml "${line#=> *${href}}")"
- title="${title:-${href}}"
- if [ $is_in_link_block -eq 0 ]
- then
- echo "<p>"
- else
- echo "<br/>"
- fi
- is_in_link_block=1
- echo "=> <a href='${href}'>${title}</a>"
- continue
- fi
-
- if [ "$( echo "$line" | cut -c1-2)" = "* " ]
- then
- close_all_open_blocks_except list
- if [ $is_in_list -eq 0 ]
- then
- echo "<ul>"
- fi
- is_in_list=1
- echo "<li>$(escape_upphtml "$(echo "$line" | cut -c3-)")</li>"
- continue
- fi
-
- if [ "$(echo "$line" | cut -c1)" = ">" ]
- then
- close_all_open_blocks_except blockquote
- if [ $is_in_blockquote -eq 0 ]
- then
- echo "<blockquote>"
- fi
- is_in_blockquote=1
- echo "<p>$(escape_upphtml "$(echo "$line" | cut -c2-)")</p>"
- continue
- fi
-
- if [ "$(echo "$line" | cut -c1-3)" = "\`\`\`" ]
- then
- close_all_open_blocks_except pre
- if [ $is_in_preformatted_block -eq 0 ]
- then
- echo "<pre>"
- else
- echo -e "\n"
- fi
- is_in_preformatted_block=1
- echo "$(escape_upphtml "$(echo "$line" | cut -c4-)")"
- continue
- fi
-
- close_all_open_blocks
- echo "<p>$(escape_upphtml "${line}")</p>"
-done
-
-close_all_open_blocks
diff --git a/http/bin/lmt b/http/bin/lmt
deleted file mode 100755
index e0e19ea..0000000
--- a/http/bin/lmt
+++ /dev/null
Binary files differ
diff --git a/http/bin/mkws b/http/bin/mkws
deleted file mode 100755
index 228109c..0000000
--- a/http/bin/mkws
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh -e
-export PATH="$(dirname $(realpath $0)):$PATH"
-
-usage() {
- >&2 printf "usage: %s url [pattern]\\n" "$(basename "$0")"
- exit 1
-}
-
-test $# -lt 1 && usage
-
-export SRC="$(realpath src)"
-export PUBLIC="$(realpath public)"
-export SHARE="$(realpath share)"
-export LAYOUTS="$(realpath share/layouts)"
-export DEFAULT_LAYOUT="${LAYOUTS}/default.layout.upphtml"
-export OUT="$(realpath out)"
-
-if ! test -f "${SRC}"/index.upphtml
-then
- >&2 printf "no index.upphtml file found\\n"
- exit 1
-fi
-
-PATH_PATTERN="${2:-*}"
-for t in $(find -L "${SRC}/" -type f -and -wholename "${PATH_PATTERN}" -and -name "*\.upp*" -and -not -name "*\.upp*\.*")
-do
- basename="$(basename "$t")"
- ext="${basename##*upp}"
-
- basename_without_ext="${basename%\.upp${ext}}"
- penultimate_segment="${basename_without_ext##*\.}"
- if [ "$basename_without_ext" != "$penultimate_segment" ] && [ -f "${LAYOUTS}/${penultimate_segment}.layout.upphtml" ]
- then
- layout="${LAYOUTS}/${penultimate_segment}.layout.upphtml"
- name="${basename%\.${penultimate_segment}\.upp${ext}}"
- else
- layout="${DEFAULT_LAYOUT}"
- name="${basename%\.upp${ext}}"
- fi
-
- in_dir="$(dirname "$t")/"
- rel_dir="${in_dir#${SRC}/}"
- mkdir -p "${OUT}/${rel_dir}/"
-
- args="$( [ -f "${t}.args" ] && cat "${t}.args" || echo "" )"
- if [ "$(head -n 1 "${layout}")" = "#!" ]
- then
- >"${layout}.tmp" echo "
-#!
-${args}
-$(tail -n +2 "${layout}")
-"
- else
- >"${layout}.tmp" echo "
-#!
-${args}
-#!
-$(cat "${layout}")
-"
- fi
- if [ "$ext" = "html" ]
- then
- pp "${layout}.tmp" "${t}" "${1}" > \
- "${OUT}/${rel_dir}/${name}.${ext}"
- else
- pp "${t}" "${1}" > \
- "${OUT}/${rel_dir}/${name}.${ext}"
- fi
- rm "${layout}.tmp"
-
- echo "Written ${OUT}/${rel_dir}${name}.${ext}"
-done