pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
307 stars 447 forks source link

OMP monographs with long author lists displays HTML #7621

Closed jnugent closed 2 years ago

jnugent commented 2 years ago

Describe the bug If a monograph has more than 5 authors, the monograph_full.tpl tempate formats the list as a comma separated list to save space. It uses the Smarty {capture} tag to wrap author names in a set of span class="label" or class="value" tags. These tags come through onto the page as escaped HTML.

Screenshot at 2022-01-13 07-58-39

Those visible span tags are added in the template via:

{capture assign="authorName"}<span class="label">{$author->getFullName()|escape}</span>{/capture}

I'm not sure if it's because there may be double escaping going on, it is escaped in the line above, and then escaped again when it is passed into the locale key via translate:

{translate key="submission.authorWithAffiliation" name=$authorName|escape affiliation=$authorAffiliation|escape}

But I've tried removing all of the escape calls and the tags still come through. Is this a problem with {capture}?

Smaller lists of authors are displayed as a regular one per line list and there is no problem.

To Reproduce Steps to reproduce the behavior:

  1. Create a new Monograph and add more than 5 authors including affiliations to it.
  2. Publish the monograph using the default theme.
  3. Load the monograph landing page
  4. What application are you using? OMP 3.3.0.8

Additional information Please add any screenshots, logs or other information we can use to investigate this bug report.

NateWr commented 2 years ago

It looks like this has been fixed in main as part of chapter pages in #7132, but it still needs to be fixed in stable-3_3_0. The preferred approach is here:

https://github.com/pkp/omp/blob/main/templates/frontend/components/authors.tpl#L59-L69

And that needs to be applied to:

https://github.com/pkp/omp/blob/stable-3_3_0/templates/frontend/objects/monograph_full.tpl#L139-L154

NateWr commented 2 years ago

@jnugent can you test the change in this PR?

PR: https://github.com/pkp/omp/pull/1055

jnugent commented 2 years ago

@NateWr confirmed fixed with that change.

NateWr commented 2 years ago

Thanks @jnugent! Merged to stable-3_3_0 and should already be fixed in main.

jnugent commented 2 years ago

Hi @NateWr this bug seems to still exist in one other place. in stable-3_3_0 and also in main:

https://github.com/pkp/omp/blob/main/templates/frontend/objects/monograph_full.tpl#L234

Screenshot at 2022-03-02 08-11-09

The approach merged in for the other template probably also needs to be applied here. Seen in a latest pull of stable-3_3_0.

asmecher commented 2 years ago

Hi @jnugent -- there's another case in the same file. It should be resolved by applying this as well: https://github.com/pkp/omp/commit/9866c97801bf6df8516445aa7ed93379fba5755b

I'll be releasing OMP 3.3.0-9 today or tomorrow, so while I'm pretty confident this'll resolve the fix, a quick confirm would be welcome!

jnugent commented 2 years ago

@asmecher I just pulled in stable-3_3_0 and confirming fixed. Thanks!