Class: Cyberweb::Generator::StaticWebpage
Overview
Cyberweb::Generator::StaticWebpage
Constant Summary
collapse
- NAMESPACE =
inspect
Constants inherited
from Base
Base::HOME_DIRECTORY_OF_THE_USER_X
Instance Method Summary
collapse
Methods inherited from Base
#be_verbose, #be_verbose?, #cascading_style_sheets_directory?, #cd, #commandline_mode?, #copyright?, #css_comment, #delete_directory, #do_toggle, #e, #echo_raw, #filename?, #full_path_to_image_directory?, #html_colours?, #html_image, #htmlentities, #img_dir?, #infer_the_namespace, #initialize_the_configuration, #is_a_file?, #is_a_video_file?, #is_an_image_file?, #is_on_roebe?, #last_tag_used?, #last_tag_used_first_element?, #last_tag_used_id?, #mkdir, #mode?, #namespace?, #open_in_browser, #opne, #remove_comments_from_this_string_but_preserve_CSS_rules, #remove_html, #return_all_directories, #return_date, #return_program_name, #return_pwd, #ruby_header?, #server_base_directory?, #set_commandline_mode, #set_last_tag_used, #update_the_image_directory, #use_this_relative_directory_for_custom_images?, #www_mode?
#copy_this_file, #cpr, #delete_file, #filename_without_extension?, #read_file_via_utf8_encoding
Methods included from BaseModule
#attach_these_constants, #base_dir?, #beautiful_url, #cd, #create_the_internal_hash, #doctype?, #ee, #ensure_main_encoding, #esystem, #html_templates, #initialize_the_config_if_the_config_hash_is_empty, #internal_hash?, #log_dir?, #no_http, #random_alphabet_characters, #rarrow?, #rds, #remove_comments_from_this_string, #remove_numbers, #require_the_html_templates, #require_these, #return_file_size_in_kb_of, #return_html_comment, #ruby_sitelib_dir?, #sanitize_this_id, #server_base_directory?, #string_remote_image, #today?, #try_to_require_rack, #try_to_require_the_open_gem, #write_what_into
#content_type_is_html, #content_type_is_jpeg, #content_type_is_json, #content_type_is_plain_text
#append_to_the_commandline_arguments, #commandline_arguments?, #first_argument?, #parse_these_commandline_arguments, #second_argument?, #set_commandline_arguments
#all_html_colours, #lightgreen, #rev, #sdir, #sfancy, #sfile, #simp, #steelblue, #tomato
Constructor Details
#initialize(input = ARGV, run_already = true) ⇒ StaticWebpage
38
39
40
41
42
43
44
45
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 38
def initialize(
input = ARGV,
run_already = true
)
reset
set_input(input)
run if run_already
end
|
Instance Method Details
#add(i = N) ⇒ Object
83
84
85
86
87
88
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 83
def add(i = N)
if i.is_a? Symbol
i = '<'+i.to_s+'>' end
@string << i
end
|
100
101
102
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 100
def br
add HtmlTags.br
end
|
76
77
78
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 76
def input?
@input
end
|
133
134
135
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 133
def opnn
super(NAMESPACE)
end
|
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 50
def reset
super()
@string = ''.dup
@store_the_html_file_here = Dir.pwd+'/foobar_video_files.html'
end
|
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 140
def run
input = input?
if File.directory? input
files = Dir[input+'*'].select {|entry| File.file? entry }
add :html
add HtmlTags.title(input)
add :body
files.each {|entry|
br
add HtmlTags.a(entry,'','','padding-left:2em; font-weight: bold')
br
add '<video width="420" height="320" controls>
<source src="'+entry+'" type="video/mp4">
</video>'
}
add HtmlTags.close :body
add HtmlTags.close :html
save_file
else
e 'Please provide an existing directory as target.'
end
end
|
#save_file(what = string?,
, into = save_file?
) ⇒ Object
107
108
109
110
111
112
113
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 107
def save_file(
what = string?,
into = save_file?
)
opnn; e "Creating file `#{sfile(into)}`."
write_what_into(what, into)
end
|
#save_file? ⇒ Boolean
Also known as:
store_the_html_file_here?
118
119
120
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 118
def save_file?
@store_the_html_file_here
end
|
65
66
67
68
69
70
71
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 65
def set_input(i)
if i.is_a? Array
i = i.join(' ').strip
end
i = i.to_s.dup
@input = i
end
|
#set_store_the_html_file_here(i) ⇒ Object
Also known as:
set_store_where, store_where=
#
set_store_the_html_file_here
#
125
126
127
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 125
def set_store_the_html_file_here(i)
@store_the_html_file_here = i
end
|
#string? ⇒ Boolean
93
94
95
|
# File 'lib/cyberweb/generator/static_webpage.rb', line 93
def string?
@string
end
|