docs: def process_figures(key, value, fmt, meta): # pylint: disable=unused-argument
      """Processes the figures."""
  
      global has_unnumbered_figures  # pylint: disable=global-statement
  
      # Process figures wrapped in Para elements
      if key == 'Para' and len(value) == 1 and \
        value[0]['t'] == 'Image' and value[0]['c'][-1][1].startswith('fig:'):
  
          # Inspect the image
          if len(value[0]['c']) == 2:  # Unattributed, bail out
              has_unnumbered_figures = True
              if fmt == 'latex':
                  return [RawBlock('tex', r'\begin{no-prefix-figure-caption}'),
                          Para(value),
                          RawBlock('tex', r'\end{no-prefix-figure-caption}')]
              return None
  
          # Process the figure
          fig = _process_figure(value, fmt)
  
          # Context-dependent output
          attrs = fig['attrs']
          if fig['is_unnumbered']:  # Unnumbered is also unreferenceable
              if fmt == 'latex':
                  return [
                      RawBlock('tex', r'\begin{no-prefix-figure-caption}'),
                      Para(value),
                      RawBlock('tex', r'\end{no-prefix-figure-caption}')]
          elif fmt in ['latex', 'beamer']:
              key = attrs[0]
              if PANDOCVERSION >= '1.17':
                  # Remove id from the image attributes.  It is incorrectly
                  # handled by pandoc's TeX writer for these versions.
                  if LABEL_PATTERN.match(attrs[0]):
                      attrs[0] = ''
              if fig['is_tagged']:  # Code in the tags
                  tex = '\n'.join([r'\let\oldthefigure=\thefigure',
                                   r'\renewcommand\thefigure{%s}'%\
                                   references[key]])
                  pre = RawBlock('tex', tex)
                  tex = '\n'.join([r'\let\thefigure=\oldthefigure',
                                   r'\addtocounter{figure}{-1}'])
                  post = RawBlock('tex', tex)
                  return [pre, Para(value), post]
          elif fig['is_unreferenceable']:
              attrs[0] = ''  # The label isn't needed any further
          elif PANDOCVERSION < '1.16' and fmt in ('html', 'html5') \
            and LABEL_PATTERN.match(attrs[0]):
              # Insert anchor
              anchor = RawBlock('html', '<a name="%s"></a>'%attrs[0])
              return [anchor, Para(value)]
          elif fmt == 'docx':
              # As per http://officeopenxml.com/WPhyperlink.php
              bookmarkstart = \
                RawBlock('openxml',
                         '<w:bookmarkStart w:id="0" w:name="%s"/>'
                         %attrs[0])
              bookmarkend = \
                RawBlock('openxml', '<w:bookmarkEnd w:id="0"/>')
              return [bookmarkstart, Para(value), bookmarkend]
  
      return None