From b3f2c67fd2d5b6c396eada917e2ef6dc069e5ea3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 13 Sep 2008 00:53:58 -0400 Subject: dal_idx: capitalize first letter of index lev1 for sort; provide letter a-z navigation --- lib/sisu/v0/dal_idx.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index f8eb5e45..9691a997 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -131,6 +131,7 @@ module SiSU_book_index use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] else use=idx_lst[0] end + use=use[0].chr.capitalize + use[1,use.length] @the_idx[use]={} unless @the_idx[use] and defined? @the_idx[use] idx_lst.each do |i| i.strip! @@ -168,12 +169,25 @@ module SiSU_book_index @idx[:sst] << "\n\n#{Mx[:br_page_new]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" + @alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @idx[:html] << '

' + @alph.each {|x| @idx[:html] << %{#{x}, }} + @idx[:html] << '

' + @letter=@alph.shift + @idx[:html] << %{\n
\n

A

} the_idx.each do |i| i.each do |x| if x.class == String + f=/^(\S)/.match(x)[1] + if @letter < f + while @letter < f + @letter=@alph.shift + @idx[:html] << %{\n
\n

#{@letter}

} + end + end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } aname=x.gsub(/\s+/,'_') - @idx[:html] << %{\n

#{x}, } + @idx[:html] << %{\n

#{x}, } @o=@idx[:sst].index(@idx[:sst].last) #@o=@idx[:sst].length - 1 @q=@idx[:html].index(@idx[:html].last) #@o=@idx[:html].length - 1 print "\n" + x + ', ' if @md.cmd =~/V/ -- cgit v1.2.3