To make tab/space runs, this is the function I use function getIndentSpaces pLevel put space into line (pLevel*4) of tempp replace cr with space in tempp return tempp end getIndentSpaces
put 1 into tDepth put "Al, child of the first marriage" into childString put getIndentSpaces(tDepth) & childString & cr after listing add 1 to tDepth put "Betty, child of Al" into childString put getIndentSpaces(tDepth) & childString & cr after listing put listing into msg ----------------- --the same technique will work with put space into item (pLevel*4) of tempp replace comma with space in tempp Of course you could use TAB instead of space. Jim Ault Las Vegas On 9/11/08 6:21 PM, "Alex Tweedly" <[EMAIL PROTECTED]> wrote: > >> function buildTree pInput >> # given indented outline of a 'forest' (i.e. multiple rooted trees) >> build the tree-like data structure >> set the itemDel to TAB >> put empty into lParents >> put 0 into lCurNode # the top-level pseudo-node >> put -1 into lCurDepth # -1 to allow for the top-level pseudo-node >> put 0 into lCount >> repeat for each line L in pInput >> >> put getDepth(L) into tDepth >> if tDepth < lCurDepth then >> # we have popped back up 1 or more levels >> put tDepth into lCurDepth >> if tDepth = 0 then >> put 0 into lCurNode >> else >> #put item tDepth+2 of lParents into lCurNode >> put lCount into lCurNode >> >> end if >> else >> if tDepth = lCurDepth then >> # another node at the same level - no change needed >> put lCount into lCurNode >> else >> if tDepth > lCurDepth+1 then # badly formed input !! >> # should probably do something more extreme here >> return empty >> end if >> # so we are here with a new increase in indent level >> put lCurNode & TAB after lParents >> >> end if >> end if >> put L into Data[lCount, 'text'] >> put item -1 of lParents into tParent >> put tParent into Data[lCount, 'parent'] >> put lCount & TAB after Data[tParent, 'children'] >> put tDepth into lCurDepth >> end repeat >> return Data >> end buildTree _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
