docs: def documents(self, key, value):
      """Populate the ``documents`` key.
  
      Also populates the ``figures`` key through side effects.
      """
      def _is_hidden(value):
          return 'HIDDEN' in [val.upper() for val in value] or None
  
      def _is_figure(value):
          figures_extensions = ['.png']
          return value.get('f') in figures_extensions
  
      def _is_fulltext(value):
          return value.get('d', '').lower() == 'fulltext' or None
  
      def _get_index_and_caption(value):
          match = re.compile(r'(^\d{5})?\s*(.*)').match(value)
          if match:
              return match.group(1), match.group(2)
  
      def _get_key(value):
          fname = value.get('n', 'document')
          extension = value.get('f', '')
  
          if fname.endswith(extension):
              return fname
          return fname + extension
  
      def _get_source(value):
          source = value.get('t', '')
          if source in ('INSPIRE-PUBLIC', 'Main'):
              source = None
          elif source.lower() == 'arxiv':
              return 'arxiv'
  
          return source
  
      figures = self.get('figures', [])
      is_context = value.get('f', '').endswith('context')
  
      if is_context:
          return
  
      if _is_figure(value):
          index, caption = _get_index_and_caption(value.get('d', ''))
          figures.append({
              'key': _get_key(value),
              'caption': caption,
              'url': afs_url(value.get('a')),
              'order': index,
              'source': 'arxiv',  # XXX: we don't have any other figures on legacy
          })
          self['figures'] = figures
      else:
          return {
              'description': value.get('d') if not _is_fulltext(value) else None,
              'key': _get_key(value),
              'fulltext': _is_fulltext(value),
              'hidden': _is_hidden(force_list(value.get('o'))),
              'url': afs_url(value.get('a')),
              'source': _get_source(value),
          }