joplin-conversion (571B)
1 #!/bin/sh 2 set -x 3 for f in *.md; do 4 sed 's/\(\.\.\/\)*_resources\///g; s:([^)]*/\([^/]*\).md):(\1.md):g; s:\^\([^\^]*\)\^:<sup>\1</sup>:g; s:\~\([^\~]*\)\~:<sub>\1</sub>:g' "$f" > "$f.new" 5 mv "$f.new" "$f" 6 done 7 for f in *.png; do 8 containedin="$(grep -IRl "$f" .)" 9 if [ -n "$containedin" ]; then 10 case "$containedin" in 11 *index.md) 12 mv "$f" "${containedin%%index.md}" 13 ;; 14 *) 15 mkdir "${containedin%%.md}" 16 mv "$containedin" "${containedin%%.md}/index.md" 17 mv "$f" "${containedin%%.md}" 18 ;; 19 esac 20 fi 21 done 22