aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/options.rb')
-rw-r--r--lib/sisu/v3/options.rb84
1 files changed, 56 insertions, 28 deletions
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index c4dbf812..c7789f3a 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -7,7 +7,8 @@
* Author: Ralph Amissah
- * Copyright: (C) 1997 - 2012, Ralph Amissah, All Rights Reserved.
+ * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2007, 2008, 2009, 2010, 2011, 2012 Ralph Amissah, All Rights Reserved.
* License: GPL 3 or later:
@@ -33,9 +34,7 @@
<http://www.fsf.org/licensing/licenses/gpl.html>
<http://www.gnu.org/licenses/gpl.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
- <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+ <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
* SiSU uses:
* Standard SiSU markup syntax,
@@ -47,7 +46,7 @@
<http://www.sisudoc.org>
* Download:
- <http://www.jus.uio.no/sisu/SiSU/download.html>
+ <http://www.sisudoc.org/sisu/en/SiSU/download.html>
* Ralph Amissah
<ralph@amissah.com>
@@ -197,6 +196,7 @@ module SiSU_Commandline
def set_files_and_paths_and_general_extract(s)
c,w='',''
m,f,pth,z,lng,lngs=[],[],[],[],[],[]
+ lng_is=''
a=s.split(/\s+/)
r_l=Px[:lng_lst].join('|')
a.uniq.each do |x|
@@ -209,7 +209,43 @@ module SiSU_Commandline
m << x
end
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+/ \
+ if x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/
+ if x =~/^(?:https?|file):\/\/\S+/ #\
+ end
+ pwd=Dir.pwd
+ fn_pod=x.gsub(/.+?([^\/]+)\.txz$/,'\1')
+ fullname=@env.processing_path.processing + '/sisupod/' + fn_pod
+ pt=Pathname.new(fullname)
+ FileUtils::mkdir_p(pt.to_s)
+ Dir.chdir(pt.realpath)
+ options=s.gsub(/(\s+--?\S+)+.+/,'\1')
+ system("
+ chdir #{fullname}
+ tar xaf #{x}
+ chdir #{pwd}
+ ")
+ Dir.chdir(pt.realpath.to_s + '/sisupod/doc')
+ r=Px[:lng_lst].join('|')
+ Dir.entries("#{fullname}/sisupod/doc").each do |d_lng|
+ if d_lng =~/^(?:#{r})$/
+ Dir.chdir(pt.realpath.to_s + "/sisupod/doc/#{d_lng}")
+ filenames=Dir.glob("*.ss[mt]")
+ filenames.each do |fn|
+ f_pths << {
+ pth: "#{fullname}/sisupod/doc/#{d_lng}",
+ f: "#{fn}",
+ pth_stub: 'doc',
+ lng: d_lng,
+ lng_is: d_lng,
+ url_base: '',
+ url: ''
+ }
+ Dir.chdir(pwd)
+ f << fn
+ end
+ end
+ end
+ elsif x =~/^(?:https?|file):\/\/\S+/ \
and x =~/\S+?\.ss[mt]$/
r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\//
url_base = (x[r_url,1])
@@ -253,12 +289,7 @@ module SiSU_Commandline
url: url
}
f << fn
- elsif x =~/^(?:https?|file):\/\/\S+/ \
- and x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/
- x=x.gsub(/^file:\/\//,'')
- f << x
elsif FileTest.file?(x)
-### FIX
pt=Pathname.new(x)
pth << pt.split[0].realpath.to_s #remove?
f << pt.split[1].to_s #remove?
@@ -267,14 +298,7 @@ module SiSU_Commandline
l_p = (pt.split[0].realpath.to_s[t,1]) \
? pt.split[0].realpath.to_s[t,1]
: nil
- lng << l_p
- lngs << if l_p
- l_p
- elsif x =~/~(#{r_l})\.ss[tm]/
- $1
- else lng_base
- end
- lng_is =if l_p
+ lngs << lng_is = if l_p
l_p
elsif x =~/~(#{r_l})\.ss[tm]/
$1
@@ -284,14 +308,11 @@ module SiSU_Commandline
pth: pt.split[0].realpath.to_s,
f: pt.split[1].to_s,
pth_stub: pt.split[0].realpath.to_s[r_u,1],
- lng: (pt.split[0].realpath.to_s[t,1]) \
- ? pt.split[0].realpath.to_s[t,1]
- : nil,
+ lng: lng_is,
lng_is: lng_is,
url_base: nil,
url: nil
}
-# Dir.chdir(pt.split[0].realpath)
else puts "file not found: #{x}"
end
elsif x =~ /\.termsheet\.rb$/
@@ -302,7 +323,7 @@ module SiSU_Commandline
puts "#{x} in #{a.join(' ')}?"
end
end
- { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng, lngs: lngs }
+ { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng_is, lngs: lngs }
end
def expand_numeric_shortcuts(a)
shortcut=SiSU_Env::InfoProcessingFlag.new
@@ -349,7 +370,7 @@ module SiSU_Commandline
m.each do |m|
case m
when /^--(?:color-toggle)$/; c=c+'c'
- when /^--(?:configure)$/; c=c+'CC'
+ when /^--(?:configure|init-site)$/; c=c+'CC'
when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m'
when /^--(?:txt|text|plaintext)$/; c=c+'t'
when /^--(?:html)$/; c=c+'h'
@@ -442,7 +463,7 @@ module SiSU_Commandline
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:site_init]=(cmd =~/C/ \
- || mod.inspect =~/"--init-site/) \
+ || mod.inspect =~/"--init-site"|"--configure"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:rc]=if mod.inspect =~/"--rc=/
@@ -508,8 +529,15 @@ module SiSU_Commandline
{ bool: false, set: :off, off: off_list}
else { bool: true, set: :na, off: [] }
end
- act[:ocn]=
- if mod.inspect =~/"--inc-ocn"/
+ act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
+ { set: :language }
+ elsif mod.inspect =~/"--(?:output-)?by-filename"/
+ { set: :filename }
+ elsif mod.inspect =~/"--(?:output-)?by-filetype"/
+ { set: :filetype }
+ else { set: :na }
+ end
+ act[:ocn]=if mod.inspect =~/"--inc-ocn"/
{ bool: true, set: :on }
elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
|| act[:switch][:off].inspect =~/"ocn"/