lorem-pedia

Generate lorem filler from Wikipedia articles about today.

Usage no npm install needed!

<script type="module">
  import loremPedia from 'https://cdn.skypack.dev/lorem-pedia';
</script>

README

Wikiday - generate lorem ipsum filler text from Wikipedia's day page.

The results are an array of words, sentences (default) or paragraphs.

The number of words per sentence, and the number of sentences per paragraph are configurable, and have mostly sensible defaults for the English language.

USAGE

  // loremcli.js
    var lorem = require("wikiday"); 
    var text = new lorem(process.argv.slice(2)); 
    text.on("Ready", function(data) { 
      console.log(data); 
      process.exit(0); 
    }); 
    text.on("Usage", function(data) { 
      console.log("Usage: "); 
      console.log(data); 
      process.exit(0); 
    }); 
    text.on("TimedOut", function(data) { 
      console.error("Wikiday request timedout."); 
      console.log(typeof data); 
      process.kill(process.pid,'SIGTERM'); 
    }); 
$ node loremcli.js -h 

Will list the options (and built-in defaults) handled by the program.

Options

        knownOpts: {  
                      "count" : Number 
                    , "help" : Boolean 
                    , "minWords" : Number 
                    , "maxWords" : Number 
                    , "minSentences" : Number 
                    , "maxSentences" : Number 
                    , "timeOut" : Number 
                    , "units" : [ "words", "sentences", "paragraphs" ]
                    }, 
        shortHands: { 
                       "c" : ["--count"]
                     , "?" : ["--help"]
                     , "h" : ["--help"]
                     , "maxw" : ["--maxWords"]
                     , "mins" : ["--minSentences"]
                     , "maxs" : ["--maxSentences"]
                     , "p" : ["--units", "paragraphs"]
                     , "s" : ["--units", "sentences"]
                     , "t" : ["--timeOut"]
                     , "u" : ["--units"]
                     , "w" : ["--units", "words"]
                     }, 
        defaults: {  
                      "count" : 4 
                    , "minWords" : 5 
                    , "maxWords" : 15 
                    , "minSentences" : 4 
                    , "maxSentences" : 8 
                    , "timeOut" : 5  // seconds  
                    , "units" : "sentences" 
                    }