Generate random Lorem Ipsum text for your project, drawing words from the full Latin dictionary!
This module provides Lorem in the following formats:
- Paragraph(s) - Random paragraph, with customizable options for number of paragraphs, number of sentences per paragraph & number of words per sentence.
- Sentence - Random sentence, with customizable options for number of words per sentence.
- Word - A random word.
package myAmazingPackage
import (
// ...
"github.com/jfajardo5/dolorem"
)
//***************
// Default Options
//*****************
// Initialize Dolorem
lorem := dolorem.Ipsum()
// Random Paragraph
fmt.Println(lorem.Paragraph())
// Random Sentence
fmt.Println(lorem.Sentence())
// Random Word
fmt.Println(lorem.Word())
- Number of paragraphs
- Number of sentences per paragraph
- Number of words per sentence
//**************
// Custom Options
//****************
// Single Sentence with x number of Words
fmt.Println(lorem.Sentence(5))
// x number of Paragraphs
fmt.Println(lorem.Paragraph(3))
// x number of Paragraphs with y number of Sentences per Paragraph
fmt.Println(lorem.Paragraph(2, 10))
// x number of Paragraphs with y number of Sentences with z number of Words per Sentence
fmt.Println(lorem.Paragraph(2, 12, 6))
By default, the very first Paragraph in a set will always start with "Dolorem ipsum dolor sit amet,"
// Initialize Dolorem
lorem := dolorem.Ipsum()
// Override ParagraphStarter
lorem.ParagraphStarter = "My custom paragraph starter,"
// Random Paragraph with custom ParagraphStarter
fmt.Println(lorem.Paragraph())
// It can also be overridden with an empty string
lorem.ParagraphStarter = ""
// Random Paragraph with no ParagraphStarter
fmt.Println(lorem.Paragraph())
// Initialize Dolorem
lorem := dolorem.Ipsum()
// Override dictionary
lorem.Dictionary = []string{"my", "custom", "dictionary"}
// Random Paragraph from custom dictionary
fmt.Println(lorem.Paragraph())
// Initialize Dolorem
lorem := dolorem.Ipsum()
// Override Seed
lorem.Seed = rand.New(rand.NewSource(time.Now().Unix()))
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Julio Fajardo - jfajardo.net
Project Link: https://github.com/jfajardo5/dolorem