From: Katie Gardner <5213160+KatieLG@users.noreply.github.com>
Date: Mon, 22 Sep 2025 13:19:37 +0000 (+0100)
Subject: gh-95953: Add a css class to changed lines of difflib.HtmlDiff make_table (#139226)
X-Git-Tag: v3.15.0a1~236
X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e642a24b50fa1ac2fa709cda233d1dc5c90333fe;p=thirdparty%2FPython%2Fcpython.git
gh-95953: Add a css class to changed lines of difflib.HtmlDiff make_table (#139226)
---
diff --git a/Lib/difflib.py b/Lib/difflib.py
index fedc85009aa0..4a0600e4ebb0 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -1924,8 +1924,11 @@ class HtmlDiff(object):
# make space non-breakable so they don't get compressed or line wrapped
text = text.replace(' ',' ').rstrip()
- return '
| f | | f | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -75,11 +75,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -91,11 +91,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -133,11 +133,11 @@
|
|
| f | | f | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -150,11 +150,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -167,11 +167,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -192,11 +192,11 @@
| 456 | | 456 |
| 456 | | 456 |
| | | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -209,11 +209,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -226,11 +226,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -247,11 +247,11 @@
|
|
| f | | f | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -263,11 +263,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | n | 1. Beautiful is beTTer than ugly. | n | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -279,11 +279,11 @@
| 123 | | 123 |
| 123 | | 123 |
| | | |
- | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
- | 2. Explicit is better than implicit. | | |
- | 3. Simple is better than complex. | | 3. Simple is better than complex. |
- | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
- | | | 5. Flat is better than nested. |
+ | t | 1. Beautiful is beTTer than ugly. | t | 1. Beautiful is better than ugly. |
+ | 2. Explicit is better than implicit. | | |
+ | 3. Simple is better than complex. | | 3. Simple is better than complex. |
+ | 4. Complex is better than complicated. | | 4. Complicated is better than complex. |
+ | | | 5. Flat is better than nested. |
| 123 | | 123 |
| 123 | | 123 |
| 123 | | 123 |
@@ -300,25 +300,25 @@
|
|
| f | | f | |
- | t | Line 1: preceded by from:[tt] to:[ssss] | t | Line 1: preceded by from:[tt] to:[ssss] |
- | Line 2: preceded by from:[sstt] to:[sssst] | | Line 2: preceded by from:[sstt] to:[sssst] |
- | Line 3: preceded by from:[sstst] to:[ssssss] | | Line 3: preceded by from:[sstst] to:[ssssss] |
- | Line 4: has from:[sst] to:[sss] after : | | Line 4: has from:[sst] to:[sss] after : |
- | Line 5: has from:[t] to:[ss] at end | | Line 5: has from:[t] to:[ss] at end |
+ | t | Line 1: preceded by from:[tt] to:[ssss] | t | Line 1: preceded by from:[tt] to:[ssss] |
+ | Line 2: preceded by from:[sstt] to:[sssst] | | Line 2: preceded by from:[sstt] to:[sssst] |
+ | Line 3: preceded by from:[sstst] to:[ssssss] | | Line 3: preceded by from:[sstst] to:[ssssss] |
+ | Line 4: has from:[sst] to:[sss] after : | | Line 4: has from:[sst] to:[sss] after : |
+ | Line 5: has from:[t] to:[ss] at end | | Line 5: has from:[t] to:[ss] at end |
| f | | f | |
- | t | Line 1: preceded by from:[tt] to:[ssss] | t | Line 1: preceded by from:[tt] to:[ssss] |
- | Line 2: preceded by from:[sstt] to:[sssst] | | Line 2: preceded by from:[sstt] to:[sssst] |
- | Line 3: preceded by from:[sstst] to:[ssssss] | | Line 3: preceded by from:[sstst] to:[ssssss] |
- | Line 4: has from:[sst] to:[sss] after : | | Line 4: has from:[sst] to:[sss] after : |
- | Line 5: has from:[t] to:[ss] at end | | Line 5: has from:[t] to:[ss] at end |
+ | t | Line 1: preceded by from:[tt] to:[ssss] | t | Line 1: preceded by from:[tt] to:[ssss] |
+ | Line 2: preceded by from:[sstt] to:[sssst] | | Line 2: preceded by from:[sstt] to:[sssst] |
+ | Line 3: preceded by from:[sstst] to:[ssssss] | | Line 3: preceded by from:[sstst] to:[ssssss] |
+ | Line 4: has from:[sst] to:[sss] after : | | Line 4: has from:[sst] to:[sss] after : |
+ | Line 5: has from:[t] to:[ss] at end | | Line 5: has from:[t] to:[ss] at end |