//-    Lorem ipsum mixin
mixin lipsum(items, type)
	//- Source (Lorem ipsum by default) text.
	-var source = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

	//- Variables for generation
	//- Boundary value for number of words in sentence
	-var minWords = 2;
	-var maxWords = 18;
	//- Boundary value for number of sentences in paragraph
	-var minSentences = 1;
	-var maxSentences = 10;
	//- Chance for comma after word (really a little bit less)
	-var commaChance = 0.2;
	//- Chance for interrogative sentence
	-var questionChance = 0.2;


	//- Remove punctuation and split string to word array.
	-var wordArray = source.replace(/[\.?!,-\/#!$%\^&\*;:{}=\-_`~()]/g,"").toLowerCase().split(" ");

	//- Capitalize first letter
	-var firstToUpperCase = function(text){
		-return text.charAt(0).toUpperCase() + text.slice(1)
	-}

	//- Generate random value from min and max with a little bit normally-distributed result
	-var getNumberOfItems = function(min, max){
		-var iteration = 3;
		-var random = function(min, max){
			-return Math.random() * (max - min);
		-}
		-var result
		-for (var i=0; i<iteration; i++){
			-if (result === undefined){
				-result = random(min,max);
			-}
			-else{
				-result += random(min,max);
			-}
		-}
		-return Math.floor(result / iteration) + min;
	-}

	//- Generate sentence
	-var generateSentence = function(){
		//- Store sentence
		-var sentence = "";
		//- Minimum and maximum words in sentence and generate words quantity
		-var words = getNumberOfItems(minWords,maxWords);

		//- Generate sentence itself
		-for (var i=0; i< words; i++){
			-sentence += wordArray[Math.floor(Math.random() * wordArray.length)];
			// Add some punctuation
			-if (i == (words -1)){
				-if (Math.random() < questionChance){
					-sentence += "? ";
				-}
				-else{
					-sentence += ". ";
				-}
			-}
			-else if (Math.random() < commaChance){
				-sentence += ", ";
			-}
			-else {
				-sentence +=" ";
			-}
		-}
		-return firstToUpperCase(sentence)
	-}

	//- Generate requested lipsum: single word with defined lenght, some words, some sentnences and paragraphs
	if type == "words"
		-var words = ""
		-for (var i = 0; i < items; i++) {
			-words += wordArray[Math.floor(Math.random() * wordArray.length)]
			if i === 0
				-words = firstToUpperCase(words)
			-words += " "
		-}
		=words

	else if type == "characters"
		-var characters = ""
		// Add words to string
		while characters.length < items
			-characters += wordArray[Math.floor(Math.random() * wordArray.length)]

		//- Capitalize first letter
		-characters = firstToUpperCase(characters)
		//- Crop string to requested length
		if (characters.length > items)
			= characters.substring(0, items)
		else
			= characters

	else if type == "paragraphs"
		-for (var i=0; i< items; i++){
			//- Set number of sentences
			-var sentences = getNumberOfItems(minSentences, maxSentences)
			p
				-for (var k=0; k< sentences; k++){
					=generateSentence()
				-}
		-}
		
	else if type == "sentences"
		-for (var i=0; i< items; i++){
			=generateSentence()
		-}

