# Loop through 'meta_key' array, search for the first occurence of the values in the HTML doc, and replace them with corresponding values in 'meta_value'.
for index in $(seq 0`expr "${#meta_key[@]}" - 1`);do
sed -i "0, /[\$][\$]${meta_key[$index]}[\$][\$]/ {s/[\$][\$]${meta_key[$index]}[\$][\$]/${meta_value[index]}/}"$1
done
}
md_to_html(){
# Convert .md files from 'source' and place them into the correct locations into 'output'
files=$(find $BASE_PATH/source -name "*.md")
for file in $files;do
read_metadata $file# Sets the 'metadata' variable
convert_to_array "$metadata"#Sets the 'meta_key' and 'meta_value' arrays
add_date_to_array "$file"#Uses 'meta_key' and 'meta_value' arrays
# Copy file to temp dir and strip metadata
cp $file$BASE_PATH/temp/
letnum_lines=$(echo$metadata| wc -l)+1
sed -i "1,${num_lines}d"$BASE_PATH/temp/`basename $file`