Skip to content
This repository was archived by the owner on Aug 5, 2023. It is now read-only.

Commit 77ef3ee

Browse files
committed
Move CSS styling to separate file
1 parent 9405cca commit 77ef3ee

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include imongo/style.css

imongo/kernel.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ def _pretty_output(json_data, show_levels=2):
214214

215215
obj_uuid = str(uuid.uuid4())
216216
html_str = '<style>{}></style><div id="{}"></div>'
217-
html_str = html_str.format(utils.css, obj_uuid)
217+
css_path = os.path.join(os.path.split(__file__)[0], 'style.css')
218+
with open(css_path) as f:
219+
css = f.read().replace(' ', '').replace('\n', '')
220+
html_str = html_str.format(css, obj_uuid)
218221
js_str = 'require(["https://rawgit.com/caldwell/renderjson/master/renderjson.js"],' \
219222
' function() {document.getElementById(\'%s\').appendChild(' \
220223
'renderjson.set_show_to_level(%d)(%s))});'

imongo/style.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
a.disclosure:link {
2+
text-decoration: none;
3+
}
4+
a.disclosure:visited {
5+
text-decoration: none;
6+
}
7+
.disclosure {
8+
color: #337AB7; font-size: 150%;
9+
}
10+
.syntax {
11+
color: grey;
12+
}
13+
.string {
14+
color: #9A334F;
15+
}
16+
.number{
17+
color: #5C9632;
18+
}
19+
.boolean {
20+
color: #AA9739;
21+
}
22+
.key {
23+
color: #403075;
24+
}
25+
.keyword {
26+
color: #AA9739;
27+
}
28+
.object.syntax {
29+
color: #337AB7;
30+
}
31+
.array.syntax {
32+
color: #337AB7;
33+
}

imongo/utils.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,3 @@ def catcher(*args, **kwargs):
3636
return None
3737

3838
return catcher
39-
40-
41-
css = """
42-
a.disclosure:link { text-decoration: none; }
43-
a.disclosure:visited { text-decoration: none; }
44-
.disclosure { color: #337AB7; font-size: 150%;}
45-
.syntax { color: grey; }
46-
.string { color: #9A334F; }
47-
.number { color: #5C9632; }
48-
.boolean { color: #AA9739; }
49-
.key { color: #403075; }
50-
.keyword { color: #AA9739; }
51-
.object.syntax { color: #337AB7; }
52-
.array.syntax { color: #337AB7; }
53-
""".replace(' ', '').replace('\n', '')
54-
55-
# .disclosure ("⊕", "⊖") FIFTH
56-
# .syntax (",", ":", "{", "}", "[", "]") GREY
57-
# .string (includes quotes) SECONDARY
58-
# .number THIRD
59-
# .boolean FIFTH AA9739
60-
# .key (object key) PRIMARY
61-
# .keyword ("null", "undefined") FIFTH
62-
# .object.syntax ("{", "}") GREY
63-
# .array.syntax ("[", "]") GREY

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def run(self):
4444
packages=['imongo'],
4545
cmdclass={'install': Installer},
4646
license='MIT',
47+
include_package_data=True,
4748
install_requires=['jupyter>=1.0.0',
4849
'ipykernel',
4950
'pexpect>=4.2.1',

0 commit comments

Comments
 (0)