diff --git a/libcpychecker_html/extlib/prefixfree-1.0.4.min.js b/libcpychecker_html/extlib/prefixfree-1.0.4.min.js
deleted file mode 100644
index b1db0326..00000000
--- a/libcpychecker_html/extlib/prefixfree-1.0.4.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// StyleFix 1.0.2 & PrefixFree 1.0.4 / by Lea Verou / MIT license
-(function(){function h(a,b){return[].slice.call((b||document).querySelectorAll(a))}if(window.addEventListener){var b=window.StyleFix={link:function(a){try{if("stylesheet"!==a.rel||a.hasAttribute("data-noprefix"))return}catch(c){return}var d=a.href||a.getAttribute("data-href"),f=d.replace(/[^\/]+$/,""),g=a.parentNode,e=new XMLHttpRequest;e.open("GET",d);e.onreadystatechange=function(){if(4===e.readyState){var c=e.responseText;if(c&&a.parentNode){c=b.fix(c,!0,a);f&&(c=c.replace(/url\(((?:"|')?)(.+?)\1\)/gi,
-function(a,c,b){return!/^([a-z]{3,10}:|\/|#)/i.test(b)?'url("'+f+b+'")':a}),c=c.replace(RegExp("\\b(behavior:\\s*?url\\('?\"?)"+f,"gi"),"$1"));var d=document.createElement("style");d.textContent=c;d.media=a.media;d.disabled=a.disabled;d.setAttribute("data-href",a.getAttribute("href"));g.insertBefore(d,a);g.removeChild(a)}}};e.send(null);a.setAttribute("data-inprogress","")},styleElement:function(a){var c=a.disabled;a.textContent=b.fix(a.textContent,!0,a);a.disabled=c},styleAttribute:function(a){var c=
-a.getAttribute("style"),c=b.fix(c,!1,a);a.setAttribute("style",c)},process:function(){h('link[rel="stylesheet"]:not([data-inprogress])').forEach(StyleFix.link);h("style").forEach(StyleFix.styleElement);h("[style]").forEach(StyleFix.styleAttribute)},register:function(a,c){(b.fixers=b.fixers||[]).splice(void 0===c?b.fixers.length:c,0,a)},fix:function(a,c){for(var d=0;d
+ #
open('pygments_c.css', 'w').write(formatter.get_style_defs())
# Use pygments to convert it all to HTML:
@@ -127,7 +113,6 @@ def code(self):
return code
-
def header(self):
"""Make the header bar of the webpage"""
@@ -136,40 +121,35 @@ def header(self):
E.DIV(
E.ATTR(id='title'),
E.H1(
- 'GCC Python Plugin',
+ E.A(
+ 'GCC Python Plugin',
+ href='http://gcc-python-plugin.readthedocs.org/',
+ ),
),
E.DIV(
- E.ATTR(id='filename'),
+ E.ATTR(id='info'),
E.SPAN(
E.CLASS('label'),
'Filename: ',
),
self.data['filename'],
- ),
- ),
- E.E.nav(
- E.ATTR(id='nav'),
- E.DIV(
- E.ATTR(id='function'),
- E.H3('Function'),
+ E.SPAN(
+ E.CLASS('label'),
+ 'Function: ',
+ ),
self.data['function']['name'],
),
E.DIV(
E.ATTR(id='report-pagination'),
- E.H3('Report'),
+ E.SPAN(
+ E.CLASS('label'),
+ 'Report: ',
+ ),
*(
E.A(str(i + 1), href="#state{0}".format(i + 1))
for i in range(len(self.data['reports']))
)
),
- E.DIV(
- E.ATTR(id='bug-toggle'),
- E.IMG(
- src=data_uri('image/png', 'images/bug.png'),
- ),
- E.H3('Bug'),
- ' [count]',
- ),
E.DIV(
E.ATTR(id='prev'),
E.IMG(
@@ -183,7 +163,26 @@ def header(self):
),
),
),
- )
+ )
+
+ @staticmethod
+ def footer():
+ """put non-essential javascript in the footer"""
+ return E.E.footer(
+ # zepto is the one resource we don't embed.
+ # It's (relatively) big, and non-essential.
+ E.SCRIPT(
+ src=(
+ 'http://cdnjs.cloudflare.com'
+ '/ajax/libs/zepto/1.1.3/zepto.js'
+ ),
+ type='text/javascript',
+ ),
+ E.SCRIPT(
+ file_contents('script.js'),
+ type='text/javascript',
+ ),
+ )
def states(self):
"""Return an ordered-list of states, for each report."""
@@ -213,7 +212,7 @@ def states(self):
for note in report['notes']:
line = note['location'][0]['line']
- note = E.P({'class':'note'}, note['message'])
+ note = E.P({'class': 'note'}, note['message'])
# Put this note on the last matching state, if possible
for ann in reversed(tuple(annotations)):
@@ -223,13 +222,11 @@ def states(self):
break
elif line > annline:
ann.addnext(
- E.LI({'data-line': str(line)}, note)
+ E.LI({'data-line': str(line)}, note)
)
break
else:
- annotations.insert(0,
- E.LI({'data-line': str(line)}, note)
- )
+ annotations.insert(0, E.LI({'data-line': str(line)}, note))
yield annotations, report['message']
@@ -240,38 +237,44 @@ def body(self):
for i, (state_html, state_problem) in enumerate(self.states(), 1):
reports.append(
- E.LI(
- E.ATTR(id="state{0}".format(i)),
+ E.LI(
+ E.ATTR(id="state{0}".format(i)),
+ E.E.header(
+ E.DIV(
+ E.CLASS('error'),
+ state_problem,
+ ),
+ E.DIV(
+ E.CLASS('report-count'),
+ E.H3('Report'),
+ str(i),
+ ),
+ ),
+ E.DIV(
+ E.CLASS('body'),
E.DIV(
E.CLASS('source'),
- E.E.header(
- E.DIV(
- E.CLASS('error'),
- state_problem,
- ),
- E.DIV(
- E.CLASS('report-count'),
- E.H3('Report'),
- str(i),
- ),
- ),
deepcopy(code),
),
state_html,
),
+ ),
)
return E.BODY(
self.header(),
reports,
+ self.footer(),
)
+
def data_uri(mimetype, filename):
"""represent a file as a data uri"""
data = open(join(HERE, filename), 'rb').read()
data = data.encode('base64').replace('\n', '')
return 'data:%s;base64,%s' % (mimetype, data)
+
def file_contents(filename):
"""Add a leading newline to make the first line show up in the right spot.
"""
@@ -283,7 +286,7 @@ class CodeHtmlFormatter(HtmlFormatter):
def wrap(self, source, outfile):
yield 0, '
' % (
- self.linenostart,
+ self.linenostart,
)
for i, line in source:
if i == 1:
@@ -295,6 +298,7 @@ def wrap(self, source, outfile):
yield i, line
yield 0, '
'
+
def main(argv):
"""our entry point"""
if len(argv) < 3:
diff --git a/libcpychecker_html/script.js b/libcpychecker_html/script.js
index 88129d0a..517f9e7d 100644
--- a/libcpychecker_html/script.js
+++ b/libcpychecker_html/script.js
@@ -79,8 +79,8 @@ $(function() {
$.each(source_flow, function(idx, flow) {
// Lines mentioned in the flow get dots...
if (flow.length && flow[0].lineno == lineno) {
- var $new_cell = $('