lib/trac-wiki/parser.rb in trac-wiki-0.3.21 vs lib/trac-wiki/parser.rb in trac-wiki-0.3.22
- old
+ new
@@ -123,10 +123,13 @@
# template_handler(macroname) -> template_text
# when macros enabled and {{myCoolMacro}} ocured,
# result fo `template_handler('myCoolMacro') inserted
attr_accessor :template_handler
+ # Proc or nil
+ # at_callback.call(env, key) -> computed value
+ attr_accessor :at_callback
# macro {{$var}} | {{#comment}} | {{!cmd}} | {{template}} | {{/template}}
# string begins with macro
MACRO_BEG_REX = /\A\{\{ ( \$[\$\.\w]+ | [\#!\/]\w* |\w+ ) /x
MACRO_BEG_INSIDE_REX = /\A(.*?) (?<!\{|!|!\{) \{\{ ( \$[\$\.\w]+ | [\#!\/]\w* | \w+ ) /xm
@@ -134,9 +137,10 @@
MACRO_END_REX = /\A(.*?) ( \}\} | \{\{ ( \$[\$\.\w]+ | [\#!\/]\w* | \w+) )/mx
# Create a new Parser instance.
def initialize(options = {})
init_macros
+ @at_callback = nil
@env = Env.new(self)
@macros = true
@allowed_schemes = %w(http https ftp ftps)
macro_commands = options.delete :macro_commands
@macro_commands.merge! macro_commands if ! macro_commands.nil?