diff options
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/base/texutil.rb')
-rw-r--r-- | Master/texmf-dist/scripts/context/ruby/base/texutil.rb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/Master/texmf-dist/scripts/context/ruby/base/texutil.rb b/Master/texmf-dist/scripts/context/ruby/base/texutil.rb index 063f67f2d38..868e3ca1625 100644 --- a/Master/texmf-dist/scripts/context/ruby/base/texutil.rb +++ b/Master/texmf-dist/scripts/context/ruby/base/texutil.rb @@ -475,18 +475,37 @@ class TeXUtil @@debug = false def initialize(t, c, k, d) - @type, @command, @key, @sortkey, @data = t, c, k, k, d + @type, @command, @key, @sortkey, @data = t, c, k, c, d end attr_reader :type, :command, :key, :data attr_reader :sortkey attr_writer :sortkey + # def build(sorter) + # if @key then + # @sortkey = sorter.normalize(sorter.tokenize(@sortkey)) + # @sortkey = sorter.remap(sorter.simplify(@key.downcase)) # ?? + # if @sortkey.empty? then + # @sortkey = sorter.remap(@command.downcase) + # end + # else + # @key = "" + # @sortkey = "" + # end + # end + def build(sorter) - @sortkey = sorter.normalize(sorter.tokenize(@sortkey)) - @sortkey = sorter.remap(sorter.simplify(@key.downcase)) # ?? - if @sortkey.empty? then - @sortkey = sorter.remap(@command.downcase) + if @sortkey and not @sortkey.empty? then + @sortkey = sorter.normalize(sorter.tokenize(@sortkey)) + @sortkey = sorter.remap(sorter.simplify(@sortkey.downcase)) # ?? + end + if not @sortkey or @sortkey.empty? then + @sortkey = sorter.normalize(sorter.tokenize(@key)) + @sortkey = sorter.remap(sorter.simplify(@sortkey.downcase)) # ?? + end + if not @sortkey or @sortkey.empty? then + @sortkey = @key.dup end end @@ -618,6 +637,9 @@ class TeXUtil if special then @sortkey = "#{@@specialsymbol}#{@sortkey}" end + if @realpage == 0 then + @realpage = 999999 + end @sortkey = [ @sortkey.downcase, @sortkey, @@ -687,7 +709,6 @@ class TeXUtil alphaclass, alpha = '', '' @@savedhowto, @@savedfrom, @@savedto, @@savedentry = '', '', '', '' if @@debug then - # if true then list.each do |entry| handle << "% [#{entry.sortkey.gsub(/#{@@split}/o,'] [')}]\n" end @@ -773,7 +794,8 @@ class TeXUtil copied = true end @nofentries += 1 if copied - if entry.realpage.to_i == 0 then + # if entry.realpage.to_i == 0 then + if entry.realpage.to_i == 999999 then Register.flushsavedline(handle) handle << "\\registersee{#{entry.type}}{#{entry.pagehowto},#{entry.texthowto}}{#{entry.seetoo}}{#{entry.page}}%\n" ; lastpage, lastrealpage = entry.page, entry.realpage @@ -1006,7 +1028,7 @@ class TeXUtil tuifile = File.suffixed(filename,'tui') if FileTest.file?(tuifile) then report("parsing file #{tuifile}") - if f = open(tuifile) then + if f = File.open(tuifile,'rb') then f.each do |line| case line.chomp when /^f (.*)$/o then @plugins.reader('MyFiles', $1.splitdata) |