aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v312
-rw-r--r--lib/sisu/v3/hub.rb8
-rw-r--r--lib/sisu/v3/options.rb76
3 files changed, 86 insertions, 10 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 5ca702dd..990ea871 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -13,7 +13,7 @@ Reverse Chronological:
%% Development branch UNSTABLE
v3 branch once stable will supersede & replace current stable v2 branch
-%% 3.0.11.orig.tar.gz (2011-05-25:21/3)
+%% 3.0.11.orig.tar.gz (2011-05-29:21/7)
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.11-1
http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz
sisu_3.0.11.orig.tar.gz
@@ -25,6 +25,16 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.11.orig.tar.gz
* cgi search form, fixes related to language code
(filename with language code being required as unique document identifier)
+ * options
+ * filter out files not matching .ss[tm]
+ * with -f -G (--find|--glob) flag glob all .ss[tm] files in dir including
+ language sub-directories (e.g. in directory above language
+ sub-directories where ./_sisu/sisurc.yml should be located:)
+ sisu3 -3G live-manual
+ * with -f (--find|--glob) flag and find .ss[tm] files that match given
+ string in dir including language subdirectories
+ sisu3 -3GR
+
* i18n, constants, some language information moved to i18n (from constants)
%% 3.0.10.orig.tar.gz (2011-05-23:21/1)
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 651276cd..5eac0b03 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -153,7 +153,7 @@ module SiSU
when /^xhtml$/; SiSU_XHTML::Source.new(@opt).read # -b xhtml.rb
when /^xml$/; SiSU_XML_SAX::Source.new(@opt).read # -x xml.rb
when /^xml_dom$/; SiSU_XML_DOM::Source.new(@opt).read # -X xml_dom.rb
- when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
+ #when /^xml_fictionbook$/; SiSU_XML_Fictionbook::Source.new(@opt).read # -f
when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k xml_scaffold.rb
when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check
when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y manifest.rb
@@ -420,9 +420,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.act[:xml_dom] #% --xml-dom, -x xml dom type
op('xml_dom','xml dom')
end
- if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml
- op('xml_fictionbook','xml fictionbook')
- end
+ #if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml
+ # op('xml_fictionbook','xml fictionbook')
+ #end
if @opt.act[:xhtml] #% --xhtml, -b xhtml
op('xhtml','xhtml sax')
end
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index e57bf7fa..96ec3c4a 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -64,24 +64,90 @@ module SiSU_commandline
class Options
attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
def initialize(a)
- @x=a
@cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path='','','','','','','','','','',''
@f_pths,@files,@paths,@mod,@act=Array.new(5){[]}
@env=SiSU_Env::Info_env.new
@dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by?
@@base_path ||=Dir.pwd
@base_path=@@base_path
+ @a=sisu_glob_rules(a)
+ @a.freeze
+ init
+ end
+ def find_all(find_flag,opt)
+ if find_flag
+ pwd_set=Dir.pwd
+ x=Dir.glob('*.ss[tm]')
+ Px[:lng_lst].each do |d|
+ if FileTest.directory?(d)
+ x << Dir.glob("#{d}/*.ss[tm]")
+ end
+ end
+ opt + x.flatten!
+ end
+ end
+ def find_select(find_flag,opt)
+ if find_flag
+ pwd_set=Dir.pwd
+ x=[]
+ if opt.inspect =~/"[a-zA-Z][a-zA-Z0-9._-]+?"/
+ opt.each do |g|
+ x <<=if g =~/.ss[tm]/
+ Dir.glob("*#{g}")
+ else
+ Dir.glob("*#{g}*.ss[tm]")
+ end
+
+ Px[:lng_lst].each do |d|
+ if FileTest.directory?(d)
+ x <<=if g =~/.ss[tm]/
+ Dir.glob("#{d}/*#{g}")
+ else
+ Dir.glob("#{d}/*#{g}*.ss[tm]")
+ end
+ end
+ end
+ end
+ end
+ x.flatten!
+ end
+ end
+ def sisu_glob_rules(a)
+ b=[]
+ f=[]
+ find_flag=false
+ a.each do |y|
+ if y =~ /^-/ \
+ or y =~ /\.ss[tm]$/
+ if y =~/^-/ \
+ && y =~/[fG]|--find|--glob/
+ find_flag=true
+ end
+ b << y
+ end
+ if find_flag \
+ && y !~ /^-/ \
+ && y =~ /\S+/
+ f << y
+ elsif y =~ /^-/
+ b << y
+ end
+ end
r=Px[:lng_lst].join('|')
r.gsub!(/\|en\|/,'|')
@lang_regx=%r{(?:#{r})}
- @a=if a.inspect =~/"(?:-\S+?|--\S+?)"/ \
+ z=if find_flag
+ if f.length > 0
+ b + find_select(find_flag,f)
+ else
+ find_all(find_flag,b)
+ end
+ elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \
&& a.inspect =~/"#{@lang_regx}\/?"/ \
&& a.inspect =~/"en\/\S+?\.ss[tm]"/
init_selected_lang_dirs(a)
- else @x
+ else b
end
- @a.freeze
- init
end
def init_selected_lang_dirs(a)
@z=[]