From ea2a686cf71874257b76465d8335b37e60409e19 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Wed, 18 Sep 2019 11:42:45 +0200 Subject: [PATCH] Support new model sources format [ci skip] --- website/src/templates/models.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/website/src/templates/models.js b/website/src/templates/models.js index 29278e919..1c90c60b6 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -108,6 +108,17 @@ function formatModelMeta(data) { } } +function formatSources(data = []) { + const sources = Array.isArray(data) ? data.map(s => ({ name: s })) : data + return sources.map(({ name, url, author }, i) => ( + <> + {i > 0 && ', '} + {name && url ? {name} : name} + {author && ` (${author})`} + + )) +} + const Help = ({ children }) => ( @@ -142,7 +153,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}` const pipeline = meta.pipeline && join(meta.pipeline.map(p => {p})) - const sources = meta.sources && join(meta.sources) + const sources = formatSources(meta.sources) const author = !meta.url ? meta.author : {meta.author} const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null const license = licenseUrl ? {meta.license} : meta.license