X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=themes%2Fdefault.sh;h=1830e26673ccd60c29e95a85f446143cce3dd18c;hb=f3d22dba45391ab591b38159a52cfa7cb803a03c;hp=6370166017775241ed9691cfca7c23c78b7282d7;hpb=4fb35b146e7aca6faf5945105ab36a270b7f1ad5;p=shellwiki diff --git a/themes/default.sh b/themes/default.sh index 6370166..1830e26 100755 --- a/themes/default.sh +++ b/themes/default.sh @@ -1,27 +1,124 @@ #!/bin/sh -theme_404(){ - printf "%s\r\n" "Status: 404 Not Found" +. "$_EXEC/tools.sh" + +theme_head(){ + printf ' + + + + ' "$_BASE" +} + +theme_header(){ + printf '
%s
' "$(wiki '[wiki]/header/')" +} - theme_page '/[404]/' +theme_footer(){ + printf '' "$(wiki '[wiki]/footer/' ||echo No footer)" } theme_page(){ local page="$1" title title="${page%/}"; title="${title##*/}" + # Important! Web Server response including newline printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" cat <<-EOF - - + $(theme_head) $(HTML "${title}") -
-
$(wiki "$page" || printf 'Page not found')
- + $(theme_header) +
+ +
+ $(wiki "$page" || printf 'Page not found') +
+
+ $(theme_footer) EOF } + +theme_editor(){ + local page="$1" title + title="${page%/}"; title="${title##*/}" + + # Important! Web Server response including newline + printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" + + cat <<-EOF + + + $(theme_head) + $(HTML "${title}") + + $(theme_header) +
+ + + + +
+ $(theme_footer) + + EOF +} + +theme_attachments(){ + local page="$1" title + title="${page%/}"; title="${title##*/}" + + # Important! Web Server response including newline + printf "%s\r\n" "Content-Type: text/html; charset=utf-8" "" + + cat <<-EOF + + + $(theme_head) + Attachments $(HTML "${title}") + + $(theme_header) +
+
+ + +
+ + +
+ $(theme_footer) + + EOF +} + +theme_login(){ + theme_page '[wiki]/login/' +} + +theme_register(){ + theme_page '[wiki]/register/' +} + +theme_404(){ + printf "%s\r\n" "Status: 404 Not Found" + + theme_page '[wiki]/404/' +}