cyberweb 0.5.225 → 0.6.17
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cyberweb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +438 -238
- data/doc/README.gen +437 -237
- data/doc/todo/todo_for_the_cyberweb_project.md +6 -0
- data/examples/advanced/cursor_example/cursor_example.cgi +29 -0
- data/examples/advanced/draw_circle/draw_circle.cgi +13 -4
- data/examples/css/css_bubbles.html +8 -2
- data/examples/css/examples_with_borders/examples_with_borders.html +33 -0
- data/examples/javascript_and_jquery/copy_to_the_clipboard_example/copy_to_the_clipboard_example.html +80 -0
- data/images/cyberweb_theme.png +0 -0
- data/lib/cyberweb/base/misc.rb +67 -18
- data/lib/cyberweb/base_module/base_module.rb +66 -8
- data/lib/cyberweb/cascading_style_sheets/cursors.css +12 -5
- data/lib/cyberweb/cascading_style_sheets/default.css +20 -18
- data/lib/cyberweb/cascading_style_sheets/glow_effects.css +12 -6
- data/lib/cyberweb/cascading_style_sheets/misc.css +12 -1
- data/lib/cyberweb/generator/cgi.rb +3 -3
- data/lib/cyberweb/html_template/html_template.rb +172 -114
- data/lib/cyberweb/javascript/javascript.rb +34 -31
- data/lib/cyberweb/javascript_code/copy_to_the_clipboard.js +12 -0
- data/lib/cyberweb/jquery_module/jquery_module.rb +51 -0
- data/lib/cyberweb/modules/css_style.rb +27 -0
- data/lib/cyberweb/{favicon → modules}/favicon.rb +162 -33
- data/lib/cyberweb/requires/require_the_cyberweb_project.rb +6 -2
- data/lib/cyberweb/toplevel_methods/download_webpage.rb +16 -2
- data/lib/cyberweb/toplevel_methods/html_tables.rb +42 -30
- data/lib/cyberweb/toplevel_methods/log_directory.rb +11 -8
- data/lib/cyberweb/toplevel_methods/misc.rb +84 -47
- data/lib/cyberweb/toplevel_methods/path.rb +29 -8
- data/lib/cyberweb/toplevel_methods/temp_directory.rb +3 -1
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +43 -7
- data/lib/cyberweb/web_object/favicon.rb +4 -106
- data/lib/cyberweb/web_object/html_tags.rb +133 -65
- data/lib/cyberweb/web_object/images.rb +20 -20
- data/lib/cyberweb/web_object/javascript_and_jquery.rb +39 -16
- data/lib/cyberweb/web_object/link.rb +18 -15
- data/lib/cyberweb/web_object/misc.rb +4158 -327
- data/lib/cyberweb/web_object/reset.rb +19 -15
- data/lib/cyberweb/web_object/run.rb +2 -0
- data/lib/cyberweb/web_object/web_object.rb +1 -3584
- data/lib/cyberweb/webmin/simple_forum/index.cgi +30 -0
- data/lib/cyberweb/webmin/simple_forum/simple_forum.rb +134 -0
- data/lib/cyberweb/yaml/http_status_codes.yml +3 -0
- data/lib/cyberweb/yaml/js_files_to_load.yml +6 -1
- data/test/html_template/html_template.rb +22 -3
- data/test/simple_tests/testing_the_javascript_component.cgi +32 -0
- data/test/simple_tests/testing_the_select_tag.cgi +7 -1
- metadata +13 -4
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
[![forthebadge](https://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/cyberweb.svg)](https://badge.fury.io/rb/cyberweb)
|
4
4
|
|
5
|
-
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">
|
5
|
+
This gem was <b>last updated</b> on the <span style="color: darkblue; font-weight: bold">01.11.2022</span> (dd.mm.yyyy notation), at <span style="color: steelblue; font-weight: bold">19:17:06</span> o'clock.
|
6
6
|
|
7
|
-
<img src="https://i.imgur.com/
|
7
|
+
<img src="https://i.imgur.com/aC4YzSk.png" style="margin-left: 1.2em">
|
8
8
|
|
9
9
|
## The (slightly convoluted) History of the Cyberweb project
|
10
10
|
|
@@ -35,23 +35,31 @@ the following:
|
|
35
35
|
div {
|
36
36
|
}
|
37
37
|
|
38
|
-
In PHP this is not easily possible, because the syntax is more rigid
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
38
|
+
In PHP this is not easily possible, because the syntax is more rigid.
|
39
|
+
Thus, at the least in regards to the syntax, ruby is better than
|
40
|
+
PHP - more flexibility syntax-wise is available to ruby users than
|
41
|
+
is for PHP users. This flexibility helps a <b>lot</b> when writing
|
42
|
+
more dynamic, and more succint, code.
|
43
|
+
|
44
|
+
During that **transition phase**, from **php** to **ruby**, the cyberweb
|
45
|
+
project was renamed several times as well - first to **web_foundation**,
|
46
|
+
then to **cybersprawl**, then to **Cyberweb**, then to **web_object** and
|
47
|
+
then back to **Cyberweb** again.
|
48
|
+
|
49
|
+
I think the name **Cyberweb** is the best choice best among these alternatives.
|
50
|
+
While **web_object** is the more technically correct and accurate term, as
|
51
|
+
everything related to the www is handled via that object (or such objects),
|
52
|
+
I prefer the name **Cyberweb** in general for the whole project - it sounds
|
53
|
+
rather futuristic. The name **WebObject** is a good name too, though, as
|
54
|
+
we attempt to describe a particular "web-page" as a "web-object", with
|
55
|
+
specific functionality, basically. The WebObject not only describes the
|
56
|
+
raw HTML code or combines it with CSS, but it can be thought of as a
|
57
|
+
higher hierarchy abstraction. In principle we could generate a .pdf
|
58
|
+
file from a WebObject too, so the functionality is not limited to
|
59
|
+
"merely" HTML or CSS only.
|
52
60
|
|
53
61
|
**class WebObject** was originally the very main class I was
|
54
|
-
using in PHP to describe my local knowledge base
|
62
|
+
using in PHP to describe my <b>local knowledge base</b>, an "app" where
|
55
63
|
I kept useful information bits about linux, and ruby, and other
|
56
64
|
parts together. The code for this project in PHP was simpler, and
|
57
65
|
also uglier though, and less flexible. (Actually the name was
|
@@ -193,7 +201,7 @@ hopefully more "modern" as well, as I work on improving the documentation
|
|
193
201
|
in the next step (no possibility to have more users without **high
|
194
202
|
quality documentation**).
|
195
203
|
|
196
|
-
Since June 2021 two new goals were added to this project:
|
204
|
+
Since <b>June 2021</b> two new goals were added to this project:
|
197
205
|
|
198
206
|
- It will contain documentation in regards to useful CSS knowledge.
|
199
207
|
- It will contain documentation in regards to useful JavaScript knowledge.
|
@@ -208,24 +216,171 @@ presented (and presentable) in a single project as well. This means
|
|
208
216
|
that there may be pure CSS, pure HTML and pure JavaScript
|
209
217
|
examples distributed within the Cyberweb project as well.
|
210
218
|
|
211
|
-
## Features
|
219
|
+
## Features of the Cyberweb project
|
212
220
|
|
213
|
-
|
214
|
-
|
221
|
+
The cyberweb project attempts to address multiple different use
|
222
|
+
cases, so it is difficult to provide an overview over its
|
223
|
+
features; in part also due to its fuzzy history.
|
215
224
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
225
|
+
However had, this subsection will at the least try to name <b>some</b>
|
226
|
+
of its features - keep in mind that ultimately it is about the
|
227
|
+
use cases <b>you</b> may have that matter more.
|
228
|
+
|
229
|
+
In no particular order, the cyberweb gem attempts to solve these
|
230
|
+
problems:
|
231
|
+
|
232
|
+
- Provide support for rack, sinatra and .cgi files for "out of the
|
233
|
+
box" working with web-related technology in general.
|
234
|
+
|
235
|
+
- Provide numerous helper methods in various classes (most importantly
|
236
|
+
in Cyberweb::Base) to help build web-applications.
|
237
|
+
|
238
|
+
- Be able to generate standalone .html files.
|
239
|
+
|
240
|
+
- Provide a unified DSL over web-related use cases.
|
241
|
+
|
242
|
+
- Support CSS-related aspects, including auto-generation of
|
243
|
+
CSS code and re-using CSS templates.
|
244
|
+
|
245
|
+
- Aim to provide a webmin-clone.
|
246
|
+
|
247
|
+
- Aim to provide a wiki.
|
248
|
+
|
249
|
+
- Aim to provide a webforum.
|
250
|
+
|
251
|
+
And many more use cases that are somehow related to these goals.
|
252
|
+
|
253
|
+
Not all of these use cases currently work fully; the cyberweb gem
|
254
|
+
in many ways is also there to help me experiment with different
|
255
|
+
ideas, and try to see what could be done to make these work.
|
256
|
+
|
257
|
+
A word about "CSS templates": you can select various different default
|
258
|
+
CSS templates. They will be stored in the <b>cascading_style_sheets/</b>
|
259
|
+
directory by default. To use them, pass a symbol to the method
|
260
|
+
invocation for css_style=(). They are numbered in succession, so
|
261
|
+
template1, template2 etc..
|
220
262
|
|
221
263
|
Example for this on the main w object:
|
222
264
|
|
223
|
-
|
265
|
+
w.css_style = :template1
|
224
266
|
|
225
267
|
This will default to the template1.
|
226
|
-
|
268
|
+
|
269
|
+
Alternatively since October 2022 you can simply use this, if you work
|
270
|
+
with a WebObject:
|
271
|
+
|
272
|
+
template1 '
|
273
|
+
# your CSS rules go in here
|
274
|
+
'
|
275
|
+
|
276
|
+
This will pull in the first template (template1) and then add the
|
277
|
+
CSS rules towards that.
|
278
|
+
|
227
279
|
Currently the way to add new templates is to expand the case menu.
|
228
280
|
|
281
|
+
## Adapting the cyberweb gem to your use cases
|
282
|
+
|
283
|
+
Presently it may be a bit difficult to adjust the cyberweb gem to
|
284
|
+
your use cases. The primary reason for this is that the cyberweb
|
285
|
+
gem was originally started to support my use cases, as well as
|
286
|
+
making available images that I have collected over many years.
|
287
|
+
So that explaines why the method img(), for instance, is defaulting
|
288
|
+
to a fairly weird use case, which means that it may not work for
|
289
|
+
your use cases initially. In the long run I intend to remedy this
|
290
|
+
situation, but for the time being, you have to accept that some
|
291
|
+
parts of the cyberweb gem are not useful for you.
|
292
|
+
|
293
|
+
Nonetheless, I decided to add this subsection to document some
|
294
|
+
things, and provide some help to new users, until eventually
|
295
|
+
the situation improves so that people can just install the gam
|
296
|
+
and "it will work", as-is.
|
297
|
+
|
298
|
+
Without further ado, let's clarify some things here next.
|
299
|
+
|
300
|
+
The cyberweb gem needs access to a temporary directory.
|
301
|
+
|
302
|
+
On Linux this is typically <b>/tmp/</b>. The cyberweb gem may
|
303
|
+
create a subdirectory there, called cyberweb/, and then copy
|
304
|
+
some files into that subdirectory - in particular JavaScript
|
305
|
+
.js files.
|
306
|
+
|
307
|
+
To query the base directory in use you can call this method:
|
308
|
+
|
309
|
+
Cyberweb.temp_directory?
|
310
|
+
|
311
|
+
If you want to use another temporary directory then you can
|
312
|
+
use this method:
|
313
|
+
|
314
|
+
Cyberweb.set_temp_directory('/opt/')
|
315
|
+
|
316
|
+
You need to make the permission bits on that directory
|
317
|
+
possibly to be modified, such as /tmp/ on Linux normally
|
318
|
+
is able to be modified by <b>group and user nobody</b> (or,
|
319
|
+
the user that runs the webserver; in my case this is typically
|
320
|
+
lighty, as I use lighttpd as my primary webserver).
|
321
|
+
|
322
|
+
The code for this functionality can be found here:
|
323
|
+
|
324
|
+
cyberweb/toplevel_methods/temp_directory.rb
|
325
|
+
|
326
|
+
Or the direct require command:
|
327
|
+
|
328
|
+
require 'cyberweb/toplevel_methods/temp_directory.rb'
|
329
|
+
|
330
|
+
This is a very important first step to do, to adjust
|
331
|
+
the temp directory to your use case.
|
332
|
+
|
333
|
+
I may add more code support for this step in the future;
|
334
|
+
for now (October 2022) I just wanted to document this,
|
335
|
+
so people know where to look for changes in this regard.
|
336
|
+
|
337
|
+
## Include the cyberweb project on a website
|
338
|
+
|
339
|
+
To include the cyberweb project on a website, in your .cgi script
|
340
|
+
for instance, do use this line:
|
341
|
+
|
342
|
+
require 'cyberweb/autoinclude'
|
343
|
+
|
344
|
+
You can then populate the @web_object object, which resides in the
|
345
|
+
main Cyberweb-namespace, and which is also aliased through a
|
346
|
+
convenience method called w(). If you autoinclude Cyberweb
|
347
|
+
then you can use the w() method directly.
|
348
|
+
|
349
|
+
This allows you to describe a webpage, such as by issuing the
|
350
|
+
following code:
|
351
|
+
|
352
|
+
w {
|
353
|
+
title 'My first homepage'
|
354
|
+
body_css 'mar1em'
|
355
|
+
h2 'Hello World!'
|
356
|
+
use_jquery
|
357
|
+
}
|
358
|
+
|
359
|
+
Note that this should happen on separate lines - the description
|
360
|
+
here for the gem does not replace newlines with the html <br> tag.
|
361
|
+
|
362
|
+
Inside **w {}** you can issue special instructions, such as use_jquery
|
363
|
+
or disable_webimages. The former allows us to use jquery, the latter
|
364
|
+
disables webimages. (Webimages are small icons that I find myself
|
365
|
+
to use a lot. If you wish to use these images, have a look at
|
366
|
+
|
367
|
+
http://shevegen.square7.ch/STD.tar.xz
|
368
|
+
|
369
|
+
)
|
370
|
+
|
371
|
+
## Proper (default) order of arguments to many methods in the Cyberweb project
|
372
|
+
|
373
|
+
The Cyberweb project uses quite a few methods that have more than 4
|
374
|
+
or 5 parameters.
|
375
|
+
|
376
|
+
The typical order for these methods is the following:
|
377
|
+
|
378
|
+
(**1**) the content belonging to the tag at hand
|
379
|
+
(**2**) the css class that is to be used for that tag (defaults to class WebTag)
|
380
|
+
(**3**) the id to that HTML element (optional)
|
381
|
+
(**4**) the css style for that tag (optional)
|
382
|
+
(**5**) javascript code to that tag (optional)
|
383
|
+
|
229
384
|
## CSS templates
|
230
385
|
|
231
386
|
CSS templates can be designated by assigning to a symbol, such as
|
@@ -283,19 +438,6 @@ display the above notification for images not found. If it is set
|
|
283
438
|
to normal or lower than that, the web_object project will not
|
284
439
|
display that warning.
|
285
440
|
|
286
|
-
## Proper (default) order of arguments to many methods in the Cyberweb project
|
287
|
-
|
288
|
-
The Cyberweb project uses quite a few methods that have more than 4
|
289
|
-
or 5 parameters.
|
290
|
-
|
291
|
-
The typical order for these methods is the following:
|
292
|
-
|
293
|
-
(**1**) the content belonging to the tag at hand
|
294
|
-
(**2**) the css class that is to be used for that tag (defaults to class WebTag)
|
295
|
-
(**3**) the id to that HTML element (optional)
|
296
|
-
(**4**) the css style for that tag (optional)
|
297
|
-
(**5**) javascript code to that tag (optional)
|
298
|
-
|
299
441
|
## Greek letters
|
300
442
|
|
301
443
|
The old greek letters are specified via shortcuts such as <b>σ</b>
|
@@ -308,18 +450,6 @@ the following command:
|
|
308
450
|
|
309
451
|
Cyberweb.show_greek_letters
|
310
452
|
|
311
|
-
## SVG
|
312
|
-
|
313
|
-
If you wish to make use of SVG it is recommended to install the
|
314
|
-
**svg_paradise** project. Then, you can use it through Cyberweb
|
315
|
-
such as in the following case:
|
316
|
-
|
317
|
-
ee Cyberweb.circle
|
318
|
-
|
319
|
-
This will output a SVG circle. Do note that this can be customized;
|
320
|
-
simply have a look for the SVG Paradise project for more
|
321
|
-
documentation pertaining to this part.
|
322
|
-
|
323
453
|
## Javascript-support in the Cyberweb project
|
324
454
|
|
325
455
|
Have a look at the subdirectory called **javascript/**.
|
@@ -364,40 +494,6 @@ Since as of **April 2019**, the old .cgi approach will be extended;
|
|
364
494
|
while .cgi will be always supported in the Cyberweb project, an
|
365
495
|
approach similar to **sinatra** will eventually be adopted as well.
|
366
496
|
|
367
|
-
## Include the cyberweb project on a website
|
368
|
-
|
369
|
-
To include the cyberweb project on a website, in your .cgi script
|
370
|
-
for instance, do use this line:
|
371
|
-
|
372
|
-
require 'cyberweb/autoinclude'
|
373
|
-
|
374
|
-
You can then populate the @web_object object, which resides in the
|
375
|
-
main Cyberweb-namespace, and which is also aliased through a
|
376
|
-
convenience method called w(). If you autoinclude Cyberweb
|
377
|
-
then you can use the w() method directly.
|
378
|
-
|
379
|
-
This allows you to describe a webpage, such as by issuing the
|
380
|
-
following code:
|
381
|
-
|
382
|
-
w {
|
383
|
-
title 'My first homepage'
|
384
|
-
body_css 'mar1em'
|
385
|
-
h2 'Hello World!'
|
386
|
-
use_jquery
|
387
|
-
}
|
388
|
-
|
389
|
-
Note that this should happen on separate lines - the description
|
390
|
-
here for the gem does not replace newlines with the html <br> tag.
|
391
|
-
|
392
|
-
Inside **w {}** you can issue special instructions, such as use_jquery
|
393
|
-
or disable_webimages. The former allows us to use jquery, the latter
|
394
|
-
disables webimages. (Webimages are small icons that I find myself
|
395
|
-
to use a lot. If you wish to use these images, have a look at
|
396
|
-
|
397
|
-
http://shevegen.square7.ch/STD.tar.xz
|
398
|
-
|
399
|
-
)
|
400
|
-
|
401
497
|
## Configuration - and editing the configuration file (which is a yaml file)
|
402
498
|
|
403
499
|
Keep in mind that you can modify a lot of the configuration that
|
@@ -539,7 +635,43 @@ I sometimes use the pre-tag, and display numbers in a table-fashion,
|
|
539
635
|
for where it may be useful to use a monospaced font, so that the
|
540
636
|
alignment of the text is easier.
|
541
637
|
|
542
|
-
##
|
638
|
+
## The WebObject (Cyberweb::WebObject)
|
639
|
+
|
640
|
+
The following subsection will contain information pertaining to
|
641
|
+
the most important class of this gem: <b>WebObject</b>.
|
642
|
+
|
643
|
+
This is the primary class that is used for describing a
|
644
|
+
web-application (or, in oldschool parlance, a HTML object
|
645
|
+
or HTML page).
|
646
|
+
|
647
|
+
## Setting the date-of-creation for a web-app based on WebObject
|
648
|
+
|
649
|
+
Since as of **October 2021** you can use:
|
650
|
+
|
651
|
+
created_when '20.08.2021'
|
652
|
+
|
653
|
+
To **indicate when the webpage at hand has been created**. This will then
|
654
|
+
add a meta-element to the page, which is roughly equivalent to:
|
655
|
+
|
656
|
+
<meta name="DCTERMS.created" scheme="DCTERMS.ISO8601" content="2010-03-17T13:31:50"/>
|
657
|
+
|
658
|
+
I am not sure whether this is super-useful or not, but I wanted
|
659
|
+
to add a method that keeps track of the creation-time of
|
660
|
+
web-apps based on web_object, which is the main reason why
|
661
|
+
this functionality was added. At the least it helps me remember
|
662
|
+
when a web-app was created.
|
663
|
+
|
664
|
+
### Default hyperlinks
|
665
|
+
|
666
|
+
The default styling for a-tags in HTML is to start with
|
667
|
+
text-decoration: none, and upon a <b>hover</b> event
|
668
|
+
change towards text-decoration: underline.
|
669
|
+
|
670
|
+
Since this is so commonly used, the method
|
671
|
+
<b>.default_hyperlink_behaviour()</b> can be used
|
672
|
+
to add the CSS rules for this, as-is.
|
673
|
+
|
674
|
+
### Setting a title on a webobject
|
543
675
|
|
544
676
|
You can set a title on the default webobject via:
|
545
677
|
|
@@ -910,7 +1042,7 @@ Normal text usually equates to a font-weight value of
|
|
910
1042
|
<b>400</b> whereas bold text equals to a value of
|
911
1043
|
<b>700</b>.
|
912
1044
|
|
913
|
-
## Caret cursor in CSS
|
1045
|
+
## Caret cursor in CSS and cursors in general
|
914
1046
|
|
915
1047
|
You can style the colour of the cursor that appears in an
|
916
1048
|
input-field.
|
@@ -933,6 +1065,14 @@ This may then look like this:
|
|
933
1065
|
|
934
1066
|
The relevant part is the red cursor in the ~middle in that input field.
|
935
1067
|
|
1068
|
+
If you have a use case for a web-page having some different cursor,
|
1069
|
+
you can use this for a given Cyberweb::WebObject:
|
1070
|
+
|
1071
|
+
cursor :wait # signals that the program is busy.
|
1072
|
+
cursor :help # signals that help-information is available.
|
1073
|
+
cursor :crosshair # signals that a selection is possible/needed.
|
1074
|
+
cursor :grab # signals that this element can be grabbed via the mouse/pointer device.
|
1075
|
+
|
936
1076
|
## CSS helper code and how it relates to the Cyberweb project
|
937
1077
|
|
938
1078
|
This subsection attempts to detail how the **cyberweb** project
|
@@ -2277,23 +2417,27 @@ is via:
|
|
2277
2417
|
doc {
|
2278
2418
|
}
|
2279
2419
|
|
2280
|
-
This **doc** refers to document and is ultimately just a
|
2281
|
-
tag. So I put my web-applications into a big
|
2420
|
+
This **doc** refers to document and is ultimately just a <div>
|
2421
|
+
tag. So I put my web-applications into a big <div> tag
|
2282
2422
|
ultimately.
|
2283
2423
|
|
2284
|
-
Since late 2020 I am also using language variants such
|
2424
|
+
Since as of late <b>2020</b> I am also using language variants such
|
2425
|
+
as:
|
2285
2426
|
|
2286
2427
|
english {
|
2287
2428
|
}
|
2429
|
+
|
2288
2430
|
# or
|
2431
|
+
|
2289
2432
|
german {
|
2290
2433
|
}
|
2291
2434
|
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2435
|
+
The latter is used for denoting that this webpage is written
|
2436
|
+
in german, and the former is used when the webpage is written in
|
2437
|
+
english. This is not a replacement for doc {}, but is the starting
|
2438
|
+
point I use for describe a web-object in general.
|
2295
2439
|
|
2296
|
-
In June 2021 this was extended in that I added the method
|
2440
|
+
In <b>June 2021</b> this was extended in that I added the method
|
2297
2441
|
called:
|
2298
2442
|
|
2299
2443
|
doc_skeleton
|
@@ -2301,20 +2445,22 @@ called:
|
|
2301
2445
|
The word <b>skeleton</b> refers to a separate file, the
|
2302
2446
|
skeleton of the web-application.
|
2303
2447
|
|
2304
|
-
Say that you have five called index.rb, index.cgi,
|
2448
|
+
Say that you have <b>five</b> files called index.rb, index.cgi,
|
2305
2449
|
index.sinatra, index_english.md and index.german.md.
|
2306
2450
|
|
2307
2451
|
This allows us to read in either the english or the german
|
2308
|
-
language.
|
2452
|
+
language, as-is.
|
2309
2453
|
|
2310
2454
|
To let the cyberweb project guess on its own, consider
|
2311
2455
|
using a variant via the following Symbol:
|
2312
2456
|
|
2313
2457
|
doc_skeleton(:english_or_german)
|
2314
2458
|
|
2315
|
-
This currently defaults to german
|
2316
|
-
or
|
2317
|
-
the web-application to view the english content instead.
|
2459
|
+
This currently defaults to <b>german</b>. You can pass <b>?use_english</b>
|
2460
|
+
or <b>?english</b> to the .cgi page to overrule this and force
|
2461
|
+
the web-application to view the english content instead. That way
|
2462
|
+
the user can change languages, as-is. A bit cumbersome for now,
|
2463
|
+
but possible.
|
2318
2464
|
|
2319
2465
|
In order for this to work, the corresponding .md file must
|
2320
2466
|
exist, e. g. **index_english.md** or **index_german.md**.
|
@@ -2323,12 +2469,12 @@ Note that this is currently (June 2021) quite experimental,
|
|
2323
2469
|
but I wanted to add the feature that we can offer different
|
2324
2470
|
languages. In the long run I may adapt this approach, to
|
2325
2471
|
make it easier to use different languages on any given
|
2326
|
-
|
2327
|
-
**roebe** gem. For example, luft.cfg under **roebe/www/luft/**
|
2472
|
+
web-application, but for now I only use this in the
|
2473
|
+
**roebe** gem. For example, <b>luft.cfg</b> under **roebe/www/luft/**
|
2328
2474
|
will show this. It may not work on your home system,
|
2329
|
-
though, as it is catered to my home setup. But it
|
2330
|
-
how this could be done in theory. So, who knows - in
|
2331
|
-
long run I may integrate this as a 'default' feature.
|
2475
|
+
though, as it is catered to my home setup currently. But it
|
2476
|
+
shows how this could be done in theory. So, who knows - in
|
2477
|
+
the long run I may integrate this as a 'default' feature.
|
2332
2478
|
|
2333
2479
|
Note that **?use_german** will work as well, to force
|
2334
2480
|
the **_german.md** file to be read.
|
@@ -2799,82 +2945,6 @@ You can add content via CSS like this:
|
|
2799
2945
|
I don't think this is too overly useful when you can dynamically
|
2800
2946
|
generate the web-app as-is, though.
|
2801
2947
|
|
2802
|
-
## Cyberweb::HtmlTemplate
|
2803
|
-
|
2804
|
-
class **Cyberweb::HtmlTemplate** can be used to fill it with HTML
|
2805
|
-
specific content.
|
2806
|
-
|
2807
|
-
Let's show a specific example how this may be used:
|
2808
|
-
|
2809
|
-
require 'cyberweb/requires/require_the_html_template.rb' # This is the recommended way to require class HtmlTemplate.
|
2810
|
-
|
2811
|
-
Cyberweb::HtmlTemplate[
|
2812
|
-
title: 'Status',
|
2813
|
-
body: '<pre style="font-size:150%">'+
|
2814
|
-
::EnvironmentInformation.return_the_most_important_info+
|
2815
|
-
'</pre>'
|
2816
|
-
].to_s
|
2817
|
-
|
2818
|
-
This would represent a "full" HTML page, as a String.
|
2819
|
-
|
2820
|
-
It is possible, since as of **18.06.2021**, to pass **CSS classes**
|
2821
|
-
into this, via:
|
2822
|
-
|
2823
|
-
css_classes:
|
2824
|
-
|
2825
|
-
For example, passing 'darkblue' to that key means that the CSS
|
2826
|
-
class 'darkblue' will be made available, which ultimately comes
|
2827
|
-
down to <b>color: darkblue</b>.
|
2828
|
-
|
2829
|
-
I needed this functionality to pull in only the CSS classes
|
2830
|
-
that I use on a particular page generated by class
|
2831
|
-
Cyberweb::HtmlTemplate.
|
2832
|
-
|
2833
|
-
Various additional entries are available. For example, if
|
2834
|
-
you want to modify the css-style in use for the body tag
|
2835
|
-
then you can simply use the following variant:
|
2836
|
-
|
2837
|
-
body_css_style: 'background-color:#DFD1FF'
|
2838
|
-
|
2839
|
-
In the long run the goal here is to extend class HtmlTemplate
|
2840
|
-
in such a way that all html-generation used within the
|
2841
|
-
Cyberweb project can be handled by it.
|
2842
|
-
|
2843
|
-
You can also pass ad-hoc CSS style into it. Example:
|
2844
|
-
|
2845
|
-
Cyberweb::HtmlTemplate[
|
2846
|
-
body: _, # The content of <body> goes in here.
|
2847
|
-
css_style: '
|
2848
|
-
img {
|
2849
|
-
border: 8px solid #black;
|
2850
|
-
padding: 2px;
|
2851
|
-
}
|
2852
|
-
' # and ^^^ there you can put your CSS rules into class HtmlTemplate
|
2853
|
-
].to_s
|
2854
|
-
|
2855
|
-
You can also pass in some ad-hoc javascript code via:
|
2856
|
-
|
2857
|
-
javascript_code:
|
2858
|
-
|
2859
|
-
All this does is add the proper [script> tag to it.
|
2860
|
-
|
2861
|
-
You can also specifically add jquery support for the HtmlTemplate.
|
2862
|
-
The following example shows how this can be done:
|
2863
|
-
|
2864
|
-
html_template = Cyberweb::HtmlTemplate[
|
2865
|
-
title: 'This is a test-page,
|
2866
|
-
body: HtmlTags.p('Another test.','','','font-size:1.8em'),
|
2867
|
-
use_jquery: true
|
2868
|
-
].to_s
|
2869
|
-
|
2870
|
-
puts html_template
|
2871
|
-
|
2872
|
-
Typing <b>Cyberweb::HtmlTemplate[]</b> is quite cumbersome, though. Since
|
2873
|
-
as of October 2022 a simpler toplevel API is available:
|
2874
|
-
|
2875
|
-
Cyberweb.html_template
|
2876
|
-
Cyberweb.html_template(body_content) # The String you pass here will be the body of the HTML page.
|
2877
|
-
|
2878
2948
|
## Embed youtube videos and videos in general
|
2879
2949
|
|
2880
2950
|
You can embed youtube videos, thanks to the MultimediaParadise
|
@@ -3116,23 +3186,6 @@ local file, if said remote website contains german umlauts.
|
|
3116
3186
|
|
3117
3187
|
In fact this was precisely the reason why that method was added.
|
3118
3188
|
|
3119
|
-
## Setting the date-of-creation for a web-app based on WebObject
|
3120
|
-
|
3121
|
-
Since as of **October 2021** you can use:
|
3122
|
-
|
3123
|
-
created_when '20.08.2021'
|
3124
|
-
|
3125
|
-
To **indicate when the webpage at hand has been created**. This will then
|
3126
|
-
add a meta-element to the page, which is roughly equivalent to:
|
3127
|
-
|
3128
|
-
<meta name="DCTERMS.created" scheme="DCTERMS.ISO8601" content="2010-03-17T13:31:50"/>
|
3129
|
-
|
3130
|
-
I am not sure whether this is super-useful or not, but I wanted
|
3131
|
-
to add a method that keeps track of the creation-time of
|
3132
|
-
web-apps based on web_object, which is the main reason why
|
3133
|
-
this functionality was added. At the least it helps me remember
|
3134
|
-
when a web-app was created.
|
3135
|
-
|
3136
3189
|
## autogenerated_system_settings.yml
|
3137
3190
|
|
3138
3191
|
The file <b>cyberweb/yaml/autogenerated_system_settings.yml</b> is created
|
@@ -3840,46 +3893,6 @@ Including the namespace for <b>Cyberweb::Objectified::Mask</b> is
|
|
3840
3893
|
done mostly for convenience, so that the user does not have to
|
3841
3894
|
manually include this module.
|
3842
3895
|
|
3843
|
-
## Drawing a coloured circle via CSS
|
3844
|
-
|
3845
|
-
You can draw a circle via CSS.
|
3846
|
-
|
3847
|
-
Let's first show the CSS rules for this:
|
3848
|
-
|
3849
|
-
div.circle {
|
3850
|
-
width: 300px;
|
3851
|
-
height: 300px;
|
3852
|
-
background: #2762e9;
|
3853
|
-
border-radius: 50%;
|
3854
|
-
}
|
3855
|
-
|
3856
|
-
Next you can use HTML to draw the circle:
|
3857
|
-
|
3858
|
-
<div class="circle"></div>
|
3859
|
-
|
3860
|
-
That's it.
|
3861
|
-
|
3862
|
-
I found this to be simple and potentially useful, so I added
|
3863
|
-
an API to the cyberweb project to support this.
|
3864
|
-
|
3865
|
-
The API goes like this:
|
3866
|
-
|
3867
|
-
Cyberweb.draw_circle()
|
3868
|
-
Cyberweb.draw_circle(width: 200)
|
3869
|
-
Cyberweb.draw_circle(width: 200, height: 500)
|
3870
|
-
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue)
|
3871
|
-
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
3872
|
-
|
3873
|
-
Pass a Hash to the method. Note that this will return the CSS rule
|
3874
|
-
as-is, as well as return the div-tag String. Cyberweb::BaseModule
|
3875
|
-
will directly embed this if you use <b>draw_circle()</b>.
|
3876
|
-
|
3877
|
-
Here is a partial screenshot showing three such examples; only the
|
3878
|
-
second example has a border-radius of 50%. See also the example
|
3879
|
-
<b>cyberweb/examples/advanced/draw_circle/draw_circle.cgi</b>.
|
3880
|
-
|
3881
|
-
<img src="https://i.imgur.com/k5wFnwn.png" style="margin: 1em">
|
3882
|
-
|
3883
3896
|
## JQuery
|
3884
3897
|
|
3885
3898
|
The Cyberweb framework/toolset favours the use of jquery. Presently,
|
@@ -4460,6 +4473,193 @@ The general syntax goes like this:
|
|
4460
4473
|
@keyframes name_here {
|
4461
4474
|
}
|
4462
4475
|
|
4476
|
+
## module Cyberweb::JqueryModule
|
4477
|
+
|
4478
|
+
<b>module Cyberweb::JqueryModule</b> is used to enable or disable support
|
4479
|
+
for jquery. Not all classes in the cyberweb gem make use of this module
|
4480
|
+
right now - notably class <b>Cyberweb::WebObject</b> does not use this
|
4481
|
+
module as of yet. This is planned at some later time in the future, as
|
4482
|
+
some code has to be re-written, in order to make use of this new
|
4483
|
+
module.
|
4484
|
+
|
4485
|
+
The only class that uses module <b>Cyberweb::JqueryModule</b> right
|
4486
|
+
now is <b>class Cyberweb::HtmlTemplate</b>.
|
4487
|
+
|
4488
|
+
## CSS Borders
|
4489
|
+
|
4490
|
+
CSS supports different borders.
|
4491
|
+
|
4492
|
+
You can control various different aspects here, such as the
|
4493
|
+
width of the border, or the style of the border.
|
4494
|
+
|
4495
|
+
The available <b>border-style properties</b> are as follows:
|
4496
|
+
|
4497
|
+
dotted - Defines a dotted border.
|
4498
|
+
dashed - Defines a dashed border.
|
4499
|
+
solid - Defines a solid border.
|
4500
|
+
double - Defines a double border.
|
4501
|
+
groove - Defines a 3D grooved border. This effect depends on the border-color value.
|
4502
|
+
ridge - Defines a 3D ridged border. This effect depends on the border-color value.
|
4503
|
+
inset - Defines a 3D inset border. This effect depends on the border-color value.
|
4504
|
+
outset - Defines a 3D outset border. This effect depends on the border-color value.
|
4505
|
+
none - Defines no border.
|
4506
|
+
hidden - Defines a hidden border.
|
4507
|
+
|
4508
|
+
The following paragraph shows how you can use this:
|
4509
|
+
|
4510
|
+
p.dotted {border-style: dotted;}
|
4511
|
+
p.dashed {border-style: dashed;}
|
4512
|
+
p.solid {border-style: solid; }
|
4513
|
+
p.double {border-style: double;}
|
4514
|
+
p.groove {border-style: groove;}
|
4515
|
+
p.ridge {border-style: ridge; }
|
4516
|
+
p.inset {border-style: inset; }
|
4517
|
+
p.outset {border-style: outset;}
|
4518
|
+
p.none {border-style: none; }
|
4519
|
+
p.hidden {border-style: hidden;}
|
4520
|
+
p.mix {border-style: dotted dashed solid double;}
|
4521
|
+
|
4522
|
+
Interestingly enough, if you do not specify a color for
|
4523
|
+
the border via border-color then this will default to <b>black</b>.
|
4524
|
+
|
4525
|
+
## Cyberweb::HtmlTemplate
|
4526
|
+
|
4527
|
+
class **Cyberweb::HtmlTemplate** can be used to fill it with HTML
|
4528
|
+
specific content.
|
4529
|
+
|
4530
|
+
Let's show a specific example how this may be used:
|
4531
|
+
|
4532
|
+
require 'cyberweb/requires/require_the_html_template.rb' # This is the recommended way to require class HtmlTemplate.
|
4533
|
+
|
4534
|
+
Cyberweb::HtmlTemplate[
|
4535
|
+
title: 'Status',
|
4536
|
+
body: '<pre style="font-size:150%">'+
|
4537
|
+
::EnvironmentInformation.return_the_most_important_info+
|
4538
|
+
'</pre>'
|
4539
|
+
].to_s
|
4540
|
+
|
4541
|
+
This would represent a "full" HTML page, as a String.
|
4542
|
+
|
4543
|
+
It is possible, since as of **18.06.2021**, to pass **CSS classes**
|
4544
|
+
into this, via:
|
4545
|
+
|
4546
|
+
css_classes:
|
4547
|
+
|
4548
|
+
For example, passing 'darkblue' to that key means that the CSS
|
4549
|
+
class 'darkblue' will be made available, which ultimately comes
|
4550
|
+
down to <b>color: darkblue</b>.
|
4551
|
+
|
4552
|
+
I needed this functionality to pull in only the CSS classes
|
4553
|
+
that I use on a particular page generated by class
|
4554
|
+
Cyberweb::HtmlTemplate.
|
4555
|
+
|
4556
|
+
Various additional entries are available. For example, if
|
4557
|
+
you want to modify the css-style in use for the body tag
|
4558
|
+
then you can simply use the following variant:
|
4559
|
+
|
4560
|
+
body_css_style: 'background-color:#DFD1FF'
|
4561
|
+
|
4562
|
+
In the long run the goal here is to extend class HtmlTemplate
|
4563
|
+
in such a way that all html-generation used within the
|
4564
|
+
Cyberweb project can be handled by it.
|
4565
|
+
|
4566
|
+
You can also pass ad-hoc CSS style into it. Example:
|
4567
|
+
|
4568
|
+
Cyberweb::HtmlTemplate[
|
4569
|
+
body: _, # The content of <body> goes in here.
|
4570
|
+
css_style: '
|
4571
|
+
img {
|
4572
|
+
border: 8px solid #black;
|
4573
|
+
padding: 2px;
|
4574
|
+
}
|
4575
|
+
' # and ^^^ there you can put your CSS rules into class HtmlTemplate
|
4576
|
+
].to_s
|
4577
|
+
|
4578
|
+
You can also pass in some ad-hoc javascript code via:
|
4579
|
+
|
4580
|
+
javascript_code:
|
4581
|
+
|
4582
|
+
All this does is add the proper [script> tag to it.
|
4583
|
+
|
4584
|
+
You can also specifically add jquery support for the HtmlTemplate.
|
4585
|
+
The following example shows how this can be done:
|
4586
|
+
|
4587
|
+
html_template = Cyberweb::HtmlTemplate[
|
4588
|
+
title: 'This is a test-page,
|
4589
|
+
body: HtmlTags.p('Another test.','','','font-size:1.8em'),
|
4590
|
+
use_jquery: true
|
4591
|
+
].to_s
|
4592
|
+
|
4593
|
+
puts html_template
|
4594
|
+
|
4595
|
+
You can also pass in a favicon to use such as shown in the following
|
4596
|
+
example:
|
4597
|
+
|
4598
|
+
Cyberweb::HtmlTemplate[
|
4599
|
+
title: 'Current Time',
|
4600
|
+
body: '<b>'+Roebe::Time.hh_mm_ss+' '+Roebe::Time.dd_mm_yyyy+'</b>',
|
4601
|
+
favicon: BeautifulUrl[:time_favicon]
|
4602
|
+
].to_s
|
4603
|
+
|
4604
|
+
Typing <b>Cyberweb::HtmlTemplate[]</b> is quite cumbersome, though. Since
|
4605
|
+
as of October 2022 a simpler toplevel API is available:
|
4606
|
+
|
4607
|
+
Cyberweb.html_template
|
4608
|
+
Cyberweb.html_template(body_content) # The String you pass here will be the body of the HTML page.
|
4609
|
+
|
4610
|
+
## SVG
|
4611
|
+
|
4612
|
+
If you wish to make use of SVG it is recommended to install the
|
4613
|
+
**svg_paradise** project. Then, you can use it through Cyberweb
|
4614
|
+
such as in the following case:
|
4615
|
+
|
4616
|
+
ee Cyberweb.circle
|
4617
|
+
|
4618
|
+
This will output a SVG circle. Do note that this can be customized;
|
4619
|
+
simply have a look for the SVG Paradise project for more
|
4620
|
+
documentation pertaining to this part.
|
4621
|
+
|
4622
|
+
## Drawing a coloured circle via CSS
|
4623
|
+
|
4624
|
+
You can draw a circle via <b>CSS</b>.
|
4625
|
+
|
4626
|
+
Let's first show the pure CSS rules for this functionality:
|
4627
|
+
|
4628
|
+
div.circle {
|
4629
|
+
width: 300px;
|
4630
|
+
height: 300px;
|
4631
|
+
background: #2762e9;
|
4632
|
+
border-radius: 50%;
|
4633
|
+
}
|
4634
|
+
|
4635
|
+
Next you can use HTML to actually "draw" the circle, as-is:
|
4636
|
+
|
4637
|
+
<div class="circle"></div>
|
4638
|
+
|
4639
|
+
That's it.
|
4640
|
+
|
4641
|
+
I found this to be simple and potentially useful, so I added
|
4642
|
+
an API to the cyberweb project to support this.
|
4643
|
+
|
4644
|
+
The toplevel API goes like this:
|
4645
|
+
|
4646
|
+
Cyberweb.draw_circle()
|
4647
|
+
Cyberweb.draw_circle(width: 200)
|
4648
|
+
Cyberweb.draw_circle(width: 200, height: 500)
|
4649
|
+
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue)
|
4650
|
+
Cyberweb.draw_circle(width: 200, height: 500, background_color: :steelblue, border_radius: '30%')
|
4651
|
+
|
4652
|
+
Pass a <b>Hash</b> into the method. Note that this will return the CSS
|
4653
|
+
rule as-is, as well as return the div-tag String. <b>Cyberweb::BaseModule</b>
|
4654
|
+
will directly embed this if you use the method <b>draw_circle()</b>.
|
4655
|
+
|
4656
|
+
Here is a partial screenshot showing three such examples; only the
|
4657
|
+
second example has a border-radius of <b>50%</b>. See also the
|
4658
|
+
distributed example at <b>cyberweb/examples/advanced/draw_circle/draw_circle.cgi</b>
|
4659
|
+
showcasing this functionality.
|
4660
|
+
|
4661
|
+
<img src="https://i.imgur.com/k5wFnwn.png" style="margin: 1em">
|
4662
|
+
|
4463
4663
|
## Useful quotes when designing websites and web-apps
|
4464
4664
|
|
4465
4665
|
The following subsection collects a few <b>interesting statements</b> -
|