#NEWLINE# def render( tmpl ) : #NEWLINE# #INDENT# ' Render a template (Itpl format) from ipython variables\n\n    Example:\n    \n    $ import ipy_render\n    $ my_name = \'Bob\'  # %store this for convenience\n    $ t_submission_form = "Submission report, author: $my_name"  # %store also\n    $ render t_submission_form\n    \n    => returns "Submission report, author: Bob" and copies to clipboard on win32\n\n    # if template exist as a file, read it. Note: ;f hei vaan => f("hei vaan")\n    $ ;render c:/templates/greeting.txt  \n    \n    Template examples (Ka-Ping Yee\'s Itpl library):\n    \n    Here is a $string.\n    Here is a $module.member.\n    Here is an $object.member.\n    Here is a $functioncall(with, arguments).\n    Here is an ${arbitrary + expression}.\n    Here is an $array[3] member.\n    Here is a $dictionary[\'member\'].\n    ' #NEWLINE# if os . path . isfile ( tmpl ) : #NEWLINE# #INDENT# tmpl = open ( tmpl ) . read ( ) #NEWLINE# #UNINDENT# res = itplns ( res , ip . user_ns ) #NEWLINE# toclip ( res ) #NEWLINE# return res