From: Paul Hänsch Date: Fri, 22 Sep 2023 15:50:03 +0000 (+0200) Subject: themeable search page X-Git-Url: http://git.plutz.net/?a=commitdiff_plain;h=35c700335c55a0819e3582a77211e3cb280f48fe;hp=9093deb385bb32eddd5149cd68c3eecb65a9c415;p=shellwiki themeable search page --- diff --git a/handlers/40_search.sh b/handlers/40_search.sh index 823ef76..d198f22 100644 --- a/handlers/40_search.sh +++ b/handlers/40_search.sh @@ -42,16 +42,6 @@ done \ [ "${page%/:*/}" = "${page%/:${LANGUAGE}/}" ] || continue fi acl_read "$page" || continue - printf '
  • %s
  • ' "$(URL "$page")" "$(HTML "$page")" + printf '%s\n' "$page" done \ -| theme_page - <<-EOF -
    -

    $(_ "Search results")

    -
    - -
    -
      - $(cat) -
    -
    - EOF +| theme_search "${words% }" diff --git a/themes/default.sh b/themes/default.sh index 85febee..5e38ee4 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -131,6 +131,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##*/}"