]> Devi Nivas Git - chevron.git/commitdiff
Update renderer.py
authorAlan Yee <alanyee@users.noreply.github.com>
Mon, 25 Nov 2019 18:52:12 +0000 (10:52 -0800)
committerGitHub <noreply@github.com>
Mon, 25 Nov 2019 18:52:12 +0000 (10:52 -0800)
More efficient to use rpartition over split in this use case

chevron/renderer.py

index 99415da97fbea56901e1fc7900d16b77c2e24680..af3e0a8ddcd3bc4d6a5f2403c710510e14aa99af 100644 (file)
@@ -338,7 +338,7 @@ def render(template='', data={}, partials_path='.', partials_ext='mustache',
                                    partials_path, partials_ext)
 
             # Find what to pad the partial with
-            left = output.split('\n')[-1]
+            left = output.rpartition('\n')[2]
             part_padding = padding
             if left.isspace():
                 part_padding += left