aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/embedded.rb171
-rw-r--r--lib/sisu/v0/hub.rb77
-rw-r--r--lib/sisu/v0/param.rb15
-rw-r--r--lib/sisu/v0/remote.rb (renamed from lib/sisu/v0/remote_put.rb)68
-rw-r--r--lib/sisu/v0/semantics.rb396
5 files changed, 263 insertions, 464 deletions
diff --git a/lib/sisu/v0/embedded.rb b/lib/sisu/v0/embedded.rb
new file mode 100644
index 00000000..11a5aa24
--- /dev/null
+++ b/lib/sisu/v0/embedded.rb
@@ -0,0 +1,171 @@
+=begin
+
+ * Name: SiSU
+
+ * Description: a framework for document structuring, publishing and search
+
+ * Author: Ralph Amissah
+
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Ralph Amissah All Rights Reserved.
+
+ * License: GPL 3 or later:
+
+ SiSU, a framework for document structuring, publishing and search
+
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007 Ralph Amissah
+
+ This program is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licenses/gpl.html>
+ <http://www.gnu.org/copyleft/gpl.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** Description: sitemap created from parameters extracted from input file(s)
+
+=end
+module SiSU_Embedded
+ require "#{SiSU_lib}/param"
+ require "#{SiSU_lib}/sysenv"
+ include SiSU_Env
+ include SiSU_Param
+ class Source
+ require 'fileutils'
+ include FileUtils
+ def initialize(opt)
+ @opt=opt
+ @md=SiSU_Param::Parameters.new(@opt).get
+ @env=SiSU_Env::Info_env.new(@md.fns)
+ @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base
+ end
+ def read
+ songsheet
+ end
+ def songsheet
+ images
+ audio
+ multimedia
+ begin
+ rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ ensure
+ end
+ end
+ def images
+ src="#{Dir.pwd}/_sisu/image"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_local"
+ rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/image_local"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ src_ec="#{src}/" + @md.ec[:image].join(" #{src}/")
+ SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
+ if @md.cmd.inspect =~/R/ #rsync to remote image directory
+ SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
+ end
+ end
+ end
+ def audio
+ #p @md.ec[:audio]
+ src="#{Dir.pwd}/_sisu/mm/audio"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio"
+ rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/mm/audio"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ src_ec="#{src}/" + @md.ec[:audio].join(" #{src}/")
+ SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
+ if @md.cmd.inspect =~/R/ #rsync to remote audio directory
+ SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
+ end
+ end
+ end
+ def multimedia
+ #p @md.ec[:multimedia]
+ src="#{Dir.pwd}/_sisu/mm/video"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video"
+ rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/mm/video"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ src_ec="#{src}/" + @md.ec[:multimedia].join(" #{src}/")
+ SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync
+ if @md.cmd.inspect =~/R/ #rsync to remote video directory
+ SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync
+ end
+ end
+ end
+ end
+end
+__END__
+def images # alternative may be preferable as source taken from local destination, and not sent remotely unless found there
+ src="#{Dir.pwd}/_sisu/image"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_local"
+ rdest="#@rhost/#{@env.path.stub_pwd}/_sisu/image_local"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ @md.ec[:image].each do |i|
+ SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync
+ #cp("#{src}/#{i}","#{ldest}/.") #use rysnc
+ if @md.cmd.inspect =~/R/ #rsync to remote image directory #ldest used as source, if not in local repo, don't share
+ SiSU_Env::System_call.new("#{ldest}/#{i}","#{rdest}/.",'q').rsync
+ end
+ end
+ end
+end
+def audio
+ #p @md.ec[:audio]
+ src="#{Dir.pwd}/_sisu/mm/audio"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ @md.ec[:audio].each do |i|
+ SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync
+ #cp("#{src}/#{i}","#{ldest}/.") #use rysnc
+ if @md.cmd.inspect =~/R/
+ #rsync to remote audio directory
+ end
+ end
+ end
+end
+def multimedia
+ #p @md.ec[:multimedia]
+ src="#{Dir.pwd}/_sisu/mm/video"
+ ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video"
+ if @md.cmd.inspect =~/[vVMR]/ and FileTest.directory?(src)
+ File.mkpath(ldest) unless FileTest.directory?(ldest)
+ @md.ec[:multimedia].each do |i|
+ SiSU_Env::System_call.new("#{src}/#{i}","#{ldest}/.",'q').rsync
+ #cp("#{src}/#{i}","#{ldest}/.") #use rysnc
+ if @md.cmd.inspect =~/R/
+ #rsync to remote multimedia directory
+ end
+ end
+ end
+end
diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb
index 4880807d..db0bb2a2 100644
--- a/lib/sisu/v0/hub.rb
+++ b/lib/sisu/v0/hub.rb
@@ -131,7 +131,7 @@ module SiSU
else
put=fns.gsub(/(.+)?\._sst$/,'\1.ssm')
@opt.fns=fns
- if @req !~/(?:urls|remote_put)$/
+ if @req !~/(?:urls|remote)$/
if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:[_-]?sst|ssm)$/
if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing
SiSU_Assemble::Composite.new(@opt).read
@@ -168,6 +168,7 @@ module SiSU
when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x
when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X
when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b
+ when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m (image and other content)
when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y
when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y
when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z
@@ -185,7 +186,7 @@ module SiSU
elsif FileTest.file?(put)
case @req
when /^urls$/; SiSU_urls::Source.new(@opt).read # -u -v -V -M
- when /^remote_put$/
+ when /^remote$/
case @message
when /scp/; SiSU_Remote::Put.new(@opt).scp # -r
when /rsync/; SiSU_Remote::Put.new(@opt).rsync # -R
@@ -216,22 +217,22 @@ module SiSU
end
def remote_put_base_site_rsync # -CR
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_base
end
def remote_put_base_site_rsync_match # -CCRZ
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_base_sync
end
def remote_put_base_site # -Cr
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).scp_base
end
def remote_put_base_site_all # -CCr
p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).scp_base_all
end
def cgi # -F
@@ -256,8 +257,6 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
puts %{#{@cX.blue}<<#{@cX.off}#{@cX.green}Start Webrick web server on port: #{prt}#{@cX.off}#{@cX.blue}>> #{@cX.off*2} }
system("sisu_webrick #{port}&\n")
end
- def semantics
- end
def not_found
puts "\n#{@cX.fuschia}FILE NOT FOUND:#{@cX.off} << #{@opt.fns} >> - requested #{@opt.cmd} processing skipped\n"
end
@@ -393,59 +392,13 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
end
if @get_s.length > 0 #% remote markup file .sst
- require 'open-uri'
- require 'pp'
- require "#{SiSU_lib}/composite"
- @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/
- @rgx_skin=/^0~skin\s+(\S+)/
- threads=[]
- for requested_page in @get_s
- threads << Thread.new(requested_page) do |url|
- open(url) do |f|
- raise "#{url} not found" unless f
- re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
- base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb
- imagedir= base_uri + '/_sisu/image_local' #check on
- doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc'
- #"Got file, and ready to process: #{fnb}.t#{instr}"
- downloaded_file=File.new("#{fnb}.-sst",'w+')
- images=SiSU_Assemble::Remote_image.new.image(imagedir)
- skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir)
- f.collect.each do |r| # work area
- skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin
- images << r.scan(@rgx_image).uniq if r =~@rgx_image
- downloaded_file << r
- end
- if skin and skin.length > 0
- SiSU_Assemble::Remote_image.new.download_doc_skin(skin)
- end
- if images and images.length > 1
- images.flatten!.uniq!
- @msg,@msgs='downloading images:', [ images.join(',') ]
- @tell.call.warn unless @opt.cmd =~/q/
- SiSU_Assemble::Remote_image.new.download_images(images)
- @msg,@msgs='downloading done',nil
- @tell.call.warn unless @opt.cmd =~/q/
- end
- downloaded_file.close
- end
- end
- end
+ require "#{SiSU_lib}/remote"
+ SiSU_Remote::Get.new(@opt,@get_s).fns
Operations.new.counter
end
- threads.each {|thr| thr.join} if threads #and threads.length > 0
if @get_p.length > 0 #% remote sisupod
- require 'net/http'
- for requested_pod in @get_p
- pod_info=Remote_download.new(requested_pod)
- @opt.fns=pod_info.pod.name
- Net::HTTP.start(pod_info.pod.site) do |http|
- resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
- open(pod_info.pod.name,'wb') do |file|
- file.write(resp.body)
- end
- end
- end
+ require "#{SiSU_lib}/remote"
+ SiSU_Remote::Get.new(@opt,@get_p).sisupod
end
rescue; SiSU_Errors::Info_error.new($!,$@,@opt,@fns).error #ok
@retry_count +=1
@@ -517,13 +470,15 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
end
+ if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
+ end
if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
end
if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
end
- if @opt.cmd =~/r/; op('remote_put','scp') #% -r copy to remote server
+ if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
end
- if @opt.cmd =~/R/; op('remote_put','rsync') #% -R copy to remote server
+ if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
end
if @opt.cmd =~/[QuUvVM]/; op('urls','urls') #% -Q -u -v -V -M urls
end
@@ -547,7 +502,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
require "#{SiSU_lib}/sitemaps"
SiSU_Sitemaps::Source.new(@opt).read
if @opt.cmd =~/R/
- require "#{SiSU_lib}/remote_put"
+ require "#{SiSU_lib}/remote"
SiSU_Remote::Put.new(@opt).rsync_sitemaps
end
else #% help instructions
diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb
index 194c42f9..9655afed 100644
--- a/lib/sisu/v0/param.rb
+++ b/lib/sisu/v0/param.rb
@@ -115,7 +115,7 @@ module SiSU_Param
@doc={ :lv=>[] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis
+ attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec
def initialize(fns_array,opt)
@env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil
@man_section=1
@@ -125,8 +125,11 @@ module SiSU_Param
@seg_autoname_safe=true
@markup_instruction,@markup_declared,@image='','','' #check which other values should be set to empty rather than nil
@markup=@markup_instruction #use @markup_instruction
- @flv,@lang,@seg_names,@tags,@tag_array,@tag_a=Array.new(6){[]}
- @doc,@fn,@make_italic,@make_bold,@tag_hash={},{},{},{},{},{}
+ @doc,@fn,@make_italic,@make_bold,@tag_hash,@ec={},{},{},{},{},{},{}
+ @flv,@lang,@seg_names,@tags,@tag_array,@tag_a,@ec[:image],@ec[:audio],@ec[:multimedia]=Array.new(9){[]}
+ @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/
+ @rgx_audio=/\{\s*(\S+?\.(?:mp3|ogg))/
+ @rgx_mm=/\{\s*(\S+?\.(?:ogg|mpeg))/ #expand and distinguish ogg
begin
rescue; SiSU_Errors::Info_error.new($!,$@,@cmd,@fns).error
ensure
@@ -591,7 +594,13 @@ module SiSU_Param
@seg_autoname_safe=false if m=~/^\d{1,3}/ and m !~/^0/
end
end
+ @ec[:image] << para.scan(@rgx_image).uniq if para =~@rgx_image #embedded content
+ @ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content
+ @ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content
end #% here endeth the document loop
+ @ec[:image].uniq!; @ec[:image].flatten!; @ec[:image].sort!
+ @ec[:audio].uniq!; @ec[:audio].flatten!; @ec[:audio].sort!
+ @ec[:multimedia].uniq!; @ec[:multimedia].flatten!; @ec[:multimedia].sort!
@man_name.gsub!(/(-)/,"\\\\\\1")
@man_name.gsub!(/\n/,"\n.BR\n")
@man_name.gsub!(/\A/,"\n.SH NAME\n")
diff --git a/lib/sisu/v0/remote_put.rb b/lib/sisu/v0/remote.rb
index 2e7975a3..b35f2396 100644
--- a/lib/sisu/v0/remote_put.rb
+++ b/lib/sisu/v0/remote.rb
@@ -51,10 +51,7 @@
<ralph@amissah.com>
<ralph.amissah@gmail.com>
- ** Description: remote put, copy output to remote server
- ** Note: this operation should probably be threaded & run at its own pace,
- independent of rest of program primary problem will be with notification
- of progress, implement naively to start with
+ ** Description: remote operations, get source from or copy output to remote server
=end
module SiSU_Remote
@@ -106,5 +103,68 @@ module SiSU_Remote
@remote.rsync_sitemaps
end
end
+ class Get
+ def initialize(opt,get_s)
+ @opt,@get_s=opt,get_s
+ @msg,@msgs='',nil
+ @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
+ end
+ def fns
+ require 'open-uri'
+ require 'pp'
+ require "#{SiSU_lib}/composite"
+ @rgx_image=/\{\s*(\S+?\.(?:png|jpg|gif))/
+ @rgx_skin=/(?:0~|@)skin:?\s+(\S+)/ #@rgx_skin=/^0~skin\s+(\S+)/
+ threads=[]
+ for requested_page in @get_s
+ threads << Thread.new(requested_page) do |url|
+ open(url) do |f|
+ raise "#{url} not found" unless f
+ re_fnb=/((?:https?|file):\/\/[^\/ ]+?\/[^\/ ]+?)\/\S+?\/([^\/]+?)\.ss(t)/ #revisit and remove DO
+ base_uri,fnb,instr=re_fnb.match(url)[1..3] if re_fnb
+ imagedir= base_uri + '/_sisu/image_local' #check on
+ doc_skin_dir = /((?:https?|file):\/\/\S+?)\/[^\/]+?\.sst$/.match(url).captures.join + '/_sisu/skin/doc'
+ #"Got file, and ready to process: #{fnb}.t#{instr}"
+ downloaded_file=File.new("#{fnb}.-sst",'w+')
+ images=SiSU_Assemble::Remote_image.new.image(imagedir)
+ skin=SiSU_Assemble::Remote_image.new.image(doc_skin_dir)
+ f.collect.each do |r| # work area
+ skin << r.scan(@rgx_skin).uniq if r =~@rgx_skin
+ images << r.scan(@rgx_image).uniq if r =~@rgx_image
+ downloaded_file << r
+ end
+ if skin and skin.length > 0
+ SiSU_Assemble::Remote_image.new.download_doc_skin(skin)
+ end
+ if images and images.length > 1
+ images.flatten!.uniq!
+ @msg,@msgs='downloading images:', [ images.join(',') ]
+ @tell.call.warn unless @opt.cmd =~/q/
+ SiSU_Assemble::Remote_image.new.download_images(images)
+ @msg,@msgs='downloading done',nil
+ @tell.call.warn unless @opt.cmd =~/q/
+ end
+ downloaded_file.close
+ end
+ end
+ end
+ threads.each {|thr| thr.join} if threads #and threads.length > 0
+ end
+ def sisupod
+ if @get_p.length > 0 #% remote sisupod
+ require 'net/http'
+ for requested_pod in @get_p
+ pod_info=Remote_download.new(requested_pod)
+ @opt.fns=pod_info.pod.name
+ Net::HTTP.start(pod_info.pod.site) do |http|
+ resp=http.get("#{pod_info.pod.path}/#{pod_info.pod.name_source}")
+ open(pod_info.pod.name,'wb') do |file|
+ file.write(resp.body)
+ end
+ end
+ end
+ end
+ end
+ end
end
__END__
diff --git a/lib/sisu/v0/semantics.rb b/lib/sisu/v0/semantics.rb
deleted file mode 100644
index 177a5d98..00000000
--- a/lib/sisu/v0/semantics.rb
+++ /dev/null
@@ -1,396 +0,0 @@
-=begin
-
- * Name: SiSU
-
- * Description: a framework for document structuring, publishing and search
-
- * Author: Ralph Amissah
-
- * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007 Ralph Amissah All Rights Reserved.
-
- * License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007 Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licenses/gpl.html>
- <http://www.gnu.org/copyleft/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf>
-
- * SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
- * Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
- * Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
-
- * Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
- ** Description: semantics
-
-=end
-module Semantic
- require "#{SiSU_lib}/param"
- class YamlInfoCreate
- def initialize(file='')
- @file=file
- @sisu=[]
- @@doc[:title],@@doc[:subtitle],@@doc[:creator],@@doc[:subject],@@doc[:keywords],@@doc[:description],@@doc[:publisher],@@doc[:contributor],@@doc[:date],@@doc[:date_created],@@doc[:date_issued],@@doc[:date_available],@@doc[:date_valid],@@doc[:date_modified],@@doc[:type],@@doc[:format],@@doc[:identifier],@@doc[:source],@@doc[:language],@@doc[:coverage],@@doc[:relation],@@doc[:rights]=nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil
- end
- def songsheet
- param
- yamlinfo
- end
- def param
- file_array=IO.readlines(@file,'')
- SiSU_Param(file_array,@file,'a') #problem not updated watch
- end
- def printscreen
- puts "#{@@cX.fuschia}filename:#{@@cX.off} " + @file
- puts "#{@@cX.fuschia}title:#{@@cX.off} " + @@doc[:title]
- puts "#{@@cX.fuschia}subtitle:#{@@cX.off} " + @@doc[:subtitle] if @@doc[:subtitle]
- puts "#{@@cX.fuschia}creator:#{@@cX.off} " + @@doc[:creator] if @@doc[:creator]
- puts "#{@@cX.fuschia}subject:#{@@cX.off} " + @@doc[:subject] if @@doc[:subject]
- puts "#{@@cX.fuschia}description:#{@@cX.off} " + @@doc[:description] if @@doc[:description]
- puts "#{@@cX.fuschia}publisher:#{@@cX.off} " + @@doc[:publisher] if @@doc[:publisher]
- puts "#{@@cX.fuschia}contributor:#{@@cX.off} " + @@doc[:contributor] if @@doc[:contributor]
- puts "#{@@cX.fuschia}date:#{@@cX.off} " + @@doc[:date] if @@doc[:date]
- puts "#{@@cX.fuschia}date created:#{@@cX.off} " + @@doc[:date_created] if @@doc[:date_created]
- puts "#{@@cX.fuschia}date issued:#{@@cX.off} " + @@doc[:date_issued] if @@doc[:date_issued]
- puts "#{@@cX.fuschia}date available:#{@@cX.off} " + @@doc[:date_available] if @@doc[:date_available]
- puts "#{@@cX.fuschia}date valid:#{@@cX.off} " + @@doc[:date_valid] if @@doc[:date_valid]
- puts "#{@@cX.fuschia}date modified:#{@@cX.off} " + @@doc[:date_modified] if @@doc[:date_modified]
- puts "#{@@cX.fuschia}type:#{@@cX.off} " + @@doc[:type] if @@doc[:type]
- puts "#{@@cX.fuschia}format:#{@@cX.off} " + @@doc[:format] if @@doc[:format]
- puts "#{@@cX.fuschia}identifier:#{@@cX.off} " + @@doc[:identifier] if @@doc[:identifier]
- puts "#{@@cX.fuschia}source:#{@@cX.off} " + @@doc[:source] if @@doc[:source]
- puts "#{@@cX.fuschia}language:#{@@cX.off} " + @@doc[:language] if @@doc[:language]
- puts "#{@@cX.fuschia}coverage:#{@@cX.off} " + @@doc[:coverage] if @@doc[:coverage]
- puts "#{@@cX.fuschia}relation:#{@@cX.off} " + @@doc[:relation] if @@doc[:relation]
- puts "#{@@cX.fuschia}rights:#{@@cX.off} " + @@doc[:rights] if @@doc[:rights]
- puts "#{@@cX.fuschia}keywords:#{@@cX.off} " + @@doc[:keywords] if @@doc[:keywords]
- puts '-----------------------'
- end
- def yamlinfo
- uri=case @file
- when /.+?\.[_-]?sst$/; @file.gsub(/(.+?)\.[_-]?sst$/,'http://localhost/reserved/\1/')
- end
- puts uri
- @sisu << '-'
- @sisu << ' filename: ' + uri
- @sisu << ' title: ' + @@doc[:title].gsub(/:/, ' - ') if @@doc[:title]
- @sisu << ' subtitle: ' + @@doc[:subtitle] if @@doc[:subtitle]
- @sisu << ' creator: ' + @@doc[:creator] if @@doc[:creator]
- @sisu << ' subject: ' + @@doc[:subject] if @@doc[:subject]
- @sisu << ' keywords: ' + @@doc[:keywords] if @@doc[:keywords]
- @sisu << ' description: ' + @@doc[:description] if @@doc[:description]
- @sisu << ' publisher: ' + @@doc[:publisher] if @@doc[:publisher]
- @sisu << ' contributor: ' + @@doc[:contributor] if @@doc[:contributor]
- @sisu << ' date: ' + @@doc[:date] if @@doc[:date]
- @sisu << ' date_created: ' + @@doc[:date_created] if @@doc[:date_created]
- @sisu << ' date_issued: ' + @@doc[:date_issued] if @@doc[:date_issued]
- @sisu << ' date_available: ' + @@doc[:dateavailable] if @@doc[:date_available]
- @sisu << ' date_valid: ' + @@doc[:date_valid] if @@doc[:date_valid]
- @sisu << ' date_modified: ' + @@doc[:date_modified] if @@doc[:date_modified]
- @sisu << ' type: ' + @@doc[:type] if @@doc[:type]
- @sisu << ' format: ' + @@doc[:format] if @@doc[:format]
- @sisu << ' identifier: ' + @@doc[:identifier] if @@doc[:identifier]
- @sisu << ' source: ' + @@doc[:source] if @@doc[:source]
- @sisu << ' language: ' + @@doc[:language] if @@doc[:language]
- @sisu << ' coverage: ' + @@doc[:coverage] if @@doc[:coverage]
- @sisu << ' relation: ' + @@doc[:relation] if @@doc[:relation]
- @sisu << ' rights: ' + @@doc[:rights] if @@doc[:rights]
- #@sisu << ' copyright: ' + @@doc[:copyright] if @@doc[:copyright]
- @sisu.each {|para| @@filename_semantic.puts para}
- end
- end
- class Yaml_info_read
- def initialize #(file='')
- @pwd=Dir.pwd
- @sisu=[]
- end
- def loadfile
- if FileTest.file?("#@pwd/semantic.yml")
- @yaml||=YAML::load(File::open("#@pwd/semantic.yml"))
- end
- end
- def printscreen
- @yaml.each do |y|
- puts y['title'] if y['title']
- puts y['subtitle'] if y['subtitle']
- puts y['creator'] if y['creator']
- puts y['subject'] if y['subject']
- puts y['description'] if y['description']
- puts y['publisher'] if y['publisher']
- puts y['contributor'] if y['contributor']
- puts y['date'] if y['date']
- puts y['date_created'] if y['date_created']
- puts y['date_issued'] if y['date_issued']
- puts y['date_available'] if y['date_available']
- puts y['date_valid'] if y['date_valid']
- puts y['date_modified'] if y['date_modified']
- puts y['type'] if y['type']
- puts y['format'] if y['format']
- puts y['identifier'] if y['identifier']
- puts y['source'] if y['source']
- puts y['language'] if y['language']
- puts y['coverage'] if y['coverage']
- puts y['relation'] if y['relation']
- puts y['rights'] if y['rights']
- puts y['copyright'] if y['copyright']
- puts y['keywords'] if y['keywords']
- puts '-----'
- end
- end
- end
- class RSS < Yaml_info_read
- def songsheet
- loadfile
- rss_nav
- debris
- end
- def rss(match=//,feedtitle='')
- @sisu=[]
- @sisu << %{<rss version="2.0">\n-\n <channel><title>#{feedtitle}</title>
-<link>http://www.jus.uio.no/lm/</link>
-<description>Semantic Information Structuring Unit</description>
-<language>en-us</language>
--
-}
- @yaml.each do |y|
- if y['title'] and ((y['subject'] and "#{y['subject']}"[match]) or (y['keywords'] and "#{y['keywords']}"[match]))
- puts y['subject']
- @sisu << %{-
- <item>
- <title>#{y['title']}</title>
- -
- <guid>
- #{y['filename']}
- </guid>
- -
- }
- @sisu << %{<description>}
- @sisu << %{<h1 id="#{y['title'].gsub(/\s+/, '-')}">#{y['title']}</h1>}
- @sisu << %{#{y['title']} } if y['title']
- @sisu << %{#{y['subtitle']} } if y['subtitle']
- @sisu << %{#{y['creator'] }} if y['creator']
- #@sisu << %{#{y['subject']}} if y['subject']
- @sisu << %{#{y['description'] }} if y['description']
- #@sisu << %{#{y['publisher']}} if y['publisher']
- #@sisu << %{#{y['contributor']}} if y['contributor']
- @sisu << %{#{y['date']} } if y['date']
- #@sisu << %{#{y['date_created']}} if y['date_created']
- #@sisu << %{#{y['date_issued']}} if y['date_issued']
- #@sisu << %{#{y['date_available']}} if y['date_available']
- #@sisu << %{#{y['date_valid']}} if y['date_valid']
- #@sisu << %{#{y['date_modified']}} if y['date_modified']
- #@sisu << %{#{y['type']}} if y['type']
- #@sisu << %{#{y['format']}} if y['format']
- #@sisu << %{#{y['identifier']}} if y['identifier']
- #@sisu << %{#{y['source']}} if y['source']
- #@sisu << %{#{y['language']}} if y['language']
- #@sisu << %{#{y['coverage']}} if y['coverage']
- #@sisu << %{#{y['relation']}} if y['relation']
- #@sisu << %{#{y['rights']}} if y['rights']
- #@sisu << %{#{y['copyright']}} if y['copyright']
- #@sisu << %{#{y['keyword']}} if y['keyword']
- @sisu << %{</description>}
- @sisu << %{</item>}
- end
- end
- @sisu << %{</channel>\n</rss>}
- #@sisu.each {|para| @@rss.puts para} #KEEP does all
- if "united nations"[match]
- @sisu.each {|para| @@rss_un.puts para}
- @sisu=[]
- end
- if "unidroit"[match]
- @sisu.each {|para| @@rss_unidroit.puts para}
- @sisu=[]
- end
- if "hcpil"[match]
- @sisu.each {|para| @@rss_hcpil.puts para}
- @sisu=[]
- end
- if "contract"[match]
- @sisu.each {|para| @@rss_contracts.puts para}
- @sisu=[]
- end
- if "navigate"[match]
- @sisu.each {|para| @@rss_nav.puts para}
- @sisu=[]
- end
- end
- def rss_un
- match=/united\s+nations|uncitral/i
- rss(match, 'Lex Mercatoria Pages on the United Nations')
- end
- def rss_unidroit
- match=/unidroit/i
- rss(match, 'Lex Mercatoria pages on UNIDROIT')
- end
- def rss_hcpil
- match=/hague\s+conference|hcpil/i
- rss(match, 'Lex Mercatoria pages on the Hague Conference on Private International Law')
- end
- def rss_contracts
- match=/contracts?/i
- rss(match, 'Lex Mercatoria Contract Law pages')
- end
- def rss_nav
- match=/navigate(\s|$)/i
- rss(match, 'Lex Mercatoria Navigation pages')
- end
- def dummy
- @sisu << %{<doc>}
- @yaml.each do |y|
- @sisu << %{<content>}
- @sisu << %{#{y['title']}} if y['title']
- @sisu << %{#{y['subtitle']}} if y['subtitle']
- @sisu << %{#{y['creator']}} if y['creator']
- @sisu << %{#{y['subject']}} if y['subject']
- @sisu << %{#{y['description']}} if y['description']
- @sisu << %{#{y['publisher']}} if y['publisher']
- @sisu << %{#{y['contributor']}} if y['contributor']
- @sisu << %{#{y['date']}} if y['date']
- @sisu << %{#{y['date_created']}} if y['date_created']
- @sisu << %{#{y['date_issued']}} if y['date_issued']
- @sisu << %{#{y['date_available']}} if y['date_available']
- @sisu << %{#{y['date_valid']}} if y['date_valid']
- @sisu << %{#{y['date_modified']}} if y['date_modified']
- @sisu << %{#{y['type']}} if y['type']
- @sisu << %{#{y['format']}} if y['format']
- @sisu << %{#{y['identifier']}} if y['identifier']
- @sisu << %{#{y['source']}} if y['source']
- @sisu << %{#{y['language']}} if y['language']
- @sisu << %{#{y['coverage']}} if y['coverage']
- @sisu << %{#{y['relation']}} if y['relation']
- @sisu << %{#{y['rights']}} if y['rights']
- @sisu << %{#{y['copyright']}} if y['copyright']
- @sisu << %{#{y['keyword']}} if y['keyword']
- @sisu << %{</content>}
- end
- @sisu << %{</doc>}
- @sisu.each {|para| @@rss.puts para}
- end
- def debris
- outputdir=SiSU_Env::Info_env.new.path.feed
- x=Dir.new(outputdir).entries
- x.each do |y|
- #unless FileTest.file?("#{outputdir}/#{y}") and File.size?("#{outputdir}/#{y}") == 0
- if File.size("#{outputdir}/#{y}") == 0
- #File.unlink("#{outputdir}/#{y}")
- puts "#{outputdir}/#{y}"
- puts File.size("#{outputdir}/#{y}")
- end
- end
- end
- end
- class RDF < Yaml_info_read
- def songsheet
- loadfile
- rdf
- rdf_un
- rdf_unidroit
- rdf_hcpil
- rdf_contracts
- rdf_nav
- debris
- end
- def rdf
- end
- def rdf_un
- end
- def rdf_unidroit
- end
- def rdf_hcpil
- end
- def rdf_contracts
- end
- def rdf_nav
- end
- def debris
- end
- end
-end
- #% start
-require "#{SiSU_lib}/param"
-require "#{SiSU_lib}/defaults"
-require "#{SiSU_lib}/sysenv"
-include SiSU_Param
-include SiSU_Env
-include SiSU_Viz
-outputdir=SiSU_Env::Info_env.new.path.feed
-pwd=Dir.pwd
-@argv=[]
-argv=$*
-#p argv
-my_make=SiSU_Env::Create_file.new('','')
-if argv.to_s =~/yaml/
- my_make.file_semantic
- files=Dir["*.sst,*._sst,*-sst"]
- end
- files.each {|f| @argv << f[/(.+?)\.[_-]?sst$/,1] if f =~/.+?\.[_-]?sst$/}
- #########
- files.each do |filename|
- Semantic::YamlInfoCreate.new(filename).songsheet
- end
-elsif argv.to_s =~/rss/
- #rss=%{#{outputdir}/semantic.xml}
- #@@rss=File.new(rss, "w+")
- rss_nav=%{#{outputdir}/navigate.xml}
- @@rss_nav=File.new(rss_nav, "w+")
- #
- #rss_un=%{#{outputdir}/un.xml}
- #@@rss_un=File.new(rss_un, "w+")
- #rss_unidroit=%{#{outputdir}/unidroit.xml}
- #@@rss_unidroit=File.new(rss_unidroit, "w+")
- #rss_hcpil=%{#{outputdir}/hcpil.xml}
- #@@rss_hcpil=File.new(rss_hcpil, "w+")
- #rss_contracts=%{#{outputdir}/contracts.xml}
- #@@rss_contracts=File.new(rss_contracts, "w+")
- ##my_make.file_rss
- Semantic::RSS.new.songsheet
-elsif argv.to_s =~/rdf/
- #rdf=%{#{outputdir}/semantic.rdf}
- #@@rdf=File.new(rdf, "w+")
- #rdf_un=%{#{outputdir}/un.rdf}
- #@@rdf_un=File.new(rdf_un, "w+")
- #rdf_unidroit=%{#{outputdir}/unidroit.rdf}
- #@@rdf_unidroit=File.new(rdf_unidroit, "w+")
- #rdf_hcpil=%{#{outputdir}/hcpil.rdf}
- #@@rdf_hcpil=File.new(rdf_hcpil, "w+")
- #rdf_contracts=%{#{outputdir}/contracts.rdf}
- #@@rdf_contracts=File.new(rdf_contracts, "w+")
- #rdf_nav=%{#{outputdir}/navigate.rdf}
- #@@rdf_nav=File.new(rdf_nav, "w+")
- ##my_make.file_rdf
- #Semantic::RDF.new.songsheet
-end
-__END__
-