aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r--lib/sisu/v0/sysenv.rb70
1 files changed, 42 insertions, 28 deletions
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index 0f6652b8..15dbeba5 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -450,6 +450,7 @@ module SiSU_Env
:index => filename(code,'index','.html'),
:odf => filename(code,'opendocument','.odt'),
:plain => filename(code,'plain','.txt'),
+ :manpage => filename(code,@fnb,'.1'),
:wiki => filename(code,'wiki','.txt'),
:digest => filename(code,'digest','.txt'),
:metadata => filename(code,'metadata','.html'), #chk
@@ -835,7 +836,7 @@ module SiSU_Env
flag=if defined? @rc['search'][type] and
defined? @rc['search'][type]['action'] and
@rc['search'][type]['flag']==true and
- @rc['search'][type]['action'] =~/http:\/\// #and
+ @rc['search'][type]['action'] =~/https?:\/\// #and
#defined? @rc['search'][type]['db'] and @rc['search'][type]['db'] =~/\S+/ # and
flag=if promo?[:ad]
false
@@ -858,7 +859,7 @@ module SiSU_Env
flag=if defined? @rc['search']
searches.each do |type|
if defined? @rc['search'][type] and
- defined? @rc['search'][type]['action'] and @rc['search'][type]['action'] =~/http:\/\// and
+ defined? @rc['search'][type]['action'] and @rc['search'][type]['action'] =~/https?:\/\// and
defined? @rc['search'][type]['db'] and @rc['search'][type]['db'] =~/\S+/ # and
flag=if promo?[:ad]
false
@@ -878,10 +879,10 @@ module SiSU_Env
rc=SiSU_Env::Get_init.instance.yamlrc
create_form_hyperestraier=if defined? rc['search']['sisu']['flag'] and
rc['search']['sisu']['flag']==true and
- action and action =~/http:\/\//; true
+ action and action =~/https?:\/\//; true
else false
end
- create_form_sisu=if action and db and action =~/http:\/\// and db =~/\S+/
+ create_form_sisu=if action and db and action =~/https?:\/\// and db =~/\S+/
true
elsif widget.search?
db=if rc['search']['sisu']['flag']==true and
@@ -946,7 +947,7 @@ WOK
def search_form_static(action=nil,db=nil)
rc=SiSU_Env::Get_init.instance.yamlrc
create_form=if rc['search']['sisu']['flag']==true and
- action and db and action =~/http:\/\// and db =~/\S+/
+ action and db and action =~/https?:\/\// and db =~/\S+/
true
elsif widget.search_fixed?
db=if rc['search']['sisu']['flag']==true and rc['search']['sisu']['db']=~/\S+/
@@ -993,7 +994,7 @@ WOK
def search?
flag=if defined? @rc['search'] and
defined? @rc['search']['sisu'] and
- defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/http:\/\// and
+ defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/https?:\/\// and
defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/
defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/
flag=if defined? @vz.widget_search and @vz.widget_search == true
@@ -1010,7 +1011,7 @@ WOK
def search_fixed?
flag=if defined? @rc['search'] and
defined? @rc['search']['sisu'] and
- defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/http:\/\// and
+ defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/https?:\/\// and
defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/
defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/
flag=if defined? @vz.widget_search and @vz.widget_search == true
@@ -1028,7 +1029,7 @@ WOK
rc=SiSU_Env::Get_init.instance.yamlrc
create_form=if defined? rc['search']['sisu']['flag'] and
rc['search']['sisu']['flag']==true and
- action and db and action =~/http:\/\// and db =~/\S+/
+ action and db and action =~/https?:\/\// and db =~/\S+/
true
elsif widget_static.search? and rc['search']['sisu']['flag']==true
db=if rc['search']['sisu']['db']=~/\S+/
@@ -1081,7 +1082,6 @@ WOK
def path #dir
def home
@sys.home
- #@home
end
def pwd
@sys.pwd
@@ -1132,7 +1132,7 @@ WOK
end
@yamlrc_dir
end
- def man
+ def man #check use
if defined? @rc['webserv']['man']; "#{webserv}/#{@rc['webserv']['man']}"
else defaults[:webserv_man]
end
@@ -1178,6 +1178,9 @@ WOK
def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names
"#{path.webserv}/#@stub_pwd"
end
+ def manpage
+ "#{path.output}/man"
+ end
def sitemaps
"#{path.output}/sitemaps"
end
@@ -1324,7 +1327,7 @@ WOK
"http://#{hostname}/#@stub_pwd"
end
def root
- if defined? @rc['webserv']['url_root'] and @rc['webserv']['url_root'] =~/http:\/\//; "#{@rc['webserv']['url_root']}/#@stub_pwd"
+ if defined? @rc['webserv']['url_root'] and @rc['webserv']['url_root'] =~/https?:\/\//; "#{@rc['webserv']['url_root']}/#@stub_pwd"
elsif defined? @rc['webserv']['url_root'] and @rc['webserv']['url_root'] =~/localhost/; "http://localhost/#@stub_pwd"
else "file://#{path.output}"
end
@@ -1335,8 +1338,8 @@ WOK
def webserv_host_base
if defined? @rc['webserv']['host']
case @rc['webserv']['host']
- when /http:\/\//; @rc['webserv']['host']
- when /\S+/; "http://#{@rc['webserv']['host']}"
+ when /https?:\/\//; @rc['webserv']['host']
+ when /\S+/; "http://#{@rc['webserv']['host']}"
else defaults[:webserv_host_cgi]
end
else defaults[:webserv_host_cgi]
@@ -1374,13 +1377,13 @@ WOK
end
def webserv_cgi #web url for local webserv (localhost, or hostname)
if defined? @rc['webserv_cgi']['host'] and not @rc['webserv_cgi']['host'].nil?
- http=@rc['webserv_cgi']['host'] =~ /http:\/\// ? '' : 'http://'
+ http=@rc['webserv_cgi']['host'] =~ /https?:\/\// ? '' : 'http://' #check https? missing
if webserv_port_cgi
"#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}/#@stub_pwd"
else "#{http}#{@rc['webserv_cgi']['host']}/#@stub_pwd"
end
else
- http=webserv_host_base=~/http:\/\// ? '' : 'http://'
+ http=webserv_host_base=~/https?:\/\// ? '' : 'http://'
if webserv_port_cgi
"#{http}#{webserv_host_base}:#{webserv_port_cgi}/#@stub_pwd"
else "#{http}#{webserv_host_base}/#@stub_pwd"
@@ -1389,13 +1392,13 @@ WOK
end
def webserv_base_cgi #web url for local webserv (localhost, or hostname)
if defined? @rc['webserv_cgi']['host'] and not @rc['webserv_cgi']['host'].nil?
- http=@rc['webserv_cgi']['host'] =~ /http:\/\// ? '' : 'http://'
+ http=@rc['webserv_cgi']['host'] =~ /https?:\/\// ? '' : 'http://'
if webserv_port_cgi
"#{http}#{@rc['webserv_cgi']['host']}:#{webserv_port_cgi}"
else "#{http}#{@rc['webserv_cgi']['host']}"
end
else
- http=webserv_host_base=~/http:\/\// ? '' : 'http://'
+ http=webserv_host_base=~/https?:\/\// ? '' : 'http://'
if webserv_port_cgi
"#{http}#{webserv_host_base}:#{webserv_port_cgi}"
else "#{http}#{webserv_host_base}"
@@ -1407,13 +1410,14 @@ WOK
if defined? @rc['webserv_cgi']['host'] and not @rc['webserv_cgi']['host'].nil?
http=if @rc['webserv_cgi']['host'] =~/http:\/\//
'http://'
+ elsif @rc['webserv_cgi']['host'] =~/https:\/\//
+ 'https://'
else defaults
end
"#{http}#{@rc['webserv_cgi']['host']}"
elsif webserv_host_base and not webserv_host_base.nil?
"#{http}#{webserv_host_base}"
- else "#{http}localhost"
- end
+ else "#{http}localhost" end
end
def webserv #web url for local webserv (localhost, or hostname)
if path.webserv_dir and path.webserv =~ /#{path.webserv_dir}/ #revisit
@@ -1438,7 +1442,7 @@ WOK
case @rc['webserv_cgi']['file_links']
when /webserv_cgi/; url.webserv_base_cgi
when /webserv/; @rc['webserv']['url_root']
- when /http:\/\//; @rc['webserv_cgi']['file_links']
+ when /https?:\/\//; @rc['webserv_cgi']['file_links']
when /\S+/; "http://#{@rc['webserv_cgi']['file_links']}"
else webserv_base_cgi
end
@@ -1811,7 +1815,7 @@ WOK
if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get
end
ft=[]
- if @md and defined? @md.fn and @md.fn # used for multilingual
+ if @md and defined? @md.fn and @md.fn # used for multilingual
if @md.cmd =~ /[hH]/; ft << @md.fn[:html]
end
if @md.cmd =~ /w/ and @md.cmd !~ /[hH]/; ft << @md.fn[:concordance]
@@ -1826,7 +1830,9 @@ WOK
end
if @md.cmd =~ /b/; ft << @md.fn[:xhtml]
end
- if @md.cmd =~ /[aAeE]/; ft << @md.fn[:plain]
+ if @md.cmd =~ /a/; ft << @md.fn[:plain]
+ end
+ if @md.cmd =~ /i/; ft << @md.fn[:manpage]
end
if @md.cmd =~ /[g]/; ft << @md.fn[:wiki]
end
@@ -1856,7 +1862,9 @@ WOK
end
if @opt.cmd =~ /b/; ft << 'scroll.xhtml' << '??.scroll.xhtml' << 'scroll.??.xhtml'
end
- if @opt.cmd =~ /[aAeE]/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
+ if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1'
+ end
+ if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt'
end
if @opt.cmd =~ /[g]/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt'
end
@@ -1960,14 +1968,13 @@ WOK
remote=remote_host_base_general
#host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty?
@@flag_remote=true if remote[:name] =~/\S+@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/
- #remote[:name]
remote_host_base_general[:name]
end
def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built
input=@local_sisu_source
output=case @opt.cmd
when /u/; "#{self.remote_host_base}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u
- when /[aAbeEhHNopwxXy]/; "#{self.remote_host_base}/#{@env.path.stub_pwd}/#{@fnb}/."
+ when /[abhHNopwxXy]/; "#{self.remote_host_base}/#{@env.path.stub_pwd}/#{@fnb}/."
else "#{self.remote_host_base}/#{@env.path.stub_pwd}/."
end
if (input =~/\S/ and input !~/\/\//) and (output =~/\S/ and output !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/
@@ -2251,7 +2258,7 @@ WOK
'docbook.css'
end
def homepage
- 'index.css'
+ 'homepage.css'
end
end
class CSS_select < Info_env
@@ -2377,6 +2384,12 @@ WOK
filename=@fno
file=make_file(path,filename)
end
+ def mkfile_man
+ path="#{@env.path.output}/man"
+ make_path(path)
+ filename=@fno
+ file=make_file(path,filename)
+ end
def mkfile_pwd
path=Dir.pwd
filename=@fno
@@ -2505,8 +2518,8 @@ WOK
end
filename_homepage=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html",'w')
filename_homepage_toc=File.new("#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html",'w')
- filename_homepage << @vz_home.index
- filename_homepage_toc << @vz_home.index
+ filename_homepage << @vz_home.homepage
+ filename_homepage_toc << @vz_home.homepage
end
end
def cp_images(src_path,dest_path)
@@ -2595,3 +2608,4 @@ module SiSU_Errors
require "#{SiSU_lib}/errors"
end
__END__
+https? intro check 2007-09-22