diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-09-13 23:27:28 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-09-13 23:27:28 -0400 |
commit | dbde53fbcfb79fd01762d97fac929af2a4cfc26a (patch) | |
tree | c98a4c884198aab848443f5b57f5e996f2d55bdd /lib | |
parent | dal_idx: capitalize first letter of index lev1 for sort; provide letter a-z n... (diff) |
dal_idx, and concordance, letter list for navigation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/concordance.rb | 25 | ||||
-rw-r--r-- | lib/sisu/v0/dal_idx.rb | 14 |
2 files changed, 26 insertions, 13 deletions
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='<font size="1" color="#777777" face=times new roman><img border="0" height="15" width="15" src="../_sisu/image/b_doc.png" alt="Full Text"> scroll: </font><font size="1" color="#222222" face=times new roman>doc# </font> ' 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 << '<p>' + alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>, }} + @file_concordance << '</p>' + letter=alph.shift + @file_concordance << %{\n<hr />\n<p class="book_index_lev1"><a name="A">A</a></p>} 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<hr />\n<p class="book_index_lev1"><a name="#{letter}">#{letter}</a></p>} + 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 << '</p>' + @file_concordance << '</p>' end # special cases endnotes and header levels 1 - 3 end credits=@vz.credits_sisu - @file_index_all << %{</div><div class="content">#{credits}<div></body>\n</html>} # footer + @file_concordance << %{</div><div class="content">#{credits}<div></body>\n</html>} # 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] << '<p>' - @alph.each {|x| @idx[:html] << %{<a href="##{x}">#{x}</a>, }} + alph.each {|x| @idx[:html] << %{<a href="##{x}">#{x}</a>, }} @idx[:html] << '</p>' - @letter=@alph.shift + letter=alph.shift @idx[:html] << %{\n<hr />\n<p class="book_index_lev1"><a name="A">A</a></p>} 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<hr />\n<p class="book_index_lev1"><a name="#{@letter}">#{@letter}</a></p>} + if letter < f + while letter < f + letter=alph.shift + @idx[:html] << %{\n<hr />\n<p class="book_index_lev1"><a name="#{letter}">#{letter}</a></p>} end end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } |