aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/concordance.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-07-30 21:30:36 -0400
committerRalph Amissah <ralph@amissah.com>2013-07-30 21:30:39 -0400
commit3e58296fa7761edaa59f807d4f8e87987ea8e921 (patch)
treed93286de4e7cba8462a71fa013d223cf84413e88 /lib/sisu/v5/concordance.rb
parentv5: output structure by, add monolingual alt for :filetype & :filename, step 1 (diff)
v5: output structure by, monolingual alternative for :filetype or :filename
* 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
Diffstat (limited to 'lib/sisu/v5/concordance.rb')
-rw-r--r--lib/sisu/v5/concordance.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/sisu/v5/concordance.rb b/lib/sisu/v5/concordance.rb
index f2143bb8..48ac1aac 100644
--- a/lib/sisu/v5/concordance.rb
+++ b/lib/sisu/v5/concordance.rb
@@ -239,15 +239,26 @@ WOK
%{<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}\##{wordlocation}">#{wordlocation}</a>; }
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
- %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
- when @rxp_t2
- %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
- when @rxp_t3
- %{[<a href="doc#{@md.lang_code_insert}#{Sfx[:html]}##{show}">H</a>]#{show}, }
- else %{<a href="#{@word_location_seg}">#{show}</a>, }
+ 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>, }
+ end
end
end
def map_para