spaCy/website/_includes/_functions.jade
2017-06-04 18:43:14 +02:00

36 lines
969 B
Plaintext

//- 💫 INCLUDES > FUNCTIONS
//- More descriptive variables for current.path and current.source
- CURRENT = current.source
- SECTION = current.path[0]
- SUBSECTION = current.path[1]
//- Add prefixes to items of an array (for modifier CSS classes)
- function prefixArgs(array, prefix) {
- return array.map(function(arg) {
- return prefix + '--' + arg;
- }).join(' ');
- }
//- Generate GitHub links
- function gh(repo, filepath, branch) {
- var branch = ALPHA ? 'develop' : branch
- return 'https://github.com/' + SOCIAL.github + '/' + repo + (filepath ? '/blob/' + (branch || 'master') + '/' + filepath : '' );
- }
//- Get social images
- function getSocialImg() {
- var base = SITE_URL + '/assets/img/social/preview_'
- var image = ALPHA ? 'alpha' : 'default'
- if (preview) image = preview
- else if (SECTION == 'docs' && !ALPHA) image = 'docs'
- return base + image + '.jpg'
- }