Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
85822df8
Commit
85822df8
authored
Apr 25, 2014
by
Matthias BUSSONNIER
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use css class for styling
parent
b3803e6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Cython/Compiler/Annotate.py
Cython/Compiler/Annotate.py
+9
-4
No files found.
Cython/Compiler/Annotate.py
View file @
85822df8
...
...
@@ -58,7 +58,12 @@ class AnnotationCCodeWriter(CCodeWriter):
def
_css
(
self
):
"""css template will later allow to choose a colormap"""
return
self
.
_css_template
css
=
self
.
_css_template
for
i
in
range
(
255
):
color
=
u"FFFF%02x"
%
int
(
255
/
(
1
+
i
/
10.0
))
css
=
css
+
'
\
n
.cython.score-%s {background-color: #%s;}'
%
(
str
(
i
),
color
)
return
css
_js
=
"""
function toggleDiv(id) {
...
...
@@ -186,8 +191,8 @@ body { font-family: courier; font-size: 12; }
code
=
_parse_code
(
annotate
,
code
)
score
=
(
5
*
calls
[
'py_c_api'
]
+
2
*
calls
[
'pyx_c_api'
]
+
calls
[
'py_macro_api'
]
+
calls
[
'pyx_macro_api'
])
color
=
u"FFFF%02x"
%
int
(
255
/
(
1
+
score
/
10.0
))
outlist
.
append
(
u"<pre class='cython line
' style='background-color: #%s' onclick='toggleDiv(
\
"
line%s
\
"
)'>"
%
(
color
,
k
))
#
color = u"FFFF%02x" % int(255/(1+score/10.0))
outlist
.
append
(
u"<pre class='cython line
score-%s' onclick='toggleDiv(
\
"
line%s
\
"
)'>"
%
(
score
,
k
))
outlist
.
append
(
u" %d: "
%
k
)
for
c
,
cc
,
html
in
special_chars
:
...
...
@@ -195,7 +200,7 @@ body { font-family: courier; font-size: 12; }
outlist
.
append
(
line
.
rstrip
())
outlist
.
append
(
u'</pre>
\
n
'
)
outlist
.
append
(
u"<pre id='line%s' class='cython code
' style='background-color: #%s'>%s</pre>"
%
(
k
,
color
,
code
))
outlist
.
append
(
u"<pre id='line%s' class='cython code
score-%s' >%s</pre>"
%
(
k
,
score
,
code
))
return
outlist
_parse_code
=
re
.
compile
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment