X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=23b03f25552b86ba2e6e3fc03a2c46d322e4cbba;hb=532b6743da019906f2f00575d246823c66ec35fd;hp=85febeef60e7274563a2e62c0d59698e7088bb12;hpb=9c519c632b087f02c32458ac5b397f83ac476a23;p=shellwiki diff --git a/themes/default.sh b/themes/default.sh index 85febee..23b03f2 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -108,17 +108,21 @@ theme_editor(){ $(for file in "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments"/* "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments"/*; do [ "$file" = "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" \ -a -f "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" ] && continue + att="$(HTML "${file##*/}")" + url="$(printf %s\\n "${file##*/}" |sed 's;[\\<>];\\&;g' |HTML)" + name="$(printf %s\\n "${file##*/}" |sed 's;[]\\[];\\&;g' |HTML)" case ${file##*/} in \*) continue;; *.[pP][nN][gG]|*.[jJ][pP][gG]|*.[jJ][pP][eE][gG]|*.[gG][iI][fF]) [ "$page" != "${page%/:$LANGUAGE/}" ] && p=../ || p='' - att="$(HTML "${file##*/}")" - printf '

![](%s)

' \ - "$p" "$att" "$att" "$att" "$att" "$att" "$att" "$att" + printf '

![](<%s>)

' \ + "$p" "$att" "$url" "$name" "$url" "$name" "$url" "$url" ;; *) - att="$(HTML "${file##*/}")" - printf '

[%s](%s)

' "$att" "$att" + printf '

[%s](<%s>)

' "$name" "$url" ;; esac done) @@ -131,6 +135,25 @@ theme_editor(){ theme_revisions(){ theme_page "$@"; } +theme_search(){ + local words="$*" + # STDIN: read result pages line by line + + theme_page - <<-EOF +
+

$([ "$words" ] && _ "Search results" || _ "Search" )

+ +
    + $( while read p; do + printf '
  1. %s
  2. ' "$(URL "$p")" "$(HTML "$p")" + done) +
+
+ EOF +} + theme_attachments(){ local page="$1" title title="${page%/}"; title="${title##*/}"