]> git.plutz.net Git - shellwiki/commitdiff
help and assist for editor
authorPaul Hänsch <paul@plutz.net>
Tue, 6 Jun 2023 14:45:34 +0000 (16:45 +0200)
committerPaul Hänsch <paul@plutz.net>
Tue, 6 Jun 2023 14:45:34 +0000 (16:45 +0200)
pages/[wiki]/editorhelp/#page.md [new file with mode: 0644]
themes/default.css
themes/default.sh

diff --git a/pages/[wiki]/editorhelp/#page.md b/pages/[wiki]/editorhelp/#page.md
new file mode 100644 (file)
index 0000000..930fda3
--- /dev/null
@@ -0,0 +1,31 @@
+### Formatting:
+
+\*\***strong**\*\*     \**emphasized*\*        `~~`~~strikethrough~~`~~`       \``verbatim`\`
+
+a backslash `\` prevents \*\*accidental formatting\*\*: \\\* \\\`
+
+### Links:
+
+Simple Weblink (use angle brackets): < <https://en.wikipedia.org/wiki/Markdown> >
+
+Simple Email Link: < <spam@example.com> >
+
+Weblink with Text: \[Wikipedia article\](https://en.wikipedia.org/wiki/Markdown) - [Wikipedia article](https://en.wikipedia.org/wiki/Markdown)
+
+Other pages on the same site:  
+[Start page](/): `[Start page](/)`, [Help](/[wiki]/editorhelp/): `[Help](/[wiki]/editorhelp/)`
+
+
+### Lists:
+
++----------------------------------+---------------------+
+|    [space] [dash] [space] [text] | - bullet            |
+|     - bullet                     | - list              |
+|     - list                       |   - indented point  |
+|       - indented point           |                     |
++------------------------------------------+---------------------+
+|    [space] [number] [dot] [space] [text] | 1. ordered          |
+|     1. ordered                           | 2. list             |
+|     2. list                              |    1. indented point|
+|        1. indented point                 |                     |
++------------------------------------------+---------------------+
index 7ef7fb3acb00ee126033991a211354b905581950..e23c18210e4f368410fc88855e88d1fce72d4ecb 100644 (file)
@@ -114,11 +114,42 @@ main pre {
 body[id$="/[edit]"] textarea,
 body[id$="/[newpage]"] textarea {
   width: 100%;
-  min-height: 20em; min-height: 70vh;
+  min-height: 20em; min-height: 50vh;
   font-family: monospace;
   font-size: inherit;
 }
 
+[id$="/[edit]"] main {
+  padding-top: 2.5em;
+}
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.syntax,
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.help {
+  background-color: #FFF;
+  min-height: 20em; min-height: 50vh;
+}
+[id$="/[edit]"] input[type=radio].tab#edtr:checked ~ form.tab.editor { display: block; }
+[id$="/[edit]"] input[type=radio].tab#help:checked ~ div.tab.syntax { display: block; }
+[id$="/[edit]"] input[type=radio].tab#himg:checked ~ div.tab.help,
+[id$="/[edit]"] input[type=radio].tab#hdoc:checked ~ div.tab.help {
+  display: block;
+}
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .himg,
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .hdoc {
+  display: none;
+}
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.help {
+  padding-top: 1em;
+  padding-left: 7em;
+}
+[id$="/[edit]"] input[type=radio].tab ~ div.tab.help .himg img {
+  float: left;
+  max-height: 4em;
+  margin-left: -6em;
+}
+[id$="/[edit]"] input[type=radio].tab#himg:checked ~ div.tab.help .himg { display: block; }
+[id$="/[edit]"] input[type=radio].tab#hdoc:checked ~ div.tab.help .hdoc { display: block; }
+
+
 /* === Attachments === */
 
 .attachment.list button[name=delete] {
index 541f71361ae5e24a1f4b09f61d91172c4dff5b35..d82764bc7bde6b3361b07e4ea3a3af972efa6e6f 100755 (executable)
@@ -68,19 +68,43 @@ theme_page(){
 }
 
 theme_editor(){
-  local page="$1" template="$2" title
-  title="${page%/}"; title="${title##*/}"
+  local page="$1" template="$2" title file att
+  title="$(HTML "${PAGE_TITLE:-"${page}"}")"
 
   [ "$template" ] && acl_read "$template" || template="$page"
 
   theme_page - "Editor: $title" <<-EOF
-       <form method=POST action="$(HTML "${_BASE}${page%/}/[edit]")">
+       <input checked type=radio class=tab name=edithelp value=edtr id=edtr><label for=edtr>Editor</label>
+       <input         type=radio class=tab name=edithelp value=help id=help><label for=help>Syntax</label>
+       <input         type=radio class=tab name=edithelp value=himg id=himg><label for=himg>Images</label>
+       <input         type=radio class=tab name=edithelp value=hdoc id=hdoc><label for=hdoc>Documents</label>
+       <form class="tab editor" method=POST action="$(HTML "${_BASE}${page%/}/[edit]")">
          <input type=hidden name=session_key value="${SESSION_KEY}"/>
          <textarea name=pagetext>$({ wiki_text "$page" \
                                   || wiki_text "$template"; } |HTML)</textarea>
          <button type=submit name=action value=update>Update</button>
          <button type=submit name=action value=cancel>Cancel</button>
        </form>
+        <div class="tab syntax">$(wiki "/[wiki]/editorhelp/")</div>
+       <div class="tab help">
+       $(for file in "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments"/* "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments"/*; do
+         [ "$file" = "$_EXEC/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" \
+               -a -f "$_DATA/pages/${page%/:$LANGUAGE/}/#attachments/${file##*/}" ] && continue
+         case ${file##*/} in
+           \*) continue;;
+           *.[pP][nN][gG]|*.[jJ][pP][gG]|*.[jJ][pP][eE][gG]|*.[gG][iI][fF])
+             [ "$page" != "${page%/:$LANGUAGE/}" ] && p=../ || p=''
+             att="$(HTML "${file##*/}")"
+             printf '<p class=himg><img src="%s%s">![](%s)</p><ul class=himg><li>[%s]([attachment]/%s)</li><li>[![%s](%s)]([attachment]/%s)</li></ul>' \
+                    "$p" "$att" "$att" "$att" "$att" "$att" "$att" "$att"
+             ;;
+           *)
+             att="$(HTML "${file##*/}")"
+             printf '<p class="hdoc">[%s](%s)</p>' "$att" "$att"
+             ;;
+         esac
+       done)
+       </div>
        EOF
 }