Skip to content

Instantly share code, notes, and snippets.

@willthemoor
Forked from geedmo/lorem.jade
Last active June 30, 2018 14:03
Show Gist options
  • Save willthemoor/749f7ee2a3e4b59e6080 to your computer and use it in GitHub Desktop.
Save willthemoor/749f7ee2a3e4b59e6080 to your computer and use it in GitHub Desktop.
Lorem Ipsum generator mixin for Jade (single paragraph)
//- ----------------------------------
//- Simplified version.
//-
//- Usage:
//- include lorem
//- p: +lipsum(42)
//- ----------------------------------
mixin capitalize(string)
= string.charAt(0).toUpperCase() + string.slice(1)
mixin lipsum(howmany)
- var words = ['consectetur', 'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero', 'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut', 'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia', 'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis', 'laoreet', 'auctor' ]
- for (var i = 0; i < howmany; i++) {
- var nextWord = words[Math.floor((Math.random()* ( words.length - 1 ) ))]
if (i == 0)
mixin capitalize(nextWord)
else
= ' ' + nextWord
if i == howmany - 1
= '.'
- }
@Yggdragstyle
Copy link

Hello, I've take your code for testing my codepen : https://codepen.io/YggLife/pen/zaexEM?editors=1000
And you've a syntax error on line 18 => mixin capitalize(nextWord)
For Pug syntax, you must change it by => +capitalize(nextWord)

I've create a fork of your codepen ? https://codepen.io/YggLife/pen/jKdEYa?editors=1100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment