Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
diffoscope
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reproducible Builds
diffoscope
Commits
f51a5f1a
Commit
f51a5f1a
authored
8 years ago
by
Chris Lamb
Browse files
Options
Downloads
Patches
Plain Diff
presenters/html.py: Use html.escape over xml.sax.saxutils.escape.
Signed-off-by:
Chris Lamb
<
lamby@debian.org
>
parent
779b6469
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diffoscope/presenters/html.py
+7
-9
7 additions, 9 deletions
diffoscope/presenters/html.py
with
7 additions
and
9 deletions
diffoscope/presenters/html.py
+
7
−
9
View file @
f51a5f1a
...
...
@@ -40,8 +40,6 @@ import codecs
import
hashlib
import
contextlib
from
xml.sax.saxutils
import
escape
from
diffoscope
import
logger
,
VERSION
from
diffoscope.config
import
Config
from
diffoscope.presenters.icon
import
FAVICON_BASE64
...
...
@@ -503,7 +501,7 @@ def output_unified_diff(print_func, css_url, directory, unified_diff):
output_footer
(
new_print_func
)
print_func
(
"
<div class=
'
ondemand
'
>
\n
"
)
print_func
(
"
... <a href=
'
%s
'
>load diff</a> ...
\n
"
%
escape
(
filename
))
print_func
(
"
... <a href=
'
%s
'
>load diff</a> ...
\n
"
%
html
.
escape
(
filename
))
print_func
(
"
</div>
\n
"
)
else
:
...
...
@@ -517,18 +515,18 @@ def output_difference(difference, print_func, css_url, directory, parents):
print_func
(
u
"
<div class=
'
diffheader
'
>
"
)
if
difference
.
source1
==
difference
.
source2
:
print_func
(
u
"
<div><span class=
'
source
'
>%s<span>
"
%
escape
(
difference
.
source1
))
%
html
.
escape
(
difference
.
source1
))
else
:
print_func
(
u
"
<div><span class=
'
source
'
>%s</span> vs.</div>
"
%
escape
(
difference
.
source1
))
%
html
.
escape
(
difference
.
source1
))
print_func
(
u
"
<div><span class=
'
source
'
>%s</span>
"
%
escape
(
difference
.
source2
))
%
html
.
escape
(
difference
.
source2
))
anchor
=
'
/
'
.
join
(
sources
[
1
:])
print_func
(
u
"
<a class=
'
anchor
'
href=
'
#%s
'
name=
'
%s
'
>
\xb6
</a>
"
%
(
anchor
,
anchor
))
print_func
(
u
"
</div>
"
)
if
difference
.
comments
:
print_func
(
u
"
<div class=
'
comment
'
>%s</div>
"
%
u
'
<br />
'
.
join
(
map
(
escape
,
difference
.
comments
)))
%
u
'
<br />
'
.
join
(
map
(
html
.
escape
,
difference
.
comments
)))
print_func
(
u
"
</div>
"
)
if
difference
.
unified_diff
:
output_unified_diff
(
print_func
,
css_url
,
directory
,
difference
.
unified_diff
)
...
...
@@ -546,7 +544,7 @@ def output_header(css_url, print_func):
css_link
=
'
<link href=
"
%s
"
type=
"
text/css
"
rel=
"
stylesheet
"
/>
'
%
css_url
else
:
css_link
=
''
print_func
(
HEADER
%
{
'
title
'
:
escape
(
'
'
.
join
(
sys
.
argv
)),
print_func
(
HEADER
%
{
'
title
'
:
html
.
escape
(
'
'
.
join
(
sys
.
argv
)),
'
favicon
'
:
FAVICON_BASE64
,
'
css_link
'
:
css_link
,
})
...
...
@@ -620,5 +618,5 @@ def output_html_directory(directory, difference, css_url=None, jquery_url=None):
print_func
(
u
"
<div class=
'
error
'
>Max output size reached.</div>
"
,
force
=
True
)
if
jquery_url
:
print_func
(
SCRIPTS
%
{
'
jquery_url
'
:
escape
(
jquery_url
)},
force
=
True
)
print_func
(
SCRIPTS
%
{
'
jquery_url
'
:
html
.
escape
(
jquery_url
)},
force
=
True
)
output_footer
(
print_func
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment