Edgewall Software

Opened 18 years ago

Closed 18 years ago

#38 closed enhancement (fixed)

[PATCH] Better support for multiline expressions

Reported by: cboos Owned by: cmlenz
Priority: minor Milestone: 0.3
Component: Template processing Version: 0.2
Keywords: Cc:

Description

Since r231, one can write multiline full expressions, i.e.

This complex value: ${...
 ... 
...}

However, this doesn't match well with Python syntax which doesn't tolerate white space in front of an expression (wrong indentation level issue).

As I can't think of any instance where this leading space may actually be expected or valid, I propose to simply left strip the white space on expressions, thereby making multiline expressions even easier and cleaner to write.

This complex value: ${
   ...
   ... # compute the value
   ...}

Trivial patch:

  • template.py

     
    844844            for idx, group in enumerate(patterns.pop(0).split(text)):
    845845                if idx % 2:
    846846                    try:
     847                        group = group.lstrip()                       
    847848                        yield EXPR, Expression(group, filename, lineno), \
    848849                              (filename, lineno, offset)
    849850                    except SyntaxError, err:

Change History (2)

comment:1 Changed 18 years ago by cmlenz

  • Status changed from new to assigned

Yeah, good idea. Thanks!

comment:2 Changed 18 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from assigned to closed

Applied in [241].

Note: See TracTickets for help on using tickets.