Mercurial > repos > rmarenco > hubarchivecreator
diff templates/display.txt @ 16:3233451a3bd6 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit fc73ec22a0db3ab09c4ac13dc58f0b54ae37845c
author | rmarenco |
---|---|
date | Sun, 25 Sep 2016 11:25:38 -0400 |
parents | acc233161f50 |
children |
line wrap: on
line diff
--- a/templates/display.txt Fri Sep 02 15:41:51 2016 -0400 +++ b/templates/display.txt Sun Sep 25 11:25:38 2016 -0400 @@ -5,11 +5,48 @@ The following has been generated by Hub Archive Creator: </p> <ul> - % for relative_file_path in list_relative_file_path: - <li> - <a href="${relative_file_path}">${relative_file_path}</a> - </li> - % endfor + ${print_tree(walkable_tree)} </ul> </body> -</html> \ No newline at end of file +</html> + +<%def name="print_tree(tree)"> + % if len(tree) == 0: + ## We do nothing, we are called by a leaf + ## If we are there, this is not normal though + ## TODO: Manage the error + return + % else: + % for vertex in tree: + % if len(tree[vertex][0]) > 0: + <li> + ${vertex} + </li> + <ul> + ${print_tree(tree[vertex][0])} + </ul> + % else: + <li> + <a href="${tree[vertex][1]}">${vertex}</a> + </li> + % endif + % endfor + % endif +</%def> + +<%doc> + def recurse_print_tree(tree, level): + if len(tree) == 0: + return + + for vertex in tree: + composite_name = vertex + bullet_point = '<li><a href="{0}>{0}</a></li>'.format(composite_name) + rval.append(bullet_point) + # Parent, so need to create a sub <ul> + if len(tree[vertex]) > 0: + rval.append('<ul>') + print_tree(tree[vertex], level+1) + rval.append('</ul>') + +</%doc> \ No newline at end of file