diff --git a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php
index aaf4cdbc4b2..084acc756d1 100644
--- a/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php
+++ b/module/VuFind/src/VuFind/RecordDriver/DefaultRecord.php
@@ -1211,7 +1211,14 @@ public function getSeries()
*/
public function getShortTitle()
{
- return $this->fields['title_short'] ?? '';
+ // Faking an example of HTML that would not be escaped
+ $title = $this->fields['title_short'] ?? '';
+ $words = explode(' ', $title);
+ if (count($words) > 3) {
+ $words[2] = '' . $words[2] . '';
+ }
+ $title = implode(' ', $words);
+ return $title;
}
/**
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/EscapeHtml.php b/module/VuFind/src/VuFind/View/Helper/Root/EscapeHtml.php
new file mode 100644
index 00000000000..7f327c70648
--- /dev/null
+++ b/module/VuFind/src/VuFind/View/Helper/Root/EscapeHtml.php
@@ -0,0 +1,76 @@
+
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link https://vufind.org/wiki/development Wiki
+ */
+
+namespace VuFind\View\Helper\Root;
+
+use Laminas\View\Helper\EscapeHtml as LaminasEscapeHtml;
+
+/**
+ * Escape view helper
+ *
+ * @category VuFind
+ * @package View_Helpers
+ * @author Maccabee Levine
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link https://vufind.org/wiki/development Wiki
+ */
+class EscapeHtml extends \Laminas\View\Helper\AbstractHelper
+{
+ protected $laminasEscapeHtml;
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->laminasEscapeHtml = new LaminasEscapeHtml();
+ }
+
+ /**
+ * This helper calls Laminas escapeHtml, but allows safe styling characters
+ *
+ * @param string $str The string to escape
+ * @param array $except Array of tag names to leave as is. Only simple tags
+ * (no attributes).
+ *
+ * @return string The partially escaped string
+ */
+ public function __invoke($str, $except = ['em', 'i', 'b'])
+ {
+ $escaped = $this->laminasEscapeHtml->__invoke($str);
+
+ // Revert ok chars
+ foreach ($except as $tag) {
+ $escaped = str_replace("<{$tag}>", "<{$tag}>", $escaped);
+ $escaped = str_replace("</{$tag}>", "{$tag}>", $escaped);
+ }
+
+ return $escaped;
+ }
+}
diff --git a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php
index 931a5193ad7..9fe3efed0ea 100644
--- a/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php
+++ b/module/VuFind/tests/unit-tests/src/VuFindTest/RecordDriver/DefaultRecordTest.php
@@ -453,7 +453,7 @@ public function testGetCallNumber()
*/
public function testGetBreadcrumb()
{
- $breadcrumb = 'La congiura dei Principi Napoletani 1701 :';
+ $breadcrumb = 'La congiura dei Principi Napoletani 1701 :';
$this->assertEquals($breadcrumb, $this->getDriver()->getBreadcrumb());
}
diff --git a/themes/root/theme.config.php b/themes/root/theme.config.php
index 82a1b0e19c4..31827bc7b8f 100644
--- a/themes/root/theme.config.php
+++ b/themes/root/theme.config.php
@@ -29,6 +29,7 @@
'VuFind\View\Helper\Root\DateTime' => 'VuFind\View\Helper\Root\DateTimeFactory',
'VuFind\View\Helper\Root\DisplayLanguageOption' => 'VuFind\View\Helper\Root\DisplayLanguageOptionFactory',
'VuFind\View\Helper\Root\Doi' => 'VuFind\View\Helper\Root\DoiFactory',
+ 'VuFind\View\Helper\Root\EscapeHtml' => 'Laminas\ServiceManager\Factory\InvokableFactory',
'VuFind\View\Helper\Root\ExplainElement' => 'Laminas\ServiceManager\Factory\InvokableFactory',
'VuFind\View\Helper\Root\Export' => 'VuFind\View\Helper\Root\ExportFactory',
'VuFind\View\Helper\Root\Feedback' => 'VuFind\View\Helper\Root\FeedbackFactory',
@@ -126,6 +127,7 @@
'dateTime' => 'VuFind\View\Helper\Root\DateTime',
'displayLanguageOption' => 'VuFind\View\Helper\Root\DisplayLanguageOption',
'doi' => 'VuFind\View\Helper\Root\Doi',
+ 'escapeHtml' => 'VuFind\View\Helper\Root\EscapeHtml',
'explainElement' => 'VuFind\View\Helper\Root\ExplainElement',
'export' => 'VuFind\View\Helper\Root\Export',
'feedback' => 'VuFind\View\Helper\Root\Feedback',