$(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">![](<%s>)</p><ul class=aimg>
+ <li>[%s](<[attachment]/%s>)</li>
+ <li>[![%s](<%s>)](<[attachment]/%s>)</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](<%s>)</p>' "$name" "$url"
;;
esac
done)