From 35c700335c55a0819e3582a77211e3cb280f48fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 22 Sep 2023 17:50:03 +0200 Subject: [PATCH] themeable search page --- handlers/40_search.sh | 14 ++------------ themes/default.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) 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##*/}" -- 2.39.2