You are here

protected function BibtexEncoder::processEntries in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php \Drupal\bibcite_bibtex\Encoder\BibtexEncoder::processEntries()

Workaround about some things in BibtexParser library.

Parameters

array $parsed: List of parsed entries.

1 call to BibtexEncoder::processEntries()
BibtexEncoder::decode in modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php

File

modules/bibcite_bibtex/src/Encoder/BibtexEncoder.php, line 104

Class

BibtexEncoder
BibTeX format encoder.

Namespace

Drupal\bibcite_bibtex\Encoder

Code

protected function processEntries(array &$parsed) {
  foreach ($parsed as &$entry) {
    if (!empty($entry['pages']) && is_array($entry['pages'])) {
      $entry['pages'] = implode('-', $entry['pages']);
    }
    if (!empty($entry['keywords'])) {
      $entry['keywords'] = array_map(function ($keyword) {
        return trim($keyword);
      }, explode(',', str_replace(';', ',', $entry['keywords'])));
    }
  }
}