[ "${page%/:*/}" = "${page%/:${LANGUAGE}/}" ] || continue
fi
acl_read "$page" || continue
- printf '<li><a href="%s">%s</a></li>' "$(URL "$page")" "$(HTML "$page")"
+ printf '%s\n' "$page"
done \
-| theme_page - <<-EOF
- <article>
- <h1>$(_ "Search results")</h1>
- <form method=GET>
- <input class="search" name="q" placeholder="$(_ Search)" value="$(HTML $words)"><button class="search" type="submit">$(_ Search)</button>
- </form>
- <ol class="searchresults">
- $(cat)
- </ol>
- </article>
- EOF
+| theme_search "${words% }"
theme_revisions(){ theme_page "$@"; }
+theme_search(){
+ local words="$*"
+ # STDIN: read result pages line by line
+
+ theme_page - <<-EOF
+ <article>
+ <h1>$([ "$words" ] && _ "Search results" || _ "Search" )</h1>
+ <form method=GET>
+ <input class="search" name="q" value="$(HTML $words)"><button class="search" type="submit">$(_ Search)</button>
+ </form>
+ <ol class="searchresults">
+ $( while read p; do
+ printf '<li><a href="%s">%s</a></li>' "$(URL "$p")" "$(HTML "$p")"
+ done)
+ </ol>
+ </article>
+ EOF
+}
+
theme_attachments(){
local page="$1" title
title="${page%/}"; title="${title##*/}"