Fixed build script to exclude untagged snippets

This commit is contained in:
Angelos Chalaris
2017-12-14 19:02:15 +02:00
parent 06018e143a
commit cd4d6ba9e8
3 changed files with 15 additions and 5 deletions

View File

@ -46,7 +46,7 @@
* [Current URL](#current-url)
* [Element is visible in viewport](#element-is-visible-in-viewport)
* [Get scroll position](#get-scroll-position)
* [Redirect to URL](#redirect-to-url)
* [Redirect to url](#redirect-to-url)
* [Scroll to top](#scroll-to-top)
### Function
@ -528,7 +528,17 @@ const getScrollPos = (el = window) =>
[⬆ back to top](#table-of-contents)
undefined
### Redirect to URL
Use `window.location.href` or `window.location.replace()` to redirect to `url`.
Pass a second argument to simulate a link click (`true` - default) or an HTTP redirect (`false`).
```js
const redirect = (url, asLink = true) =>
asLink ? window.location.href = url : window.location.replace(url);
// redirect('https://google.com')
```
[⬆ back to top](#table-of-contents)
### Scroll to top

View File

@ -52,13 +52,13 @@ catch (err){
try {
output += `${startPart+'\n'}`;
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
output +=`### ${capitalize(tag, true)}\n`;
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
output += `* [${taggedSnippet[0][0].toUpperCase() + taggedSnippet[0].replace(/-/g,' ').slice(1)}](#${taggedSnippet[0].replace(/\(/g,'').replace(/\)/g,'').toLowerCase()})\n`
output += '\n';
}
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
output +=`## ${capitalize(tag, true)}\n`;
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;

View File

@ -58,7 +58,7 @@ powerset:math
promisify:function
random-integer-in-range:utility
random-number-in-range:utility
redirect-to-URL:browser
redirect-to-url:browser
reverse-a-string:string
RGB-to-hexadecimal:utility
run-promises-in-series:function