Mercurial > repos > yating-l > hubarchivecreator
comparison templates/display.txt @ 0:f493979f1408 draft default tip
planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
author | yating-l |
---|---|
date | Wed, 21 Dec 2016 12:13:04 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f493979f1408 |
---|---|
1 <%namespace name="os" module="os"/> | |
2 <html> | |
3 <body> | |
4 <p> | |
5 The following has been generated by Hub Archive Creator: | |
6 </p> | |
7 <ul> | |
8 ${print_tree(walkable_tree)} | |
9 </ul> | |
10 </body> | |
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> |