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=' 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
\nA
}
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 << %{