|
From: <eng...@ss...> - 2002-07-04 12:57:52
|
On Wed, 3 Jul 2002, Adam Chodorowski wrote: > On Tue, 02 Jul 2002 21:48:20 -0400 David Goodger > <go...@us...> wrote: > > > Adam Chodorowski wrote: > > > Is there any plan for adding a "tree" construct to reST? It would be > > > very useful for many things, for example displaying directory > > > trees. You could use the following syntax (if it isn't ambigous, I > > > don't know...): > > > > > > + Root > > > +- Child 1 > > > | +- Grandchild 1.1 > > > | +- Grandchild 1.2 > > > +- Child 2 > > > > No plans; this is the first request I've seen. The syntax as given > > *is* ambiguous: the "+" looks like a bullet. It could easily be made > > unambiguous though (for example, use "+-" throughout). > > > > What's the difference between a tree and a nested list? You could > > simply represent it like this: > > [example] > > > The list has a little more vertical space, but contains the same > > information. > > Yes, conceptually nested lists and a tree are basically the same. One problem > with the former is exactly the extra whitespace, which makes it impractical to > really use for larger trees. > > The other part is mostly about presentation: nested lists are presented quite > differently from how I would like trees to be (like my example with lines and > such (which is IMHO actually useful for people reading the document)). Also, > it would be quite easy to detect "interior nodes" and "leafe nodes", and you > could vary the output accordingly (eg. put a directory icon before the > interior ones, file icon before leaves). > > > Literal blocks (ASCII art) would be an easy way to get started. > > Depending on what processing ought to be done to the tree, this > > may be an adequate solution. > > Perhaps a directive followed by nested lists would be enough. The directive > could simply wrap the lists with "this is really a tree", so it is possible to > make the output look different (eg. the HTML writer could wrap it in <div > class="tree"> so you could use the stylesheet to reduce vertical spacing etc) > from regular nested lists (which you might want to use for other things). Eg.: > > .. tree:: > > Root > > + Child 1 > > + Grandchild 1.1 > + Grandchild 1.2 > > + Child 2 tree shows this in my home . |-- #pico17523# |-- CVS-RCS-HOWTO.gz |-- DSC48kl.jpg |-- Desktop | |-- Autostart | `-- zip `-- zip on nt +---bin | +---arj32 | +---hexview | \---mysql +---FilZip 2000 +---Install | +---3com alternative +- Root +- Child 1 | +- Grandchild 1.1 | +- Grandchild 1.2 +- Child 2 if the parser recognizes the "+-" as tree start. ending by "\" or "`" might easy the parser. -- BINGO: Wie gehts Ihnen mit ...? --- Engelbert Gruber -------+ SSG Fintl,Gruber,Lassnig / A6410 Telfs Untermarkt 9 / Tel. ++43-5262-64727 ----+ |