From: makoto kuwata <kwa...@gmail.com>
Date: Sun, 7 Jun 2009 07:19:09 -0700 (PDT)
Local: Sun, Jun 7 2009 10:19 am
Subject: Re: pyTenjin Feature Requests
Steve,
On 2009-06-07 12:18, makoto kuwata <kwa...@gmail.com> wrote:
> Here you are:
For example, the following template reveals a bug. ex2.pyhtml:
<div>
resutl:
$ python main.py ex2.pyhtml | cat -n
$ python main.py ex2.pyhtml | python
I hacked MyTempalte class again to solve this bug.
main2.py:
import tenjin
class MyTemplate(tenjin.Template):
def add_stmt(self, buf, code):
> len(self._spaces):
# buf[-1:-1] = (self._spaces, "if True: ## dummy
\n", ) if s and s.isspace() and s.find("\n") < 0: spc = self._spaces indent = ' ' * self.indent while len(s) > len(spc): buf[-1:-1] = (spc, "if True: ## dummy\n", ) spc += indent if self.newline == "\r\n": code = code.replace("\r\n", "\n") buf.append(code) if __name__ == '__main__':
result:
$ python main2.py ex2.pyhtml
This solves the bug, but notice that this hack inserts
I think that it is very hard to control indents accurately
--
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||