random-words 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec_status +166 -39
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +313 -0
  5. data/CHANGELOG.md +67 -0
  6. data/Gemfile +15 -12
  7. data/Gemfile.lock +46 -26
  8. data/README.md +208 -15
  9. data/bin/randw +258 -92
  10. data/lib/random-words/array.rb +71 -0
  11. data/lib/random-words/config.rb +254 -0
  12. data/lib/random-words/generator.rb +257 -94
  13. data/lib/random-words/hash.rb +16 -0
  14. data/lib/random-words/html2markdown.rb +205 -0
  15. data/lib/random-words/lorem-markdown.rb +397 -0
  16. data/lib/random-words/number-to-word.rb +139 -0
  17. data/lib/random-words/source.rb +106 -0
  18. data/lib/random-words/string.rb +224 -45
  19. data/lib/random-words/table-cleanup.rb +210 -0
  20. data/lib/random-words/version.rb +1 -1
  21. data/lib/random-words/words/1984/adjectives.txt +103 -0
  22. data/lib/random-words/words/1984/adverbs.txt +92 -0
  23. data/lib/random-words/words/1984/articles-plural.txt +10 -0
  24. data/lib/random-words/words/1984/articles-singular.txt +10 -0
  25. data/lib/random-words/words/1984/clauses.txt +79 -0
  26. data/lib/random-words/words/1984/config.yml +4 -0
  27. data/lib/random-words/words/1984/conjunctions-coordinating.txt +20 -0
  28. data/lib/random-words/words/1984/conjunctions-subordinate.txt +29 -0
  29. data/lib/random-words/words/1984/names.txt +12 -0
  30. data/lib/random-words/words/1984/nouns-plural.txt +89 -0
  31. data/lib/random-words/words/1984/nouns-singular.txt +74 -0
  32. data/lib/random-words/words/1984/numbers.yml +5 -0
  33. data/lib/random-words/words/1984/phrases.txt +16 -0
  34. data/lib/random-words/words/1984/prepositions.txt +89 -0
  35. data/lib/random-words/words/1984/terminators.txt +16 -0
  36. data/lib/random-words/words/1984/verbs-passive.txt +83 -0
  37. data/lib/random-words/words/1984/verbs-plural.txt +91 -0
  38. data/lib/random-words/words/1984/verbs-singular.txt +110 -0
  39. data/lib/random-words/words/alice/adjectives.txt +80 -0
  40. data/lib/random-words/words/alice/adverbs.txt +87 -0
  41. data/lib/random-words/words/alice/articles-plural.txt +10 -0
  42. data/lib/random-words/words/alice/articles-singular.txt +10 -0
  43. data/lib/random-words/words/alice/clauses.txt +81 -0
  44. data/lib/random-words/words/alice/config.yml +4 -0
  45. data/lib/random-words/words/alice/conjunctions-coordinating.txt +20 -0
  46. data/lib/random-words/words/alice/conjunctions-subordinate.txt +29 -0
  47. data/lib/random-words/words/alice/names.txt +10 -0
  48. data/lib/random-words/words/alice/nouns-plural.txt +95 -0
  49. data/lib/random-words/words/alice/nouns-singular.txt +82 -0
  50. data/lib/random-words/words/alice/numbers.yml +5 -0
  51. data/lib/random-words/words/alice/phrases.txt +16 -0
  52. data/lib/random-words/words/alice/prepositions.txt +45 -0
  53. data/lib/random-words/words/alice/terminators.txt +16 -0
  54. data/lib/random-words/words/alice/verbs-passive.txt +495 -0
  55. data/lib/random-words/words/alice/verbs-plural.txt +115 -0
  56. data/lib/random-words/words/alice/verbs-singular.txt +97 -0
  57. data/lib/random-words/words/bacon/clauses.txt +592 -592
  58. data/lib/random-words/words/bacon/config.yml +4 -0
  59. data/lib/random-words/words/bacon/conjunctions-coordinating.txt +20 -0
  60. data/lib/random-words/words/bacon/names.txt +54 -0
  61. data/lib/random-words/words/bacon/numbers.yml +5 -0
  62. data/lib/random-words/words/bacon/phrases.txt +20 -0
  63. data/lib/random-words/words/bacon/prepositions.txt +45 -0
  64. data/lib/random-words/words/bacon/terminators.txt +16 -0
  65. data/lib/random-words/words/corporate/config.yml +4 -0
  66. data/lib/random-words/words/corporate/conjunctions-coordinating.txt +20 -0
  67. data/lib/random-words/words/corporate/names.txt +74 -0
  68. data/lib/random-words/words/corporate/numbers.yml +5 -0
  69. data/lib/random-words/words/corporate/phrases.txt +29 -0
  70. data/lib/random-words/words/corporate/prepositions.txt +45 -0
  71. data/lib/random-words/words/corporate/terminators.txt +16 -0
  72. data/lib/random-words/words/doctor/adjectives.txt +92 -0
  73. data/lib/random-words/words/doctor/adverbs.txt +92 -0
  74. data/lib/random-words/words/doctor/articles-plural.txt +10 -0
  75. data/lib/random-words/words/doctor/articles-singular.txt +10 -0
  76. data/lib/random-words/words/doctor/clauses.txt +83 -0
  77. data/lib/random-words/words/doctor/config.yml +10 -0
  78. data/lib/random-words/words/doctor/conjunctions-coordinating.txt +20 -0
  79. data/lib/random-words/words/doctor/conjunctions-subordinate.txt +29 -0
  80. data/lib/random-words/words/doctor/names.txt +74 -0
  81. data/lib/random-words/words/doctor/nouns-plural.txt +84 -0
  82. data/lib/random-words/words/doctor/nouns-singular.txt +84 -0
  83. data/lib/random-words/words/doctor/numbers.yml +5 -0
  84. data/lib/random-words/words/doctor/phrases.txt +29 -0
  85. data/lib/random-words/words/doctor/prepositions.txt +45 -0
  86. data/lib/random-words/words/doctor/terminators.txt +16 -0
  87. data/lib/random-words/words/doctor/verbs-passive.txt +83 -0
  88. data/lib/random-words/words/doctor/verbs-plural.txt +88 -0
  89. data/lib/random-words/words/doctor/verbs-singular.txt +83 -0
  90. data/lib/random-words/words/english/clauses.txt +592 -592
  91. data/lib/random-words/words/english/config.yml +4 -0
  92. data/lib/random-words/words/english/conjunctions-coordinating.txt +20 -0
  93. data/lib/random-words/words/english/names.txt +74 -0
  94. data/lib/random-words/words/english/numbers.yml +5 -0
  95. data/lib/random-words/words/english/phrases.txt +29 -0
  96. data/lib/random-words/words/english/prepositions.txt +45 -0
  97. data/lib/random-words/words/english/terminators.txt +16 -0
  98. data/lib/random-words/words/english/verbs-plural.txt +1 -0
  99. data/lib/random-words/words/english/verbs-singular.txt +1 -0
  100. data/lib/random-words/words/foulmouth/adjectives.txt +89 -0
  101. data/lib/random-words/words/foulmouth/adverbs.txt +97 -0
  102. data/lib/random-words/words/foulmouth/articles-plural.txt +12 -0
  103. data/lib/random-words/words/foulmouth/articles-singular.txt +11 -0
  104. data/lib/random-words/words/foulmouth/clauses.txt +74 -0
  105. data/lib/random-words/words/foulmouth/config.yml +4 -0
  106. data/lib/random-words/words/foulmouth/conjunctions-coordinating.txt +20 -0
  107. data/lib/random-words/words/foulmouth/conjunctions-subordinate.txt +29 -0
  108. data/lib/random-words/words/foulmouth/names.txt +81 -0
  109. data/lib/random-words/words/foulmouth/nouns-plural.txt +96 -0
  110. data/lib/random-words/words/foulmouth/nouns-singular.txt +99 -0
  111. data/lib/random-words/words/foulmouth/numbers.yml +5 -0
  112. data/lib/random-words/words/foulmouth/phrases.txt +30 -0
  113. data/lib/random-words/words/foulmouth/prepositions.txt +35 -0
  114. data/lib/random-words/words/foulmouth/terminators.txt +16 -0
  115. data/lib/random-words/words/foulmouth/verbs-passive.txt +143 -0
  116. data/lib/random-words/words/foulmouth/verbs-plural.txt +91 -0
  117. data/lib/random-words/words/foulmouth/verbs-singular.txt +104 -0
  118. data/lib/random-words/words/hipster/adjectives.txt +100 -0
  119. data/lib/random-words/words/hipster/adverbs.txt +89 -0
  120. data/lib/random-words/words/hipster/articles-plural.txt +10 -0
  121. data/lib/random-words/words/hipster/articles-singular.txt +10 -0
  122. data/lib/random-words/words/hipster/clauses.txt +180 -0
  123. data/lib/random-words/words/hipster/config.yml +4 -0
  124. data/lib/random-words/words/hipster/conjunctions-coordinating.txt +20 -0
  125. data/lib/random-words/words/hipster/conjunctions-subordinate.txt +29 -0
  126. data/lib/random-words/words/hipster/names.txt +73 -0
  127. data/lib/random-words/words/hipster/nouns-plural.txt +96 -0
  128. data/lib/random-words/words/hipster/nouns-singular.txt +100 -0
  129. data/lib/random-words/words/hipster/numbers.yml +5 -0
  130. data/lib/random-words/words/hipster/phrases.txt +21 -0
  131. data/lib/random-words/words/hipster/prepositions.txt +45 -0
  132. data/lib/random-words/words/hipster/terminators.txt +16 -0
  133. data/lib/random-words/words/hipster/verbs-passive.txt +88 -0
  134. data/lib/random-words/words/hipster/verbs-plural.txt +106 -0
  135. data/lib/random-words/words/hipster/verbs-singular.txt +114 -0
  136. data/lib/random-words/words/latin/config.yml +4 -0
  137. data/lib/random-words/words/latin/conjunctions-coordinating.txt +15 -0
  138. data/lib/random-words/words/latin/names.txt +93 -0
  139. data/lib/random-words/words/latin/numbers.yml +5 -0
  140. data/lib/random-words/words/latin/phrases.txt +16 -0
  141. data/lib/random-words/words/latin/prepositions.txt +18 -0
  142. data/lib/random-words/words/latin/terminators.txt +16 -0
  143. data/lib/random-words/words/spanish/adjectives.txt +81 -0
  144. data/lib/random-words/words/spanish/adverbs.txt +87 -0
  145. data/lib/random-words/words/spanish/articles-plural.txt +4 -0
  146. data/lib/random-words/words/spanish/articles-singular.txt +4 -0
  147. data/lib/random-words/words/spanish/clauses.txt +74 -0
  148. data/lib/random-words/words/spanish/config.yml +4 -0
  149. data/lib/random-words/words/spanish/conjunctions-coordinating.txt +8 -0
  150. data/lib/random-words/words/spanish/conjunctions-subordinate.txt +16 -0
  151. data/lib/random-words/words/spanish/names.txt +61 -0
  152. data/lib/random-words/words/spanish/nouns-plural.txt +92 -0
  153. data/lib/random-words/words/spanish/nouns-singular.txt +125 -0
  154. data/lib/random-words/words/spanish/numbers.yml +5 -0
  155. data/lib/random-words/words/spanish/phrases.txt +31 -0
  156. data/lib/random-words/words/spanish/prepositions.txt +31 -0
  157. data/lib/random-words/words/spanish/terminators.txt +17 -0
  158. data/lib/random-words/words/spanish/verbs-passive.txt +495 -0
  159. data/lib/random-words/words/spanish/verbs-plural.txt +326 -0
  160. data/lib/random-words/words/spanish/verbs-singular.txt +351 -0
  161. data/lib/random-words/words/veggie/adjectives.txt +111 -0
  162. data/lib/random-words/words/veggie/adverbs.txt +81 -0
  163. data/lib/random-words/words/veggie/articles-plural.txt +10 -0
  164. data/lib/random-words/words/veggie/articles-singular.txt +10 -0
  165. data/lib/random-words/words/veggie/clauses.txt +57 -0
  166. data/lib/random-words/words/veggie/config.yml +4 -0
  167. data/lib/random-words/words/veggie/conjunctions-coordinating.txt +20 -0
  168. data/lib/random-words/words/veggie/conjunctions-subordinate.txt +29 -0
  169. data/lib/random-words/words/veggie/names.txt +93 -0
  170. data/lib/random-words/words/veggie/nouns-plural.txt +78 -0
  171. data/lib/random-words/words/veggie/nouns-singular.txt +105 -0
  172. data/lib/random-words/words/veggie/numbers.yml +5 -0
  173. data/lib/random-words/words/veggie/phrases.txt +20 -0
  174. data/lib/random-words/words/veggie/prepositions.txt +45 -0
  175. data/lib/random-words/words/veggie/terminators.txt +16 -0
  176. data/lib/random-words/words/veggie/verbs-passive.txt +56 -0
  177. data/lib/random-words/words/veggie/verbs-plural.txt +79 -0
  178. data/lib/random-words/words/veggie/verbs-singular.txt +79 -0
  179. data/lib/random-words.rb +28 -0
  180. data/random-words.gemspec +3 -1
  181. data/src/_README.md +208 -15
  182. metadata +181 -9
  183. data/lib/random-words/words/bacon/numbers.txt +0 -21
  184. data/lib/random-words/words/corporate/numbers.txt +0 -21
  185. data/lib/random-words/words/english/numbers.txt +0 -21
  186. data/lib/random-words/words/latin/numbers.txt +0 -21
@@ -0,0 +1,56 @@
1
+ are bought
2
+ were bought
3
+ are eaten
4
+ were eaten
5
+ are cooked
6
+ were cooked
7
+ are prepared
8
+ were prepared
9
+ are served
10
+ were served
11
+ are grown
12
+ were grown
13
+ are harvested
14
+ were harvested
15
+ are selected
16
+ were selected
17
+ are stored
18
+ were stored
19
+ are chopped
20
+ were chopped
21
+ are washed
22
+ were washed
23
+ are seasoned
24
+ were seasoned
25
+ are sliced
26
+ were sliced
27
+ are steamed
28
+ were steamed
29
+ are sautéed
30
+ were sautéed
31
+ are roasted
32
+ were roasted
33
+ are grilled
34
+ were grilled
35
+ are diced
36
+ were diced
37
+ are pureed
38
+ were pureed
39
+ are blended
40
+ were blended
41
+ are tossed
42
+ were tossed
43
+ are marinated
44
+ were marinated
45
+ are consumed
46
+ were consumed
47
+ are picked
48
+ were picked
49
+ are preserved
50
+ were preserved
51
+ are arranged
52
+ were arranged
53
+ are plated
54
+ were plated
55
+ are seasoned
56
+ were seasoned
@@ -0,0 +1,79 @@
1
+ arrange
2
+ bake
3
+ balance
4
+ blend
5
+ buy
6
+ catalog
7
+ challenge
8
+ choose
9
+ chop
10
+ clean
11
+ collect
12
+ combine
13
+ complete
14
+ consume
15
+ cook
16
+ cut
17
+ dice
18
+ dig
19
+ distribute
20
+ dress
21
+ eat
22
+ enhance
23
+ enjoy
24
+ export
25
+ fertilize
26
+ finish
27
+ flavor
28
+ freeze
29
+ frost
30
+ fry
31
+ glaze
32
+ grill
33
+ grow
34
+ harvest
35
+ import
36
+ innovate
37
+ inspect
38
+ marinate
39
+ marvel
40
+ mash
41
+ melt
42
+ offer
43
+ organize
44
+ pair
45
+ pick
46
+ plant
47
+ plate
48
+ prepare
49
+ preserve
50
+ process
51
+ purchase
52
+ puree
53
+ recommend
54
+ refrigerate
55
+ roast
56
+ sample
57
+ sauté
58
+ savor
59
+ season
60
+ select
61
+ separate
62
+ serve
63
+ share
64
+ shred
65
+ slice
66
+ specialize
67
+ sprinkle
68
+ steam
69
+ stir
70
+ store
71
+ substitute
72
+ taste
73
+ toss
74
+ transform
75
+ transport
76
+ wash
77
+ whip
78
+ whisk
79
+ zest
@@ -0,0 +1,79 @@
1
+ arranges
2
+ bakes
3
+ balances
4
+ blends
5
+ buys
6
+ catalogs
7
+ challenges
8
+ chooses
9
+ chops
10
+ cleans
11
+ collects
12
+ combines
13
+ completes
14
+ consumes
15
+ cooks
16
+ cuts
17
+ dices
18
+ digs
19
+ distributes
20
+ dresses
21
+ eats
22
+ enhances
23
+ enjoys
24
+ exports
25
+ fertilizes
26
+ finishes
27
+ flavors
28
+ freezes
29
+ frosts
30
+ fry
31
+ glazes
32
+ grills
33
+ grows
34
+ harvests
35
+ imports
36
+ innovates
37
+ inspects
38
+ marinates
39
+ marvels
40
+ mashes
41
+ melts
42
+ offers
43
+ organizes
44
+ pairs
45
+ picks
46
+ plants
47
+ plates
48
+ prepares
49
+ preserves
50
+ processes
51
+ purchases
52
+ purees
53
+ recommends
54
+ refrigerates
55
+ roasts
56
+ samples
57
+ sautés
58
+ savors
59
+ seasons
60
+ selects
61
+ separates
62
+ serves
63
+ shares
64
+ shreds
65
+ slices
66
+ specializes
67
+ sprinkles
68
+ steams
69
+ stirs
70
+ stores
71
+ substitutes
72
+ tastes
73
+ tosses
74
+ transforms
75
+ transports
76
+ washes
77
+ whips
78
+ whisks
79
+ zests
data/lib/random-words.rb CHANGED
@@ -1,6 +1,34 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'fileutils'
5
+ require 'yaml'
6
+
4
7
  require_relative 'random-words/version'
5
8
  require_relative 'random-words/string'
9
+ require_relative 'random-words/hash'
10
+ require_relative 'random-words/array'
11
+ require_relative 'random-words/source'
12
+ require_relative 'random-words/config'
6
13
  require_relative 'random-words/generator'
14
+ require_relative 'random-words/number-to-word'
15
+ require_relative 'random-words/lorem-markdown'
16
+ require_relative 'random-words/html2markdown'
17
+
18
+ # Main module for RandomWords
19
+ module RandomWords
20
+ # Main class for RandomWords
21
+ class << self
22
+ # @!visibility private
23
+ attr_accessor :testing, :tested
24
+
25
+ # @!visibility private
26
+ # Initialize the RandomWords module
27
+ def initialize!(testing = false)
28
+ @testing ||= testing
29
+ @tested ||= []
30
+ end
31
+ end
32
+
33
+ initialize!
34
+ end
data/random-words.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = 'me@brettterpstra.com'
10
10
 
11
11
  spec.summary = 'Random words generator'
12
- spec.description = 'Generate random text (lorem ipsum) from a variety of sources. Can be used to generate random words, sentences, or paragraphs.'
12
+ spec.description = 'Generate random text (lorem ipsum) from a variety of sources.'
13
13
  spec.homepage = 'https://github.com/ttscoff/random-words'
14
14
  spec.license = 'MIT'
15
15
  spec.required_ruby_version = '>= 2.6.0'
@@ -33,4 +33,6 @@ Gem::Specification.new do |spec|
33
33
  end
34
34
 
35
35
  spec.metadata['rubygems_mfa_required'] = 'true'
36
+
37
+ spec.add_dependency 'nokogiri', '~> 1.12'
36
38
  end
data/src/_README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # RandomWords
2
2
  <!--README-->
3
3
 
4
- [![RubyGems.org](https://img.shields.io/gem/v/snibbets)](https://rubygems.org/gems/snibbets)
4
+ [![RubyGems.org](https://img.shields.io/gem/v/random-words)](https://rubygems.org/gems/random-words)
5
5
 
6
6
  A random text (Lorem Ipsum) generator.
7
7
 
@@ -9,32 +9,225 @@ A random text (Lorem Ipsum) generator.
9
9
 
10
10
  gem install random-words
11
11
 
12
- Depending on your setup, you may need `gem install --user-install random-words`, or in worst case scenario, `sudo gem install random-words`. You can also use `brew gem install random-words` if you use [Homebrew](https://brew.sh).
12
+ Depending on your setup, you may need
13
+ `gem install --user-install random-words`, or in
14
+ worst case scenario, `sudo gem install random-words`.
15
+ You can also use `brew gem install random-words` if
16
+ you use [Homebrew](https://brew.sh).
13
17
 
14
18
  ### CLI
15
19
 
16
- The gem installs a binary `randw`. It can generate random characters, sentences, paragraphs, and passwords.
20
+ The gem installs a binary `randw`. It can generate random
21
+ characters, sentences, paragraphs, markdown, html, and
22
+ passwords.
17
23
 
18
24
  ```console
19
25
  Usage: randw [options]
20
- Options:
21
- -S, --source [SOURCE] Specify the source language (default: latin)
22
- -l [short|medium|long|very_long],
23
- --length Specify the length of the sentence
24
- --graf-length [NUMBER] Specify the number of sentences in a paragraph
25
- -s, --sentences [NUMBER] Generate random sentences
26
- -p, --paragraphs [NUMBER] Generate random paragraphs
27
- -w, --words [NUMBER] Generate random words
28
- -c, --characters [NUMBER] Generate random characters
29
- --password Generate a random password
30
- --separator [CHAR] Specify the separator character for the password
31
- -n, --no-whitespace Specify whether to remove whitespace in generated text (characters only)
26
+ OPTIONS:
27
+ -S, --source SOURCE Specify the source language (default: latin)
28
+ -l, --length LENGTH Specify the length of the sentence [short|medium|long|very_long]
29
+ --graf-length NUMBER Specify the number of sentences in a paragraph
30
+ --[no-]extended Specify whether to use extended punctuation in generated text
31
+ GENERATORS:
32
+ -s, --sentences [NUMBER] Generate NUMBER of random sentences (default: 3)
33
+ -p, --paragraphs [NUMBER] Generate NUMBER of random paragraphs (default: 3)
34
+ -w, --words [NUMBER] Generate NUMBER of random words (default: 10)
35
+ -c, --characters [NUMBER] Generate random characters of length (default: 100)
36
+ -m, --markdown [SETTINGS] Generate random markdown text, comma separated string like "latin,10,all"
37
+ dec: add em and strong
38
+ link: add links
39
+ ul: add unordered lists
40
+ ol: add ordered lists
41
+ dl: add definition lists
42
+ bq: add block quotes
43
+ code: add code spans and block
44
+ mark: add ==highlights==
45
+ headers: add headlines
46
+ image: add images
47
+ table: add tables
48
+ -H, --html [SETTINGS] Generate random html text, comma separated string like "latin,10,all"
49
+ --password [LENGTH] Generate a random password of LENGTH (default: 20)
50
+ PASSWORD OPTIONS:
51
+ --separator CHAR Specify the separator character for the password (default: " ")
52
+ -n, --[no-]whitespace Specify whether to remove whitespace in generated text (characters only)
53
+ DICTIONARIES:
54
+ --list-dictionaries List available dictionaries
55
+ --create-dictionary [NAME] Create a new dictionary
56
+ OTHER OPTIONS:
32
57
  -d, --debug Enable debug mode, displays sentence/word/character counts
33
58
  -h, --help Display this help message
34
59
  -v, --version Display the version
35
60
  -t, --test Run the full debug test
36
61
  ```
37
62
 
63
+ #### Generating Markdown text
64
+
65
+ The `--markdown` flag takes a SETTINGS argument. This is a
66
+ comma- or slash-separated string that determines the
67
+ elements to include.
68
+
69
+ First, the source language (defaults to latin), then the
70
+ length of paragraphs and tables: e.g. `english/medium`. You
71
+ can add any digits to determine how many paragraps are
72
+ generated (default 5), e.g. `corporate/medium/10`.
73
+
74
+ Then you can add individual elements, or use `/all` to
75
+ trigger all elements. The elements available are:
76
+
77
+ | trigger | element |
78
+ | :------ | :------------------------ |
79
+ | dec | add em and strong |
80
+ | link | add links |
81
+ | ul | add unordered lists |
82
+ | ol | add ordered lists |
83
+ | dl | add definition lists |
84
+ | bq | add block quotes |
85
+ | code | add code spans and blocks |
86
+ | mark | add ==highlights== |
87
+ | headers | add headlines |
88
+ | image | add images |
89
+ | table | add tables |
90
+
91
+ The number of elements inserted depends on the length you specify.
92
+
93
+ Example commands:
94
+
95
+ ```console
96
+ $ randw -m "latin/1/short/ol"
97
+
98
+ Illa brevis muros potior arcesso, apud multae octo centum nonaginta octo nodum! Haec ruosus misericordia mox contendo, apud nullus fors.
99
+
100
+
101
+ 1. Hoc cognatus opus facile complor latus discendo
102
+ 2. Aliqua apparens census quod nego
103
+ 3. Nullus salvus dux apud habeo spectabilis
104
+ 4. Quaedam sensus regnum cura gaudeo ornatus faeneo mox
105
+
106
+ $ randw -m "english,5,all"
107
+
108
+ # Any shiny napkin effectively picks
109
+
110
+ Neither sudden lake exceedingly works, outside a clarity even if which is a source of _an_ strength even if which holds _one subtle horse_ the future. Any lovable tank remarkabl...
111
+ ```
112
+
113
+ #### Creating A New Dictionary
114
+
115
+ You can add your own sources for generating your random
116
+ text. A dictionary is a directory containing several text
117
+ files, one for each part of speech that RandomWords uses.
118
+ All of the parts must exist. The directory name is the same
119
+ as the name of the dictionary.
120
+
121
+ User dictionaries must be stored in `~/.config/random-words/words/[NAME]`.
122
+
123
+ The easiest way to generate a new language is to use the CLI:
124
+
125
+ ```console
126
+ randw --create-dictionary [NAME]
127
+ ```
128
+
129
+ Once this command is run, a new directory in
130
+ `~/.config/random-words/words` will be created containing
131
+ all of the necessary files with English defaults. Simply
132
+ edit these files, and then you'll be able to call the
133
+ language by its name (or triggers defined in the config, see
134
+ below). If a language of the same name exists, missing files
135
+ will be filled in, but existing files will not be
136
+ overwritten.
137
+
138
+ The necessary files are:
139
+
140
+ ```console
141
+ adjectives.txt
142
+ adverbs.txt
143
+ articles-plural.txt
144
+ articles-singular.txt
145
+ clauses.txt
146
+ config.yml
147
+ conjunctions-coordinating.txt
148
+ conjunctions-subordinate.txt
149
+ names.txt
150
+ nouns-plural.txt
151
+ nouns-singular.txt
152
+ numbers.txt
153
+ phrases.txt
154
+ prepositions.txt
155
+ terminators.txt
156
+ verbs-passive.txt
157
+ verbs-plural.txt
158
+ verbs-singular.txt
159
+ ```
160
+
161
+ ##### Language Configuration
162
+
163
+ The `config.yml` file in a language directory is a simple
164
+ YAML configuration. It contains the keys:
165
+
166
+ ```yaml
167
+ ---
168
+ name: english
169
+ description: English words
170
+ triggers: [english]
171
+ ```
172
+
173
+ A default configuration file will be created when running `--create-dictionary` with the CLI.
174
+
175
+ - `name`: The name of the dictionary
176
+
177
+ This should be the same as the directory name in most cases
178
+ - `description`: Just used for display when running `--list-dictionaries`
179
+ - `triggers`: An array of triggers that can be used to trigger the language.
180
+
181
+ For example, the `bacon` language has the triggers `[bacon, meat, carnivore]`, so you can use `randw -S meat` on the command line (or with the library).
182
+
183
+
184
+
185
+ ##### Terminators
186
+
187
+ The `terminators.txt` file contains pairs of punctuation,
188
+ separated by commas, one per line. If a sentence terminator
189
+ doesn't have opening punctuation, start the line with a
190
+ comma. More than one character can be used in either side of
191
+ the pair. For example, to create a double quoted sentence
192
+ with a period inside the closing quote, you would use:
193
+
194
+ ",."
195
+
196
+ A blank line (or any line not containing a comma) will
197
+ separate regular punctuation from extended punctuation. In
198
+ the default file, `.`, `?`, and `!` are considered regular
199
+ punctuation, and parenthesis and quotes are considered
200
+ extended punctuation. Extended punctuation is off by
201
+ default, but in the CLI can be enabled with `--extended`,
202
+ and using the library you can include
203
+ `use_extended_punctuation: true` in the options when
204
+ initializing, or use `@rw.use_extended_punctuation = true`
205
+ to set it after initializing.
206
+
207
+ Repeating words or terminators more than once in the config
208
+ files increases their likelihood of being used. In the
209
+ default terminator.txt files, the period, question mark, and
210
+ exclamation point are repeated multiple times to make them
211
+ the most likely to be used.
212
+
213
+ ##### Names
214
+
215
+ The `names.txt` file is just used when creating block quotes
216
+ in Markdown or HTML output. Sections are split by blank
217
+ lines: first names, last names, and optionally full names.
218
+ If the first line contains characters other than letters,
219
+ single quotes, and dashes, it will be assumed that you've
220
+ skipped straight to full names and those will be used
221
+ instead of generating random combinations.
222
+
223
+ #### Language Notes
224
+
225
+ RandomWords loosely uses English rules for sentence construction, so non-English languages will likely generate even more nonsensical strings.
226
+
227
+ If you create a fun dictionary, please let me know (or make a PR) and I'll gladly include (most) new dictionaries in the main distribution.
228
+
229
+ > The easiest way to get words is with AI. A ChatGPT prompt like "give me 100 plural nouns related to the medical profession, in plain text, one per line, sorted alphabetically" will get you a good list of words you can then just paste into `nouns-plural.txt` in your dictionary.
230
+
38
231
  ### Library
39
232
 
40
233
  ```ruby