pnbp

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 75c96ac168348a4e781f92cda72c3ffb4f0121b7
parent 68f07e23ad7e0e222fd92426f4511d6e43ad8b90
Author: Paul Longtine <paullongtine@gmail.com>
Date:   Fri Jun 13 15:25:31 2014

fixed scripts, did not support multiple scripts on the same page.

Diffstat:
 src/build.py | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/build.py b/src/build.py @@ -101,22 +101,25 @@ def runMod(t,var,page): #Takes all code blocks in templates ("{:print("Hi"):}") and executes it, and replaces the block with the "returns" variable def runInlineScript(template,page): - try: - index = template.index("{:")+2 - exists = True - - except: - exists = False + exists = True + while exists: + try: + index = template.index("{:")+2 + findex = index + exists = True + + except: + exists = False - if exists: - script = "" - while template[index:index+2] != ":}": - script = script + template[index] - index += 1 + if exists: + script = "" + while template[index:index+2] != ":}": + script = script + template[index] + index += 1 - returns = "" - exec(script) - template = template.replace(template[template.index("{:"):template.index(":}")+2],returns) + returns = "" + exec(script) + template = template.replace(template[findex-2:index+2],returns) return template