summaryrefslogtreecommitdiff
path: root/scripts/context/ruby/base/texutil.rb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/context/ruby/base/texutil.rb')
-rw-r--r--scripts/context/ruby/base/texutil.rb33
1 files changed, 23 insertions, 10 deletions
diff --git a/scripts/context/ruby/base/texutil.rb b/scripts/context/ruby/base/texutil.rb
index 9e66aecff..3775469ed 100644
--- a/scripts/context/ruby/base/texutil.rb
+++ b/scripts/context/ruby/base/texutil.rb
@@ -475,24 +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)
- if @key then
+ if @sortkey and not @sortkey.empty? 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 = ""
- # weird
+ @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