prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  abbr support doesn't work for multiline
  Eg:
  
  ``` rst
  this is an :abbr:`TLA (Three Letter
  Abbreviation)`
  ```
  
  will output
  `<abbr>TLA (Three Letter Abbreviation)</abbr>`
  
  instead of
  `<abbr title="Three Letter Abbreviation">TLA</abbr>`
  
  I believe this could be fixed by adding the `re.M` flag to the `re.compile` call on this line: https://github.com/getpelican/pelican/blob/636fd6cc380f2537924532a587c70e96a386e25c/pelican/rstdirectives.py#L101
  
  This refs ticket #395 
  
  
  </issue>
  <code>
  [start of pelican/rstdirectives.py]
  1 # -*- coding: utf-8 -*-
  2 from __future__ import unicode_literals, print_function
  3 
  4 from docutils import nodes, utils
  5 from docutils.parsers.rst import directives, roles, Directive
  6 from pygments.formatters import HtmlFormatter
  7 from pygments import highlight
  8 from pygments.lexers import get_lexer_by_name, TextLexer
  9 import re
  10 import six
  11 import pelican.settings as pys
  12 
  13 
  14 class Pygments(Directive):
  15     """ Source code syntax highlighting.
  16     """
  17     required_arguments = 1
  18     optional_arguments = 0
  19     final_argument_whitespace = True
  20     option_spec = {
  21         'anchorlinenos': directives.flag,
  22         'classprefix': directives.unchanged,
  23         'hl_lines': directives.unchanged,
  24         'lineanchors': directives.unchanged,
  25         'linenos': directives.unchanged,
  26         'linenospecial': directives.nonnegative_int,
  27         'linenostart': directives.nonnegative_int,
  28         'linenostep': directives.nonnegative_int,
  29         'lineseparator': directives.unchanged,
  30         'linespans': directives.unchanged,
  31         'nobackground': directives.flag,
  32         'nowrap': directives.flag,
  33         'tagsfile': directives.unchanged,
  34         'tagurlformat': directives.unchanged,
  35     }
  36     has_content = True
  37 
  38     def run(self):
  39         self.assert_has_content()
  40         try:
  41             lexer = get_lexer_by_name(self.arguments[0])
  42         except ValueError:
  43             # no lexer found - use the text one instead of an exception
  44             lexer = TextLexer()
  45 
  46         # Fetch the defaults
  47         if pys.PYGMENTS_RST_OPTIONS is not None:
  48             for k, v in six.iteritems(pys.PYGMENTS_RST_OPTIONS):
  49                 # Locally set options overrides the defaults
  50                 if k not in self.options:
  51                     self.options[k] = v
  52 
  53         if ('linenos' in self.options and
  54                 self.options['linenos'] not in ('table', 'inline')):
  55             if self.options['linenos'] == 'none':
  56                 self.options.pop('linenos')
  57             else:
  58                 self.options['linenos'] = 'table'
  59 
  60         for flag in ('nowrap', 'nobackground', 'anchorlinenos'):
  61             if flag in self.options:
  62                 self.options[flag] = True
  63 
  64         # noclasses should already default to False, but just in case...
  65         formatter = HtmlFormatter(noclasses=False, **self.options)
  66         parsed = highlight('\n'.join(self.content), lexer, formatter)
  67         return [nodes.raw('', parsed, format='html')]
  68 
  69 directives.register_directive('code-block', Pygments)
  70 directives.register_directive('sourcecode', Pygments)
  71 
  72 
  73 _abbr_re = re.compile('\((.*)\)$')
  74 
  75 
  76 class abbreviation(nodes.Inline, nodes.TextElement):
  77     pass
  78 
  79 
  80 def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
  81     text = utils.unescape(text)
  82     m = _abbr_re.search(text)
  83     if m is None:
  84         return [abbreviation(text, text)], []
  85     abbr = text[:m.start()].strip()
  86     expl = m.group(1)
  87     return [abbreviation(abbr, abbr, explanation=expl)], []
  88 
  89 roles.register_local_role('abbr', abbr_role)
  90
  [end of pelican/rstdirectives.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py
  --- a/pelican/rstdirectives.py
  +++ b/pelican/rstdirectives.py
  @@ -70,7 +70,7 @@
   directives.register_directive('sourcecode', Pygments)
   
   
  -_abbr_re = re.compile('\((.*)\)$')
  +_abbr_re = re.compile('\((.*)\)$', re.DOTALL)
   
   
   class abbreviation(nodes.Inline, nodes.TextElement):
  
verification_info: {"golden_diff": "diff --git a/pelican/rstdirectives.py b/pelican/rstdirectives.py\n--- a/pelican/rstdirectives.py\n+++ b/pelican/rstdirectives.py\n@@ -70,7 +70,7 @@\n directives.register_directive('sourcecode', Pygments)\n \n \n-_abbr_re = re.compile('\\((.*)\\)$')\n+_abbr_re = re.compile('\\((.*)\\)$', re.DOTALL)\n \n \n class abbreviation(nodes.Inline, nodes.TextElement):\n", "issue": "abbr support doesn't work for multiline\nEg:\n\n``` rst\nthis is an :abbr:`TLA (Three Letter\nAbbreviation)`\n```\n\nwill output\n`<abbr>TLA (Three Letter Abbreviation)</abbr>`\n\ninstead of\n`<abbr title=\"Three Letter Abbreviation\">TLA</abbr>`\n\nI believe this could be fixed by adding the `re.M` flag to the `re.compile` call on this line: https://github.com/getpelican/pelican/blob/636fd6cc380f2537924532a587c70e96a386e25c/pelican/rstdirectives.py#L101\n\nThis refs ticket #395 \n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals, print_function\n\nfrom docutils import nodes, utils\nfrom docutils.parsers.rst import directives, roles, Directive\nfrom pygments.formatters import HtmlFormatter\nfrom pygments import highlight\nfrom pygments.lexers import get_lexer_by_name, TextLexer\nimport re\nimport six\nimport pelican.settings as pys\n\n\nclass Pygments(Directive):\n    \"\"\" Source code syntax highlighting.\n    \"\"\"\n    required_arguments = 1\n    optional_arguments = 0\n    final_argument_whitespace = True\n    option_spec = {\n        'anchorlinenos': directives.flag,\n        'classprefix': directives.unchanged,\n        'hl_lines': directives.unchanged,\n        'lineanchors': directives.unchanged,\n        'linenos': directives.unchanged,\n        'linenospecial': directives.nonnegative_int,\n        'linenostart': directives.nonnegative_int,\n        'linenostep': directives.nonnegative_int,\n        'lineseparator': directives.unchanged,\n        'linespans': directives.unchanged,\n        'nobackground': directives.flag,\n        'nowrap': directives.flag,\n        'tagsfile': directives.unchanged,\n        'tagurlformat': directives.unchanged,\n    }\n    has_content = True\n\n    def run(self):\n        self.assert_has_content()\n        try:\n            lexer = get_lexer_by_name(self.arguments[0])\n        except ValueError:\n            # no lexer found - use the text one instead of an exception\n            lexer = TextLexer()\n\n        # Fetch the defaults\n        if pys.PYGMENTS_RST_OPTIONS is not None:\n            for k, v in six.iteritems(pys.PYGMENTS_RST_OPTIONS):\n                # Locally set options overrides the defaults\n                if k not in self.options:\n                    self.options[k] = v\n\n        if ('linenos' in self.options and\n                self.options['linenos'] not in ('table', 'inline')):\n            if self.options['linenos'] == 'none':\n                self.options.pop('linenos')\n            else:\n                self.options['linenos'] = 'table'\n\n        for flag in ('nowrap', 'nobackground', 'anchorlinenos'):\n            if flag in self.options:\n                self.options[flag] = True\n\n        # noclasses should already default to False, but just in case...\n        formatter = HtmlFormatter(noclasses=False, **self.options)\n        parsed = highlight('\\n'.join(self.content), lexer, formatter)\n        return [nodes.raw('', parsed, format='html')]\n\ndirectives.register_directive('code-block', Pygments)\ndirectives.register_directive('sourcecode', Pygments)\n\n\n_abbr_re = re.compile('\\((.*)\\)$')\n\n\nclass abbreviation(nodes.Inline, nodes.TextElement):\n    pass\n\n\ndef abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):\n    text = utils.unescape(text)\n    m = _abbr_re.search(text)\n    if m is None:\n        return [abbreviation(text, text)], []\n    abbr = text[:m.start()].strip()\n    expl = m.group(1)\n    return [abbreviation(abbr, abbr, explanation=expl)], []\n\nroles.register_local_role('abbr', abbr_role)\n", "path": "pelican/rstdirectives.py"}]}