diff options
author | Christos <christos@bauherren.ovh> | 2025-01-01 00:07:38 +0000 |
---|---|---|
committer | Christos <christos@bauherren.ovh> | 2025-01-01 00:07:38 +0000 |
commit | ca1b2ce4289980e4e8d3d20fac5ef09ec6dd213b (patch) | |
tree | 17c54717a8d76e8804291ecf56a218d1ba90095d /cork-base.rc |
First commit
Diffstat (limited to 'cork-base.rc')
-rw-r--r-- | cork-base.rc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/cork-base.rc b/cork-base.rc new file mode 100644 index 0000000..1beacf7 --- /dev/null +++ b/cork-base.rc @@ -0,0 +1,77 @@ +#!/bin/rc +path=(. /bin) +fn run { + lpaf=home$REQUEST_URI + rpafs='/'; wd='/'; ifs='/'; + arg = `{echo $REQUEST_URI} + if (test -d $lpaf) { + lpaf=$lpaf^'i' + } + for (i in $arg) { + wd=$wd^$i + rpafs=($rpafs $wd) + wd=$wd'/' + } + echo; + for (h in $bar) { $$h } + mh $lpaf.md +} +fn sbar { + echo -n 'ENTER HTML PREAMBLE HERE' + ls -F home/./$rpafs | sed -e 's,/+\./+,/,g' \ + -e '/\/i\.(md)$/d' \ + -e 's/\.(md)$//' -e 's!^home!!' | sort | awk -F/ ' + function p(x, y, s) { for (i=0; i<x-y; i++) printf s } + BEGIN { lNF = 2 } + { + sub("/$", "", $0) + p(NF, lNF, "<ul>"); p(lNF, NF, "</ul><hr>") + lNF = NF; fp = $NF + printf "<li><a href=\%s\>%s</a>", $0, fp + } + END { p(lNF, 2, "</ul><hr>"); printf "</ul></nav></small><article>" }'} +fn add { + _l = $1^_^$#$1 + $_l = $*(2-) + $1 = ($$1 $_l) +} +add bar sbar; run + (avsbq) | cat cork-base +#!/bin/rc +path=(. /bin) +fn run { + lpaf=home$REQUEST_URI + rpafs='/'; wd='/'; ifs='/'; + arg = `{echo $REQUEST_URI} + if (test -d $lpaf) { + lpaf=$lpaf^'i' + } + for (i in $arg) { + wd=$wd^$i + rpafs=($rpafs $wd) + wd=$wd'/' + } + echo; + for (h in $bar) { $$h } + mh $lpaf.md +} +fn sbar { + echo -n '<style>img{width:150px;}nav li ul{padding-left:.5em}body{display:flex;flex-wrap:wrap;margin:20 24%}article{flex:1}nav{min-width:12em}ul{list-style: none}#t{flex:2;position:fixed;right:calc(5vw + 10px);width:222px;max-height:80vh;overflow-y:auto;box-sizing:border-box;background-color:#fff;z-index:10;}</style><meta charset=utf-8><small><nav><ul>' + ls -F home/./$rpafs | sed -e 's,/+\./+,/,g' \ + -e '/\/i\.(md)$/d' \ + -e 's/\.(md)$//' -e 's!^home!!' | sort | awk -F/ ' + function p(x, y, s) { for (i=0; i<x-y; i++) printf s } + BEGIN { lNF = 2 } + { + sub("/$", "", $0) + p(NF, lNF, "<ul>"); p(lNF, NF, "</ul><hr>") + lNF = NF; fp = $NF + printf "<li><a href=\%s\>%s</a>", $0, fp + } + END { p(lNF, 2, "</ul><hr>"); printf "</ul></nav></small><article>" }'} +fn add { + _l = $1^_^$#$1 + $_l = $*(2-) + $1 = ($$1 $_l) +} +add bar sbar; run |