#!/usr/bin/env bash if [ $# -eq 0 ] then echo "Converts a folder of tiddlers in the tiddlers/content folder into system/hidden tiddlers so that TiddlyWiki will ignore them (including the built-in search)." echo echo "Usage: ./hide.sh path/to/folder" echo echo "Example ./hide.sh labs/lab01" exit fi files=$(find "tiddlers/content/${1}" -type f -name '*.tid' -or -name '*.meta') IFS=$'\n' for f in ${files} ; do echo "${f}" # add the '$:' system title prefix sed --in-place --regexp-extended --expression='s|title: ([^$].*)|title: $:\1|' "${f}" # add a 'hidden' tag sed --in-place --regexp-extended --expression='s|tags: (.*)|tags: \1 hidden|' "${f}" done