Describe the issue or problem
We are hoping to be able to italicize keywords as well as other fields. The use case here is mostly titles of works, although this 2016 forum post also mentions a use case for biology for species names: Formatting keywords (italicizing keyword entries) in Latin
I wanted to ask if there are reasons to avoid implementing it.
Steps I took leading up to the issue
By default, keywords can’t be italicized using HTML tags, even though that can be done for titles and a few other fields.
What application are you using?
OJS 3.3.0.13
(but we are also trying to make these fixes compatible with future updates so I have been looking at the latest release on GitHub too, stable-3_4_0 ojs/templates/frontend/objects/article_details.tpl at stable-3_4_0 · pkp/ojs · GitHub)
Additional information
From what I found this topic is covered more extensively in relation to titles, and this thread about titles and italics is very useful: How to make italics in article title in OJS 3
This is the file that’s relevant here:
ojs\templates\frontend\objects\article_details.tpl
The above forum post recommends changing this:
{$publication->getLocalizedTitle()|escape}
to this:
{$publication->getLocalizedTitle()|strip_unsafe_html}
We were able to use it to implement title italicization in our current install, and I can see from the most recent release that OJS defaults currently use these settings to allow italics (using strip_unsafe_html) for the following fields:
title
subtitle
abstract
biography
data availability
citation
However, they still use “escape” for the keywords, and can’t do italics.
If I replace “escape” with “strip_unsafe_html” on my test site, I can get italicized keywords by entering them with <i> in the metadata field.
So, changing this:
{$keyword|escape}{if !$smarty.foreach.keywords.last}{translate key=“common.commaListSeparator”}{/if}
To this:
{$keyword|strip_unsafe_html{if !$smarty.foreach.keywords.last}{translate key=“common.commaListSeparator”}{/if}
However, since this is not implemented for keywords in the latest version of OJS, I wanted to check – is there a reason to avoid it? Are there plans to add it in future? I imagine strip_unsafe_html would take care of any possible upstream/downstream metadata problems, but I wanted to check – I want to avoid deviating from the main OJS build.