Skip to content

Commit df7f50a

Browse files
committed
grab zepto from cdn, rather than embedding.
1 parent 1d80e1a commit df7f50a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

libcpychecker_html/make_html.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
These reports should be usable as email attachments, offline.
44
This means we need to embed *all* our assets.
55
6-
TODO: #11 optimize the filesize
6+
We make an exception for zepto; it's (relatively) big, and the behaviors
7+
it adds are non-essential to reading the report.
78
"""
89
from __future__ import print_function
910
from __future__ import unicode_literals
@@ -79,13 +80,16 @@ def head(self):
7980
)
8081
for css in ('extlib/reset-20110126.min', 'pygments_c', 'style')
8182
)
83+
head.append(E.SCRIPT(
84+
src='http://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.3/zepto.js',
85+
type='text/javascript',
86+
))
8287
head.extend(
8388
E.SCRIPT(
8489
file_contents(js + '.js'),
8590
type='text/javascript',
8691
)
8792
for js in (
88-
'extlib/zepto-1.1.3.min',
8993
'extlib/prefixfree-1.0.4.min',
9094
'script'
9195
)
@@ -263,12 +267,14 @@ def body(self):
263267
)
264268

265269
def data_uri(mimetype, filename):
266-
"represent a file as a data uri"
267-
data = open(join(HERE, filename), 'rb').read().encode('base64').replace('\n', '')
270+
"""represent a file as a data uri"""
271+
data = open(join(HERE, filename), 'rb').read()
272+
data = data.encode('base64').replace('\n', '')
268273
return 'data:%s;base64,%s' % (mimetype, data)
269274

270275
def file_contents(filename):
271-
# The leading newline makes the first line show up in the right spot.
276+
"""Add a leading newline to make the first line show up in the right spot.
277+
"""
272278
return '\n' + open(join(HERE, filename)).read()
273279

274280

0 commit comments

Comments
 (0)