forked from vollnhals/jsTree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_nodes.py
26 lines (20 loc) · 1.04 KB
/
create_nodes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import random
import sys
idx = 0
f = file("american-words.95", "r")
words = f.readlines();
def get_word():
return words[random.randint(0, len(words) - 1)].strip()
for i in range(int(sys.argv[1])):
print "<li rel='drive' id='node_" + str(idx) + "'><ins class='jstree-icon'> </ins><a href=''><ins class='jstree-icon'> </ins>" + get_word() + "</a>" + "<span>" + get_word() + "</span>",
idx += 1
print "<ul>",
for j in range(random.randint(1, 10)):
print "<li rel='folder' id='node_" + str(idx) + "'><ins class='jstree-icon'> </ins><a href=''><ins class='jstree-icon'> </ins>" + get_word() + "</a>"+ "<span>" + get_word() + "</span>",
idx += 1
print "<ul>",
for k in range(random.randint(1, 10)):
print "<li rel='default' id='node_" + str(idx) + "'><ins class='jstree-icon'> </ins><a href=''><ins class='jstree-icon'> </ins>" + get_word() + "</a>" + "<span>" + get_word() + "</span></li>",
idx += 1
print "</ul></li>",
print "</ul></li>"