I don't understand that subst: stuff, but this makes the date template work
authorralf@brainbot.com
Mon Nov 17 18:56:35 2008 +0100 (7 weeks ago)
changeset 17922b9d1949e71f
parent 179167c4f535f79e
child 17935623e767caa8
I don't understand that subst: stuff, but this makes the date template work
mwlib/templ/magic_nodes.py
       1 --- a/mwlib/templ/magic_nodes.py	Mon Nov 17 16:56:07 2008 +0100
       2 +++ b/mwlib/templ/magic_nodes.py	Mon Nov 17 18:56:35 2008 +0100
       3 @@ -1,4 +1,12 @@
       4  from mwlib.templ import nodes, evaluate
       5 +
       6 +class Subst(nodes.Node):
       7 +    def flatten(self, expander, variables, res):
       8 +        name = []
       9 +        evaluate.flatten(self[0], expander, variables, name)
      10 +        name = u"".join(name).strip()
      11 +        
      12 +        res.append("{{subst:%s}}" % (name,))
      13  
      14  class Time(nodes.Node):
      15      def flatten(self, expander, variables, res):
      16 @@ -18,5 +26,5 @@
      17          from mwlib.templ import magic_time
      18          res.append(magic_time.time(format, d))
      19          
      20 -registry = {'#time': Time}
      21 +registry = {'#time': Time, 'subst': Subst}
      22