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

def uicilibris::templateParser::imageParser::imgFun (   self,
  d 
)
the standard parser for a dictionary coming from an image

Definition at line 103 of file templateParser.py.

                      :
        """
        the standard parser for a dictionary coming from an image
        """
        modifiers=""
        if "width" in d:
            modifiers+="width=%s, " %d["width"]
        if "height" in d:
            modifiers+="height=%s, " %d["height"]
        code="\\includegraphics"
        if modifiers:
            code+="[%s]" %modifiers[:-2]
        code+="{%s}" %d["imgFile"]
        figure=False
        caption=""
        for k in d:
            if type(k)==type(0): # for the numeric keys
                if d[k]=="thumb":
                    figure=True
                elif caption=="": # the first unindentified value becomes a caption
                    figure=True
                    caption=d[k]
        if figure:
            code="\\begin{figure}[h!]\n\\begin{center}\n\\caption{%s}\\\\ \n%s\n\\end{center}\n\\end{figure}\n" %(caption, code)
            
        return code


Generated by  Doxygen 1.6.0   Back to index