Closed szmejap closed 2 years ago
Should be fixed by https://github.com/kerrickstaley/genanki/commit/1b43c7517c53e231a3c56876c8d5fe7ea8bebdaf and https://github.com/kerrickstaley/genanki/commit/2f22b941831252de69e37ccd4002b636d22297c0 which will go out in the next release of genanki. Thanks for the great bug report!
Hello,
The invalid HTML tags check fails on the following note field contents:
I checked with Anki on Linux, and the field value is displayed correctly, if I paste it manually into a note.
The regular expression here: https://github.com/kerrickstaley/genanki/blob/5026448cb661570b2355afc5a45c1c9fcc9eea24/genanki/note.py#L51
Does not accept two tags: HTML comment, and CDATA. Comments can be easily fixed by including
!--
as a valid opening, like so:r'<(?!(/?[a-zA-Z0-9]+|!--)(?: .*|/?)>)(?:.|\n)*?>'
Adding CDATA opening explicitly also works:
r'<(?!(/?[a-zA-Z0-9]+|!--|!\[CDATA\[)(?: .*|/?)>)(?:.|\n)*?>'
regexr.com/6k6pf
I'm sorry for not doing a pull request now. I gotta run and wanted to describe this issue quickly, so that I don't forget about it.
Is there a set of tests, to make sure, that the suggested change to the regex doesn't break the functionality by accepting more, than Anki does? I have not checked, if comment closing tag is properly handled. The contents of CDATA are also not checked for correctness.
Cheers, Pawel