mirror of
https://github.com/python/cpython.git
synced 2025-10-27 03:34:32 +00:00
gh-95953: Add a css class to changed lines of difflib.HtmlDiff make_table (#139226)
This commit is contained in:
parent
72d5ee0511
commit
e642a24b50
4 changed files with 150 additions and 144 deletions
|
|
@ -1924,8 +1924,11 @@ def _format_line(self,side,flag,linenum,text):
|
|||
# make space non-breakable so they don't get compressed or line wrapped
|
||||
text = text.replace(' ',' ').rstrip()
|
||||
|
||||
return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \
|
||||
% (id,linenum,text)
|
||||
# add a class to the td tag if there is a difference on the line
|
||||
css_class = ' class="diff_changed" ' if flag else ' '
|
||||
|
||||
return f'<td class="diff_header"{id}>{linenum}</td>' \
|
||||
+ f'<td{css_class}nowrap="nowrap">{text}</td>'
|
||||
|
||||
def _make_prefix(self):
|
||||
"""Create unique anchor prefixes"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue