docs: def parse_references_elements(ref_sect, kbs, linker_callback=None):
      """Passed a complete reference section, process each line and attempt to
         ## identify and standardise individual citations within the line.
         @param ref_sect: (list) of strings - each string in the list is a
          reference line.
         @param preprint_repnum_search_kb: (dictionary) - keyed by a tuple
          containing the line-number of the pattern in the KB and the non-standard
          category string.  E.g.: (3, 'ASTRO PH'). Value is regexp pattern used to
          search for that report-number.
         @param preprint_repnum_standardised_categs: (dictionary) - keyed by non-
          standard version of institutional report number, value is the
          standardised version of that report number.
         @param periodical_title_search_kb: (dictionary) - keyed by non-standard
          title to search for, value is the compiled regexp pattern used to
          search for that title.
         @param standardised_periodical_titles: (dictionary) - keyed by non-
          standard title to search for, value is the standardised version of that
          title.
         @param periodical_title_search_keys: (list) - ordered list of non-
          standard titles to search for.
         @return: (tuple) of 6 components:
           ( list       -> of strings, each string is a MARC XML-ized reference
                           line.
             integer    -> number of fields of miscellaneous text found for the
                           record.
             integer    -> number of title citations found for the record.
             integer    -> number of institutional report-number citations found
                           for the record.
             integer    -> number of URL citations found for the record.
             integer    -> number of DOI's found
             integer    -> number of author groups found
             dictionary -> The totals for each 'bad title' found in the reference
                           section.
           )
      """
      # a list to contain the processed reference lines:
      citations = []
      # counters for extraction stats:
      counts = {
          'misc': 0,
          'title': 0,
          'reportnum': 0,
          'url': 0,
          'doi': 0,
          'auth_group': 0,
      }
      # A dictionary to contain the total count of each 'bad title' found
      # in the entire reference section:
      bad_titles_count = {}
  
      # Cleanup the reference lines
  
      # process references line-by-line:
      for ref_line in ref_sect:
          clean_line = wash_and_repair_reference_line(ref_line)
  
          citation_elements, line_marker, this_counts, bad_titles_count = \
              parse_reference_line(
                  clean_line, kbs, bad_titles_count, linker_callback)
  
          # Accumulate stats
          counts = sum_2_dictionaries(counts, this_counts)
  
          citations.append({'elements': citation_elements,
                            'line_marker': line_marker,
                            'raw_ref': ref_line})
  
      # Return the list of processed reference lines:
      return citations, counts, bad_titles_count