<?php $lib = new Library(); $lib->simpleTag('echo2', function ($arg) { return $arg; }); return $lib;
<?php $lib = new Library(); $lib->tag('badtag', function ($parser, $token) { throw new RuntimeError('I am a bad tag'); }); $lib->simpleTag('badsimpletag', function () { throw new RuntimeError('I am a bad simpletag'); }); return $lib;
// @register.simple_tag(takes_context=True) // def simple_tag_without_context_parameter(arg): // """Expected simple_tag_without_context_parameter __doc__""" // return "Expected result" // simple_tag_without_context_parameter.anything = "Expected simple_tag_without_context_parameter __dict__" // // @register.simple_tag(takes_context=True) // def current_app(context): // return "%s" % context.current_app // // @register.simple_tag(takes_context=True) // def use_l10n(context): // return "%s" % context.use_l10n // $lib->simpleTag('minustwo', function ($value) { return $value - 2; }); $lib->simpleTag('minusone', function ($value) { return $value - 1; }); // // @register.inclusion_tag('inclusion.html') // def inclusion_no_params(): // """Expected inclusion_no_params __doc__""" // return {"result" : "inclusion_no_params - Expected result"} // inclusion_no_params.anything = "Expected inclusion_no_params __dict__" // // @register.inclusion_tag(get_template('inclusion.html')) // def inclusion_no_params_from_template(): // """Expected inclusion_no_params_from_template __doc__""" // return {"result" : "inclusion_no_params_from_template - Expected result"}