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.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +438 -238
  3. data/doc/README.gen +437 -237
  4. data/doc/todo/todo_for_the_cyberweb_project.md +6 -0
  5. data/examples/advanced/cursor_example/cursor_example.cgi +29 -0
  6. data/examples/advanced/draw_circle/draw_circle.cgi +13 -4
  7. data/examples/css/css_bubbles.html +8 -2
  8. data/examples/css/examples_with_borders/examples_with_borders.html +33 -0
  9. data/examples/javascript_and_jquery/copy_to_the_clipboard_example/copy_to_the_clipboard_example.html +80 -0
  10. data/images/cyberweb_theme.png +0 -0
  11. data/lib/cyberweb/base/misc.rb +67 -18
  12. data/lib/cyberweb/base_module/base_module.rb +66 -8
  13. data/lib/cyberweb/cascading_style_sheets/cursors.css +12 -5
  14. data/lib/cyberweb/cascading_style_sheets/default.css +20 -18
  15. data/lib/cyberweb/cascading_style_sheets/glow_effects.css +12 -6
  16. data/lib/cyberweb/cascading_style_sheets/misc.css +12 -1
  17. data/lib/cyberweb/generator/cgi.rb +3 -3
  18. data/lib/cyberweb/html_template/html_template.rb +172 -114
  19. data/lib/cyberweb/javascript/javascript.rb +34 -31
  20. data/lib/cyberweb/javascript_code/copy_to_the_clipboard.js +12 -0
  21. data/lib/cyberweb/jquery_module/jquery_module.rb +51 -0
  22. data/lib/cyberweb/modules/css_style.rb +27 -0
  23. data/lib/cyberweb/{favicon → modules}/favicon.rb +162 -33
  24. data/lib/cyberweb/requires/require_the_cyberweb_project.rb +6 -2
  25. data/lib/cyberweb/toplevel_methods/download_webpage.rb +16 -2
  26. data/lib/cyberweb/toplevel_methods/html_tables.rb +42 -30
  27. data/lib/cyberweb/toplevel_methods/log_directory.rb +11 -8
  28. data/lib/cyberweb/toplevel_methods/misc.rb +84 -47
  29. data/lib/cyberweb/toplevel_methods/path.rb +29 -8
  30. data/lib/cyberweb/toplevel_methods/temp_directory.rb +3 -1
  31. data/lib/cyberweb/version/version.rb +2 -2
  32. data/lib/cyberweb/web_images/map_symbol_to_image_location.rb +43 -7
  33. data/lib/cyberweb/web_object/favicon.rb +4 -106
  34. data/lib/cyberweb/web_object/html_tags.rb +133 -65
  35. data/lib/cyberweb/web_object/images.rb +20 -20
  36. data/lib/cyberweb/web_object/javascript_and_jquery.rb +39 -16
  37. data/lib/cyberweb/web_object/link.rb +18 -15
  38. data/lib/cyberweb/web_object/misc.rb +4158 -327
  39. data/lib/cyberweb/web_object/reset.rb +19 -15
  40. data/lib/cyberweb/web_object/run.rb +2 -0
  41. data/lib/cyberweb/web_object/web_object.rb +1 -3584
  42. data/lib/cyberweb/webmin/simple_forum/index.cgi +30 -0
  43. data/lib/cyberweb/webmin/simple_forum/simple_forum.rb +134 -0
  44. data/lib/cyberweb/yaml/http_status_codes.yml +3 -0
  45. data/lib/cyberweb/yaml/js_files_to_load.yml +6 -1
  46. data/test/html_template/html_template.rb +22 -3
  47. data/test/simple_tests/testing_the_javascript_component.cgi +32 -0
  48. data/test/simple_tests/testing_the_select_tag.cgi +7 -1
  49. metadata +13 -4
@@ -789,3 +789,9 @@
789
789
  https://d3js.org/
790
790
  http://smoothiecharts.org/
791
791
  --------------------------------------------------------------------------------
792
+ (85) → continue with the simple forum, once it works.
793
+ Once the simple forum works, we may have to add
794
+ a more complex forum, that has more features.
795
+ and perhaps showcase it somewhere, together with
796
+ SQL.
797
+ --------------------------------------------------------------------------------
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # http://localhost/programming/ruby/src/cyberweb/examples/advanced/cursor_example/cursor_example.cgi
6
+ # =========================================================================== #
7
+ require 'cyberweb/autoinclude'
8
+
9
+ english('Cursor example') {
10
+ created_on '31.10.2022' # Monday.
11
+ autoextend
12
+ ruby_favicon
13
+ template1
14
+ body_css_class 'mar0px s2px padt2px VERDANAs'
15
+ body_css_style 'background-color: #d3d2d1;'
16
+ font_size 'def'
17
+ cursor :wait
18
+
19
+ doc('mar0px pad0px s0_6em') {
20
+ h1 dot(106, 'marr8px')+
21
+ title?,
22
+ 'mart1px marb0_5em'
23
+ p_default {
24
+ e 'This page will show a default cursor for the body tag.'
25
+ br
26
+ e 'Simply hover over the text here via the mouse interface
27
+ (pointer device).'
28
+ }
29
+ }}
@@ -6,11 +6,11 @@
6
6
  # =========================================================================== #
7
7
  require 'cyberweb/autoinclude'
8
8
 
9
- english(:filename) {
9
+ english('Draw circle') {
10
10
  autoextend
11
11
  ruby_favicon
12
- css_template1
13
- body_css_class 'mar0px s2px padt2px VERDANAs'
12
+ default_hyperlinks_template1
13
+ body_css_class 'mar0px padt2px VERDANAs pad1em'
14
14
  body_css_style 'background-color: #d3d2d1;'
15
15
  font_size 'def'
16
16
 
@@ -19,7 +19,10 @@ doc('mar0px pad0px s0_5em') {
19
19
  'Draw a circle example',
20
20
  'mart1px marb0_5em'
21
21
  draw_circle(
22
- width: 100, height: 200, background_color: :steelblue, border_radius: '30%'
22
+ width: 100,
23
+ height: 200,
24
+ background_color: :steelblue,
25
+ border_radius: '30%'
23
26
  )
24
27
  draw_circle(
25
28
  width: 50,
@@ -33,4 +36,10 @@ doc('mar0px pad0px s0_5em') {
33
36
  background_color: :tomato,
34
37
  border_radius: '40%'
35
38
  )
39
+ draw_circle(
40
+ width: 120,
41
+ height: 120,
42
+ background_color: :darkgreen,
43
+ border_radius: '80%'
44
+ )
36
45
  }}
@@ -4,6 +4,9 @@
4
4
  <meta charset="utf-8">
5
5
  <title>Demo: CSS speech bubbles</title>
6
6
  <style>
7
+ body {
8
+ font-size: 1.2em;
9
+ }
7
10
 
8
11
  .triangle_isosceles_bubble {
9
12
  position:relative;
@@ -36,9 +39,12 @@
36
39
  <body>
37
40
  <div class="triangle_isosceles_bubble">
38
41
  This shows a simple example for CSS bubbles. It was
39
- adapted from:<br>
42
+ adapted from:
43
+ <br>
40
44
 
41
- http://nicolasgallagher.com/pure-css-speech-bubbles/demo/
45
+ <a href="http://nicolasgallagher.com/pure-css-speech-bubbles/demo/">
46
+ http://nicolasgallagher.com/pure-css-speech-bubbles/demo/
47
+ </a>
42
48
 
43
49
  </div>
44
50
  </body>
@@ -0,0 +1,33 @@
1
+ <html>
2
+ <head>
3
+ <title>Examples with borders in CSS</title>
4
+ <style>
5
+ p.dotted { padding: 8px; border-style: dotted; border-width: 6px;}
6
+ p.dashed { padding: 8px; border-style: dashed; border-width: 6px;}
7
+ p.solid { padding: 8px; border-style: solid; border-width: 6px;}
8
+ p.double { padding: 8px; border-style: double; border-width: 6px;}
9
+ p.groove { padding: 8px; border-style: groove; border-width: 6px;}
10
+ p.ridge { padding: 8px; border-style: ridge; border-width: 6px;}
11
+ p.inset { padding: 8px; border-style: inset; border-width: 6px;}
12
+ p.outset { padding: 8px; border-style: outset; border-width: 6px;}
13
+ p.none { padding: 8px; border-style: none; border-width: 6px;}
14
+ p.hidden { padding: 8px; border-style: hidden; border-width: 6px;}
15
+ p.mix { padding: 8px; border-style: dotted dashed solid double; border-width: 6px;}
16
+ </style>
17
+ </head>
18
+ <body>
19
+
20
+ <p class="dotted">dotted border</p>
21
+ <p class="dashed">dashed border</p>
22
+ <p class="solid">solid border</p>
23
+ <p class="double">double border</p>
24
+ <p class="groove">groove border</p>
25
+ <p class="ridge">ridge border</p>
26
+ <p class="inset">inset border</p>
27
+ <p class="outset">outside border</p>
28
+ <p class="none">none border</p>
29
+ <p class="hidden">hidden border</p>
30
+ <p class="mix">mix border</p>
31
+
32
+ </body>
33
+ </html>
@@ -0,0 +1,80 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <style>
6
+ .tooltip {
7
+ position: relative;
8
+ display: inline-block;
9
+ }
10
+
11
+ .tooltip .tooltiptext {
12
+ visibility: hidden;
13
+ width: 140px;
14
+ background-color: #555;
15
+ color: #fff;
16
+ text-align: center;
17
+ border-radius: 6px;
18
+ padding: 5px;
19
+ position: absolute;
20
+ z-index: 1;
21
+ bottom: 150%;
22
+ left: 50%;
23
+ margin-left: -75px;
24
+ opacity: 0;
25
+ transition: opacity 0.3s;
26
+ }
27
+
28
+ .tooltip .tooltiptext::after {
29
+ content: "";
30
+ position: absolute;
31
+ top: 100%;
32
+ left: 50%;
33
+ margin-left: -5px;
34
+ border-width: 5px;
35
+ border-style: solid;
36
+ border-color: #555 transparent transparent transparent;
37
+ }
38
+
39
+ .tooltip:hover .tooltiptext {
40
+ visibility: visible;
41
+ opacity: 1;
42
+ }
43
+ </style>
44
+ </head>
45
+
46
+ <body>
47
+
48
+ <script>
49
+ function copy_to_the_clipboard(id_to_use) {
50
+ // Get the text field
51
+ var x = document.getElementById(id_to_use);
52
+
53
+ // Select the text field
54
+ x.select();
55
+ /*
56
+ x.setSelectionRange(0, 99999); // For mobile devices
57
+ */
58
+
59
+ // Copy the text inside the text field
60
+ navigator.clipboard.writeText(x.value);
61
+
62
+ /*
63
+ * Alert the copied text - this is a bit annoying
64
+ * so it was disabled.
65
+ */
66
+ /*
67
+ alert("Copied the text: " + x.value);
68
+ */
69
+ }
70
+
71
+ </script>
72
+
73
+ <!-- The text field -->
74
+ <input type="text" value="Hello World" id="foobar">
75
+
76
+ <!-- The button used to copy the text -->
77
+ <button onclick="copy_to_the_clipboard('foobar')">Copy text</button>
78
+
79
+ </body>
80
+ </html>
Binary file
@@ -8,6 +8,16 @@ module Cyberweb
8
8
 
9
9
  class Base # === Cyberweb::Base
10
10
 
11
+ # ========================================================================= #
12
+ # === create_the_internal_hash
13
+ # ========================================================================= #
14
+ def create_the_internal_hash
15
+ # ======================================================================= #
16
+ # === @internal_hash
17
+ # ======================================================================= #
18
+ @internal_hash = {}
19
+ end
20
+
11
21
  # ========================================================================= #
12
22
  # === read_file_via_utf8_encoding
13
23
  # ========================================================================= #
@@ -43,13 +53,6 @@ class Base # === Cyberweb::Base
43
53
  return i.gsub(use_this_regex,'')
44
54
  end
45
55
 
46
- # ========================================================================= #
47
- # === be_verbose
48
- # ========================================================================= #
49
- def be_verbose
50
- @be_verbose = true
51
- end # Whether we will be verbose or not.
52
-
53
56
  # ========================================================================= #
54
57
  # === is_image?
55
58
  #
@@ -108,17 +111,6 @@ class Base # === Cyberweb::Base
108
111
  File.delete(i) if File.exist?(i)
109
112
  end
110
113
 
111
- # ========================================================================= #
112
- # === mkdir (mkdir tag)
113
- # ========================================================================= #
114
- def mkdir(i)
115
- begin
116
- FileUtils.mkdir_p(i)
117
- rescue Errno::EACCES # => error
118
- # e 'Permission denied for the directory '+i.to_s
119
- end
120
- end
121
-
122
114
  # ========================================================================= #
123
115
  # === css_comment
124
116
  # ========================================================================= #
@@ -323,4 +315,61 @@ class Base # === Cyberweb::Base
323
315
  FileUtils.cp_r(from, to)
324
316
  end
325
317
 
318
+ # ========================================================================= #
319
+ # === mkdir (mkdir tag)
320
+ #
321
+ # This method can be used to create a directory.
322
+ # ========================================================================= #
323
+ def mkdir(i)
324
+ begin
325
+ FileUtils.mkdir_p(i)
326
+ rescue Errno::EACCES # => error
327
+ e "Permission denied for the directory #{i}."
328
+ end
329
+ end; alias create_directory mkdir # === create_directory
330
+
331
+ # ========================================================================= #
332
+ # === copy_this_file
333
+ # ========================================================================= #
334
+ def copy_this_file(file)
335
+ require 'fileutils'
336
+ FileUtils.cp(file, return_pwd)
337
+ end
338
+
339
+ # ========================================================================= #
340
+ # === infer_the_namespace
341
+ #
342
+ # This will assume the true namespace from the inspectable name.
343
+ # ========================================================================= #
344
+ def infer_the_namespace
345
+ _ = inspect
346
+ if _.include?(':0x')
347
+ _ = _.split(':0x').first.to_s.strip
348
+ end
349
+ _ = _.to_s.delete('<')
350
+ if _.include? ' '
351
+ _ = _.split(' ').first.delete('#')
352
+ if _.include? ':'
353
+ _ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
354
+ end
355
+ end
356
+ @namespace = _.delete('#') # And assign it here.
357
+ end
358
+
359
+ # ========================================================================= #
360
+ # === be_verbose
361
+ #
362
+ # Whether we will be verbose or not.
363
+ # ========================================================================= #
364
+ def be_verbose
365
+ @be_verbose = true
366
+ end; alias set_be_verbose be_verbose # === set_be_verbose
367
+
368
+ # ========================================================================= #
369
+ # === be_verbose?
370
+ # ========================================================================= #
371
+ def be_verbose?
372
+ @be_verbose
373
+ end
374
+
326
375
  end; end
@@ -11,7 +11,9 @@
11
11
  # =========================================================================== #
12
12
  module Cyberweb
13
13
 
14
- module BaseModule
14
+ module BaseModule # === Cyberweb::BaseModule
15
+
16
+ alias e puts
15
17
 
16
18
  require 'cyberweb/toplevel_methods/return_strict_doctype.rb'
17
19
 
@@ -27,13 +29,6 @@ module BaseModule
27
29
  return "#{Cyberweb.return_strict_doctype}\n"
28
30
  end
29
31
 
30
- # ========================================================================= #
31
- # === require_the_html_templates
32
- # ========================================================================= #
33
- def require_the_html_templates
34
- require 'cyberweb/requires/require_the_html_template.rb'
35
- end
36
-
37
32
  # ========================================================================= #
38
33
  # === set_commandline_arguments
39
34
  # ========================================================================= #
@@ -63,6 +58,34 @@ module BaseModule
63
58
  @commandline_arguments.first
64
59
  end; alias first? first_argument? # === first?
65
60
 
61
+ # ========================================================================= #
62
+ # === content_type_is_json (json tag)
63
+ # ========================================================================= #
64
+ def content_type_is_json
65
+ {
66
+ 'Content-Type' => 'text/json'
67
+ }
68
+ end
69
+
70
+ # ========================================================================= #
71
+ # === content_type_is_jpeg
72
+ # ========================================================================= #
73
+ def content_type_is_jpeg
74
+ {
75
+ 'Content-Type' => 'image/jpeg'
76
+ }
77
+ end; alias content_type_is_jpg content_type_is_jpeg # === content_type_is_jpg
78
+
79
+ # ========================================================================= #
80
+ # === content_type_is_plain_text
81
+ # ========================================================================= #
82
+ def content_type_is_plain_text
83
+ {
84
+ 'Content-Type' => 'text/plain'
85
+ }
86
+ end; alias content_type_is_plain content_type_is_plain_text # === content_type_is_plain
87
+ alias content_type_is_text content_type_is_plain_text # === content_type_is_text
88
+
66
89
  # ========================================================================= #
67
90
  # === string_remote_image
68
91
  # ========================================================================= #
@@ -76,4 +99,39 @@ module BaseModule
76
99
  ::HtmlTags.img(i)
77
100
  end
78
101
 
102
+ # ========================================================================= #
103
+ # === try_to_require_the_open_gem
104
+ # ========================================================================= #
105
+ def try_to_require_the_open_gem
106
+ begin
107
+ require 'open'
108
+ rescue LoadError; end
109
+ end
110
+
111
+ # ========================================================================= #
112
+ # === content_type_is_html
113
+ # ========================================================================= #
114
+ def content_type_is_html
115
+ {
116
+ 'Content-Type' => 'text/html'
117
+ }
118
+ end
119
+
120
+ # ========================================================================= #
121
+ # === require_the_html_templates
122
+ # ========================================================================= #
123
+ def require_the_html_templates
124
+ require 'cyberweb/requires/require_the_html_template.rb'
125
+ end
126
+
127
+ # ========================================================================= #
128
+ # === html_templates
129
+ # ========================================================================= #
130
+ def html_templates(hash)
131
+ require_the_html_templates unless Cyberweb.const_defined?(:HtmlTemplate)
132
+ Cyberweb::HtmlTemplate[
133
+ hash
134
+ ].to_s
135
+ end; alias html_template html_templates # === html_template
136
+
79
137
  end; end
@@ -1,10 +1,17 @@
1
1
  /* Cursor tags */
2
- .cursor_default { cursor: default; }
3
- .cursor_auto { cursor: auto; }
4
- .cursor_sw_resize { cursor: sw-resize; }
5
- .cursor_pointer { cursor: pointer; }
6
- .cursor_move { cursor: move; }
2
+ .cursor_auto { cursor: auto; }
3
+ .cursor_crosshair { cursor: crosshair; }
4
+ .cursor_default { cursor: default; }
5
+ .cursor_help { cursor: help; }
6
+ .cursor_grab { cursor: grab; }
7
+ .cursor_move { cursor: move; }
8
+ .cursor_pointer { cursor: pointer; }
9
+ .cursor_sw_resize { cursor: sw-resize; }
10
+ .cursor_wait { cursor: wait; }
7
11
 
12
+ /*
13
+ * Some more advanced cursors, e. g. custom cursors.
14
+ */
8
15
  .cursor_happy {
9
16
  cursor: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/9632/happy.png"), auto;
10
17
  }
@@ -1747,23 +1747,6 @@ hr.thick {
1747
1747
  display: inline;
1748
1748
  }
1749
1749
 
1750
- /*
1751
- * The next two lines can be used to display three stars
1752
- * in the middle of a page.
1753
- *
1754
- * If you use Cyberweb::WebObject then you can use this
1755
- * via "hr_stars" or just "stars" - a method call.
1756
- */
1757
- .hr_stars {
1758
- border:none;
1759
- }
1760
- .hr_stars::after {
1761
- content:'✩ ✩ ✩';
1762
- display:block;
1763
- text-align:center;
1764
- font-size:1.2em;
1765
- }
1766
-
1767
1750
  /*
1768
1751
  * The following was disabled as of 27.11.2021:
1769
1752
  *
@@ -1868,4 +1851,23 @@ pre { font-size: 1.0em;}
1868
1851
 
1869
1852
  .table_cell {
1870
1853
  display: table-cell;
1871
- }
1854
+ }
1855
+
1856
+ /*
1857
+ * The next two lines can be used to display three stars in the
1858
+ * middle of a page.
1859
+ *
1860
+ * If you use Cyberweb::WebObject then you can use this via
1861
+ * "hr_stars" or just "stars" - a method call.
1862
+ */
1863
+ .hr_stars {
1864
+ border:none;
1865
+ }
1866
+
1867
+ .hr_stars::after {
1868
+ content: '✩ ✩ ✩';
1869
+ display: block;
1870
+ margin: 0 auto;
1871
+ text-align: center;
1872
+ font-size: 1.2em;
1873
+ }
@@ -8,7 +8,8 @@
8
8
  text-shadow: 0 0 80px rgb(192 219 255 / 75%), 0 0 32px rgb(65 120 255 / 24%);
9
9
  }
10
10
 
11
- .glow_on_hover {
11
+ .glow_on_hover,
12
+ .rainbow_effect {
12
13
  width: 220px;
13
14
  height: 50px;
14
15
  border: none;
@@ -21,7 +22,8 @@
21
22
  border-radius: 10px;
22
23
  }
23
24
 
24
- .glow_on_hover:before {
25
+ .glow_on_hover:before,
26
+ .rainbow_effect:before {
25
27
  content: '';
26
28
  background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
27
29
  position: absolute;
@@ -38,19 +40,23 @@
38
40
  border-radius: 8px;
39
41
  }
40
42
 
41
- .glow_on_hover:active {
43
+ .glow_on_hover:active,
44
+ .rainbow_effect:active {
42
45
  color: #000
43
46
  }
44
47
 
45
- .glow_on_hover:active:after {
48
+ .glow_on_hover:active:after,
49
+ .rainbow_effect:active:after {
46
50
  background: transparent;
47
51
  }
48
52
 
49
- .glow_on_hover:hover:before {
53
+ .glow_on_hover:hover:before,
54
+ .rainbow_effect:hover:before {
50
55
  opacity: 1;
51
56
  }
52
57
 
53
- .glow_on_hover:after {
58
+ .glow_on_hover:after,
59
+ .rainbow_effect:after {
54
60
  z-index: -1;
55
61
  content: '';
56
62
  position: absolute;
@@ -199,4 +199,15 @@ div.circle {
199
199
  */
200
200
  .retain_aspect_ratio {
201
201
  object-fit: contain;
202
- }
202
+ }
203
+
204
+ /*
205
+ * Clip-path related functionality.
206
+ */
207
+ .default_clip_path_pentagon {
208
+ polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
209
+ }
210
+
211
+ .default_clip_path_circle {
212
+ clip-path: circle(80px at center);
213
+ }
@@ -44,16 +44,16 @@ class CGI < ::Cyberweb::Generator::Generator # === Cyberweb::Generator::CGI
44
44
  )
45
45
  return RUBY_HEADER+"
46
46
  # =========================================================================== #
47
- # require ''
47
+ # require 'foobar.cgi'
48
48
  # =========================================================================== #
49
49
  require 'cyberweb/autoinclude'
50
50
 
51
- english(:filename) {
51
+ english(:filename_capitalized) {
52
52
  created_on '#{Cyberweb.date_today}' # #{Cyberweb.return_current_weekday}.
53
53
  autoextend # ← This can be used to automatically do: include Cyberweb
54
54
  # title '#{use_this_title}' # Or use this as the title.
55
55
  ruby_favicon
56
- template1
56
+ hyperlinks_template1 ''
57
57
  body_css_class 'mar0px s2px padt2px VERDANAs'
58
58
  body_css_style 'background-color: #d3d2d1;'
59
59
  font_size 'def'