Sprichwoerter 0.1 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 80f837ad47153be05dea980ae26c1fd24dfe9cf6
4
- data.tar.gz: 93abff22aaac0f9232b93bd846099c98f8f8296f
2
+ SHA256:
3
+ metadata.gz: 409ea77be08978d4ac11df8a73862f25b8af2638043749feb7ca0baca0e8b124
4
+ data.tar.gz: df0cd33efbe5421d50e6f2792ff6dea4d31d00892dd7123601f571a5c95d39a1
5
5
  SHA512:
6
- metadata.gz: c638f6865975268ed30b33962d17f7b2cda89703145f41c1f43386a5b2d2ad48c403b0977bef9bd537df154c22d173f02faaa271c19fcc4bd63f7abccb6e99ec
7
- data.tar.gz: ba43ea04d0630ccc11cc0b382e18eac42b3815f8ad9514c7974c72edad1b12c49118b0fb9f04aab3f9108ccd5537bdce5dd16827fef41a31b96f83bf28316957
6
+ metadata.gz: df720f489ff6223d426199387d64f0cc53ea20f71cfd76791e37f36920d76e6b15f384fcf56fc650a301f395d927105ac2a7e182f6eede5786c19ca4401a3ee5
7
+ data.tar.gz: 39b01904a8a6f76d1b9fbfe7ac4106d145c931fd60dc8c5ee4c40b13543ca0557ae4fd197c9975baebadffc68743b3334bcb32e3b5a1d86cd10bfe127396800b
@@ -0,0 +1,20 @@
1
+ require_relative "lib/version"
2
+ require 'date'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.version = VERSION
6
+ s.name = File.basename(__FILE__, '.gemspec')
7
+ s.date = Date.today.strftime('%F')
8
+ s.summary = SUMMARY
9
+ s.description = "Generates random, senseless proverbs by combining beginnings and endings of existing proverbs."
10
+ s.authors = ["Michael Uplawski"]
11
+ s.email = 'michael.uplawski@uplawski.eu'
12
+ s.files = %w~sprichwoerter proverbs~.collect{|f| 'bin/' << f} + %w~adder.rb color_output.rb argparser.rb rearranging.rb translating.rb translations logging.rb log.conf liste_de.rb sprichwörter.rb liste_en.rb version.rb user_input.rb~.collect{|f| 'lib/' << f} + %w~Sprichwoerter.gemspec~.collect{|f|f} + %w~html/proverbs.html html/sprichwoerter.html man/proverbs.6.gz man/sprichwoerter.6.gz pdf/proverbs.pdf pdf/sprichwoerter.pdf rst/proverbs.rst rst/sprichwoerter.rst~.collect{|f| 'doc/' << f}
13
+ s.executables = "sprichwoerter", "proverbs"
14
+ s.license = 'Nonstandard'
15
+ s.required_ruby_version = '>= 2.5'
16
+ s.metadata = {
17
+ "homepage_uri" => 'https://www.uplawski.eu/software/sprichwoerter',
18
+ "documentation_uri" => 'https://www.uplawski.eu/software/sprichwoerter/proverbs.html'
19
+ }
20
+ end
data/bin/proverbs CHANGED
@@ -1,25 +1,55 @@
1
1
  #!/usr/bin/env ruby
2
2
  #encoding: UTF-8
3
+
3
4
  =begin
4
- /***************************************************************************
5
- * ©2016-2016, Michael Uplawski <michael.uplawski@uplawski.eu> *
5
+ * ©2016-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
6
  * *
7
7
  * This program is free software; you can redistribute it and/or modify *
8
- * it under the terms of the GNU General Public License as published by *
9
- * the Free Software Foundation; either version 3 of the License, or *
8
+ * it under the terms of the WTFPL, either version 2 of the License, or *
10
9
  * (at your option) any later version. *
11
- * *
12
- * This program is distributed in the hope that it will be useful, *
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
- * GNU General Public License for more details. *
16
- * *
17
- * You should have received a copy of the GNU General Public License *
18
- * along with this program; if not, write to the *
19
- * Free Software Foundation, Inc., *
20
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21
- ***************************************************************************/
10
+ * See http://www.wtfpl.net/about/ for details. *
22
11
  =end
23
12
 
24
13
  require_relative '../lib/sprichwörter'
25
- SprichWoerter.new('en')
14
+ require_relative '../lib/adder'
15
+ require_relative '../lib/color_output'
16
+
17
+ SprichWoerter.new('en', ARGV)
18
+ =begin
19
+ if(ARGV.include?("-h") || ARGV.include?("--help"))
20
+ usage = %q~
21
+ Usage: proverbs
22
+ or proverbs list
23
+ or proverbs add singular "A watched pot" "never boils"
24
+ or proverbs add plural "cheaters" "never prosper"
25
+
26
+ The argument 'add' will add a new, original proverb to the list and write
27
+ all available English proverbs to
28
+ /home/user/.proverbs/liste_en.rb.
29
+
30
+ A backup-copy of the previous version is also created.
31
+
32
+ Proverbs, which are identical in all details will be recognized and
33
+ duplicates are avoided.
34
+ ~
35
+
36
+ puts usage
37
+ exit 0
38
+ end
39
+
40
+
41
+ if(ARGV.include?("add") && ARGV.length > 3 )
42
+ ARGV.delete('add')
43
+ Adder.new('en', *ARGV)
44
+ elsif ARGV.include?("list")
45
+ SprichWoerter.new('en', :list)
46
+ exit true
47
+ elsif !ARGV.empty?
48
+ puts red("\nUnsuitable or insufficient arguments '" << bold(ARGV.join(', ') ) << "'.")
49
+ puts "Run with '-h' or '--help' to see the usage message."
50
+ puts
51
+ exit 0
52
+ else
53
+ SprichWoerter.new('en')
54
+ end
55
+ =end
data/bin/sprichwoerter CHANGED
@@ -1,25 +1,59 @@
1
1
  #!/usr/bin/env ruby
2
2
  #encoding: UTF-8
3
3
  =begin
4
- /***************************************************************************
5
- * ©2016-2016, Michael Uplawski <michael.uplawski@uplawski.eu> *
4
+ * ©2016-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
6
5
  * *
7
6
  * This program is free software; you can redistribute it and/or modify *
8
- * it under the terms of the GNU General Public License as published by *
9
- * the Free Software Foundation; either version 3 of the License, or *
7
+ * it under the terms of the WTFPL, either version 2 of the License, or *
10
8
  * (at your option) any later version. *
11
- * *
12
- * This program is distributed in the hope that it will be useful, *
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
- * GNU General Public License for more details. *
16
- * *
17
- * You should have received a copy of the GNU General Public License *
18
- * along with this program; if not, write to the *
19
- * Free Software Foundation, Inc., *
20
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21
- ***************************************************************************/
9
+ * See http://www.wtfpl.net/about/ for details. *
22
10
  =end
23
11
 
24
12
  require_relative '../lib/sprichwörter'
25
- SprichWoerter.new('de')
13
+ require_relative '../lib/adder'
14
+ require_relative '../lib/color_output'
15
+
16
+ SprichWoerter.new('de', ARGV)
17
+
18
+ =begin
19
+ if(ARGV.include?("-h") || ARGV.include?("--hilfe"))
20
+ usage = %q~
21
+ Aufrufsyntax: sprichwoerter
22
+ oder sprichwoerter liste
23
+ oder sprichwoerter neu singular "Ein König mit Krone" "ist besser als ohne"
24
+ oder sprichwoerter neu plural "Hunde, die bellen" "beißen nicht"
25
+
26
+ Der Parameter 'neu' fügt ein neues, ursprüngliches Sprichwort in die Liste
27
+ hinzu und schreibt alle verfügbaren, deutschen Sprichwörter in die Datei
28
+ /home/user/.proverbs/liste_de.rb,
29
+
30
+ Außerdem wird bei jedem Schreiben in diese Datei eine Kopie der vorigen Version
31
+ erzeugt.
32
+
33
+ Buchstäblich identische Sprichwörter werden erkannt und Duplikate vermieden.
34
+ ~
35
+
36
+ puts usage
37
+ exit 0
38
+ end
39
+ =end
40
+
41
+ =begin
42
+ if(ARGV.include?("neu") && ARGV.length > 3)
43
+ ARGV.delete('neu')
44
+ Adder.new('de', *ARGV)
45
+ elsif ARGV.include?("liste")
46
+ SprichWoerter.new('de', :list)
47
+ exit true
48
+ elsif !ARGV.empty?
49
+ puts red("\nUnbrauchbare oder zu wenig Programmargumente '" << bold(ARGV.join(', ') ) << "'.")
50
+ puts "Starten Sie das Programm mit '-h' oder '--hilfe', um die Kurzhilfe zu sehen."
51
+ puts
52
+ exit 0
53
+ else
54
+ #SprichWoerter.new('de', :create)
55
+ SprichWoerter.new(ARGV)
56
+ end
57
+ =end
58
+ #
59
+ #---test
@@ -0,0 +1,289 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta name="generator" content="vim - Vi Improved, a programmer's editor; HTML Tidy for Linux version 5.8.0
5
+ "/>
6
+ <meta charset="utf-8" />
7
+ <meta name="viewport" content=
8
+ "width=device-width, initial-scale=1" />
9
+ <title>Proverbs</title>
10
+ <style type="text/css">
11
+ /*<![CDATA[*/
12
+
13
+ /*
14
+ :Author: Michael Uplawski
15
+ :Contact: michael.uplawski@uplawski.eu
16
+ :License: WTFPL 2.0, see http://www.wtfpl.net/about/
17
+
18
+ Stylesheet for use with Docutils.
19
+ */
20
+
21
+ body {
22
+ background-color:#e0f0c0;
23
+ font-family: Verdana,Helvetica,Univers;
24
+ }
25
+
26
+ p {width: 80%;}
27
+
28
+ h1.title {color:#800080;font-size:2em;}
29
+ h2 {color:darkblue;font-size:1.5em;}
30
+ h3 {color:#3030f0;font-size:1em;}
31
+
32
+ nav:before {
33
+ content:'Contents';
34
+ font-weight:bold;
35
+ color:darkblue;
36
+ font-size:1.5em;
37
+ }
38
+
39
+ p, ul.simple, ol.simple, dt {margin-left:2em;}
40
+ dd {margin-left:4em;}
41
+
42
+ /* correct left margin of nested block tags*/
43
+ dd p, li p {margin-left:0;}
44
+ dd * ul {margin-left:0 ! important; }
45
+ dd ul {margin-left:0 ! important; }
46
+ dd dl dt, dd dl dd {margin-left:0 ! important;}
47
+
48
+ em {color:#000080;
49
+ background-color:#ffffa0;
50
+ }
51
+
52
+ pre.literal-block {
53
+ margin-left:2em;
54
+ font-family:Verdana,Helvetica,Univers;
55
+ }8
56
+ blockquote {background-color:#ffc090;
57
+ padding:0.5em;
58
+ width:80%;
59
+ border-radius:0.5em;
60
+ }
61
+
62
+
63
+ /*]]>*/
64
+ </style>
65
+ </head>
66
+ <body>
67
+ <main id="proverbs">
68
+ <h1 class="title">PROVERBS</h1>
69
+
70
+ <p class="subtitle" id=
71
+ "rearrange-proverbs-into-new-mostly-senseless-proverbs">
72
+ Rearrange proverbs into new, mostly senseless, proverbs.</p>
73
+
74
+ <p><em>Sprichwörter</em> is the German name for the same
75
+ program.</p>
76
+
77
+ <section id="synopsis">
78
+ <h2>Synopsis</h2>
79
+
80
+ <blockquote>
81
+ <p><strong>proverbs</strong>
82
+ </p>
83
+
84
+ <p><strong>proverbs -[qc &lt;COLOR&gt;] (--qualify --color
85
+ &lt;COLOR&gt;)</strong>
86
+ </p>
87
+
88
+ <p><strong>proverbs -f (--favorites)</strong>
89
+ </p>
90
+
91
+ <p><strong>proverbs -a (--add)</strong>
92
+ </p>
93
+
94
+ <p><strong>proverbs -h (--help)</strong>
95
+ </p>
96
+
97
+ <p><strong>proverbs -v (--version)</strong>
98
+ </p>
99
+ </blockquote>
100
+ </section>
101
+
102
+ <section id="description">
103
+ <h2>DESCRIPTION</h2>
104
+
105
+ <p>The program combines the beginnings and the endings of
106
+ proverbs randomly picked from a list. The result is a phrase
107
+ which is still recognizable as "kind of a proverb" but
108
+ without claiming to convey any real message, let alone
109
+ "wisdom".</p>
110
+
111
+ <p>Yes. It is intended as a humorous waste of time. You can,
112
+ for example, call proverbs from your <em>.bashrc</em>
113
+ file.</p>
114
+
115
+ <p>When called on the command-prompt as
116
+ <strong>proverbs</strong> without any options, a newly
117
+ generated proverb will be printed out on screen.</p>
118
+ </section>
119
+
120
+ <section id="options">
121
+ <h2>OPTIONS</h2>
122
+
123
+ <dl class="simple">
124
+ <dt><strong>-a</strong> or <strong>--add</strong></dt>
125
+
126
+ <dd>
127
+ <p>Allows you to add a new, real proverb to the list of
128
+ original proverbs. You are prompted for each of the
129
+ details: language (one of <em>en</em> or <em>de</em> at
130
+ the time of this writing), singular or plural
131
+ (<em>s</em>, <em>p</em>), beginning and ending of the
132
+ proverb.</p>
133
+ </dd>
134
+
135
+ <dt><strong>-f</strong> or
136
+ <strong>--favorites</strong></dt>
137
+
138
+ <dd>
139
+ <p>Will dump the list of "qualified", random proverbs,
140
+ i.e. those that had been found worth saving after a
141
+ previous call to proverbs.</p>
142
+ </dd>
143
+
144
+ <dt><strong>-q</strong> or <strong>--qualify</strong></dt>
145
+
146
+ <dd>
147
+ <p>After a newly created proverb has been presented, you
148
+ have a few seconds to eventually qualify a proverb, i.e.
149
+ add it to the list of favorites, by pushing '+'.</p>
150
+ </dd>
151
+
152
+ <dt><strong>-c</strong> or
153
+ <strong>--color=COLOR</strong></dt>
154
+
155
+ <dd>
156
+ <p>Sets the color the border which sourrounds a generated
157
+ proverb. Must be one of red, green, yellow, purple, cyan,
158
+ blue, white or black.</p>
159
+ </dd>
160
+
161
+ <dt><strong>-h</strong> or <strong>--help</strong></dt>
162
+
163
+ <dd>
164
+ <p>Shows the short help-text for the program.</p>
165
+ </dd>
166
+
167
+ <dt><strong>-v</strong> or <strong>--version</strong></dt>
168
+
169
+ <dd>
170
+ <p>Shows version-information</p>
171
+ </dd>
172
+ </dl>
173
+
174
+ <section id=
175
+ "adding-proverbs-to-the-default-list-option-a-or-add">
176
+ <h3>ADDING PROVERBS to the default list (option -a or
177
+ --add)</h3>
178
+
179
+ <p>At the time of this writing (october 2019), original
180
+ ('real') proverbs must conform to the pattern</p>
181
+
182
+ <p>"<em>someone or something</em>" | "<strong>does or
183
+ is</strong> <em>something</em>"</p>
184
+
185
+ <p>Just execute the program a few times on the
186
+ command-line, without arguments, to get the idea.</p>
187
+
188
+ <p>For the time, original proverbs are grouped with respect
189
+ to their subject (someone or something), which is
190
+ uncountable or in singular for the first group (like in
191
+ “Fortune | favors the bold”), in plural for the second
192
+ group (like in “All Roads | lead to Rome”).</p>
193
+ </section>
194
+ </section>
195
+
196
+ <section id="files">
197
+ <h2>FILES</h2>
198
+
199
+ <p>The hidden directory <em>.proverbs</em> in the user's
200
+ home-directory can contain three types of file. For the
201
+ English version, these are:</p>
202
+
203
+ <dl class="simple">
204
+ <dt><em>liste_en.rb</em>
205
+ </dt>
206
+
207
+ <dd>
208
+ <p>This file contains all the currently available,
209
+ original proverbs. It exists only, if you have already
210
+ added new original proverbs.</p>
211
+ </dd>
212
+
213
+ <dt><em>liste_en_bak.rb</em>
214
+ </dt>
215
+
216
+ <dd>
217
+ <p>A backup-copy of the previous version of the list of
218
+ proverbs.</p>
219
+ </dd>
220
+
221
+ <dt><em>qualifile_en</em>
222
+ </dt>
223
+
224
+ <dd>
225
+ <p>This file contains the list of previously qualified,
226
+ randomly generated proverbs, i.e. the list of
227
+ <em>favorites</em>. It is created when you qualify a
228
+ proverb for the very first time, and dumped to screen,
229
+ when you use the option -f or --favorites.</p>
230
+ </dd>
231
+ </dl>
232
+ </section>
233
+
234
+ <section id="other-information">
235
+ <h2>OTHER INFORMATION</h2>
236
+
237
+ <dl class="field-list simple">
238
+ <dt>Source-code<span class="colon">:</span></dt>
239
+
240
+ <dd>
241
+ <p>"Proverbs" had been developed in <a class=
242
+ "reference external" href=
243
+ "https://www.ruby-lang.org">Ruby</a> and is distributed
244
+ as a <a class="reference external" href=
245
+ "https://rubygems.org/gems/Sprichwoerter">ruby-gem</a>.
246
+ If you installed the program from the gem-file (with
247
+ <em>gem install</em>), then you find all the source-files
248
+ in the gem-folder for your Ruby-version. Otherwise, you
249
+ can also unpack the gem-file (with <em>tar</em>), then
250
+ uncompress the data-archive and take a look at the files
251
+ in the resulting, new folders <em>bin</em> and
252
+ <em>lib</em>.</p>
253
+ </dd>
254
+ </dl>
255
+
256
+ <dl class="field-list simple">
257
+ <dt>License<span class="colon">:</span></dt>
258
+
259
+ <dd>
260
+ <p>"Proverbs" is released under the conditions of the
261
+ <a class="reference external" href=
262
+ "https://www.wtfpl.net/about/">WTFPL</a>, version
263
+ 2.0.</p>
264
+ </dd>
265
+
266
+ <dt>Version<span class="colon">:</span></dt>
267
+
268
+ <dd>
269
+ <p>1.6 of 2019/10/15</p>
270
+ </dd>
271
+
272
+ <dt>Author<span class="colon">:</span></dt>
273
+
274
+ <dd>
275
+ <p>"Proverbs" has been programmed by Michael Uplawski
276
+ &lt;<a class="reference external" href=
277
+ "mailto:michael.uplawski@uplawski.eu">michael.uplawski@uplawski.eu</a>&gt;.
278
+ The German parlor game <em>"Verrückte Sprichwörter"</em>
279
+ ("Crazy Proverbs") was the principal inspiration for the
280
+ project.</p>
281
+ </dd>
282
+ </dl>
283
+
284
+ <p><strong>Ω</strong>
285
+ </p>
286
+ </section>
287
+ </main>
288
+ </body>
289
+ </html>