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
128f1d77
Commit
128f1d77
authored
Sep 01, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some HTML issues in annotation file
parent
57cbbc21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
Cython/Compiler/Annotate.py
Cython/Compiler/Annotate.py
+10
-7
No files found.
Cython/Compiler/Annotate.py
View file @
128f1d77
...
...
@@ -11,9 +11,11 @@ from Code import CCodeWriter
from
Cython
import
Utils
# need one-characters subsitutions (for now) so offsets aren't off
special_chars
=
[(
u'<'
,
u'
\
xF0
'
,
u'<'
),
(
u'>'
,
u'
\
xF1
'
,
u'>'
),
(
u'&'
,
u'
\
xF2
'
,
u'&'
)]
special_chars
=
[
(
u'&'
,
u'
\
xF2
'
,
u'&'
),
(
u'<'
,
u'
\
xF0
'
,
u'<'
),
(
u'>'
,
u'
\
xF1
'
,
u'>'
),
]
line_pos_comment
=
re
.
compile
(
r'/\
*.*?<<<<<<<<<<<<<<.*?
\*/\n*'
,
re
.
DOTALL
)
...
...
@@ -57,8 +59,7 @@ class AnnotationCCodeWriter(CCodeWriter):
self
.
mark_pos
(
None
)
f
=
Utils
.
open_source_file
(
source_filename
)
lines
=
f
.
readlines
()
for
k
in
range
(
len
(
lines
)):
line
=
lines
[
k
]
for
k
,
line
in
enumerate
(
lines
):
for
c
,
cc
,
html
in
special_chars
:
line
=
line
.
replace
(
c
,
cc
)
lines
[
k
]
=
line
...
...
@@ -86,6 +87,7 @@ class AnnotationCCodeWriter(CCodeWriter):
html_filename
=
os
.
path
.
splitext
(
target_filename
)[
0
]
+
".html"
f
=
codecs
.
open
(
html_filename
,
"w"
,
encoding
=
"UTF-8"
)
f
.
write
(
u'<!DOCTYPE html>
\
n
'
)
f
.
write
(
u'<!-- Generated by Cython %s -->
\
n
'
%
Version
.
watermark
)
f
.
write
(
u'<html>
\
n
'
)
f
.
write
(
u"""
...
...
@@ -147,8 +149,9 @@ function toggleDiv(id) {
code = code_source_file[k]
except KeyError:
code = ''
code = code.replace('
<
', '
<
code
><</
code
>
')
else:
for c, cc, html in special_chars:
code = code.replace(c, html)
code, py_c_api_calls = py_c_api.subn(ur"<span class='
py_c_api
'>
\
1
</span>(", code)
code, pyx_c_api_calls = pyx_c_api.subn(ur"<span class='
pyx_c_api
'>
\
1
</span>(", code)
...
...
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