if post.body is a string, you can do post.body[:30]  like you would do with 
a normal python string. You can't get fancy with a post.body[:27] + '...' 
just for the sake of being "polite.

The problem in your code is that you're "truncating" a source of something 
that needs to be truncated at the right position.....e.g. if you're inside 
a blockquote and you don't close the "quote", you'll be left with an 
"uncorrect" representation of the truncated markmin .....

e.g.

- a list
-- ``web2py
lorem ipsum etcetcetc
...
....
``:code


if your truncation leaves the last line out, the generated HTML might not 
be correct. 


On Monday, January 14, 2013 5:52:49 PM UTC+1, [email protected] wrote:
>
> {{ for post in posts:}}
>    <h2>
>      <a href="{{=URL(r=request,f='view_post',args=post.id)}}">
>        {{=post.title}}
>      </a>
>    </h2>
> {{=WIKI(post.body|truncate:30)}}
> {{pass}}
>
> Thanks in avance. something similar to Django |truncate:x
>

-- 



Reply via email to