mrichards42 / xword

Cross-platform crossword solving
https://mrichards42.github.io/xword/
GNU General Public License v3.0
42 stars 13 forks source link

Escape XML by default in metadata and clue text. #193

Closed jpd236 closed 1 year ago

jpd236 commented 1 year ago

Previously, this was done on an ad-hoc basis in certain formats/fields, but not all, which could lead to inconsistent/incorrect handling of special characters like & and <.

Now, all metadata fields and clues default to assuming that the provided strings are plaintext and escape XML characters so that XWord (which renders them as HTML) renders them correctly. Functions take an additional, optional is_html bool parameter which can be set to true if the input should be left unchanged (since it is already valid HTML). This is used for JPZ, IPUZ, Amuse Labs imports, and Rows Garden clues (where we convert * to italic tags, and escape the rest of the clue manually).

Fixes #182

mrichards42 commented 1 year ago

This all seems reasonable to me, thanks! I'm assuming you've been running this for a little while now without any issues, so happy to merge.