3 # Copyright 2023 Paul Hänsch
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12 # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15 # IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 . "$_EXEC/themes/default.sh"
20 local page="$1" title="$2" editor="false"
21 [ "${title#Editor: }" != "$title" ] && editor="true"
22 title="$(HTML "${title:-"${PAGE_TITLE:-"${page}"}"}")"
24 # Important! Web Server response including newline
25 printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
29 <html${LANGUAGE:+ lang=\"${LANGUAGE}\"}><head>
32 && printf '<link rel="stylesheet" type="text/css" href="%s">' \
33 "$_BASE/%5B.%5D/themes/simplemde/simplemde.css" \
34 "$_BASE/%5B.%5D/themes/simplemde/fakeawesome.css" \
35 && printf '<script src="%s"></script>' \
36 "$_BASE/%5B.%5D/themes/simplemde/simplemde.js"
38 <title>${title}</title>
39 </head><body id="$(HTML "${PATH_INFO}")">
43 $(if [ "$page" = '-' ]; then
52 && printf %s '<script>var simplemde = new SimpleMDE({
53 autoDownloadFontAwesome: false,
57 hideIcons: ["heading", "side-by-side", "fullscreen", "guide"],
58 showIcons: ["bold", "italic", "strikethrough", "heading-1", "heading-2", "heading-3",
59 "code", "unordered-list", "ordered-list", "table"],
61 horizontalRule: ["", "\n-----\n"],
62 image: ["![alt-text](", ".jpg)"],
64 table: ["", "\n| Col 1 | Col 2 | Col 3 |\n|------:|:-----:|:------|\n| Text | Text | Text |\n"]