[TikiWiki-commits] [Git][tikiwiki/tiki][28.x] [FIX] Plugin Zotero: improved zotero footnote display
"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <68e58949a0c9d_2ca0d868260e3@gitlab-sidekiq-low-urgency-cpu-bound-v2-5b754674d6-6qfb6.mail> |
Baraka Kinywa pushed to branch 28.x at Tiki Wiki CMS Groupware / Tiki
Commits:
0122ccbf by Espoir Baraka at 2025-10-08T00:35:47+03:00
[FIX] Plugin Zotero: improved zotero footnote display
---
* [FIX] Plugin Zotero: improved zotero footnote display
---
* [FIX] Plugin Zotero: improved zotero footnote display
---
* [FIX] Zotero: improve zotero footnote display
See merge request tikiwiki/tiki!8717
(cherry picked from commit 486176df48964fb6f440ff7205758edbabae3a21)
See merge request tikiwiki/tiki!8731
(cherry picked from commit 30e9a64cec5cf927bebd131500673f2e2a4f41ce)
See merge request tikiwiki/tiki!8732
- - - - -
1 changed file:
- lib/wiki-plugins/wikiplugin_zotero.php
Changes:
=====================================
lib/wiki-plugins/wikiplugin_zotero.php
=====================================
@@ -76,8 +76,33 @@ function wikiplugin_zotero($data, $params)
$cachelib->cacheItem($cacheKey, serialize($info), 'zotero');
}
- $content = $info['content'];
- $content = str_replace('<div', '<span', $content);
- $content = str_replace('</div>', '</span>', $content);
- return "{FOOTNOTE()}~np~{$content} {$note}~/np~{FOOTNOTE}";
+ // Get the title from Zotero data
+ // Some Zotero entries don't have a direct 'title' field (e.g., notes or attachments)
+ // In these cases, extract the title from the content field to display something meaningful
+ $title = isset($info['title']) ? $info['title'] : '';
+
+ if (empty($title)) {
+ // Extract title from HTML content
+ // Replace block-level HTML tags with newlines to preserve structure
+ $content = $info['content'];
+ $content = preg_replace('/<\/(p|div|h[1-6]|li|tr|br)>/i', "\n", $content);
+
+ // Strip remaining HTML tags and decode entities
+ $textContent = strip_tags($content);
+ $textContent = html_entity_decode($textContent, ENT_QUOTES, 'UTF-8');
+ $textContent = trim($textContent);
+
+ // Use first non-empty line as title
+ $lines = array_filter(array_map('trim', explode("\n", $textContent)));
+ $title = ! empty($lines) ? reset($lines) : '';
+ }
+
+ // Combine title with note if provided
+ $footnoteContent = $title;
+ if (! empty($note)) {
+ $footnoteContent .= ' - ' . $note;
+ }
+
+ // Return the footnote with the title
+ return "{FOOTNOTE()}{$footnoteContent}{FOOTNOTE}";
}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0122ccbff8f9ce7db6cbbbefcbef57a8c5f19a9c
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0122ccbff8f9ce7db6cbbbefcbef57a8c5f19a9c
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs