]> git.plutz.net Git - shellwiki/commitdiff
Syntax help fro white space file names
authorPaul Hänsch <paul@plutz.net>
Sun, 8 Oct 2023 23:54:31 +0000 (01:54 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 8 Oct 2023 23:54:31 +0000 (01:54 +0200)
themes/default.sh

index eb3d537442c41f90e4202ad47029e186fb6f38da..23b03f25552b86ba2e6e3fc03a2c46d322e4cbba 100755 (executable)
@@ -108,17 +108,21 @@ theme_editor(){
        $(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
+         att="$(HTML "${file##*/}")"
+          url="$(printf %s\\n "${file##*/}" |sed 's;[\\<>];\\&;g' |HTML)"
+         name="$(printf %s\\n "${file##*/}" |sed 's;[]\\[];\\&;g' |HTML)"
          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=aimg><img src="%s%s">![](%s)</p><ul class=aimg><li>[%s]([attachment]/%s)</li><li>[![%s](%s)]([attachment]/%s)</li></ul>' \
-                    "$p" "$att" "$att" "$att" "$att" "$att" "$att" "$att"
+             printf '<p class=aimg><img src="%s%s">![](&lt;%s&gt;)</p><ul class=aimg>
+                       <li>[%s](&lt;[attachment]/%s&gt;)</li>
+                       <li>[![%s](&lt;%s&gt;)](&lt;[attachment]/%s&gt;)</li>
+                     </ul>' \
+                    "$p" "$att" "$url" "$name" "$url" "$name" "$url" "$url"
              ;;
            *)
-             att="$(HTML "${file##*/}")"
-             printf '<p class="adoc">[%s](%s)</p>' "$att" "$att"
+             printf '<p class="adoc">[%s](&lt;%s&gt;)</p>' "$name" "$url"
              ;;
          esac
        done)