From 2ec7a07f1a896a666fea65c109d0e344e0600651 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:12:09 -0400 Subject: v3: correct sisupod references and path to .txz (replace .zip) --- lib/sisu/v3/param.rb | 4 +--- lib/sisu/v3/sysenv.rb | 14 +++++++------- lib/sisu/v3/urls.rb | 8 ++++---- 3 files changed, 12 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 1be55583..f9d7ecb0 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -989,13 +989,11 @@ module SiSU_Param m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] @flv=@env.document_language_versions_found[:f] - #@fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.zip') : (@fnn + '.sst.zip') else m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss - #m=/((.+?)(?:\~\w{2,5})?)\.((?:-|ssm\.)?sst|ssm)$/ #watch added match for sss @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3] @flv=@env.document_language_versions_found[:f] - @fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.zip') : (@fnn + '.sst.zip') + @fnz=(@fns =~/\.(?:ssm\.sst|ssm)$/) ? (@fnn + '.ssm.txz') : (@fnn + '.sst.txz') end @papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general @sfx_src=@fns[m,2] diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 475a8369..a24937d2 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -381,9 +381,9 @@ module SiSU_Env @@fnb ||=@fns[m,2] @@fnt ||=@fns[m,3] @@flv ||=document_language_versions_found[:f] - unless @@fns =~/\S+?\.zip/ - @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' - elsif @@fnb; @@fnb + '.sst.zip' + unless @@fns =~/\S+?\.txz/ + @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.txz' + elsif @@fnb; @@fnb + '.sst.txz' else '' # e.g. termsheet end end @@ -2731,7 +2731,7 @@ WOK def src # consider if @opt.fnb \ and not @opt.fnb.empty? - sm="#{@env.path.output}/pod/#{@opt.fns}.zip" + sm="#{@env.path.output}/src/pod/#{@opt.fns}.txz" rm(sm) if FileTest.file?(sm) sm="#{@env.path.output}/src/#{@opt.fns}" rm(sm) if FileTest.file?(sm) @@ -2853,7 +2853,7 @@ WOK remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') + src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.txz') if (local_gen =~/\S/ \ and local_gen !~/\/\//) \ and (remote_gen =~/\S/ \ @@ -2876,7 +2876,7 @@ WOK if FileTest.file?("#{local_src}/#{src_doc}") puts "#{local_src}/#{src_doc}* -> #{remote_src}" end - if FileTest.file?("#{local_pod}/#{src_doc}.zip") + if FileTest.file?("#{local_pod}/#{src_doc}.txz") puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" end else @@ -3051,7 +3051,7 @@ WOK puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "#{local_gen} -> #{remote_gen}" if FileTest.file?("#{local_src}/#{src_doc}") \ - or FileTest.file?("#{local_src}/#{src_doc}.zip") + or FileTest.file?("#{local_src}/#{src_doc}.txz") puts "#{local_src}/#{src_doc}* -> #{remote_src}" end else diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index cbb11ba5..a6612175 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -134,7 +134,7 @@ module SiSU_urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.text_editor} #{@md.file.output_path.src.dir}/#{y}").result end def pod(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/pod/#{y}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} #{@env.url.output_tell}/src/pod/#{y}").result end self end @@ -347,9 +347,9 @@ module SiSU_urls end if x=~/^S/ \ and @opt.cmd =~/S/ - zipfile=if @opt.fns =~/\.ssm\.sst$/; y.gsub(/(?:\~\S{2,3})?(\.ssm\.sst\.zip)$/,'.ssm.zip') - else y.gsub(/(?:\~\S{2,3})?(\.sst\.zip)$/,'\1') - end + (@opt.fns =~/\.ssm\.sst$/) \ + ? y.gsub(/(?:\~\S{2,3})?(\.ssm.sst\.txz)$/,'.ssm.txz') + : y.gsub(/(?:\~\S{2,3})?(\.sst\.txz)$/,'\1') show.source.pod(x,y) end if x=~/^s/ \ -- cgit v1.2.3 From 65e4c0633003a9e3ddbe0aab11909232b61bbdc8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:14:06 -0400 Subject: v3: options, match fix for --glob / --find --- lib/sisu/v3/options.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index ac31a896..dbfe5d79 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -116,7 +116,7 @@ module SiSU_commandline end end def sisu_glob_rules(a) - a=if a.inspect =~/"-\S*[fG]/ \ + a=if a.inspect =~/"-[A-Za-z0-9]*[fG]/ \ or a.inspect =~/"--find"|"--glob"/ b,f=[],[] find_flag=false @@ -138,11 +138,9 @@ module SiSU_commandline r.gsub!(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} z=if find_flag - if f.length > 0 - b + find_select(find_flag,f) - else - find_all(find_flag,b) - end + (f.length > 0) \ + ? (b + find_select(find_flag,f)) + : find_all(find_flag,b) elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ -- cgit v1.2.3 From af7543c058995af80e25f2f71be3a12699e26564 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:15:22 -0400 Subject: v3: options, (hub), action (opt.act) modified to increase use possibilities --- lib/sisu/v3/hub.rb | 92 ++++++------- lib/sisu/v3/options.rb | 347 ++++++++++++++++++++++--------------------------- 2 files changed, 204 insertions(+), 235 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 029c2861..5319bfdc 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -104,7 +104,6 @@ module SiSU @opt.files.each_with_index do |fns,i| env=SiSU_Env::Info_env.new(fns) if fns =~ /sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz|\.ssp)$/ -# env=SiSU_Env::Info_env.new(fns) require_relative 'remote' # remote.rb #check pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.txz|\.ssp)$/ SiSU_Remote::Remote_download.new(fns).pod.name @@ -305,28 +304,29 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.cmd =~/E/ # re-assign character require 'profile' end - if @opt.act[:harvest] - require_relative 'harvest' # harvest.rb - SiSU_Harvest::Source.new(@opt).read # -h -H html.rb + if @opt.act[:harvest][:bool] + require_relative 'harvest' # harvest.rb + SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ - require_relative 'sst_convert_markup' # sst_convert_markup.rb + require_relative 'sst_convert_markup' # sst_convert_markup.rb elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX flag=SiSU_Env::Info_processing_flag.new - if @opt.cmd =~/[vVM]/ #% version information + if @opt.cmd =~/[vVM]/ #% version information if @opt.cmd =~/V/ \ - and @opt.files.empty? #% environment + and @opt.files.empty? #% environment SiSU_Help::Help.new('env',@opt).environment else SiSU_Help::Help.new('env',@opt).sisu_version end end - if @opt.act[:license] #% license information + if @opt.act[:license][:bool] #% license information SiSU_Help::Help.new('license',@opt).help_request end - if @opt.act[:dal] or @opt.act[:maintenance] #% --maintenance, -m for -C + if @opt.act[:dal][:bool] \ + or @opt.act[:maintenance][:bool] #% --maintenance, -m for -C path={} path[:css]=@@env.path.output + '/_sisu/css' path[:xml]=@@env.path.output + '/_sisu/xml' @@ -344,7 +344,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end end - if @opt.act[:site_init] #% --init-site, -C initialize/configure + if @opt.act[:site_init][:bool] #% --init-site, -C initialize/configure op('conf','configure site') if @opt.cmd =~/R/ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \ @@ -360,19 +360,19 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end end end - if @opt.act[:sample_search_form] #% --sample-search-form, -F cgi sample search form + if @opt.act[:sample_search_form][:bool] #% --sample-search-form, -F cgi sample search form Operations.new(@opt).cgi end - if @opt.act[:webrick] #% --webrick, -W webrick + if @opt.act[:webrick][:bool] #% --webrick, -W webrick Operations.new(@opt).webrick end - if @opt.cmd =~/Z/ #% -Z wipe previous output clean + if @opt.cmd =~/Z/ #% -Z wipe previous output clean op('zap','Zap, deletions') end - if @opt.act[:share_source] + if @opt.act[:share_source][:bool] op('share_src','SiSU markup source') end - if @opt.act[:dal] + if @opt.act[:dal][:bool] @retry_count= -1 begin path_image='./_sisu/processing/external_document/image' @@ -397,8 +397,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ SiSU_Remote::Get.new(@opt,@get_s).fns Operations.new.counter end - if @get_p.length > 0 #% remote sisupod - require_relative 'remote' # remote.rb + if @get_p.length > 0 #% remote sisupod + require_relative 'remote' # remote.rb SiSU_Remote::Get.new(@opt,@get_p).sisupod end rescue @@ -409,60 +409,60 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end @opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') } end - if @opt.act[:dal] #%--dal, -m + if @opt.act[:dal][:bool] #%--dal, -m op('dal','dal') end @opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') } - if @opt.act[:sisupod] #% --sisupod, -S make sisupod + if @opt.act[:sisupod][:bool] #% --sisupod, -S make sisupod op('sisupod_make','sisupod (txz)') if @opt.fns=~/\.kdi._sst/ - op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source + op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source end end - if @opt.act[:qrcode] #% --qrcode, -Q + if @opt.act[:qrcode][:bool] #% --qrcode, -Q op('qrcode','QRcode') end - if @opt.act[:hash_digests] #% --hash-digests, -N digest tree + if @opt.act[:hash_digests][:bool] #% --hash-digests, -N digest tree op('digests','digests') end - if @opt.act[:html] #% --html, -h + if @opt.act[:html][:bool] #% --html, -h op('html','html') end - if @opt.act[:txt] #% --txt, -t -a + if @opt.act[:txt][:bool] #% --txt, -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file op('plaintext','plaintext') end - if @opt.act[:epub] #% --epub, -e + if @opt.act[:epub][:bool] #% --epub, -e op('epub','ePub') end - if @opt.act[:odt] #% --odt, -o opendocument + if @opt.act[:odt][:bool] #% --odt, -o opendocument op('odf','OpenDocument') end - if @opt.act[:xml_sax] #% --xml-sax, -x xml sax type + if @opt.act[:xml_sax][:bool] #% --xml-sax, -x xml sax type op('xml','xml sax') end - if @opt.act[:xml_dom] #% --xml-dom, -x xml dom type + if @opt.act[:xml_dom][:bool] #% --xml-dom, -x xml dom type op('xml_dom','xml dom') end - #if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml + #if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml # op('xml_fictionbook','xml fictionbook') #end - if @opt.act[:xhtml] #% --xhtml, -b xhtml + if @opt.act[:xhtml][:bool] #% --xhtml, -b xhtml op('xhtml','xhtml sax') end - if @opt.act[:concordance] #% --concordance, -w + if @opt.act[:concordance][:bool] #% --concordance, -w op('concordance','Concordance') end - if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting + if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting op('xml_md_oai_pmh_dc','OAI PMH') end - if @opt.act[:po4a] #% --po4a, -P + if @opt.act[:po4a][:bool] #% --po4a, -P op('po4a','po4a') end - if @opt.act[:git] #% --git, -g sisu git + if @opt.act[:git][:bool] #% --git, -g sisu git op('git','SiSU Git') end - if @opt.cmd =~/T/ #% -T termsheet/standard form + if @opt.cmd =~/T/ #% -T termsheet/standard form SiSU_Help::Help.new('termsheet').help_request @opt.files.each do |fns| if FileTest.file?(fns) @@ -476,38 +476,38 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end Operations.new.counter end - if @opt.cmd =~/k/ #% -T temporary tests + if @opt.cmd =~/k/ #% -T temporary tests op('xml_scaffold','XML scaffold') end - if @opt.act[:pdf] #% --pdf, -p latex/ texpdf + if @opt.act[:pdf][:bool] #% --pdf, -p latex/ texpdf op('texpdf','LaTeX pdf') end - if @opt.act[:manpage] #% --manpage, -i + if @opt.act[:manpage][:bool] #% --manpage, -i op('manpage','manpage') end - if @opt.act[:texinfo] #% --texinfo, -I + if @opt.act[:texinfo][:bool] #% --texinfo, -I op('texinfo','TeX Info') end - if @opt.act[:psql] #% --pg, -D DB postgresql + if @opt.act[:psql][:bool] #% --pg, -D DB postgresql op('dbi','postgresql') end - if @opt.act[:sqlite] #% --sqlite, -d DB sqlite + if @opt.act[:sqlite][:bool] #% --sqlite, -d DB sqlite op('dbi','sqlite') end - if @opt.act[:dal] #% --dal, -m embedded content + if @opt.act[:dal][:bool] #% --dal, -m embedded content op('embedded','Embedded Content') end - if @opt.act[:manifest] #% --manifest, -y + if @opt.act[:manifest][:bool] #% --manifest, -y op('manifest','Manifest') end - if @opt.act[:sitemap] #% --sitemap, -Y + if @opt.act[:sitemap][:bool] #% --sitemap, -Y op('sitemaps','Sitemap') end if @opt.mod.inspect !~/--harvest/ - if @opt.act[:scp] #% -r copy to remote server + if @opt.act[:scp][:bool] #% -r copy to remote server op('remote','scp') end - if @opt.act[:rsync] #% -R copy to remote server + if @opt.act[:rsync][:bool] #% -R copy to remote server op('remote','rsync') end else diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index dbfe5d79..66866dc3 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -375,204 +375,173 @@ module SiSU_commandline def opt_act #note mod line commands have already been converted to command characters, cmd cmd,mod=@cmd,@mod act={} - act[:license]=if cmd =~/L/ \ - or mod.inspect =~/"--license/ - true - else false - end - act[:site_init]=if cmd =~/C/ \ - or mod.inspect =~/"--init-site/ - true - else false - end - act[:verbose]=if cmd =~/v/ \ - or mod.inspect =~/"--verbose"/ - true - else false - end - act[:quiet]=if cmd =~/q/ \ - or mod.inspect =~/"--quiet"/ - true - else false - end + act[:license]=(cmd =~/L/ \ + || mod.inspect =~/"--license/) \ + ? { bool: true } + : { bool: false } + act[:site_init]=(cmd =~/C/ \ + || mod.inspect =~/"--init-site/) \ + ? { bool: true } + : { bool: false } + act[:rc]=if mod.inspect =~/"--rc=/ + x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') + { bool: true, inst: x } + else + { bool: false, inst: '' } + end + act[:verbose]=(cmd =~/v/ \ + || mod.inspect =~/"--verbose"/) \ + ? { bool: true } + : { bool: false } + act[:quiet]=(cmd =~/q/ \ + || mod.inspect =~/"--quiet"/) \ + ? { bool: true } + : { bool: false } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - true + { bool: true } elsif mod.inspect =~/"--color-off"/ - true - else true #fix default color + { bool: false } + else { bool: true } #fix default color end # act[:color_toggle]=if cmd =~/c/ \ # or mod.inspect =~/"--color-toggle"/ # true # else false # end - act[:maintenance]=if cmd =~/M/ \ - or mod.inspect =~/"--maintenance|--keep-processing-files"/ - true - else false - end + act[:maintenance]=(cmd =~/M/ \ + || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ + ? { bool: true } + : { bool: false } act[:ocn]=if mod.inspect =~/"--no-ocn"/ - false - else true - end - act[:dal]=if cmd =~/m/ \ - or mod.inspect =~/"--dal"/ - true - else false - end - act[:html]=if cmd =~/h/ \ - or mod.inspect =~/"--html"/ - true - else false - end - act[:concordance]=if cmd =~/w/ \ - or mod.inspect =~/"--concordance"/ - true - else false - end - act[:pdf]=if cmd =~/p/ \ - or mod.inspect =~/"--pdf"/ - true - else false - end - act[:epub]=if cmd =~/e/ \ - or mod.inspect =~/"--epub"/ - true - else false - end - act[:odt]=if cmd =~/o/ \ - or mod.inspect =~/"--odf"/ - true - else false - end - act[:xml_sax]=if cmd =~/x/ \ - or mod.inspect =~/"--xml-sax"/ - true - else false - end - act[:xml_dom]=if cmd =~/X/ \ - or mod.inspect =~/"--xml-dom"/ - true - else false - end - act[:xhtml]=if cmd =~/b/ \ - or mod.inspect =~/"--xhtml"/ - true - else false - end - act[:txt]=if cmd =~/[at]/ \ - or mod.inspect =~/"--txt"/ - true - else false - end - act[:manpage]=if cmd =~/i/ \ - or mod.inspect =~/"--manpage"/ - true - else false - end - act[:texinfo]=if cmd =~/I/ \ - or mod.inspect =~/"--texinfo"/ - true - else false - end - act[:fictionbook]=if cmd =~/f/ \ - or mod.inspect =~/"--fictionbook"/ - true - else false - end - act[:psql]=if cmd =~/D/ \ - or mod.inspect =~/"--pg"|"--pgsql"/ - true - else false - end - act[:sqlite]=if cmd =~/d/ \ - or mod.inspect =~/"--sqlite"/ - true - else false - end - act[:harvest]=if mod.inspect =~/"--harvest"/ - true - else false - end - act[:po4a]=if cmd =~/P/ \ - or mod.inspect =~/"--po4a"|"--pot?"/ - true - else false - end - act[:git]=if cmd =~/g/ \ - or mod.inspect =~/"--git"/ - true - else false - end - act[:hash_digests]=if cmd =~/N/ \ - or mod.inspect =~/"--hash-digests"/ - true - else false - end - act[:sample_search_form]=if cmd =~/F/ \ - or mod.inspect =~/"--sample-search-form"/ - true - else false - end - act[:webrick]=if cmd =~/W/ \ - or mod.inspect =~/"--webrick"/ - true - else false - end - act[:share_source]=if cmd =~/s/ \ - or mod.inspect =~/"--source"/ - true - else false - end - act[:sisupod]=if cmd =~/S/ \ - or mod.inspect =~/"--sisupod"/ - true - else false - end - act[:scp]=if cmd =~/r/ \ - or mod.inspect =~/"--scp"/ - true - else false - end - act[:rsync]=if cmd =~/R/ \ - or mod.inspect =~/"--rsync"/ - true - else false - end - act[:delete_output]=if cmd =~/z/ \ - or mod.inspect =~/"--delete"|"--zap"/ - true - else false - end - act[:urls_all]=if cmd =~/U/ \ - or mod.inspect =~/"--urls-all"/ - true - else false - end - act[:urls_seleted]=if cmd =~/u/ \ - or mod.inspect =~/"--urls"/ - true - else false - end - act[:sitemap]=if cmd =~/Y/ \ - or mod.inspect =~/"--sitemap"/ - true - else false - end - act[:qrcode]=if cmd =~/Q/ \ - or mod.inspect =~/"--qrcode"/ - true - else false - end - act[:manifest]=if cmd =~/y/ \ - or mod.inspect =~/"--manifest"/ - true - else false - end - act[:help]=if mod.inspect =~/"--help/ - true - else false - end + { bool: false } + else { bool: true } + end + act[:dal]=(cmd =~/m/ \ + || mod.inspect =~/"--dal"/) \ + ? { bool: true } + : { bool: false } + act[:html]=(cmd =~/h/ \ + || mod.inspect =~/"--html"/) \ + ? { bool: true } + : { bool: false } + act[:concordance]=(cmd =~/w/ \ + || mod.inspect =~/"--concordance"/) \ + ? { bool: true } + : { bool: false } + act[:pdf]=(cmd =~/p/ \ + || mod.inspect =~/"--pdf"/) \ + ? { bool: true } + : { bool: false } + act[:epub]=(cmd =~/e/ \ + || mod.inspect =~/"--epub"/) \ + ? { bool: true } + : { bool: false } + act[:odt]=(cmd =~/o/ \ + || mod.inspect =~/"--odf"/) \ + ? { bool: true } + : { bool: false } + act[:xml_sax]=(cmd =~/x/ \ + || mod.inspect =~/"--xml-sax"/) \ + ? { bool: true } + : { bool: false } + act[:xml_dom]=(cmd =~/X/ \ + || mod.inspect =~/"--xml-dom"/) \ + ? { bool: true } + : { bool: false } + act[:xhtml]=(cmd =~/b/ \ + || mod.inspect =~/"--xhtml"/) \ + ? { bool: true } + : { bool: false } + act[:txt]=(cmd =~/[at]/ \ + || mod.inspect =~/"--txt"/) \ + ? { bool: true } + : { bool: false } + act[:manpage]=(cmd =~/i/ \ + || mod.inspect =~/"--manpage"/) \ + ? { bool: true } + : { bool: false } + act[:texinfo]=(cmd =~/I/ \ + || mod.inspect =~/"--texinfo"/) \ + ? { bool: true } + : { bool: false } + act[:fictionbook]=(cmd =~/f/ \ + || mod.inspect =~/"--fictionbook"/) \ + ? { bool: true } + : { bool: false } + act[:psql]=(cmd =~/D/ \ + || mod.inspect =~/"--pg"|"--pgsql"/) \ + ? { bool: true } + : { bool: false } + act[:sqlite]=(cmd =~/d/ \ + || mod.inspect =~/"--sqlite"/) \ + ? { bool: true } + : { bool: false } + act[:harvest]=(mod.inspect =~/"--harvest"/) \ + ? { bool: true } + : { bool: false } + act[:po4a]=(cmd =~/P/ \ + || mod.inspect =~/"--po4a"|"--pot?"/) \ + ? { bool: true } + : { bool: false } + act[:git]=(cmd =~/g/ \ + || mod.inspect =~/"--git"/) \ + ? { bool: true } + : { bool: false } + act[:hash_digests]=(cmd =~/N/ \ + || mod.inspect =~/"--hash-digests"/) \ + ? { bool: true } + : { bool: false } + act[:sample_search_form]=(cmd =~/F/ \ + || mod.inspect =~/"--sample-search-form"/) \ + ? { bool: true } + : { bool: false } + act[:webrick]=(cmd =~/W/ \ + || mod.inspect =~/"--webrick"/) \ + ? { bool: true } + : { bool: false } + act[:share_source]=(cmd =~/s/ \ + || mod.inspect =~/"--source"/) \ + ? { bool: true } + : { bool: false } + act[:sisupod]=(cmd =~/S/ \ + || mod.inspect =~/"--sisupod"/) \ + ? { bool: true } + : { bool: false } + act[:scp]=(cmd =~/r/ \ + || mod.inspect =~/"--scp"/) \ + ? { bool: true } + : { bool: false } + act[:rsync]=(cmd =~/R/ \ + || mod.inspect =~/"--rsync"/) \ + ? { bool: true } + : { bool: false } + act[:delete_output]=(cmd =~/z/ \ + || mod.inspect =~/"--delete"|"--zap"/) \ + ? { bool: true } + : { bool: false } + act[:urls_all]=(cmd =~/U/ \ + || mod.inspect =~/"--urls-all"/) \ + ? { bool: true } + : { bool: false } + act[:urls_seleted]=(cmd =~/u/ \ + || mod.inspect =~/"--urls"/) \ + ? { bool: true } + : { bool: false } + act[:sitemap]=(cmd =~/Y/ \ + || mod.inspect =~/"--sitemap"/) \ + ? { bool: true } + : { bool: false } + act[:qrcode]=(cmd =~/Q/ \ + || mod.inspect =~/"--qrcode"/) \ + ? { bool: true } + : { bool: false } + act[:manifest]=(cmd =~/y/ \ + || mod.inspect =~/"--manifest"/) \ + ? { bool: true } + : { bool: false } + act[:help]=(mod.inspect =~/"--help/) \ + ? { bool: true } + : { bool: false } @act=act end def cmd -- cgit v1.2.3 From 705ccf77b4b61dca16137ada741d1765a52ca573 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:16:23 -0400 Subject: v3: hub (affecting options +others) sisupod processing (v2 enabled) --- lib/sisu/v3/hub.rb | 84 +++++++++++++++++++++++++++++++++++++++++++------- lib/sisu/v3/options.rb | 4 +-- lib/sisu/v3/remote.rb | 4 +-- lib/sisu/v3/sysenv.rb | 34 +++++++++++--------- 4 files changed, 97 insertions(+), 29 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 5319bfdc..088fb309 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -68,7 +68,7 @@ module SiSU @opt,@req,@message=opt,req,message @n_do=0 end - def pod_output(fns_pod) + def pod3_output(fns_pod) dir_pwd=@@env.path.pwd dir_pod=@@env.sisupod_gen_v3(fns_pod) Dir.chdir("#{dir_pod}/doc") @@ -95,6 +95,33 @@ module SiSU @pwd=`pwd`.strip Dir.chdir(@pwd) end + def pod2_output(fns_pod) + dir_pwd=@@env.path.pwd + dir_pod=@@env.sisupod_gen_v2(fns_pod) + Dir.chdir(dir_pod) + system("ls") + files=Dir['*.ss[tm]'] + files_ssm=Dir['*.ssm'] + files_sst=Dir['*.sst'] + content=if files_ssm.length > 0 + files_ssm.join(' ') + elsif files_sst.length > 0 + files_sst.join(' ') + else + p 'no files found' + end + @opt.fns=content + if FileTest.directory?(dir_pod) + Dir.chdir(dir_pod) + system(" + sisu3 -CC #{@opt.cmd} #{@opt.mod.join(' ')} #{content} + #sisu3 -CC #{@opt.cmd} -G #{@opt.mod.join(' ')} #{content} + ") + Dir.chdir(dir_pwd) + end + @pwd=`pwd`.strip + Dir.chdir(@pwd) + end def select require_relative @req if @req =~/^conf$/ # -C @@ -113,7 +140,19 @@ module SiSU end SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ @opt.files.shift - pod_output(pod_name) + pod3_output(pod_name) + break + elsif fns =~ /sisupod(?:\.zip)?|\S+?(?:\.ss[mt]\.zip|\.ssp)$/ + require_relative 'remote' # remote.rb #check + pod_name=if fns =~ /http:\/\/\S+?(?:\.ss[mt]\.zip|\.ssp)$/ + SiSU_Remote::Remote_download.new(fns).pod.name + else + re_p=/(\S+?\.ss[mt](?:\.zip)?)$/ + re_p.match(fns).captures.join + end + SiSU_Screen::Ansi.new(@opt.cmd,pod_name).puts_blue unless @opt.cmd =~/q/ + @opt.files.shift + pod2_output(pod_name) break else put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') @@ -333,8 +372,18 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path[:xsd]=path[:xml] + '/xsd' path[:xsd]=path[:xml] + '/rnc' path[:xsd]=path[:xml] + '/rng' - re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/ - unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line + re_p3=/(sisupod(?:\.txz)?|\S+?\.ss[mt]\.txz|[^\/]+?\.ssp)$/ + unless @opt.files.join(',') =~ re_p3 #do not mix pods with source markup files in command line + unless ( FileTest.directory?(path[:css]) \ + and FileTest.directory?(path[:xsd]) ) + @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX + end + if @opt.cmd =~/M/ + $VERBOSE=false #debug $VERBOSE=true + end + end + re_p2=/(sisupod(?:\.zip)?|\S+?\.ss[mt]\.zip)$/ + unless @opt.files.join(',') =~ re_p2 #do not mix pods with source markup files in command line unless ( FileTest.directory?(path[:css]) \ and FileTest.directory?(path[:xsd]) ) @opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX @@ -379,17 +428,30 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path_skin='./_sisu/processing/external_document/skin/doc' @get_s,@get_p,@get_pl=[],[],[] re_s=/((?:https?|file):\/\/\S+?\.sst)$/ - re_p=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ - re_pl=/^(\/\S+?\.ss[mt]\.txz)/ + re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ + re_pl3=/^(\/\S+?\.ss[mt]\.txz)/ + @opt.files.each do |fns| + if fns =~re_s + @get_s << re_s.match(fns)[1] if re_s + end + if fns =~re_p3 + @get_p << re_p3.match(fns)[1] if re_p3 + end + if fns =~re_pl3 + @get_pl << re_pl3.match(fns)[1] if re_p3 + end + end + re_p2=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/ + re_pl2=/^(\/\S+?\.ss[mt]\.zip)/ @opt.files.each do |fns| if fns =~re_s @get_s << re_s.match(fns)[1] if re_s end - if fns =~re_p - @get_p << re_p.match(fns)[1] if re_p + if fns =~re_p2 + @get_p << re_p2.match(fns)[1] if re_p2 end - if fns =~re_pl - @get_pl << re_pl.match(fns)[1] if re_p + if fns =~re_pl2 + @get_pl << re_pl2.match(fns)[1] if re_p2 end end if @get_s.length > 0 #% remote markup file .sst @@ -555,7 +617,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ @opt.files.each do |fns| if FileTest.file?(fns) @opt.fns=fns - unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\S+?\.ssp)$/ + unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)?|\S+?\.ssp)$/ if @opt.cmd.inspect=~/-P/ elsif @opt.fns=~/\.kdi$/ \ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/ diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 66866dc3..eeca31ec 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -201,9 +201,9 @@ module SiSU_commandline if x =~/^--\S+/ m << x end - elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.txz|sisupod(\.txz)?)$/ + elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ if x =~/^(?:https?|file):\/\/\S+/ \ - or x =~/\S+?\.ss[mt]\.txz|sisupod\.txz/ \ + or x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ \ && FileTest.file?(x) x=x.gsub(/^file:\/\//,'') f << x diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index bda7529b..1e974f9c 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -180,8 +180,8 @@ module SiSU_Remote @requested_file=requested_file end def pod - re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod(?:\.txz)?|\S+?(?:\.ss[mt]\.txz)?|[^\/]+?\.ssp)$/ - re_p=/(sisupod(?:\.txz)?|\S+?\.ss[mt](?:\.txz)?|[^\/]+?\.ssp)$/ + re_p_div=/https?:\/\/([^\/]+)(\/\S+)\/(sisupod\.(?:txz|zip)|\S+?(?:\.ss[mt]\.(?:txz|zip))?|[^\/]+?\.ssp)$/ + re_p=/(sisupod\.(?:txz|zip)|\S+?\.ss[mt]\.(?:txz|zip)?|[^\/]+?\.ssp)$/ if @requested_file =~ re_p_div @site,@pth,@pod= re_p_div.match(@requested_file).captures elsif @requested_file =~ re_p diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index a24937d2..f052e2a5 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -217,9 +217,10 @@ module SiSU_Env m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m stub_pwd=@@pwd[m,1] @@rc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] - @@yamlrc_path=(stub_pwd !~/^sisupod$/) \ - ? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) - : ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod + @@yamlrc_path=["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] + #@@yamlrc_path=(stub_pwd !~/^sisupod$/) \ + #? (["#{@@pwd}/_sisu/#{SiSU_version_dir}","#{@@pwd}/_sisu","#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"]) + #: ["#{@@home}/.sisu/#{SiSU_version_dir}","#{@@home}/.sisu","#{@@sisu_etc}/#{SiSU_version_dir}"] #security policy: prevent reading of sisurc.yml in sisupod @@ad_path=(stub_pwd !~/^sisupod$/) \ ? (["#{@@pwd}/_sisu/skin/yml","#{@@home}/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"]) : ["#{@@home}/.sisu",@@sisu_etc] @@ -2496,11 +2497,9 @@ WOK unless FileTest.directory?(sisupod_processing_path) mkdir_p(sisupod_processing_path) end - if FileTest.file?("#{Dir.pwd}/#{fns_pod}") - system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{processing_path.processing}") - else - SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/ - end + (FileTest.file?(fns_pod)) \ + ? system("unzip -q #{fns_pod} -d #{processing_path.processing}") + : (SiSU_Screen::Ansi.new('',"file not found: #{fns_pod}").warn unless @cmd=~/q/) sisupod_processing_path end end @@ -2563,10 +2562,14 @@ WOK end class Info_settings < Info_env def permission?(prog) #program defaults - (defined? @rc['permission_set'][prog]) ? @rc['permission_set'][prog] : false + (defined? @rc['permission_set'][prog]) \ + ? @rc['permission_set'][prog] + : false end def program?(prog) #program defaults - (defined? @rc['program_set'][prog]) ? @rc['program_set'][prog] : false + (defined? @rc['program_set'][prog]) \ + ? @rc['program_set'][prog] + : false end end class File_map < Info_env @@ -4783,10 +4786,13 @@ WOK skin_path=[] @env.sys.rc_path.each {|x| skin_path << "#{x}/skin"} skin_path << "#{@env.processing_path.processing}/external_document/skin" - skin=true - if @pwd_stub =~/^sisupod$/ \ - and @md.opt.mod.inspect !~/--trust/ - skin=false #security only run skins on sisupod if --trust flag is provided + skin=if @pwd_stub =~/^(?:doc|sisupod)$/ \ + and ((! @md.nil?) \ + && (defined? @md.opt) \ + && (defined? @md.opt.mod) \ + && @md.opt.mod.inspect =~/--trust/) + true #security only run skins on sisupod if --trust flag is provided + else false end doc_skin,dir_skin=nil,nil if skin -- cgit v1.2.3 From 403a52d7c62e4bb5ea6a0534b4062c57384dc3b3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:17:19 -0400 Subject: v3: dal_images, disabled imagemagick configuration permission check * until sisupod reads local sisurc.yml (configuration file) --- lib/sisu/v3/dal_images.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/dal_images.rb b/lib/sisu/v3/dal_images.rb index c2088874..b05c7ec7 100644 --- a/lib/sisu/v3/dal_images.rb +++ b/lib/sisu/v3/dal_images.rb @@ -67,7 +67,7 @@ module SiSU_images data=@data tuned_file=[] @rmgk=false - imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick') + imagemagick_=true #imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick') if imagemagick_ begin @rmgk=SiSU_Env::Load.new('RMagick').prog -- cgit v1.2.3 From c2163c564756a6998fa9d82ae33c92724ab7f8fc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:20:25 -0400 Subject: v3: image (relative) paths for different sisu output structures * (re: by_language, by_filetype, by_filename) * sysenv, set path * html seg, scroll, manifest (qrcodes), xmls --- lib/sisu/v3/constants.rb | 5 +++-- lib/sisu/v3/html_scroll.rb | 1 + lib/sisu/v3/html_tune.rb | 7 ++++--- lib/sisu/v3/manifest.rb | 5 ++--- lib/sisu/v3/qrcode.rb | 4 ++-- lib/sisu/v3/shared_xml.rb | 12 ++++++------ lib/sisu/v3/sysenv.rb | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 54 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index 498ee1f3..1202e47c 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -65,8 +65,9 @@ Ax={ Xx={ protect: '☞', segment: 'Ф', - html_relative2: '※※', #'※' '☼' - html_relative1: '※', #'※' '☼' + relative_path: '☼', + html_relative2: '※※', + html_relative1: '※', } Mx={ meta_o: '〔@', meta_c: '〕', diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index 0a37bcca..beb3700a 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -81,6 +81,7 @@ module SiSU_HTML_scroll @rcdc=false @scr={ body: [], metadata: [], owner_details: [] } data.each do |dob| + dob.obj.gsub!(/#{@md.file.output_path.html_seg.rel_image}/m,@md.file.output_path.html_scroll.rel_image) if defined? dob.name and dob.name =~/^meta/ \ and dob.obj =~/Document Information/ dob.obj.gsub!(/(Document Information(?: \(metadata\))?)/,'\1') diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb index c97183f1..afedec54 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v3/html_tune.rb @@ -257,9 +257,10 @@ module SiSU_HTML_Tune c=m[/"(.+?)"/m,1] caption=%{

#{c}

} if c png=m.scan(/\S+/)[0] - image_path=if @md.fns =~/\.-ss[tm]$/; @env.url.images_external - else @env.url.images_local - end + image_path=@md.file.output_path.html_seg.rel_image + #image_path=(@md.fns =~/\.-ss[tm]$/) \ + #? @env.url.images_external + #: @env.url.images_local ins=if u \ and u.strip !~/^image$/ %{#{caption}} diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 3b34d0b2..adc048ef 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -418,9 +418,8 @@ module SiSU_Manifest def qrc_image pth="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" fn=@f.base_filename.manifest_txt - #fix relative path for different output structures - img_md="../../_sisu/image/qrc_md.#{fn}.png" - img_title="../../_sisu/image/qrc_title.#{fn}.png" + img_md="#{@md.file.output_path.html.rel_image}/qrc_md.#{fn}.png" + img_title="#{@md.file.output_path.html.rel_image}/qrc_title.#{fn}.png" if FileTest.file?("#{pth}/qrc_md.#{fn}.png")==true @manifest[:html] <<< diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index fe9ca432..e244231e 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -709,9 +709,9 @@ WOK @en_manifest=if @env.output_dir_structure.by_language_code? "#{url}/en/manifest/#{@md.fnb}.html" elsif @env.output_dir_structure.by_filetype? - "#{url}/manifest/#{@md.fnb}.#{lc}.html" + "#{url}/manifest/#{@md.fnb}.#{@md.opt.lng}.html" else - "#{url}/sisu_manifest.#{lc}.html" + "#{url}/sisu_manifest.#{@md.opt.lng}.html" end @manifest[:txt] <<<\1') dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{[\\1] \\4}) + %{[\\1] \\4}) dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{\\1}) + %{\\1}) dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, - %{[\\1] \\4}) + %{[\\1] \\4}) dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, - %{\\1}) + %{\\1}) dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1') #watch, compare html_tune dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, @@ -416,7 +416,7 @@ module SiSU_XML_munge dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, - "#{@dir.url.images_local}\/\\1") + "#{@md.file.output_path.xml.rel_image}\/\\1") dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip @@ -438,7 +438,7 @@ module SiSU_XML_munge dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort dob.obj.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax dob.obj.gsub!(/(#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif))[ ]+.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/, - "#{@dir.url.images_local}\/\\1") + "#{@md.file.output_path.xml.rel_image}\/\\1") dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index f052e2a5..7463cb4b 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -4175,6 +4175,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../_sisu/image' + else + '../_sisu/image' + end + end self end def html_seg @@ -4196,6 +4205,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../../_sisu/image' + else + '../_sisu/image' + end + end self end def html_concordance @@ -4221,6 +4239,15 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + if @env.output_dir_structure.by_language_code? + '../../_sisu/image' + elsif @env.output_dir_structure.by_filetype? + '../_sisu/image' + else + '../_sisu/image' + end + end self end def xhtml @@ -4242,6 +4269,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + '../../_sisu/image' + end self end def epub @@ -4263,6 +4293,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + './image' + end self end def odt @@ -4305,6 +4338,9 @@ WOK def rel_sm set_path(ft).rel_sm.ab end + def rel_image + '../../_sisu/image' + end self end def xml_sax -- cgit v1.2.3 From e70f6340ee6c3e294468f15ed72ff69508b8f679 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 13 Sep 2011 19:21:46 -0400 Subject: v3: epub * fix for different output structures, language codes not used internally (within epub) * adjustment to image paths for image copy --- lib/sisu/v3/epub.rb | 15 +++++++++------ lib/sisu/v3/epub_concordance.rb | 10 +++++----- lib/sisu/v3/epub_format.rb | 22 +++++++++++----------- lib/sisu/v3/epub_segments.rb | 4 ++-- lib/sisu/v3/epub_tune.rb | 6 +++--- 5 files changed, 30 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 12ec1ce0..c1dcacec 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -338,7 +338,7 @@ module SiSU_EPUB title=if dob.obj !~/Document Information/; linkname else link='metadata' - %{#{linkname}} + %{#{linkname}} end toc={} txt_obj={ txt: title } @@ -423,13 +423,13 @@ module SiSU_EPUB linkname,ocn=dob.obj.strip,dob.ocn p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn if dob.ln==4 - seg_link=%{ + seg_link=%{ #{dob.obj} } @@seg_url=dob.name elsif dob.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=dob.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, - %{} + + %{} + %{\\1 \\2 }) end p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) if ocn @@ -451,7 +451,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -472,7 +472,7 @@ module SiSU_EPUB if ocn \ and ocn !~/#/ p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,ocn) - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } txt_obj={ txt: lnk_n_txt } @@ -660,7 +660,10 @@ module SiSU_EPUB img_pth=@md.env.path.image_source_include @md.ec[:image].each do |x| if FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ - and FileTest.file?("#{img_pth}/#{x}") + && FileTest.file?("#{@md.file.output_path.epub.rel_image}/#{x}") + cp("#{@md.file.output_path.epub.rel_image}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") + elsif FileTest.directory?("#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") \ + && FileTest.file?("#{img_pth}/#{x}") cp("#{img_pth}/#{x}","#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}/image") end end diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 687155d2..3a961285 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -185,18 +185,18 @@ WOK protected def location_scroll(wordlocation,show) @wordlocation=wordlocation - %{#{@wordlocation}; } + %{#{@wordlocation}; } end def location_seg(wordlocation,show) @wordlocation,@show=wordlocation,show - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil? + @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{Sfx[:epub_xhtml]}#o\\2") unless wordlocation.nil? case @wordlocation when @rxp_t1 - %{[H]#{@show}, } + %{[H]#{@show}, } when @rxp_t2 - %{[H]#{@show}, } + %{[H]#{@show}, } when @rxp_t3 - %{[H]#{@show}, } + %{[H]#{@show}, } else %{#{@show}, } end end diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 345bee95..42570dd0 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1763,7 +1763,7 @@ WOK } end def seg_head_navigation_band - firstseg=%{ + firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ DISABLE[:epub][:internal_navigation] \ @@ -1771,7 +1771,7 @@ WOK : %{

#{firstseg}

} end def seg_head_navigation_band_bottom - firstseg=%{ + firstseg=%{ #{@vz.epub_png_nav_nxt} } if @md.firstseg =~/\S+/ DISABLE[:epub][:internal_navigation] \ @@ -1906,17 +1906,17 @@ WOK def dot_control_pre_next %{
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc} - + #{@vz.png_nav_dot_nxt} #{@vz.table_close}} @@ -1924,12 +1924,12 @@ WOK def dot_control_pre %{ @@ -1941,15 +1941,15 @@ WOK end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' - toc=%{ + toc=%{ #{@vz.epub_png_nav_toc} } - pre=%{ + pre=%{ #{@vz.epub_png_nav_pre} } if f_pre==true - nxt=%{ + nxt=%{ #{@vz.epub_png_nav_nxt} } if f_nxt==true @@ -2439,7 +2439,7 @@ WOK fn='doc' if fn.to_s.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{

- #{@endnote_part_a}#{fn}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}#{@endnote_part_b} + #{@endnote_part_a}#{fn}#{Sfx[:epub_xhtml]}#{@endnote_part_b}

} end diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 7e4c412e..67d0884c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -238,7 +238,7 @@ WOK and dob.ln==4 if tracking != 0 Seg.new(@md).tail - segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] if dob.is=='heading' \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ @@ -259,7 +259,7 @@ WOK heading_art(dob) head(dob) if @@seg_name_xhtml[tracking]=='sisu_manifest' # this is for manifest, includes navigation bug - segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{@md.lang_code_insert}#{Sfx[:epub_xhtml]}" + segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') Seg_output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'sisu_manifest').output Seg.new.reinitialise #BUG navigation bug with items following metadata, and occurring before manifest, this becomes a bug ... work area for book index, FIX diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index d691361b..fedef1b3 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -274,11 +274,11 @@ module SiSU_EPUB_Tune c=m[/"(.+?)"/m,1] caption=%{

#{c}

} if c png=m.scan(/\S+/)[0] - image_path='./image' + image_path=@md.file.output_path.epub.rel_image #image_path=@env.url.images_epub ins=if u \ and u.strip !~/^image$/ - %{#{caption}} - else %{#{caption}} + %{#{caption}} + else %{#{caption}} end word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/,ins) else -- cgit v1.2.3
- + #{@vz.png_nav_dot_pre} - + #{@vz.png_nav_dot_toc}