X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mods%2Ffriendica-to-smarty-tpl.py;h=ff1a102a44de894bde28b5c914df19b602d340c2;hb=cd017282e4e9e3756496d5b10dddd379279c0aed;hp=6037d04ea21cd3d2ea9ea9f646772a4258b735f4;hpb=a29842e3019255efd3f91fc01df29f5837d54fa4;p=friendica.git diff --git a/mods/friendica-to-smarty-tpl.py b/mods/friendica-to-smarty-tpl.py index 6037d04ea2..ff1a102a44 100755 --- a/mods/friendica-to-smarty-tpl.py +++ b/mods/friendica-to-smarty-tpl.py @@ -77,7 +77,7 @@ def fix_element(element): if parts[first+1][0] == '$': # This takes care of elements where the filename is a variable, e.g. {{ inc $file }} - element += 'file:' + ldelim + parts[first+1].rstrip('}') + rdelim + element += ldelim + parts[first+1].rstrip('}') + rdelim else: # This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }} element += parts[first+1].rstrip('}') @@ -189,10 +189,14 @@ for a_file in files: filename = os.path.join(path,a_file) ext = a_file.split('.')[-1] if os.path.isfile(filename) and ext == 'tpl': - with open(filename, 'r') as f: - newfilename = os.path.join(outpath,a_file) - with open(newfilename, 'w') as outf: - print "Converting " + filename + " to " + newfilename - convert(f, outf, php_tpl) + f = open(filename, 'r') + newfilename = os.path.join(outpath,a_file) + outf = open(newfilename, 'w') + + print "Converting " + filename + " to " + newfilename + convert(f, outf, php_tpl) + + outf.close() + f.close()