From dbde53fbcfb79fd01762d97fac929af2a4cfc26a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 13 Sep 2008 23:27:28 -0400 Subject: dal_idx, and concordance, letter list for navigation --- CHANGELOG | 2 ++ lib/sisu/v0/concordance.rb | 25 +++++++++++++++++++------ lib/sisu/v0/dal_idx.rb | 14 +++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f066aac9..3c345cbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * markup adjustment, book type index introduced * dal, book type indexing module + * book type index and concordance, letter list for navigation + * middle layer, url representation changed, downstream code affected * dummy headings removed when not used, latex/pdf, odf, html scroll diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index fad91d14..dd4411ac 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -207,11 +207,11 @@ WOK def songsheet begin mkdir_p(@path) unless FileTest.directory?(@path) - @file_index_all=File.open("#@path/#{@md.fn[:concordance]}",'w') + @file_concordance=File.open("#@path/#{@md.fn[:concordance]}",'w') map_para rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error ensure - @file_index_all.close + @file_concordance.close end end protected @@ -315,20 +315,33 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_index_all << SiSU_Concordance::Source::Doc_title.new(@particulars).create + @file_concordance << SiSU_Concordance::Source::Doc_title.new(@particulars).create + 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] + @file_concordance << '

' + alph.each {|x| @file_concordance << %{#{x}, }} + @file_concordance << '

' + letter=alph.shift + @file_concordance << %{\n
\n

A

} for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} + f=/^(\S)/.match(word)[1] + if letter < f.upcase + while letter < f.upcase + letter=alph.shift + @file_concordance << %{\n
\n

#{letter}

} + end + end keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 if @word_map[word][0] =~ /\d+/ wm=[] - @file_index_all << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} + @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} end - @file_index_all << '

' + @file_concordance << '

' end # special cases endnotes and header levels 1 - 3 end credits=@vz.credits_sisu - @file_index_all << %{
#{credits}
\n} # footer + @file_concordance << %{
#{credits}
\n} # footer tell=SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}") tell.flow if @md.cmd =~/[MV]/ end diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 9691a997..a5806d06 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -169,20 +169,20 @@ 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] + 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}, }} + alph.each {|x| @idx[:html] << %{#{x}, }} @idx[:html] << '

' - @letter=@alph.shift + 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}

} + 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]} } -- cgit v1.2.3