X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;ds=sidebyside;f=themes%2Fdefault.sh;h=56b57aed24eb505669d742cca13fde2f9660ae3f;hb=5188614dbad08cce02ab53910d9252b0007f228f;hp=6370166017775241ed9691cfca7c23c78b7282d7;hpb=6c8a69b3a84e68dd86f16ec23913c3d2c77d0755;p=shellwiki
diff --git a/themes/default.sh b/themes/default.sh
index 6370166..56b57ae 100755
--- a/themes/default.sh
+++ b/themes/default.sh
@@ -1,27 +1,74 @@
#!/bin/sh
-theme_404(){
- printf "%s\r\n" "Status: 404 Not Found"
+theme_head(){
+ printf '
+
+
+ ' "$_BASE"
+}
- theme_page '/[404]/'
+theme_header(){
+ printf '' "$(wiki '[wiki]/header/')"
+}
+
+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 newline
printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
cat <<-EOF
-
-
+ $(theme_head)
$(HTML "${title}")
-
+ $(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 newline
+ printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
+
+ cat <<-EOF
+
+
+ $(theme_head)
+ $(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/'
+}