prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  La comparaison des versions a perdu sa sidebar
  ## Étapes pour reproduire 
  
  - prenez un tuto avec plusieurs éditions
  - cliquer sur "comparer les versions"
  - sélectionner deux versions
  
  **Comportement observé**
  
  la sidebar n'apparaît pas dans la page de comparaison des versions
  
  **Comportement désiré**
  
  La sidebar est là.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `zds/utils/templatetags/htmldiff.py`
  Content:
  ```
  1 from difflib import HtmlDiff
  2 from django import template
  3 from django.utils.html import format_html
  4 from django.utils.safestring import mark_safe
  5 from django.utils.translation import ugettext_lazy as _
  6 
  7 
  8 register = template.Library()
  9 
  10 
  11 @register.simple_tag
  12 def htmldiff(string1, string2):
  13 
  14     try:
  15         txt1 = string1.decode('utf-8').splitlines()
  16     # string1 is an empty SafeText from template
  17     except AttributeError:
  18         txt1 = string1.splitlines()
  19 
  20     try:
  21         txt2 = string2.decode('utf-8').splitlines()
  22     except AttributeError:
  23         txt2 = string2.splitlines()
  24 
  25     diff = HtmlDiff(tabsize=4, wrapcolumn=80)
  26     result = diff.make_table(txt1, txt2, context=True, numlines=2)
  27 
  28     if 'No Differences Found' in result:
  29         return format_html('<p>{}</p>', _('Pas de changements.'))
  30     else:
  31         return format_html('<div class="diff_delta">{}</div>', mark_safe(result))
  32
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/zds/utils/templatetags/htmldiff.py b/zds/utils/templatetags/htmldiff.py
  --- a/zds/utils/templatetags/htmldiff.py
  +++ b/zds/utils/templatetags/htmldiff.py
  @@ -22,10 +22,12 @@
       except AttributeError:
           txt2 = string2.splitlines()
   
  -    diff = HtmlDiff(tabsize=4, wrapcolumn=80)
  +    diff = HtmlDiff(tabsize=4)
       result = diff.make_table(txt1, txt2, context=True, numlines=2)
   
       if 'No Differences Found' in result:
           return format_html('<p>{}</p>', _('Pas de changements.'))
       else:
  -        return format_html('<div class="diff_delta">{}</div>', mark_safe(result))
  +        # the diff.make_table() replaces all spaces by non-breakable ones, which prevent line breaks:
  +        r = mark_safe(result.replace('<td nowrap="nowrap">', '<td>').replace('&nbsp;', ' '))
  +        return format_html('<div class="diff_delta">{}</div>', r)
  
verification_info: {"golden_diff": "diff --git a/zds/utils/templatetags/htmldiff.py b/zds/utils/templatetags/htmldiff.py\n--- a/zds/utils/templatetags/htmldiff.py\n+++ b/zds/utils/templatetags/htmldiff.py\n@@ -22,10 +22,12 @@\n     except AttributeError:\n         txt2 = string2.splitlines()\n \n-    diff = HtmlDiff(tabsize=4, wrapcolumn=80)\n+    diff = HtmlDiff(tabsize=4)\n     result = diff.make_table(txt1, txt2, context=True, numlines=2)\n \n     if 'No Differences Found' in result:\n         return format_html('<p>{}</p>', _('Pas de changements.'))\n     else:\n-        return format_html('<div class=\"diff_delta\">{}</div>', mark_safe(result))\n+        # the diff.make_table() replaces all spaces by non-breakable ones, which prevent line breaks:\n+        r = mark_safe(result.replace('<td nowrap=\"nowrap\">', '<td>').replace('&nbsp;', ' '))\n+        return format_html('<div class=\"diff_delta\">{}</div>', r)\n", "issue": "La comparaison des versions a perdu sa sidebar\n## \u00c9tapes pour reproduire \r\n\r\n- prenez un tuto avec plusieurs \u00e9ditions\r\n- cliquer sur \"comparer les versions\"\r\n- s\u00e9lectionner deux versions\r\n\r\n**Comportement observ\u00e9**\r\n\r\nla sidebar n'appara\u00eet pas dans la page de comparaison des versions\r\n\r\n**Comportement d\u00e9sir\u00e9**\r\n\r\nLa sidebar est l\u00e0.\n", "before_files": [{"content": "from difflib import HtmlDiff\nfrom django import template\nfrom django.utils.html import format_html\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef htmldiff(string1, string2):\n\n    try:\n        txt1 = string1.decode('utf-8').splitlines()\n    # string1 is an empty SafeText from template\n    except AttributeError:\n        txt1 = string1.splitlines()\n\n    try:\n        txt2 = string2.decode('utf-8').splitlines()\n    except AttributeError:\n        txt2 = string2.splitlines()\n\n    diff = HtmlDiff(tabsize=4, wrapcolumn=80)\n    result = diff.make_table(txt1, txt2, context=True, numlines=2)\n\n    if 'No Differences Found' in result:\n        return format_html('<p>{}</p>', _('Pas de changements.'))\n    else:\n        return format_html('<div class=\"diff_delta\">{}</div>', mark_safe(result))\n", "path": "zds/utils/templatetags/htmldiff.py"}], "after_files": [{"content": "from difflib import HtmlDiff\nfrom django import template\nfrom django.utils.html import format_html\nfrom django.utils.safestring import mark_safe\nfrom django.utils.translation import ugettext_lazy as _\n\n\nregister = template.Library()\n\n\n@register.simple_tag\ndef htmldiff(string1, string2):\n\n    try:\n        txt1 = string1.decode('utf-8').splitlines()\n    # string1 is an empty SafeText from template\n    except AttributeError:\n        txt1 = string1.splitlines()\n\n    try:\n        txt2 = string2.decode('utf-8').splitlines()\n    except AttributeError:\n        txt2 = string2.splitlines()\n\n    diff = HtmlDiff(tabsize=4)\n    result = diff.make_table(txt1, txt2, context=True, numlines=2)\n\n    if 'No Differences Found' in result:\n        return format_html('<p>{}</p>', _('Pas de changements.'))\n    else:\n        # the diff.make_table() replaces all spaces by non-breakable ones, which prevent line breaks:\n        r = mark_safe(result.replace('<td nowrap=\"nowrap\">', '<td>').replace('&nbsp;', ' '))\n        return format_html('<div class=\"diff_delta\">{}</div>', r)\n", "path": "zds/utils/templatetags/htmldiff.py"}]}