dot

packages and services management
Log | Files | Refs | README

commit a4cc51e0947870cb896b54ab5ca87ebe477b60af
parent 6cc0f87e6dd2991623c68c91c459b73af44e4626
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 13 Apr 2018 00:18:09 +0200

simpler markdown alternative formatter

Diffstat:
DMakefile | 33---------------------------------
Abin/git-drag | 14++++++++++++++
Mbin/markup-fmt | 99+++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
Mbin/markup-html | 0
Mbin/xdg-open | 2+-
Aconfigure-git | 24++++++++++++++++++++++++
Aconfigure-symlinks | 19+++++++++++++++++++
Muri/people | 1+
8 files changed, 128 insertions(+), 64 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,33 +0,0 @@ -.PHONY: all -all: dirs config - -.PHONY: dirs -dirs: - mkdir -p ${HOME}/run - mkdir -p ${HOME}/var/http - mkdir -p ${HOME}/var/git - mkdir -p ${HOME}/var/gopher - mkdir -p ${HOME}/var/torrent - mkdir -p ${HOME}/var/mail - mkdir -p ${HOME}/var/iso - -.PHONY: config -config: - mkdir -p ${HOME}/.config/enchive - ln -fs /mnt/key/enchive.pub ${HOME}/.config/enchive/enchive.pub - ln -fs /mnt/key/enchive.sec ${HOME}/.config/enchive/enchive.sec - - mkdir -p ${HOME}/.ssh - cp ${PWD}/ssh/authorized_keys ${HOME}/.ssh/authorized_keys - ln -fs ${PWD}/ssh/config ${HOME}/.ssh/config - - ln -fs ${PWD}/profile ${HOME}/.profile - ln -fs ${PWD}/mpoprc ${HOME}/.mpoprc - ln -fs ${PWD}/msmtprc ${HOME}/.msmtprc - ln -fs ${PWD}/xinitrc ${HOME}/.xinitrc - ln -fs ${PWD}/git ${HOME}/.config/git - -.PHONY: git -git: - mkdir -p ${HOME}/var/git - (cd ${HOME}/var/git && xargs -n 1 git clone --bare) <git/repos diff --git a/bin/git-drag b/bin/git-drag @@ -0,0 +1,14 @@ +#!/bin/sh -ex + +# clone a repo with the .git dir in ~/var/git/bare-repo + +# usage: git xerox <uri> +# +# The `./.git` will then be a file pointing to some bare repo in +# the ~/var/git/<repo>.git directory. + +repo="${1##*@*[:/]}" + +mkdir -p "$HOME/var/git" + +git init --separate-git-dir="$HOME" diff --git a/bin/markup-fmt b/bin/markup-fmt @@ -1,75 +1,114 @@ #!/usr/bin/awk -f -function fold(block) +function fold(block, prefix) { - while ((line = substr(block, 1, 80)) != "") { - sub(" +[^ ]*$", "", line); - print(line); + len = length(prefix); + gsub("\t", " ", block); + sub("^ *", "", block); + sub(" *$", "", block); + gsub(" +", " ", block); + gsub("[.!?] ", "& ", block); + while ((line = substr(block, 1, 80 - len)) != "") { + if (length(line) == 80 - len) + sub(" +[^ ]*$", "", line); + print(prefix line); block = substr(block, length(line) + 1); sub("^ *", "", block); } } -function paragraph(block) +function paragraph(block, prefix) { + if (!block) + return; print(""); - if (match(block, "^\\*\\*[^*]*\\*\\*:") { + sub("^ *", "", block); + if (match(block, "^\\*\\*[^*]*\\*\\*:")) { print(substr(block, 1, RLENGTH)); block = substr(block, RLENGTH + 1); } - sub(" *$", "", block); - gsub(" +", " ", block); - fold(block); + fold(block, prefix); } function title(block) { + if (!block) + return; fold(block); half = "========================================"; print(half half); } -function subtitle(str) +function heading(block) { - printf("\n\n### "); - fold(str); + if (!block) + return; + print("\n"); + fold(block); + half = "----------------------------------------"; + print(half half); } -BEGIN { - block = ""; +function subheading(str) +{ + print("\n\n### " str); } -/^[ \t]*$/ { - if (block) paragraph(block); - block = ""; next; +/^\t/ { + paragraph(block, ""); block = ""; + print(""); + while(match($0, /^\t/)) { + print; + if (!getline) break; + } } -/^\t+[^ \t]$/ { - while(match($0, /^\t+[^ \t]$/)) { +/^>/ { + paragraph(block, ""); block = ""; + while(sub(/^> */, "")) { + block = block " " $0; + if (!getline) exit; } - + paragraph(block, "> "); block = ""; +} + +/^\[.*\]:/ { + paragraph(block, ""); block = ""; + print(""); + while (match($0, /^\[.*\]:/)) { + print; + if (!getline) exit; + } +} + +/^[ \t]*$/ { + paragraph(block, ""); block = ""; next; } /^=+$/ { - if (block) title(block); - block = ""; next; + title(block); block = ""; next; } /^-+$/ { - if (block) heading(block); - block = ""; next; + heading(block); block = ""; next; +} + +sub(/^# +/, "") { + paragraph(block, ""); block = ""; title(block " " $0); next; +} + +sub(/^## +/, "") { + paragraph(block, ""); block = ""; heading($0); next; } -sub(/^#+ *$/, "") { - if (block) paragraph(block); - subheading($0); - block = ""; next; +sub(/^###+ */, "") { + paragraph(block, ""); block = ""; subheading($0); next; } { - block = block " " $0; next; + block = block " " $0; } END { - if (block) paragraph(block); + paragraph(block, ""); } diff --git a/bin/markup-html b/bin/markup-html diff --git a/bin/xdg-open b/bin/xdg-open @@ -132,7 +132,7 @@ case "$1" in [ "$port" = . ] && port="" || port="-p $port" [ "$user" = . ] && user="" || user="$user@" [ "$pass" = . ] && pass="" || pass="$" - exec xdg-abduco "$1" ssh -Y $port "$user$host" + exec xdg-abduco "$1" ssh $port "$user$host" ;; (telnet://*) exec xdg-abduco "$1" telnet "$port" "$host" diff --git a/configure-git b/configure-git @@ -0,0 +1,24 @@ +#!/bin/sh -x + +mkdir -p "$HOME/var/git" || exit 1 +cd "$HOME/var/git" || exit 1 + +git clone --bare git://josuah.net/alphabet.git +git clone --bare git://josuah.net/atelier-fu.fr.git +git clone --bare git://josuah.net/cgr.git +git clone --bare git://josuah.net/cyberia.systems.git +git clone --bare git://josuah.net/distor.git +git clone --bare git://josuah.net/dmux.git +git clone --bare git://josuah.net/drawille-el.git +git clone --bare git://josuah.net/eel.git +git clone --bare git://josuah.net/etc.git +git clone --bare git://josuah.net/ff2txt.git +git clone --bare git://josuah.net/fungus-pathogen.git +git clone --bare git://josuah.net/iomenu.git +git clone --bare git://josuah.net/josuah.net.git +git clone --bare git://josuah.net/mail.git +git clone --bare git://josuah.net/miniwi.git +git clone --bare git://josuah.net/music.git +git clone --bare git://josuah.net/ploot.git +git clone --bare git://josuah.net/pot.git +git clone --bare git://josuah.net/util.git diff --git a/configure-symlinks b/configure-symlinks @@ -0,0 +1,19 @@ +#!/bin/sh -ex + +cd "${0%/*}" + +mkdir -p ${HOME}/run + +mkdir -p ${HOME}/.config/enchive +ln -fs /mnt/key/enchive.pub ${HOME}/.config/enchive/enchive.pub +ln -fs /mnt/key/enchive.sec ${HOME}/.config/enchive/enchive.sec + +mkdir -p ${HOME}/.ssh +cp ${PWD}/ssh/authorized_keys ${HOME}/.ssh/authorized_keys +ln -fs ${PWD}/ssh/config ${HOME}/.ssh/config + +ln -fs ${PWD}/profile ${HOME}/.profile +ln -fs ${PWD}/mpoprc ${HOME}/.mpoprc +ln -fs ${PWD}/msmtprc ${HOME}/.msmtprc +ln -fs ${PWD}/xinitrc ${HOME}/.xinitrc +ln -fs ${PWD}/git ${HOME}/.config/git diff --git a/uri/people b/uri/people @@ -25,5 +25,6 @@ http://www.researchgate.net/profile/Kazuhiro_Oiwa ssh://josuah@nas.josuah.net ssh://josuah@rpi.josuah.net ssh://josuahdemangeon@grex.org +ssh://root@localhost ssh://root@localhost:10000 ssh://root@nas.josuah.net