~zenomat/tinywiki

db287be745e569dddd704d84ed64a30e56c08a6d — Adrian 2 months ago bb7d8ea
Fix yaml extraction

This fixes the yaml extraction, in cases, where multiple `---`
delimiters are in the file, e.g. in tables
1 files changed, 1 insertions(+), 1 deletions(-)

M build.sh
M build.sh => build.sh +1 -1
@@ 2,7 2,7 @@

function parse_yml()
{
	yml="$(awk 'f{ if (/---/){printf "%s", buf; f=0; buf=""} else buf = buf $0 ORS}; /---/{f=1}' "$1")"
	yml="$(awk 'f{ i=0; if (/---/){printf "%s", buf; f=0; buf="";i++} else buf = buf $0 ORS}; /---/{f=1; if (i==1){exit}}' "$1")"
	yml_data[0]="$(echo "$yml" | shyaml get-value title 2>/dev/null || echo "No title provided")"
	yml_data[1]="$(echo "$yml" | shyaml get-value desc 2>/dev/null || echo "No description provided")"
	yml_data[2]="$(echo "$yml" | shyaml get-value toc 2>/dev/null || echo "false")"