Mercurial > repos > rmarenco > hubarchivecreator
comparison 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 |
comparison
equal
deleted
inserted
replaced
15:2a45cd656e8e | 16:3233451a3bd6 |
---|---|
3 <body> | 3 <body> |
4 <p> | 4 <p> |
5 The following has been generated by Hub Archive Creator: | 5 The following has been generated by Hub Archive Creator: |
6 </p> | 6 </p> |
7 <ul> | 7 <ul> |
8 % for relative_file_path in list_relative_file_path: | 8 ${print_tree(walkable_tree)} |
9 <li> | |
10 <a href="${relative_file_path}">${relative_file_path}</a> | |
11 </li> | |
12 % endfor | |
13 </ul> | 9 </ul> |
14 </body> | 10 </body> |
15 </html> | 11 </html> |
12 | |
13 <%def name="print_tree(tree)"> | |
14 % if len(tree) == 0: | |
15 ## We do nothing, we are called by a leaf | |
16 ## If we are there, this is not normal though | |
17 ## TODO: Manage the error | |
18 return | |
19 % else: | |
20 % for vertex in tree: | |
21 % if len(tree[vertex][0]) > 0: | |
22 <li> | |
23 ${vertex} | |
24 </li> | |
25 <ul> | |
26 ${print_tree(tree[vertex][0])} | |
27 </ul> | |
28 % else: | |
29 <li> | |
30 <a href="${tree[vertex][1]}">${vertex}</a> | |
31 </li> | |
32 % endif | |
33 % endfor | |
34 % endif | |
35 </%def> | |
36 | |
37 <%doc> | |
38 def recurse_print_tree(tree, level): | |
39 if len(tree) == 0: | |
40 return | |
41 | |
42 for vertex in tree: | |
43 composite_name = vertex | |
44 bullet_point = '<li><a href="{0}>{0}</a></li>'.format(composite_name) | |
45 rval.append(bullet_point) | |
46 # Parent, so need to create a sub <ul> | |
47 if len(tree[vertex]) > 0: | |
48 rval.append('<ul>') | |
49 print_tree(tree[vertex], level+1) | |
50 rval.append('</ul>') | |
51 | |
52 </%doc> |