diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 2 | ||||
-rw-r--r-- | lib/sisu/v5/concordance.rb | 35 |
2 files changed, 14 insertions, 23 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 5d53be74..b442c4ed 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -32,6 +32,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.9.orig.tar.xz * output structure by :filename or :filetype, multilingual default, fix +* concordance, fix + %% 5.0.8.orig.tar.xz (2013-07-30:30/2) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.8 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.8-1 diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb index 48ac1aac..96f293f2 100644 --- a/lib/sisu/v5/concordance.rb +++ b/lib/sisu/v5/concordance.rb @@ -239,25 +239,13 @@ WOK %{<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}\##{wordlocation}">#{wordlocation}</a>; } end def location_seg(wordlocation,show) ##fix - case wordlocation - when /@rxp_t1|@rxp_t2|@rxp_t3/ - fnh={ - fn: 'doc', - lng: @md.lang_code_insert - } - fn=@md.file.base_filename.html_seg(fnh) - %{[<a href="#{fn}##{show}">H</a>]#{show}, } - else - if not wordlocation.nil? \ - and wordlocation =~ /(.+?)\#(\d+)/ - seg,loc=/(.+?)\#(\d+)/.match(wordlocation)[1,2] - fnh={ - fn: seg, - lng: @md.lang_code_insert - } - fn=@md.file.base_filename.html_seg(fnh) - word_location_seg=%{#{fn}##{loc}} - %{<a href="#{word_location_seg}">#{show}</a>, } + unless wordlocation.nil? + wl=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") + case wordlocation + when /#{@rxp_t1}|@rxp_t2}|#{@rxp_t3}/ + %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, } + when /(.+?)\#(\d+)/ + %{<a href="#{wl}">#{show}</a>, } end end end @@ -327,10 +315,11 @@ WOK end @freq[word] +=1 @word_map[word] ||= [] - if line !~@rxp_lv1 \ - and line !~@rxp_lv2 \ - and line !~@rxp_lv3 #fix @rxp_lv # Mx[:lv_o] - @word_map[word] << location_seg("#{@seg}\##{ocn}",ocn) + if line !~ /#{@rxp_lv1}|#{@rxp_lv2}|#{@rxp_lv3}/ + loc_=%{#{location_seg("#{@seg}\##{ocn}",ocn).to_s}} + unless loc_.empty? + @word_map[word] << loc_ + end else @word_map[word] << case line when @rxp_lv1; location_seg('T1',ocn) #fix @rxp_lv # Mx[:lv_o] |