forked from ISI-TechKnAcq/techknacq-tk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreading-list
More file actions
executable file
·69 lines (57 loc) · 1.33 KB
/
reading-list
File metadata and controls
executable file
·69 lines (57 loc) · 1.33 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
# TechKnAcq: Generate reading list
# Jonathan Gordon
import sys
import click
from techknacq.conceptgraph import ConceptGraph
from techknacq.readinglist import ReadingList
# User model constants
BEGINNER = 5
INTERMEDIATE = 4
ADVANCED = 3
@click.command()
@click.option('--form', default='text',
type=click.Choice(['text', 'html', 'tsv']))
@click.argument('concept_graph', type=click.Path(exists=True))
@click.argument('query', nargs=-1)
def main(concept_graph, query, form):
cg = ConceptGraph(click.format_filename(concept_graph))
if form == 'html':
print("""
<html>
<head>
<title>Reading List</title>
<style type="text/css">
body {
font: 12pt 'Univers LT Std', 'Helvetica Neue', Helvetica, sans-serif;
max-width: 600pt;
margin: 4pc auto;
}
dl, dt, dd, ul, li { margin: 0; padding: 0; }
dt {
margin-top: 12pt;
font-weight: bold;
}
dd {
margin-top: 6pt;
margin-left: 1pt;
border-left: 6pt solid #ccc;
padding-left: 12pt;
}
li {
list-style-type: none;
margin-bottom: 6pt;
}
</style>
</head>
<body>
<h1>Reading List</h1>""")
learner_model = {}
for c in cg.concepts():
learner_model[c] = BEGINNER
r = ReadingList(cg, query, learner_model)
r.print(form=form)
if form == 'html':
print('</body></html>')
if __name__ == '__main__':
main()