From 385aaa2d7e99e9ce66b55d10a9fa292e6b9dc363 Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Thu, 28 Dec 2017 11:48:42 +0200 Subject: [PATCH] Collapsible examples in builder --- scripts/build-script.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/build-script.js b/scripts/build-script.js index efa247d89..966f8a178 100644 --- a/scripts/build-script.js +++ b/scripts/build-script.js @@ -76,8 +76,11 @@ try { uncategorizedOutput += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`; } else { output +=`## ${capitalize(tag, true)}\n`; - for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag)) - output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`; + for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag)){ + let data = snippets[taggedSnippet[0]+'.md']; + data = data.slice(0,data.lastIndexOf('```js')) + '
\nExamples\n\n' + data.slice(data.lastIndexOf('```js'),data.lastIndexOf('```')) + data.slice(data.lastIndexOf('```')) + '\n
\n'; + output += `\n${data+'\n[⬆ back to top](#table-of-contents)\n'}`; + } } } output += uncategorizedOutput;