Support for italicizing keywords?

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.

Hi again,
Just wanted to bump this up in case anyone has any insights. I think for now I will recommend we not implement it since I want to stay in line with OJS development but I am curious if there is more discussion around which fields to allow rich text editing and which ones to avoid and if there is a rationale there I could point people to.
Thank you!
Emily

Hi @ehopkins,

I think the biggest challenge you’ll have with keywords is that they’re entered using a UI tool called tag-it which allows multiple entries to be added and kept separately. For formatting to be possible, the UI tool would also need to support it, and I’m not aware of a tool that allows both keyword-style entry and rich formatting within entries.

Downstream consumers of fields supporting rich formatting often don’t support that formatting – so in the case of titles, for example, it’s often necessary to strip out the formatting and just provide plain text. That’s not a huge technical hurdle, but does mean that the use of these fields is often limited to just OJS.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hi Alec,
Thanks for your reply! We’ve been adding old issues of this journal in bulk with XML so I hadn’t tried to use tag-it for these keywords but that makes sense as to why it would work differently than the other fields!
Take care,
Emily