django template slice css behaviour -
i working on small blogging engine fun allows html contents. on home page every blog post sliced 500 , displayed.
while coding element struck me such slice dangerous. assuming there <b></b>
tag in blog post sliced after tag opened, make every other content of home page become bold.
i wondering if django has mechanism slice after html element has been closed or if there other way in such problem can solved.
the truncatewords_html
template filter takes account tags might have been opened not closed given slice.
take in docs at: https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#truncatewords-html filter's use , have @ line 140 in django/utils/text.py @ _html_words()
function leveraged truncatewords_html
Comments
Post a Comment