Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Kushal Kumaran
On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert nicogrub...@yahoo.de wrote: Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},        {'indent': 1, 'title':'Item 2', 'hassubfolder':False},        {'indent': 1,

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Stefan Behnel
Nico Grubert, 30.06.2010 10:34: I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub Item 1.1',

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
Use a stack? Whenever you start a new list, push the corresponding closing tag onto a stack. Whenever your indent level decreases, pop the stack and write out the closing tag you get. It's straightforward to use a python list as a stack. Thanks for the tip, Kushal. Do you have a short code

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Remi Carton
Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2,

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Dave Angel
Nico Grubert wrote: Use a stack? Whenever you start a new list, push the corresponding closing tag onto a stack. Whenever your indent level decreases, pop the stack and write out the closing tag you get. It's straightforward to use a python list as a stack. Thanks for the tip, Kushal.

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Jorgen Grahn
On Wed, 2010-06-30, Kushal Kumaran wrote: On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert nicogrub...@yahoo.de wrote: Dear list members I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},        {'indent': 1, 'title':'Item 2',

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Daniel Fetchinson
I have this python list that represets a sitemap: tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False}, {'indent': 1, 'title':'Item 2', 'hassubfolder':False}, {'indent': 1, 'title':'Folder 1', 'hassubfolder':True}, {'indent': 2, 'title':'Sub Item 1.1',