aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/concordance.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/concordance.rb')
-rw-r--r--lib/sisu/v3/concordance.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb
index 2c1c9ddf..f8118cd0 100644
--- a/lib/sisu/v3/concordance.rb
+++ b/lib/sisu/v3/concordance.rb
@@ -173,6 +173,8 @@ WOK
end
end
class Words
+ require_relative 'i18n' # i18n.rb
+ include SiSU_i18n
require_relative 'defaults' # defaults.rb
include SiSU_Viz
require_relative 'html_format' # html_format.rb
@@ -198,7 +200,9 @@ WOK
@rxp_excluded1=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
@rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#{@dp}|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!!
@rgx_splitlist=%r{[—.,;:#{Mx[:nbsp]}-]}mi
- @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|\w+|[a-zA-Z]+}mi
+ @alph=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_arrays
+ @alphlst=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_strings
+ @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|[#{@alphlst[:l]}#{@alphlst[:u]}]+|\w+}mi
rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error
end
end
@@ -244,6 +248,11 @@ WOK
line.obj.gsub!(/#{@rxp_excluded1}/,' ')
line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match
for word in line.obj.scan(@rgx_scanlist) #%take in word or other match
+ if word =~ /^([#{@alphlst[:l]}])/
+ firstletter=$1
+ flu=firstletter.tr(@alphlst[:l],@alphlst[:u])
+ word.gsub!(/^#{firstletter}/,flu )
+ end
word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'')
word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'')
word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'')
@@ -310,8 +319,8 @@ WOK
head.gsub!(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2)
head.gsub!(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1)
@file_concordance << head
- 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=@alph[:u]
alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>,&nbsp;}}
@file_concordance << '</p>'
letter=alph.shift