Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- PREFIX=wiki
- FILES=$(find . -type f -iname '*.md' -o -iname '*.markdown')
- if [[ "$1" == "revert" ]]; then
- # To Parse back to normal local [[links]]
- for file in $FILES; do
- sed -e 's/\[\(.*\)\](\/$PREFIX\/\(.*\))/[[\1]]/g' $file > $file.tmp
- mv $file.tmp $file
- done
- else
- # Rename local [[links]] to regular links.
- for file in $FILES; do
- sed -e 's/\[\[\(.*\)\]\]/[\1](\/$PREFIX\/\1)/g' $file > $file.tmp
- mv $file.tmp $file
- done
- fi
Add Comment
Please, Sign In to add comment