From 7868172cb1b9fa07bc4cef89992b7382ec5c7c60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Thu, 26 Aug 2021 01:01:53 +0200 Subject: [PATCH] use external comment script --- .gitignore | 1 + poll.sh | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index d891078..5f74930 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ serverkey [0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=][0-9a-zA-Z:=] +comments/ diff --git a/poll.sh b/poll.sh index bb5bc8d..7ab0e9d 100644 --- a/poll.sh +++ b/poll.sh @@ -1,5 +1,7 @@ #!/bin/sh +. "${_EXEC}/comments.sh" + id="$(checkid "${PATH_INFO#/}")" file="${_DATA}/${id}" @@ -223,19 +225,24 @@ else pagename="$(pagename "$id")" yield_page "$pagename" poll <<-EOF - [form method=POST + [main [section .description [h1 .title $(HTML "$pagename")] $(DBM "$file" get description |markdown) ] - $(table_poll || printf '[p Poll parameters are invalid]') - $(if [ "$admin" ]; then - printf '[section .bookmark You have bookmarked the admin page of this poll: [a href="./%s" modify poll]]' "$(URL ${id}/${admin})" - elif [ "$bookmarks" ]; then - printf '[section .bookmark This poll has been bookmarked and is accessible via a link on the front page.]' - else - printf '[section .bookmark Polls are accessible only via their URL. You can set a Cookie to bookmark all polls you visit. Bookmarked polls will be listed on the frontpage.
[submit "bookmark" "add" Set Cookie]]' - fi) + [form method=POST + $(table_poll || printf '[p Poll parameters are invalid]') + + $(if [ "$admin" ]; then + printf '[section .bookmark You have bookmarked the admin page of this poll: [a href="./%s" modify poll]]' "$(URL ${id}/${admin})" + elif [ "$bookmarks" ]; then + printf '[section .bookmark This poll has been bookmarked and is accessible via a link on the front page.]' + else + printf '[section .bookmark Polls are accessible only via their URL. You can set a Cookie to bookmark all polls you visit. Bookmarked polls will be listed on the frontpage.
[submit "bookmark" "add" Set Cookie]]' + fi) + ] + + $(w_comments) ] EOF fi -- 2.39.2