Skip to content

wrap empty paragraph tags after import from XSweet

Dan Visel requested to merge wrap-empty-paragraph-tags into main

A surprising amount of the time we're getting content coming in from XSweet that doesn't have tags around block-level elements. Take demo_1_.docx, one of our standard test imports: if you look carefully at it, you'll see that the label on this table:

Screenshot_2023-02-27_at_7.28.54_PM

which says "Source: Fictitious data, for illustration purposes only" comes into our current Kotahi imported concatenated onto the next paragraph:

Screen_Shot_2023-02-27_at_7.21.57_PM

(If you look after the table, you can see that the label has become part of the next paragraph.)

This is probably a bug in XSweet! It would be better if it were fixed there. But I've added a pretty simple function to upload.js that goes through incoming content – if it doesn't have a tag, it wraps a <p> tag around it. This might not always be right, but we're not smooshing paragraphs together. So we get this:

Screen_Shot_2023-02-27_at_7.22.32_PM

If this were fixed in XSweet, we could take this out of the chain. In the interim, I think this would probably help clean up what's coming into Kotahi. I suspect we're not noticing these errors a lot of the time.

(XSweet bug report: XSweet/XSweet#182 )

Edited by Dan Visel

Merge request reports