From f555e0777bb4408e2e380150f28f3d433cb66d66 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 16 Sep 2008 00:35:57 -0400 Subject: fixes: alphabet list (concordance, dal_idx), and file types (dal_expand_insertions) --- lib/sisu/v0/concordance.rb | 7 ++++-- lib/sisu/v0/dal.rb | 45 ------------------------------------ lib/sisu/v0/dal_expand_insertions.rb | 45 ++++++++++++++++++++++++++++++++++++ lib/sisu/v0/dal_idx.rb | 7 ++++-- 4 files changed, 55 insertions(+), 49 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index dd4411ac..babc6655 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -326,8 +326,11 @@ WOK f=/^(\S)/.match(word)[1] if letter < f.upcase while letter < f.upcase - letter=alph.shift - @file_concordance << %{\n
\n

#{letter}

} + if alph.length > 0 + letter=alph.shift + @file_concordance << %{\n
\n

#{letter}

} + else break + end end end keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index c01c2d0a..18e2f8dd 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -265,51 +265,6 @@ module SiSU_DAL outputdata end protected - def output_filetypes_in_cmd(cmd_shortcut,source=nil) - #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used - cf_defaults=SiSU_Env::Info_processing_flag.new - cmd_list=case cmd_shortcut.inspect - when /0/; cf_defaults.cf_0 - when /1/; cf_defaults.cf_1 - when /2/; cf_defaults.cf_2 - when /3/; cf_defaults.cf_3 - when /4/; cf_defaults.cf_4 - when /5/; cf_defaults.cf_5 - end - file_type_names={} - file_type_names[:gen],file_type_names[:src]=[],[] - file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html' - end - file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] - end - file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] - end - #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1' - #end - file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt' - end - file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml' - end - file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml' - end - file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml' - end - file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt' - end - file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt' - end - file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html' - end - file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt' - end - file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source - end - file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip" - end - file_type_names[:gen]=file_type_names[:gen].flatten - file_type_names[:src]=file_type_names[:src].flatten - file_type_names - end end end __END__ diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb index 1ab0c03b..17362092 100644 --- a/lib/sisu/v0/dal_expand_insertions.rb +++ b/lib/sisu/v0/dal_expand_insertions.rb @@ -64,6 +64,51 @@ module SiSU_insertions def initialize(data) @data=data end + def output_filetypes_in_cmd(cmd_shortcut,source=nil) + #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used + cf_defaults=SiSU_Env::Info_processing_flag.new + cmd_list=case cmd_shortcut.inspect + when /0/; cf_defaults.cf_0 + when /1/; cf_defaults.cf_1 + when /2/; cf_defaults.cf_2 + when /3/; cf_defaults.cf_3 + when /4/; cf_defaults.cf_4 + when /5/; cf_defaults.cf_5 + end + file_type_names={} + file_type_names[:gen],file_type_names[:src]=[],[] + file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html' + end + file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] + end + file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] + end + #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1' + #end + file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt' + end + file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml' + end + file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml' + end + file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml' + end + file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt' + end + file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt' + end + file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html' + end + file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt' + end + file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source + end + file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip" + end + file_type_names[:gen]=file_type_names[:gen].flatten + file_type_names[:src]=file_type_names[:src].flatten + file_type_names + end def expand_insertions? data=@data tuned_file,tuned_file_tmp=[],[] diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index c2bba846..d7d5223e 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -181,8 +181,11 @@ module SiSU_book_index f=/^(\S)/.match(x)[1] if letter < f while letter < f - letter=alph.shift - @idx[:html] << %{\n
\n

#{letter}

} + if alph.length > 0 + letter=alph.shift + @idx[:html] << %{\n
\n

#{letter}

} + else break + end end end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } -- cgit v1.2.3