#!/usr/bin/env bash getYamlBlock(){ vecho "getYamlBlock $*" cd "$dataDir" || return local filename filename="$(findFile "$1")" # If there is a yaml file, use it # if not, try and get the yaml header if [ -f "$filename.yaml" ]; then cat "$filename.yaml" else sed -n '1 { /^---/ { :a N; /\n---/! ba; p} }' "$filename" | sed '1d;$d;s/\t/ /g' fi } getYamlTitle(){ vecho "getYamlTitle $*" cd "$dataDir" || return getYamlBlock "$1" | yq -r '.Title' } getYamlTags(){ vecho "getYamlTitle $*" cd "$dataDir" || return getYamlBlock "$1" | yq -r '.Tags | join("\n")' }