Here's what I do to make code mixed with HTML in PSP files manageable. =
Your
mileage may vary...
What I do is indent "code" lines (the <%%> blocks) independently from =
the
HTML indentation. Also, I only use a single line of code in a <% %> =
block,
keep it to a single line, and never have a code block and HTML on the =
same
line. The exception is a multi-line chunk of code at the top of the =
file
for setup.
The <%=3D %> blocks are indented with the HTML, not the code, because =
they
represent output, not control flow.
For example:
<%
Multi line setup code
goes here
%>
<div>
<table>
<%for i in range(10):%>
<tr>
<%for j in range(10):%>
<td>
<%=3Di%>,<%=3Dj%>
</td>
<%end%>
</tr>
<%end%>
</table>
</div>
Notice how the "code" as defined by the <%%> blocks is indented
independently of the HTML, which is typically much more deeply nested =
than
the code.
This might look messy in plain text, but if you use a syntax =
highlighting
editor that makes the <%%> blocks stand out, then it's easy to see the =
code
structure and the HTML structure at the same time.
- Geoff
Winston Wolff wrote:
> Indentation is indeed awkward with PSP files. I personally use
> Cheetah instead.
>=20
> -ww
>=20
> On Dec 1, 2004, at 4:08 PM, Douglas Soares de Andrade wrote:
>=20
>> Hi !
>>=20
>> I have a feature request to PSP.
>>=20
>> See the example:
>>=20
>> <%
>> res.write("This is a test and works.")
>> %>
>>=20
>> <html>
>> <tr>
>> <td>
>> <%
>> res.write("This block will not work.")
>> %>
>> </td>
>> </tr>
>> </html>
>>=20
>> The code above dont work, to make it work i had to do:
>>=20
>> <html>
>> <tr>
>> <td>
>> <%
>> res.write("This block will not work.")
>> %>
>> </td>
>> </tr>
>> </html>
>>=20
>> This works... But, isn't there a way to make the n=BA 01 code work ?
>> This will be more legible and will make the output of the PSP script
>> follow the entire html identation.
>>=20
>> Thanks !
>>=20
>> --
>> Douglas Soares de Andrade - UnilesteMG
>> dsa em unilestemg.br - Linux User: #237615
>> http://douglasandrade.tk
>>=20
>>=20
>>=20
>> -------------------------------------------------------
>> SF email is sponsored by - The IT Product Guide
>> Read honest & candid reviews on hundreds of IT Products from real
>> users. Discover which products truly live up to the hype. Start
>> reading now. http://productguide.itmanagersjournal.com/
>> _______________________________________________
>> Webware-discuss mailing list
>> Webware-discuss@...
>> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>=20
>=20
>=20
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real
> users. Discover which products truly live up to the hype. Start
> reading now. http://productguide.itmanagersjournal.com/
> _______________________________________________
> Webware-discuss mailing list
> Webware-discuss@...
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
|