From 6a6c011f1278d37d078c224410311ffac45bad1c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 5 Apr 2012 14:47:29 -0400 Subject: v3: urls, reporting, some cleaning --- lib/sisu/v3/options.rb | 11 ++++-- lib/sisu/v3/sysenv.rb | 1 + lib/sisu/v3/urls.rb | 93 ++++++++++++++++++++++++++++---------------------- 3 files changed, 62 insertions(+), 43 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 11d03e1d..3db80231 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -357,7 +357,7 @@ module SiSU_Commandline when /^--(?:od[ft])$/; c=c+'o' when /^--(?:pdf)$/; c=c+'p' when /^--(?:concordance|wordmap)$/; c=c+'w' - when /^--(?:manpage)$/; c=c+'i' + when /^--(?:manpage|man)$/; c=c+'i' when /^--(?:texinfo)$/; c=c+'I' when /^--(?:xhtml)$/; c=c+'b' when /^--(?:xml-sax)$/; c=c+'x' @@ -379,6 +379,7 @@ module SiSU_Commandline when /^--(?:zap|delete)$/; c=c+'Z' when /^--(?:sample-search-form)$/; c=c+'F' when /^--(?:webserv|webrick)$/; c=c+'W' + when /^--(?:profile)$/; c=c+'E' when /^--(?:maintenance|keep-processing-files)$/; c=c+'M' when /^--(?:verbose[=-]3)$/; c=c+'VM' when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V' @@ -486,6 +487,10 @@ module SiSU_Commandline || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } + act[:profile]=(cmd =~/E/ \ + || mod.inspect =~/"--profile"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:switch]=if mod.inspect =~/"--switch-off=/ off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1') off_list=off_list.scan(/[^,;\s]+/) @@ -625,7 +630,7 @@ module SiSU_Commandline ? { bool: true, set: :on } : { bool: false, set: :na } act[:odt]=(cmd =~/o/ \ - || mod.inspect =~/"--odf"/) \ + || mod.inspect =~/"--odt"|"--odf"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:xml_sax]=(cmd =~/x/ \ @@ -645,7 +650,7 @@ module SiSU_Commandline ? { bool: true, set: :on } : { bool: false, set: :na } act[:manpage]=(cmd =~/i/ \ - || mod.inspect =~/"--manpage"/) \ + || mod.inspect =~/"--manpage"|"--man"/) \ ? { bool: true, set: :on } : { bool: false, set: :na } act[:texinfo]=(cmd =~/I/ \ diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 0b3a581c..442795c9 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -590,6 +590,7 @@ module SiSU_Env odf: filename(code,'','.odt'), epub: filename(code,'','.epub'), plain: filename(code,'','.txt'), + qrcode: filename(code,'','.jpg'), manpage: filename(code,'','.1'), #fix, section number wiki: filename(code,'wiki','.txt'), digest: filename(code,'digest','.txt'), diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 31614a37..ddb62fa7 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -93,20 +93,18 @@ module SiSU_Urls else 'not recognised file' end @u ||= { - 'a --txt (Plain-text (footnotes))'=>@fn[:plain], 'b --xhtml (XHTML)'=>@fn[:xhtml], 'D[iu] --psql (DBI import/update postgresql)'=>'dbi psql', - 'd[iu] --sqlite (DBI import/update sqlite)'=>'dbi sqlite3', + 'd --sqlite (DBI sqlite)'=>'dbi sqlite3', + 'd[iu] --sqlite (DBI sqlite)'=>'dbi sqlite3', 'e --epub (EPUB)'=>@fn[:epub], 'P --pot (Pot)'=>@fn[:pot], 'h --html (HTML segmented)'=>@fn[:toc], - 'H --html (HTML segmented)'=>@fn[:toc], 'h --html (HTML scroll)'=>@fn[:doc], - 'H --html (HTML scroll)'=>@fn[:doc], 'I --texinfo (Info file)'=>'info', - 'i --man (manpage)'=>'manpage', + 'i --manpage (manpage)'=>'manpage', 'm --dal (Document Abstraction)'=>'dal', - 'N (Digests md5/sha256)'=>@fn[:digest], + 'N --hash-digests (Digests md5/sha256)'=>@fn[:digest], 'o --odt (ODF:ODT - Open Document)'=>@fn[:odf], 'p --pdf (PDF landscape)'=>@fn[:pdf_l], 'p --pdf (PDF portrait)'=>@fn[:pdf_p], @@ -116,6 +114,7 @@ module SiSU_Urls 't --txt (Plain-text (endnotes))'=>@fn[:plain], 'x --xml-sax (XML sax type)'=>@fn[:sax], 'X --xml-dom (XML dom type)'=>@fn[:dom], + 'Q --qrcode (QR Code jpg)'=>@fn[:qrcode], 'y --manifest (Manifest, html)'=>@fn[:manifest], 'Y (Sitemap, xml)'=>@fn[:sitemap], 'w --concordance (Concordance, html)'=>@fn[:concordance], @@ -160,6 +159,9 @@ module SiSU_Urls def concordance(x) SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}").result end + def qrcode(x) + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result + end def manifest(x) SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.web_browser} file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}").result end @@ -215,7 +217,10 @@ module SiSU_Urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI psql","#{@pwd_stub}::#{@opt.fns}",y).result end def sqlite(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}\n sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db\n", "#{y}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x} DBI sqlite","sqlite3 #{@env.path.webserv}/#{@md.opt.f_pth[:pth_stub]}/sisu_sqlite.db").result + end + def sqlite_discreet(x,y) + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","sqlite3 #{@md.file.output_path.sqlite_discreet.dir}/#{@md.file.base_filename.sqlite_discreet}").result end self end @@ -284,48 +289,52 @@ module SiSU_Urls @u.each do |x,y| if @opt.fns =~ @m_regular if @opt.cmd =~/[MVv]/ - if (x=~/^a/ and @opt.cmd =~/a/) \ - or (x=~/^t/ and @opt.cmd =~/t/) + if x=~/--txt\b/ \ + and @opt.act[:txt][:set]==:on show.text(x) end - if x=~/^b/ \ - and @opt.cmd =~/b/ + if x=~/--xhtml\b/ \ + and @opt.act[:xhtml][:set]==:on show.xhtml(x) end - if x=~/^D/ \ - and @opt.cmd =~/D/ + if x=~/--psql\b/ \ + and @opt.act[:psql][:set]==:on show.db.psql(x,y) end - if x=~/^d/ \ - and @opt.cmd =~/d/ + if x=~/d\s+--sqlite\b|--sql\b/ \ + and @opt.act[:sqlite_discreet][:set]==:on + show.db.sqlite_discreet(x,y) + end + if x=~/d\[iu\]\s+--sqlite\b/ \ + and @opt.act[:sqlite][:set]==:on show.db.sqlite(x,y) end - if x=~/^e/ \ - and @opt.cmd =~/e/ + if x=~/--epub\b/ \ + and @opt.act[:epub][:set]==:on show.epub(x) end - if x=~/^h/ \ - and @opt.cmd =~/h/ + if x=~/--html\b/ \ + and @opt.act[:html][:set]==:on if x =~/scroll/ show.html.scroll(x) else show.html.toc(x) end end - if x=~/^I/ \ + if x=~/--texinfo\b/ \ and @opt.cmd =~/I/ show.pinfo(x,y) end - if x=~/^i/ \ - and @opt.cmd =~/i/ + if x=~/--manpage\b/ \ + and @opt.act[:manpage][:set]==:on show.manpage(x) end - if x=~/^N/ \ + if x=~/--hash-digests\b/ \ and @opt.cmd =~/N/ show.hash_digest(x) end - if x=~/^o/ \ - and @opt.cmd =~/o/ + if x=~/--odt\b|--odf\b/ \ + and @opt.act[:odt][:set]==:on show.odt(x) end if x=~/^P/ \ @@ -337,43 +346,47 @@ module SiSU_Urls show.po4a.pot(x,f) end end - if x=~/^p/ \ - and @opt.cmd =~/p/ + if x=~/--pdf\b/ \ + and @opt.act[:pdf][:set]==:on if x =~/portrait/ show.pdf.portrait(x) else show.pdf.landscape(x) end end - if x=~/^S/ \ - and @opt.cmd =~/S/ + if x=~/--sisupod\b/ \ + and @opt.act[:sisupod][:set]==:on (@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/ \ - and @opt.cmd =~/s/ + if x=~/--source\b/ \ + and @opt.act[:share_source][:set]==:on show.source.src(x,y) end - if x=~/^w/ \ - and @opt.cmd =~/w/ + if x=~/--concordance\b/ \ + and @opt.act[:concordance][:set]==:on show.html.concordance(x) end - if x=~/^X/ \ - and @opt.cmd =~/X/ + if x=~/--xml-dom\b/ \ + and @opt.act[:xml_dom][:set]==:on show.xml.dom(x) end - if x=~/^x/ \ - and @opt.cmd =~/x/ + if x=~/--xml-sax\b/ \ + and @opt.act[:xml_sax][:set]==:on show.xml.sax(x) end - if x=~/^Y/ \ + if x=~/--qrcode\b/ \ + and @opt.act[:qrcode][:set]==:on + show.qrcode(x) + end + if x=~/--sitemap\b/ \ and @opt.cmd =~/Y/ #BROKEN show.xml.sitemap(x) end - if x=~/^y/ \ - and @opt.cmd =~/y/ + if x=~/--manifest\b/ \ + and @opt.act[:manifest][:set]==:on show.html.manifest(x) end end -- cgit v1.2.3