#3184: [patch] better unordered_list
------------------------------------+---------------------------------------
Reporter:  [EMAIL PROTECTED]  |        Owner:  adrian
Type: defect | Status: new Priority: normal | Milestone: Component: Template system | Version: SVN Severity: normal | Resolution: Keywords: | ------------------------------------+---------------------------------------
Changes (by simonbun <[EMAIL PROTECTED]>):

* cc: [EMAIL PROTECTED] (added)

Comment:

Hi, thanks for the patch.

I've mailed you about a small bug in the patch with arrays of 2+ depth.
Test case:

{{{
['page1', ['page2', ['page3', ['page4']]]]
}}}


At first i tried patching your patch, but i ended up rewriting it because
it was too complex for me.

I decided not to post my code as a diff seeing as it's not quite finished.
The original filter inserted newlines and tabs so that the html was
formatted nicely. Personally i have no need for this feature, so i didn't
implement it.

It shouldn't be much work though, so if someone is still reading this,
feel free to implement it.

code:
{{{
def unordered_list(value):

  def _recurse_children(parent):
    temp = ''

    for child in parent:
      temp += '<li>'

      if type(child) == ListType:
        temp += '<ul>' + _recurse_children(child) + '</ul>'
      else:
        temp += child

      temp += '</li>'

    return temp

  return _recurse_children(value)
}}}

Regards,
Simon

--
Ticket URL: <http://code.djangoproject.com/ticket/3184#comment:>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to