lib/trac-wiki/env.rb in trac-wiki-0.3.23 vs lib/trac-wiki/env.rb in trac-wiki-0.3.24
- old
+ new
@@ -8,15 +8,10 @@
@env = env || {}
@argv = {}
@argv_stack = []
end
- def nocache!
- atput('nocache', true)
- self
- end
-
# r: expanded-macro, rest-of-str, lines, offset-in-line
def parse_macro_all(macro_name, str, macro_name_size = nil)
str_size = str.size
args, rest, lines, offset = parse_balanced(str)
atput('maclen', str_size - rest.size + macro_name_size) if ! macro_name_size.nil?
@@ -99,10 +94,15 @@
ret = @parser.macro_commands[macro_name].call(self)
return ret
end
"UCMD(#{macro_name}|#{@env['arg']})"
end
+
+ def arg_count
+ @env[:cmd_args].size
+ end
+
def arg(idx)
@env[:cmd_args][idx] || ''
end
def prepare_y
@@ -139,10 +139,10 @@
cur = nil
end
#print "at(#{key}) -> default\n" if cur.nil?
if cur.nil?
if ! @parser.at_callback.nil?
- val = @parser.at_callback.call(key, @env)
+ val = @parser.at_callback.call(key, self)
return val if ! val.nil?
end
return default
end
end