Commits

Anonymous committed 375b8e4

fixes #1, variable substitution. Restructured some code for fix.

Comments (0)

Files changed (1)

         return filter(make_heading_filter(procedureNames),heading_list)
 """*******"""
 
-
-def transform(procedure) :
+def transform(procedure):
         """****f* dump/transform
         *       DESCRIPTION
         *               maps a python-fu procedure object to dictionary
         *               dictionary containing mapped attributes
         *       SOURCE
         *"""
+
         dct = dict()
 
         dct["name"] = escape_html(procedure.proc_name)
         dct["parameters"] = alt_table(procedure.params)
         dct["results"] = alt_table(procedure.return_vals)
 
-        return dct
-"""*******"""
-
-
-def procedure_body(procedure):
-        """****f* dump/procedure_body
-        *       DESCRIPTION
-        *               returns an HTML representation of a python-fu procedure object in a string
-        *       ARGUMENTS
-        *               procedure -- the python-fu procedure object to format
-        *       SIDE EFFECTS
-        *               None.
-        *       RESULT
-        *               HTML string containing procedure attributes
-        *       SOURCE
-        *"""
-        return Template("""
+        dct["body"] = Template("""
                 <hr style="margin-bottom:0px;"/>
                 <div style="display:inline-block;">
                         <h1>${name}</h1>
                 ${parameters}
                 <h4>Return</h4>
                 ${results}
-                <hr style="margin-bottom:0px;" />""").safe_substitute(transform(procedure))
+                <hr style="margin-bottom:0px;" />""").safe_substitute(dct)
+
+        return dct
 """*******"""
 
 
 
                         if (singleFile is True):
                                 proc_buf += Template('\t\t<a id="${anchor}"></a>').safe_substitute({"anchor":space[i]})
-                                proc_buf += procedure_body(pdb[space[i]])
+                                proc_buf += transform(pdb[space[i]])["body"]
 
                                 tmp = linker(heading)
                                 tmp["offset"] = "\t\t"
 
                                 tmp += "\n\t\t</nav>\n"
 
-                                proc_buf = tmp + procedure_body(pdb[space[i]]) + tmp
+                                dct = transform(pdb[space[i]])
+                                dct["body"] = tmp + dct["body"] + tmp
 
                                 with open(os.path.join(root,"pdb","%s.html"%slugify(space[i])), "w+") as f :
-                                        f.write(Template(__PROC_HTML).safe_substitute({"body":proc_buf}))
-
-                                proc_buf = ""
+                                        f.write(Template(__PROC_HTML).safe_substitute(dct))
 
                 # end procedure buffering