summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/context/ruby/base/texutil.rb
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
commit8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch)
tree3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/scripts/context/ruby/base/texutil.rb
parent850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff)
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/context/ruby/base/texutil.rb')
-rw-r--r--Master/texmf-dist/scripts/context/ruby/base/texutil.rb38
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)