From dfb272ba6dc3ddb42109d5f98a88dc03014c3221 Mon Sep 17 00:00:00 2001 From: Marcell Mars Date: Mon, 26 Apr 2021 00:40:30 +0200 Subject: [PATCH] filter has_ list from actual frontmatter to keep the order --- src/App.svelte | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 0a4a01c..ecc0258 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -38,16 +38,20 @@ relpath = repo.path; relpermalink = repo.relpermalink protocol = document.location.protocol.substring(0,4) - let tkey = Object.keys(repo.frontmatter).filter(t => t.toLowerCase() == "title")[0] title = repo.frontmatter[tkey] - let xastiers = Object.keys(repo.frontmatter).filter(t => t.startsWith("has_")) - if (xastiers.length > 0) { + let xastiers = Object.keys(repo.frontmatter).filter(t => t.toLowerCase().startsWith("has_")) + if (xastiers.length == 1) { hastiers = xastiers[0].substr(4) - tiers = METASP[xastiers[0].split("has_")[1]].tiers.filter(t => repo.frontmatter[xastiers].includes(t.file)) - if (xastiers.length == 1) { - candidates = diffArrr(METASP[xastiers[0].split("has_")[1]].tiers, tiers) - } + tiers = [] + repo.frontmatter[xastiers[0]].forEach(t => { + METASP[hastiers].tiers.forEach(f => { + if (f.file == t) { + tiers.push(f) + } + }) + }) + candidates = diffArrr(METASP[hastiers].tiers, tiers) } } el.src = `../js/repo/${location.hash.substring(1)}.js`