Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrienko/lipsum-js
Simple lorem-ipsum text generator
https://github.com/andrienko/lipsum-js
Last synced: 7 days ago
JSON representation
Simple lorem-ipsum text generator
- Host: GitHub
- URL: https://github.com/andrienko/lipsum-js
- Owner: andrienko
- Created: 2014-12-07T19:41:18.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-08T11:12:35.000Z (almost 10 years ago)
- Last Synced: 2024-10-08T13:55:15.123Z (about 1 month ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Lorem ipsum generator writtem in JS
===Basic stuff
---// Will produce a sentence containing from 3 to 10 words
lipsumjs.generateSentence(3,10);
// Will produce 10 sentences containing from 3 to 10 words, but first replaced
// with canonical "Lorem ipsum dolor sit amet.." sentence
lipsumjs.generate(10, 3, 10, addFirstCanon);
// Will produce 10 paragraphs of variotic number of sentences (p-tags)
lipsumjs.generateParagraphs(10);
// Same as previous, only tags will be divs
lipsumjs.generateParagraphs(10,'div');
Building own sentences
---
// Will return an array containing from 3 to 10 words
lipsumjs.getWords(3,10);
// Will return an array containing from 3 to 10 words, only words will be taken
// from words_base variable, which should be array
lipsumjs.getWords(3,10,words_base);
// Will build sentence from words in array
lipsumjs.buildSentenceFromWords(words_array);
// Will build sentence of 3 to 10 words containing up to 2 (Math.floor(10/4)) commas
var words_array = lipsumjs.getWords(3,10);
var commas = lipsumjs.getCommaIndexes(words_array.length);
lipsumjs.buildSentenceFromWords(words_array, commas);
Lipsum tag and data attributes
---Just add the lipsum_tag.js after lipsum.js to your page and everything that has data-lipsum attribute will have a
paragraph of lipsum text in its content:
This text will be replaced with lipsum text
Feel free to modify it to add customizations, eh?