lib/trac-wiki/env.rb in trac-wiki-0.3.21 vs lib/trac-wiki/env.rb in trac-wiki-0.3.22
- old
+ new
@@ -129,13 +129,19 @@
cur = cur[subkey]
elsif cur.is_a? Array
cur = cur[subkey.to_i]
else
#print "at(#{key})->: default"
- return default
+ cur = nil
end
#print "at(#{key}) -> default\n" if cur.nil?
- return default if cur.nil?
+ if cur.nil?
+ if ! @parser.at_callback.nil?
+ val = @parser.at_callback.call(key, @env)
+ return val if ! val.nil?
+ end
+ return default
+ end
end
#rint "at(#{key})->#{cur}\n"
to_str ? cur.to_s : cur
end
def atput(key, val = nil)