From 2635b72eaa5e22cc7f16a43aa292c22496f7c19c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 8 Aug 2013 00:19:39 -0400 Subject: v4: merge v5 lib (5.0.10) * output structure by, add monolingual alt for :filetype & :filename, step 1 * output structure by, monolingual alternative for :filetype or :filename without language code, if document is in default language * set a default language, 'en' or as specified * set in rc file or from command line instruction * command line e.g. sisu -hv --monolingual --by-filename sisu_markup.sst sisu -3v --monolingual --by-filetype sisu_manual.ssm * sisurc.yml lingual: 'mono' | 'multi' lingual: 'mono' * note: output by :filetype is roughly equivalent to what monolingual output by :language would be * allow command line setting of default language using language code --default-language='en' --default-lang-en if used together with --monolingual and --by-filetype or --by-filename the selected default language document will not have a language code in the output filename * output structure by, monolingual alternative, documentation * cgi helper script, sample search form, single form, monolingual option * single cgi form, (with different internal variables set for output types) --- lib/sisu/v4/concordance.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/sisu/v4/concordance.rb') diff --git a/lib/sisu/v4/concordance.rb b/lib/sisu/v4/concordance.rb index cba5ae99..567b36e0 100644 --- a/lib/sisu/v4/concordance.rb +++ b/lib/sisu/v4/concordance.rb @@ -239,15 +239,14 @@ WOK %{#{wordlocation}; } end def location_seg(wordlocation,show) ##fix - @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") unless wordlocation.nil? - case wordlocation - when @rxp_t1 - %{[H]#{show}, } - when @rxp_t2 - %{[H]#{show}, } - when @rxp_t3 - %{[H]#{show}, } - else %{#{show}, } + unless wordlocation.nil? + wl=wordlocation.gsub(/(.+?)\#(\d+)/,"\\1#{@md.lang_code_insert}#{Sfx[:html]}#\\2") + case wordlocation + when /#{@rxp_t1}|@rxp_t2}|#{@rxp_t3}/ + %{[H]#{show}, } + when /(.+?)\#(\d+)/ + %{#{show}, } + end end end def map_para @@ -316,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] -- cgit v1.2.3