aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3/db_create.rb12
-rw-r--r--lib/sisu/v3/db_indexes.rb4
-rw-r--r--lib/sisu/v3/dbi_discreet.rb1
-rw-r--r--lib/sisu/v3/options.rb11
-rw-r--r--lib/sisu/v3/sysenv.rb12
-rw-r--r--lib/sisu/v3/urls.rb93
6 files changed, 77 insertions, 56 deletions
diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb
index 627f0ea5..02c33b99 100644
--- a/lib/sisu/v3/db_create.rb
+++ b/lib/sisu/v3/db_create.rb
@@ -99,7 +99,7 @@ module SiSU_DbCreate
to be populated from document files
create tables metadata_and_text
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE metadata_and_text (
tid BIGINT PRIMARY KEY,
@@ -210,7 +210,7 @@ module SiSU_DbCreate
to be populated from documents files
create tables doc_objects
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE doc_objects (
lid BIGINT PRIMARY KEY,
@@ -251,7 +251,7 @@ module SiSU_DbCreate
to be populated from document files
create tables endnotes
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE endnotes (
nid BIGINT PRIMARY KEY,
@@ -273,7 +273,7 @@ module SiSU_DbCreate
to be populated from document files
create tables endnotes_asterisk
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE endnotes_asterisk (
nid BIGINT PRIMARY KEY,
@@ -295,7 +295,7 @@ module SiSU_DbCreate
to be populated from document files
create tables endnotes_plus
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE endnotes_plus (
nid BIGINT PRIMARY KEY,
@@ -318,7 +318,7 @@ module SiSU_DbCreate
to be populated from doc_objects files
create tables urls
data import through ruby transfer
- } unless @opt.cmd =~/q/
+ } if @opt.cmd =~/[VM]/
@conn.execute(%{
CREATE TABLE urls (
metadata_tid BIGINT REFERENCES metadata_and_text,
diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v3/db_indexes.rb
index f61c584f..0f41c5df 100644
--- a/lib/sisu/v3/db_indexes.rb
+++ b/lib/sisu/v3/db_indexes.rb
@@ -71,7 +71,7 @@ module SiSU_DbIndex
end
end
def base
- print "\n create documents common indexes\n" unless @opt.cmd =~/q/
+ print "\n create documents common indexes\n" if @opt.cmd =~/[VM]/
sql_arr=[
%{CREATE INDEX idx_ocn ON doc_objects(ocn);},
%{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);},
@@ -99,7 +99,7 @@ module SiSU_DbIndex
conn_execute_array(sql_arr)
end
def text
- print "\n create documents TEXT indexes\n" unless @opt.cmd =~/q/
+ print "\n create documents TEXT indexes\n" if @opt.cmd =~/[VM]/
sql_arr=[
%{CREATE INDEX idx_clean ON doc_objects(clean);},
%{CREATE INDEX idx_endnote ON endnotes(clean);}
diff --git a/lib/sisu/v3/dbi_discreet.rb b/lib/sisu/v3/dbi_discreet.rb
index d9ecd8e7..61ab3a3d 100644
--- a/lib/sisu/v3/dbi_discreet.rb
+++ b/lib/sisu/v3/dbi_discreet.rb
@@ -118,6 +118,7 @@ module SiSU_DBI_Discreet #% database building
sdb_index=SiSU_DbDBI::Index.new(@opt,conn,@file,'sqlite')
sdb.output_dir?
begin
+ SiSU_Screen::Ansi.new(@opt.cmd,'SQLite',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi unless @opt.cmd =~/q/
sdb.create_db
sdb.create_table.metadata_and_text
sdb.create_table.doc_objects
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 4383a893..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'),
@@ -848,7 +849,7 @@ module SiSU_Env
elsif @cmd =~/V/; FileUtils::rm(@input)
elsif @cmd !~/q/; FileUtils::rm(@input)
elsif @cmd =~/q/; FileUtils::rm(@input)
- else puts "\tWARN: operation ignored"
+ else puts "\tWARN: operation ignored"
end
end
end
@@ -1852,10 +1853,11 @@ WOK
defaults[:sisu_share]
end
def style
- if (@md.opt.opt_act[:dump][:bool] \
- && @md.opt.opt_act[:dump][:inst]) \
- || (@md.opt.opt_act[:redirect][:bool] \
- && @md.opt.opt_act[:redirect][:inst])
+ if @md \
+ && ((@md.opt.opt_act[:dump][:bool] \
+ && @md.opt.opt_act[:dump][:inst]) \
+ || (@md.opt.opt_act[:redirect][:bool] \
+ && @md.opt.opt_act[:redirect][:inst]))
'css'
else
defaults[:stylesheet_stub]
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