dot

packages and services management
Log | Files | Refs | README

commit de1328c01e6d6c90f28a7de8392f7487f051612a
parent 2cabfe396d2b85d16632e515f8dd0dac71e003a1
Author: josuah <mail@josuah.net>
Date:   Mon,  2 Jan 2017 18:58:41 +0100

fixed www, updated iomenu

Diffstat:
M.local/bin/www | 45++++++++++++++++++++++-----------------------
M.local/share/build/iomenu | 2+-
2 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/.local/bin/www b/.local/bin/www @@ -4,75 +4,74 @@ LAYOUT="layout.html" +# 1: name of item being parsed +# 2: input remaining to parse + parse() { - item="$1" input="$2" - # print the input up to the next keyword, and shift position in input - printf %s "${input%%{{*}" + printf %s "${2%%{{*}" # check for remaining keywords - [ "${input##*{{*}" ] && return 0 + [ "${2##*{{*}" ] && return 0 # take the separator out of the keyword - input="${input#*{{}" + set -- "$1" "${2#*{{}" # execute the keyword action and print its output - case "${input%%\}\}*}" in + case "${2%%\}\}*}" in *content* ) - [ -f "$item/index.txt" ] && cat "$item/index.txt" + [ -f "$1/index.txt" ] && cat "$1/index.txt" ;; *list* ) - [ "$item" != '.' ] && list "$item" + [ "$1" != '.' ] && list "$1" ;; *nav* ) - parse "$item" "$(nav)" + parse "$1" "$(nav)" ;; *title* ) - printf %s "$item" | sed -r 's/^\.//; /^.+$/ s|^| > |; s|/| > |g' + printf %s "$1" | sed -r 's|^\.||; /^.+$/ s|^| > |; s|/| > |g' ;; *root* ) - if [ "$item" = '.' ] + if [ "$1" = '.' ] then printf '.' else - printf %s/ "$item" | sed 's_[^/]__g; s_/_../_g; s_/$__' + printf %s/ "$1" | sed 's|[^/]||g; s|/|../|g; s|/$||' fi ;; esac - parse "$item" "${input#*\}\}}" + parse "$1" "${2#*\}\}}" } -# # HTML list of the current directory content. -# + +# 1: directroy to list + list() { - dir="$1" - - printf '<ul>\n' + printf '<ul>\n' - ( # for cd not to affect current directory - cd "$dir" || exit + ( + cd "$1" || exit 1 find . -mindepth 1 -maxdepth 1 ! -name 'index.*' | sort | sed -r 's_..(.*)_<li><a href="\1">\1</a></li>_' ) - printf '</ul>' + printf '</ul>' } -# # HTML line of relative links to first level directory -# + nav() { find . -mindepth 1 -maxdepth 1 -type d ! -path '*/.*' | diff --git a/.local/share/build/iomenu b/.local/share/build/iomenu @@ -1,3 +1,3 @@ # Input/Output interactive menu and completion engine. -tar=http://repo.or.cz/iomenu.git/snapshot/e244fd10ca3775b1f1d70aa3eaf33173d27e638b.tar.gz +tar=http://repo.or.cz/iomenu.git/snapshot/0ddab4a350f95ea6704cf4b15e773fbbc3bdecaf.tar.gz