| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1f511e1 commit 78de011
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2036,6 +2036,10 @@ def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False, | |||
| 2036 | 2036 | s.append( fmt % (next_id[i],next_href[i],fromlist[i], | |
| 2037 | 2037 | next_href[i],tolist[i])) | |
| 2038 | 2038 | if fromdesc or todesc: | |
| 2039 | + fromdesc = fromdesc.replace("&", "&").replace(">", ">") \ | ||
| 2040 | + .replace("<", "<") | ||
| 2041 | + todesc = todesc.replace("&", "&").replace(">", ">") \ | ||
| 2042 | + .replace("<", "<") | ||
| 2039 | 2043 | header_row = '<thead><tr>%s%s%s%s</tr></thead>' % ( | |
| 2040 | 2044 | '<th class="diff_next"><br /></th>', | |
| 2041 | 2045 | '<th colspan="2" class="diff_header">%s</th>' % fromdesc, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -238,6 +238,15 @@ def test_html_diff(self): | |||
| 238 | 238 | with open(findfile('test_difflib_expect.html')) as fp: | |
| 239 | 239 | self.assertEqual(actual, fp.read()) | |
| 240 | 240 | ||
| 241 | + def test_make_table_escape_table_header(self): | ||
| 242 | + html_diff = difflib.HtmlDiff() | ||
| 243 | + output = html_diff.make_table(patch914575_from1.splitlines(), | ||
| 244 | + patch914575_to1.splitlines(), | ||
| 245 | + fromdesc='<from>', | ||
| 246 | + todesc='<to>') | ||
| 247 | + self.assertIn('<from>', output) | ||
| 248 | + self.assertIn('<to>', output) | ||
| 249 | + | ||
| 241 | 250 | def test_recursion_limit(self): | |
| 242 | 251 | # Check if the problem described in patch #1413711 exists. | |
| 243 | 252 | limit = sys.getrecursionlimit() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + Escape table header output of :meth:`difflib.HtmlDiff.make_table`. | ||
| 2 | + Patch by Karthikeyan Singaravelan. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments