Logo Search packages:      
Sourcecode: uicilibris version File versions  Download package

def uicilibris::templateParser::templateParser::pfMaker (   self,
  fun 
)
creates a parse function
@param fun a function getting the dictionary of parameters of a template
@return a function whose profile is: input parameter = a match expression, result = a string

Reimplemented in uicilibris::templateParser::imageParser.

Definition at line 58 of file templateParser.py.

                         :
        """
        creates a parse function
        @param fun a function getting the dictionary of parameters of a template
        @return a function whose profile is: input parameter = a match expression, result = a string
        """
        def pf(m):
            params=m.group(1)
            params=params[1:].split("|")
            dic={}
            i=0
            for p in params:
                m=re.match("([\S]+)=(.*)",p)
                if m:
                    dic[m.group(1)]=m.group(2)
                else:
                    dic[i]=p
                    i+=1
            try:
                return fun(dic)
            except:
                exctype, excval = sys.exc_info()[:2]
                exc=re.findall(".*\.(.*)'.*", "%s" %exctype)[0]
                pass
            return "{\\textbf{%s: %s}; could not translate the template '%s'}" %(exc, excval, self.ident)
        return pf


Generated by  Doxygen 1.6.0   Back to index