I have just completed a patch to make curly-braces {} work in
PSP pages. It was fairly easy to tie in due to the very clean and
rational PSP code! It still needs more testing but it seems fairly
robust so far. Basically, it eliminates reliance on indentation in PSPs
but the code is still line oriented in that the newline is still the
statement separator and the block-opening curly-brace must appear as the
last non-comment character on a line. Closing braces can appear just
about anywhere allowing the following:
<%@ page indentType="braces" method="writeHTML" %>
<table>
<% for x in range(10) { %>
<TR>
<% for y in range(10) {
if y%2 { %>
<TD bgcolor='red'>red
<% } else { %>
<TD bgcolor='blue'>blue
<% } %>
</TD>
<% } %>
</TR>
<% } %>
If anyone is interested in this it consists of a minor patch to
Generators.py,ParseEventHandler.py, and ServletWriter.py plus a new 4k
file BraceConverter.py which I can email (sending to the list doesn't
seem appropriate even though it is small)
In the course of this, I also removed a break statement from
ParseEventHandler.py:165 which was preventing the page directive from
processing more than one attribute.
|