|
|
|
@ -10,7 +10,7 @@ use Drupal\footnotes\Plugin\Filter\FootnotesFilter;
|
|
|
|
|
* Provides a base filter for Reference Footnotes filter. |
|
|
|
|
* |
|
|
|
|
* @Filter( |
|
|
|
|
* id = "filter_reference_footnotes",footnote_list |
|
|
|
|
* id = "filter_reference_footnotes", |
|
|
|
|
* module = "bibcite_footnotes", |
|
|
|
|
* title = @Translation("Reference Footnotes filter"), |
|
|
|
|
* description = @Translation("You can insert footnotes directly into texts."), |
|
|
|
@ -141,16 +141,16 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($op == 'output footer') { |
|
|
|
|
if ($this->settings['footnotes_ibid']) { |
|
|
|
|
$this->ibidemify($store_matches); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count($store_matches) > 0) { |
|
|
|
|
// Separate out endontes and reference notes. |
|
|
|
|
$notes = $this->extractNotesByType(self::ENDNOTE, $store_matches); |
|
|
|
|
$references = $this->extractNotesByType(self::REFERENCE, $store_matches); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($this->settings['footnotes_ibid']) { |
|
|
|
|
$this->ibidemify($references); |
|
|
|
|
} |
|
|
|
|
// Only if there are stored fn matches, pass the array of fns to be |
|
|
|
|
// themed as a list |
|
|
|
|
$markup = [ |
|
|
|
@ -330,19 +330,15 @@ class ReferenceFootnotesFilter extends FootnotesFilter {
|
|
|
|
|
protected function ibidemify(&$footnotes) { |
|
|
|
|
$prev_reference_id = FALSE; |
|
|
|
|
foreach ($footnotes as $index => $fn) { |
|
|
|
|
if (!empty($fn['text'])) { |
|
|
|
|
$prev_reference_id = FALSE; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if ($prev_reference_id) { |
|
|
|
|
if ($fn['reference'] == $prev_reference_id) { |
|
|
|
|
unset($footnotes[$index]['reference']); |
|
|
|
|
$footnotes[$index]['text'] = $this->t('Ibid.'); |
|
|
|
|
$footnotes[$index]['text'] = 'Ibid.'; |
|
|
|
|
$footnotes[$index]['text_clean'] = 'Ibid.'; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$prev_reference_id = $fn['reference']; // Could be empty, that's OK. |
|
|
|
|
|
|
|
|
|
$prev_reference_id = $fn['reference']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|