Skip to content

Commit

Permalink
#576 - created script to make consistent figure names in the assets/i…
Browse files Browse the repository at this point in the history
…mg directory and in the markdown pages
  • Loading branch information
robertoostenveld committed Jul 15, 2022
1 parent 7213810 commit da974ab
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions _scripts/rename_figures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
#
# Use as:
# rename_figures.sh <page.md>
#
# This script does not do the conversion itself, but prints the commands to screen.
# The user of the script shoudl check teh commands prior to execution

[ -e "$1" ] || exit 1

figures=$(grep "include image" $1 | cut -d \" -f 2)

echo $figures

n=1
for figure in $figures ; do
oldname=$(basename $figure)
ext=$(echo $oldname | cut -f 2 -d '.')
newname=$(dirname $figure)/figure"$n"."$ext"
echo git mv ."$figure" ."$newname"
echo sed -i .bak s~$figure~$newname~g $1
n=$(expr $n + 1)
done

0 comments on commit da974ab

Please sign in to comment.