cyberweb 0.6.17 → 0.7.9
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.
Potentially problematic release.
This version of cyberweb might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +299 -134
- data/bin/images_from_this_webpage +11 -0
- data/doc/README.gen +276 -107
- data/doc/todo/todo_for_the_cyberweb_project.md +90 -90
- data/examples/css/day_night_toggle/day_night_toggle.html +202 -0
- data/examples/css/fleeing_dinosaur_animation/fleeing_dinosaur_animation.html +420 -0
- data/examples/css/important_style/important_style.html +35 -0
- data/examples/html/custom_cursor.html +1 -1
- data/examples/javascript_and_jquery/misc/miscallenous_javascript_examples.html +25 -0
- data/examples/javascript_and_jquery/roll_a_die/roll_a_die.html +48 -0
- data/lib/cyberweb/base/misc.rb +7 -0
- data/lib/cyberweb/cascading_style_sheets/div.css +2 -2
- data/lib/cyberweb/cascading_style_sheets/drop_shadow.css +4 -0
- data/lib/cyberweb/cascading_style_sheets/fonts.css +42 -30
- data/lib/cyberweb/cascading_style_sheets/glow_effects.css +58 -0
- data/lib/cyberweb/cascading_style_sheets/margin.css +254 -248
- data/lib/cyberweb/cascading_style_sheets/tooltip.css +73 -0
- data/lib/cyberweb/generator/cgi.rb +2 -1
- data/lib/cyberweb/javascript_code/custom_functions.js +16 -16
- data/lib/cyberweb/javascript_code/math.js +18 -0
- data/lib/cyberweb/javascript_code/simulate_a_dice.js +13 -5
- data/lib/cyberweb/sinatra/custom_extensions.rb +2 -2
- data/lib/cyberweb/toplevel_methods/misc.rb +44 -0
- data/lib/cyberweb/utility_scripts/create_coloured_tags.rb +1 -5
- data/lib/cyberweb/utility_scripts/download_balloon_css.rb +1 -5
- data/lib/cyberweb/utility_scripts/fix_incorrect_links_to_locally_existing_images_in_this_file.rb +5 -33
- data/lib/cyberweb/utility_scripts/hyperlink_all_images_from.rb +1 -5
- data/lib/cyberweb/utility_scripts/obtain_css_rules.rb +169 -0
- data/lib/cyberweb/version/version.rb +2 -2
- data/lib/cyberweb/web_object/html_tags.rb +12 -1
- data/lib/cyberweb/web_object/images.rb +534 -178
- data/lib/cyberweb/web_object/javascript_and_jquery.rb +9 -9
- data/lib/cyberweb/web_object/link.rb +102 -67
- data/lib/cyberweb/web_object/misc.rb +320 -518
- data/lib/cyberweb/yaml/js_files_to_load.yml +3 -2
- data/lib/cyberweb/yaml/load_these_yaml_files_by_default.yml +1 -0
- data/test/complex_tests/testing_style_variants/show_coloured_boxes.cgi +2 -2
- data/test/javascript/testing_various_javascript_related_APIs.html +17 -0
- data/test/simple_tests/testing_dragging_an_image.cgi +2 -0
- data/test/simple_tests/testing_uniform_css_rules_for_all_images.cgi +25 -0
- metadata +15 -5
@@ -34,3 +34,76 @@
|
|
34
34
|
top: -5px;
|
35
35
|
left: 105%;
|
36
36
|
}
|
37
|
+
|
38
|
+
/* tipped element. should be inline-block or block*/
|
39
|
+
.tooltip_for_a_right_arrow {
|
40
|
+
display: inline-block;
|
41
|
+
position: relative;
|
42
|
+
cursor: pointer;
|
43
|
+
color: #3bb4e5;
|
44
|
+
background-color: black;
|
45
|
+
box-sizing: border-box;
|
46
|
+
font-style: normal;
|
47
|
+
transition: all .25s ease-in-out;
|
48
|
+
z-index: 0;
|
49
|
+
}
|
50
|
+
|
51
|
+
.tooltip_for_a_right_arrow:hover {
|
52
|
+
color:#069;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* The tip */
|
56
|
+
.tooltip_for_a_right_arrow:before {
|
57
|
+
content: attr(data-tip);
|
58
|
+
position: absolute;
|
59
|
+
color: #fff;
|
60
|
+
line-height: 1.2em;
|
61
|
+
font-style: normal;
|
62
|
+
text-align: center;
|
63
|
+
visibility: hidden;
|
64
|
+
transition: all .3s ease-in-out;
|
65
|
+
text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
|
66
|
+
font-family: sans-serif;
|
67
|
+
padding: 1.0em;
|
68
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
69
|
+
min-width: 280px;
|
70
|
+
background-color: #020110;
|
71
|
+
letter-spacing: 2;
|
72
|
+
font-weight: 700
|
73
|
+
font-size: 2.2em;
|
74
|
+
border: 3px solid tomato:
|
75
|
+
opacity: 1;
|
76
|
+
}
|
77
|
+
|
78
|
+
.tooltip_for_a_right_arrow:after {
|
79
|
+
width: 0;
|
80
|
+
height: 0;
|
81
|
+
border-style: solid;
|
82
|
+
content: '';
|
83
|
+
position: absolute;
|
84
|
+
visibility: hidden;
|
85
|
+
transition: all .3s ease-in-out
|
86
|
+
opacity: 1;
|
87
|
+
}
|
88
|
+
.tooltip_for_a_right_arrow:hover:before,
|
89
|
+
.tooltip_for_a_right_arrow:hover:after {
|
90
|
+
visibility: visible;
|
91
|
+
opacity: 1
|
92
|
+
}
|
93
|
+
|
94
|
+
/* right */
|
95
|
+
.tooltip_for_a_right_arrow.the_tooltip_will_appear_on_the_right_side:before {
|
96
|
+
right: 0;
|
97
|
+
top: 50%;
|
98
|
+
transform: translate(calc(100% + 8px), -50%);
|
99
|
+
box-sizing: border-box;
|
100
|
+
border-radius: 3px;
|
101
|
+
}
|
102
|
+
|
103
|
+
.tooltip_for_a_right_arrow.the_tooltip_will_appear_on_the_right_side:after {
|
104
|
+
border-width: 8px 8px 8px 0;
|
105
|
+
border-color: transparent rgba(10, 20, 30, 0.85) transparent transparent;
|
106
|
+
right: -8px;
|
107
|
+
top: 50%;
|
108
|
+
transform: translate(0, -50%);
|
109
|
+
}
|
@@ -31,7 +31,8 @@ class CGI < ::Cyberweb::Generator::Generator # === Cyberweb::Generator::CGI
|
|
31
31
|
# ========================================================================= #
|
32
32
|
# === USE_THESE_CSS_CLASSES_FOR_THE_MAIN_DIV_ELEMENT
|
33
33
|
# ========================================================================= #
|
34
|
-
USE_THESE_CSS_CLASSES_FOR_THE_MAIN_DIV_ELEMENT =
|
34
|
+
USE_THESE_CSS_CLASSES_FOR_THE_MAIN_DIV_ELEMENT =
|
35
|
+
'mar0px pad0px s0_8em'
|
35
36
|
|
36
37
|
# ========================================================================= #
|
37
38
|
# === Cyberweb::Generator::CGI.generate_default_skeleton_for_webpage
|
@@ -128,22 +128,6 @@ function reveal(d) {
|
|
128
128
|
document.getElementById(d).style.visibility = "visible"
|
129
129
|
}
|
130
130
|
|
131
|
-
|
132
|
-
/*
|
133
|
-
* === popup()
|
134
|
-
*
|
135
|
-
* An alias to alert.
|
136
|
-
*
|
137
|
-
* Usage example:
|
138
|
-
*
|
139
|
-
* popup("Hello world!")
|
140
|
-
*
|
141
|
-
*/
|
142
|
-
function popup(i)
|
143
|
-
{
|
144
|
-
alert(i);
|
145
|
-
}
|
146
|
-
|
147
131
|
/*
|
148
132
|
* intercept_spacebar();
|
149
133
|
*/
|
@@ -291,3 +275,19 @@ function upcase(x)
|
|
291
275
|
var y=document.getElementById(x).value
|
292
276
|
document.getElementById(x).value=y.toUpperCase()
|
293
277
|
}
|
278
|
+
|
279
|
+
/*
|
280
|
+
* === popup()
|
281
|
+
*
|
282
|
+
* An alias to alert.
|
283
|
+
*
|
284
|
+
* Usage examples:
|
285
|
+
*
|
286
|
+
* popup("Hello world!")
|
287
|
+
* popup("<div style="font-size: 3em"><h3>Hello world!</h3></div>")
|
288
|
+
*
|
289
|
+
*/
|
290
|
+
function popup(i)
|
291
|
+
{
|
292
|
+
alert(i);
|
293
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
/*
|
2
|
+
* All math-related aspects will be stored in this file here.
|
3
|
+
*/
|
4
|
+
|
5
|
+
/*
|
6
|
+
* calculate_circumference()
|
7
|
+
*/
|
8
|
+
function calculate_circumference(i) {
|
9
|
+
/*
|
10
|
+
if (typeof i === 'string') {
|
11
|
+
i = parseInt(i);
|
12
|
+
}
|
13
|
+
*/
|
14
|
+
var result = 2 * Math.PI * i;
|
15
|
+
/* The next line can be used for debugging */
|
16
|
+
/*console.log("Circumference of circle is: " + result);*/
|
17
|
+
return result;
|
18
|
+
}
|
@@ -2,19 +2,27 @@
|
|
2
2
|
* The code that follows past this comment can be used to simulate
|
3
3
|
* the roll of a dice / some die. This can be used for some games,
|
4
4
|
* including RPG-related games.
|
5
|
+
*
|
6
|
+
|
7
|
+
<script type="text/javascript" src="simulate_a_dice.js"></script>
|
8
|
+
|
5
9
|
*/
|
6
10
|
|
7
11
|
/*
|
8
12
|
* random_number_from_to()
|
9
13
|
*
|
10
|
-
* This function can be used to simulate the dice-roll
|
11
|
-
*
|
14
|
+
* This function can be used to simulate the dice-roll* event.
|
15
|
+
*
|
16
|
+
* min value is the lowest number of the die.
|
17
|
+
*
|
18
|
+
* This currently only simulates a single die.
|
19
|
+
*
|
12
20
|
*/
|
13
|
-
function random_number_from_to(min = 1,
|
21
|
+
function random_number_from_to(min = 1, n_sides = 6) {
|
14
22
|
|
15
23
|
// Return a random integer from 1 to max value:
|
16
|
-
let result = Math.floor(Math.random() * (
|
17
|
-
result +=
|
24
|
+
let result = Math.floor(Math.random() * (n_sides));
|
25
|
+
result += min; /* +1 because the minimal value returned is 0 */
|
18
26
|
|
19
27
|
return result;
|
20
28
|
}
|
@@ -62,6 +62,50 @@ module Cyberweb
|
|
62
62
|
require 'cyberweb/toplevel_methods/write_what_into.rb'
|
63
63
|
require 'cyberweb/html_tags/option.rb'
|
64
64
|
|
65
|
+
# ========================================================================= #
|
66
|
+
# === Cyberweb.return_all_images_from_this_webpage
|
67
|
+
#
|
68
|
+
# The second argument, if true, will return the absolute path.
|
69
|
+
#
|
70
|
+
# Usage example:
|
71
|
+
#
|
72
|
+
# x = Cyberweb.return_all_images_from_this_webpage('https://www.projectaon.org/en/xhtml/lw/02fotw/sect166.htm')
|
73
|
+
# return_all_images_from_this_webpage sect159.htm
|
74
|
+
#
|
75
|
+
# ========================================================================= #
|
76
|
+
def self.return_all_images_from_this_webpage(
|
77
|
+
i, use_absolute_path = false
|
78
|
+
)
|
79
|
+
if i.is_a? Array
|
80
|
+
i = i.first
|
81
|
+
end
|
82
|
+
require 'open-uri'
|
83
|
+
base_dir = "#{File.dirname(i)}/"
|
84
|
+
dataset = URI.open(i).read
|
85
|
+
# ======================================================================= #
|
86
|
+
# Now we have the raw dataset. Next we must obtain all images that
|
87
|
+
# are part of that String.
|
88
|
+
# ======================================================================= #
|
89
|
+
use_this_regex = /(<img .+>)/
|
90
|
+
scanned = dataset.scan(use_this_regex).flatten
|
91
|
+
use_this_regex = /src="([A-Za-z0-9\.]+)"/ # See: https://rubular.com/r/eCrJt6W1Uyky6w
|
92
|
+
# ======================================================================= #
|
93
|
+
# Next, assign to result.
|
94
|
+
# ======================================================================= #
|
95
|
+
result = scanned.map {|entry|
|
96
|
+
if entry.include? 'src='
|
97
|
+
entry = entry.scan(use_this_regex)
|
98
|
+
end
|
99
|
+
entry
|
100
|
+
}.flatten
|
101
|
+
if use_absolute_path
|
102
|
+
result.map! {|entry|
|
103
|
+
"#{base_dir}#{entry}"
|
104
|
+
}
|
105
|
+
end
|
106
|
+
return result
|
107
|
+
end
|
108
|
+
|
65
109
|
# ========================================================================= #
|
66
110
|
# === Cyberweb.draw_triangle
|
67
111
|
#
|
@@ -19,11 +19,6 @@ class CreateColouredTags < Base # === Cyberweb::CreateColouredTags
|
|
19
19
|
require 'convert_global_env'
|
20
20
|
rescue LoadError; end
|
21
21
|
|
22
|
-
# ========================================================================= #
|
23
|
-
# === NAMESPACE
|
24
|
-
# ========================================================================= #
|
25
|
-
NAMESPACE = inspect
|
26
|
-
|
27
22
|
# ========================================================================= #
|
28
23
|
# === STORE_WHERE
|
29
24
|
#
|
@@ -48,6 +43,7 @@ class CreateColouredTags < Base # === Cyberweb::CreateColouredTags
|
|
48
43
|
# ========================================================================= #
|
49
44
|
def reset
|
50
45
|
super()
|
46
|
+
infer_the_namespace
|
51
47
|
set_commandline_mode
|
52
48
|
# First, determine where we shall store the file coloured_tags.rb actually.
|
53
49
|
if ENV['CYBERWEB']
|
@@ -21,11 +21,6 @@ class DownloadBalloonCss < Base # === Cyberweb::DownloadBalloonCss
|
|
21
21
|
|
22
22
|
require 'open-uri'
|
23
23
|
|
24
|
-
# ========================================================================= #
|
25
|
-
# === NAMESPACE
|
26
|
-
# ========================================================================= #
|
27
|
-
NAMESPACE = inspect
|
28
|
-
|
29
24
|
# ========================================================================= #
|
30
25
|
# === REMOTE_URL
|
31
26
|
#
|
@@ -56,6 +51,7 @@ class DownloadBalloonCss < Base # === Cyberweb::DownloadBalloonCss
|
|
56
51
|
# ========================================================================= #
|
57
52
|
def reset
|
58
53
|
super()
|
54
|
+
infer_the_namespace
|
59
55
|
end
|
60
56
|
|
61
57
|
# ========================================================================= #
|
data/lib/cyberweb/utility_scripts/fix_incorrect_links_to_locally_existing_images_in_this_file.rb
CHANGED
@@ -20,11 +20,6 @@ module Cyberweb
|
|
20
20
|
|
21
21
|
class FixIncorrectLinksToLocallyExistingImagesInThisFile < Base # === Cyberweb::FixIncorrectLinksToLocallyExistingImagesInThisFile
|
22
22
|
|
23
|
-
# ========================================================================= #
|
24
|
-
# === NAMESPACE
|
25
|
-
# ========================================================================= #
|
26
|
-
NAMESPACE = inspect
|
27
|
-
|
28
23
|
# ========================================================================= #
|
29
24
|
# === LOCAL_PATH_TO_THE_IMAGES
|
30
25
|
#
|
@@ -51,34 +46,9 @@ class FixIncorrectLinksToLocallyExistingImagesInThisFile < Base # === Cyberweb::
|
|
51
46
|
# ========================================================================= #
|
52
47
|
def reset
|
53
48
|
super()
|
54
|
-
|
55
|
-
# === @namespace
|
56
|
-
# ======================================================================= #
|
57
|
-
@namespace = NAMESPACE
|
58
|
-
end
|
59
|
-
|
60
|
-
# ========================================================================= #
|
61
|
-
# === set_commandline_arguments
|
62
|
-
# ========================================================================= #
|
63
|
-
def set_commandline_arguments(i = '')
|
64
|
-
i = [i].flatten.compact
|
65
|
-
@commandline_arguments = i
|
49
|
+
infer_the_namespace
|
66
50
|
end
|
67
51
|
|
68
|
-
# ========================================================================= #
|
69
|
-
# === commandline_arguments?
|
70
|
-
# ========================================================================= #
|
71
|
-
def commandline_arguments?
|
72
|
-
@commandline_arguments
|
73
|
-
end
|
74
|
-
|
75
|
-
# ========================================================================= #
|
76
|
-
# === first_argument?
|
77
|
-
# ========================================================================= #
|
78
|
-
def first_argument?
|
79
|
-
@commandline_arguments.first
|
80
|
-
end; alias first? first_argument? # === first?
|
81
|
-
|
82
52
|
# ========================================================================= #
|
83
53
|
# === run (run tag)
|
84
54
|
# ========================================================================= #
|
@@ -97,7 +67,9 @@ class FixIncorrectLinksToLocallyExistingImagesInThisFile < Base # === Cyberweb::
|
|
97
67
|
regex_to_use = /<img src="(.+?)"/
|
98
68
|
line =~ regex_to_use
|
99
69
|
match = $1.to_s.dup # ← This may be a String such as "../../../data/images/STD/DOT_06.png".
|
100
|
-
|
70
|
+
e
|
71
|
+
e "DEBUG INFORMATION: match was #{Colours.steelblue(match)}"
|
72
|
+
e
|
101
73
|
# ================================================================= #
|
102
74
|
# Next check whether the image-file exists. If not we can modify
|
103
75
|
# this link.
|
@@ -131,7 +103,7 @@ puts "DEBUG INFORMATION: match was #{Colours.steelblue(match)}"
|
|
131
103
|
# ========================================================================= #
|
132
104
|
# === Cyberweb::FixIncorrectLinksToLocallyExistingImagesInThisFile[]
|
133
105
|
# ========================================================================= #
|
134
|
-
def self.[](i =
|
106
|
+
def self.[](i = ARGV)
|
135
107
|
new(i)
|
136
108
|
end
|
137
109
|
|
@@ -22,11 +22,6 @@ module Cyberweb
|
|
22
22
|
|
23
23
|
class HyperlinkAllImagesFrom < Base # === Cyberweb::HyperlinkAllImagesFrom
|
24
24
|
|
25
|
-
# ========================================================================= #
|
26
|
-
# === NAMESPACE
|
27
|
-
# ========================================================================= #
|
28
|
-
NAMESPACE = inspect
|
29
|
-
|
30
25
|
# ========================================================================= #
|
31
26
|
# === initialize
|
32
27
|
# ========================================================================= #
|
@@ -44,6 +39,7 @@ class HyperlinkAllImagesFrom < Base # === Cyberweb::HyperlinkAllImagesFrom
|
|
44
39
|
# ========================================================================= #
|
45
40
|
def reset
|
46
41
|
super()
|
42
|
+
infer_the_namespace
|
47
43
|
# ======================================================================= #
|
48
44
|
# === @html_string
|
49
45
|
#
|
@@ -0,0 +1,169 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# === Cyberweb::ObtainCssRules
|
6
|
+
#
|
7
|
+
# This class can obtain some CSS rules, based on the .css files that
|
8
|
+
# are distributed within the cyberweb gem.
|
9
|
+
#
|
10
|
+
# Usage example:
|
11
|
+
#
|
12
|
+
# Cyberweb::ObtainCssRules.new
|
13
|
+
#
|
14
|
+
# =========================================================================== #
|
15
|
+
# require 'cyberweb/utility_scripts/obtain_css_rules.rb'
|
16
|
+
# Cyberweb::ObtainCssRules.new
|
17
|
+
# =========================================================================== #
|
18
|
+
require 'cyberweb/base/base.rb'
|
19
|
+
|
20
|
+
module Cyberweb
|
21
|
+
|
22
|
+
class ObtainCssRules < Base # === Cyberweb::ObtainCssRules
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# === initialize
|
26
|
+
# ========================================================================= #
|
27
|
+
def initialize(
|
28
|
+
i = ARGV,
|
29
|
+
run_already = true
|
30
|
+
)
|
31
|
+
reset
|
32
|
+
set_commandline_arguments(i)
|
33
|
+
run if run_already
|
34
|
+
end
|
35
|
+
|
36
|
+
# ========================================================================= #
|
37
|
+
# === reset (reset tag)
|
38
|
+
# ========================================================================= #
|
39
|
+
def reset
|
40
|
+
super()
|
41
|
+
infer_the_namespace
|
42
|
+
# ======================================================================= #
|
43
|
+
# === @seek_this_CSS_class
|
44
|
+
# ======================================================================= #
|
45
|
+
@seek_this_CSS_class = '.mars1em'
|
46
|
+
# ======================================================================= #
|
47
|
+
# === @result
|
48
|
+
# ======================================================================= #
|
49
|
+
@result = nil
|
50
|
+
end
|
51
|
+
|
52
|
+
# ========================================================================= #
|
53
|
+
# === result?
|
54
|
+
# ========================================================================= #
|
55
|
+
def result?
|
56
|
+
@result
|
57
|
+
end
|
58
|
+
|
59
|
+
# ========================================================================= #
|
60
|
+
# === set_result
|
61
|
+
# ========================================================================= #
|
62
|
+
def set_result(i)
|
63
|
+
if i.is_a? Array
|
64
|
+
i = i.first
|
65
|
+
end
|
66
|
+
@result = i
|
67
|
+
end
|
68
|
+
|
69
|
+
# ========================================================================= #
|
70
|
+
# === sanitize_the_result
|
71
|
+
#
|
72
|
+
# Currently this method will only get rid of excess ' ' characters.
|
73
|
+
# ========================================================================= #
|
74
|
+
def sanitize_the_result
|
75
|
+
@result.squeeze!(' ')
|
76
|
+
end
|
77
|
+
|
78
|
+
# ========================================================================= #
|
79
|
+
# === set_seek_this_CSS_class
|
80
|
+
# ========================================================================= #
|
81
|
+
def set_seek_this_CSS_class(i)
|
82
|
+
i = i.dup
|
83
|
+
unless i.start_with?('.')
|
84
|
+
i.prepend('.')
|
85
|
+
end
|
86
|
+
@seek_this_CSS_class = i
|
87
|
+
end; alias set_seek_this set_seek_this_CSS_class # === set_seek_this
|
88
|
+
|
89
|
+
# ========================================================================= #
|
90
|
+
# === seek_this_CSS_class?
|
91
|
+
# ========================================================================= #
|
92
|
+
def seek_this_CSS_class?
|
93
|
+
@seek_this_CSS_class
|
94
|
+
end; alias seek? seek_this_CSS_class? # === seek?
|
95
|
+
|
96
|
+
# ========================================================================= #
|
97
|
+
# === raw_content
|
98
|
+
#
|
99
|
+
# This method will return the raw body of the CSS rule at hand. So if
|
100
|
+
# the content is '{ margin-left: 1em; margin-right: 1em; }' then only
|
101
|
+
# the part between the two '' will returned via this method here.
|
102
|
+
#
|
103
|
+
# Otherwise the original @result is returned.
|
104
|
+
#
|
105
|
+
# Currently this method will remove excessive ' ' too, and .strip() on
|
106
|
+
# the resulting String.
|
107
|
+
# ========================================================================= #
|
108
|
+
def raw_content
|
109
|
+
if @result.include?('{')
|
110
|
+
return @result.scan(/{(.+)}/).flatten.first.to_s.squeeze(' ').strip
|
111
|
+
else
|
112
|
+
return @result
|
113
|
+
end
|
114
|
+
end; alias raw_body? raw_content # === raw_body?
|
115
|
+
alias raw_content? raw_content # === raw_content?
|
116
|
+
alias body? raw_content # === body?
|
117
|
+
|
118
|
+
# ========================================================================= #
|
119
|
+
# === run (run tag)
|
120
|
+
# ========================================================================= #
|
121
|
+
def run
|
122
|
+
_ = cascading_style_sheets_directory?
|
123
|
+
all_local_css_files = Dir[_+'*.css']
|
124
|
+
all_local_css_files.each {|this_CSS_file|
|
125
|
+
if File.exist?(this_CSS_file)
|
126
|
+
dataset = File.readlines(this_CSS_file)
|
127
|
+
parse(dataset)
|
128
|
+
end
|
129
|
+
}
|
130
|
+
end
|
131
|
+
|
132
|
+
# ========================================================================= #
|
133
|
+
# === parse
|
134
|
+
#
|
135
|
+
# Here we assume that the dataset is an Array.
|
136
|
+
# ========================================================================= #
|
137
|
+
def parse(dataset)
|
138
|
+
if dataset.any? {|line| line.start_with?(@seek_this_CSS_class) }
|
139
|
+
# Ok, here we found a match, so output the rule.
|
140
|
+
selection = dataset.select {|line| line.start_with?(@seek_this_CSS_class) }
|
141
|
+
set_result(selection)
|
142
|
+
# else # in this case we found no match.
|
143
|
+
#
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# ========================================================================= #
|
148
|
+
# === parse_string
|
149
|
+
# ========================================================================= #
|
150
|
+
def parse_string(i)
|
151
|
+
if i.start_with?(@seek_this_CSS_class)
|
152
|
+
set_result(i)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
# ========================================================================= #
|
157
|
+
# === Cyberweb::ObtainCssRules[]
|
158
|
+
# ========================================================================= #
|
159
|
+
def self.[](i = ARG)
|
160
|
+
new(i)
|
161
|
+
end
|
162
|
+
|
163
|
+
end; end
|
164
|
+
|
165
|
+
if __FILE__ == $PROGRAM_NAME
|
166
|
+
alias e puts
|
167
|
+
css_rules = Cyberweb::ObtainCssRules.new(ARGV)
|
168
|
+
pp css_rules.raw_body?
|
169
|
+
end # obtaincssrules
|
@@ -9,12 +9,12 @@ module Cyberweb
|
|
9
9
|
# ========================================================================= #
|
10
10
|
# === VERSION
|
11
11
|
# ========================================================================= #
|
12
|
-
VERSION = '0.
|
12
|
+
VERSION = '0.7.9'
|
13
13
|
|
14
14
|
# ========================================================================= #
|
15
15
|
# === LAST_UPDATE
|
16
16
|
# ========================================================================= #
|
17
|
-
LAST_UPDATE = '
|
17
|
+
LAST_UPDATE = '28.11.2022'
|
18
18
|
|
19
19
|
# ========================================================================= #
|
20
20
|
# === URL_TO_THE_DOCUMENTATION
|
@@ -217,6 +217,14 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
|
|
217
217
|
css_class = Input.to_s
|
218
218
|
end
|
219
219
|
_ = ''.dup
|
220
|
+
if type.is_a? Hash
|
221
|
+
if type.has_key? :id
|
222
|
+
id = type.delete(:id)
|
223
|
+
end
|
224
|
+
if type.empty?
|
225
|
+
type = :text
|
226
|
+
end
|
227
|
+
end
|
220
228
|
# ======================================================================= #
|
221
229
|
# First, let's start to assemble our main string that we will return.
|
222
230
|
# This must come before we handle anything else.
|
@@ -405,7 +413,10 @@ class WebObject < ::Cyberweb::Base # === Cyberweb::WebObject
|
|
405
413
|
# ======================================================================= #
|
406
414
|
# === :text
|
407
415
|
# ======================================================================= #
|
408
|
-
when :text,
|
416
|
+
when :text,
|
417
|
+
:field,
|
418
|
+
:default,
|
419
|
+
:t
|
409
420
|
_ << ' type="text"'
|
410
421
|
# ======================================================================= #
|
411
422
|
# === :file
|