andrewhancox / moodle-filter_translations

7 stars 8 forks source link

Translation hashes are stripped when $CFG->forceclean is enabled. #161

Open rjnl opened 1 year ago

rjnl commented 1 year ago

When $CFG->forceclean is enabled then the translation hashes are stripped out before content is saved to the database. This results in "broken" translations.

Pinging @andrewhancox

mudrd8mz commented 1 year ago

According to http://htmlpurifier.org/live/configdoc/plain.html#AutoFormat.RemoveEmpty the HTMLPurifier should not remove empty elements. That is, if the span was like

<span data-translationhash="1837ec56664068113ac8185fb169e2b1" />

instead of the current

<span data-translationhash="1837ec56664068113ac8185fb169e2b1"></span>

maybe it would survive the purifier?

jgramp commented 1 year ago

If we do this the HTML won't validate though I don't think David: https://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span

What about?

\\ \

mudrd8mz commented 1 year ago

Yeah, you're right. Thanks Jessica.

On Tue, 13 Dec 2022, 01:49 Jessica Gramp, @.***> wrote:

If we do this the HTML won't validate though I don't think David: https://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span

What about?

— Reply to this email directly, view it on GitHub https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347587884, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAU6R6NXDOS5RGIAKDLGJDWM7BX3ANCNFSM6AAAAAAS3ZJA6U . You are receiving this because you commented.Message ID: @.***>

jgramp commented 1 year ago

But if it works and it breaks validation perhaps it doesn't matter - assuming the options that do validate don't work. E.g. adding the non-breaking space. We should test all of them and see whether any of them resolve the issue and then make a decision on how to proceed. Jessica Gramp Moodle Community Manager

Moodle HQ - moodle.com [image: Moodle - Empowering educators to improve our world]

On Tue, 13 Dec 2022 at 15:33, David Mudrák @.***> wrote:

Yeah, you're right. Thanks Jessica.

On Tue, 13 Dec 2022, 01:49 Jessica Gramp, @.***> wrote:

If we do this the HTML won't validate though I don't think David:

https://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span

What about?

— Reply to this email directly, view it on GitHub < https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347587884 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAAU6R6NXDOS5RGIAKDLGJDWM7BX3ANCNFSM6AAAAAAS3ZJA6U

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347751558, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBNVTQYNWB6LBMMYRPJKEDWM77SPANCNFSM6AAAAAAS3ZJA6U . You are receiving this because you commented.Message ID: @.***>

andrewhancox commented 1 year ago

I can’t remember why I decided it needed to be valid HTML in the first place rather than double curly braces… I’m 99% sure there was a reason but may be worth reconsidering.

On 13 Dec 2022, at 05:08, Jessica Gramp @.***> wrote:

But if it works and it breaks validation perhaps it doesn't matter - assuming the options that do validate don't work. E.g. adding the non-breaking space. We should test all of them and see whether any of them resolve the issue and then make a decision on how to proceed. Jessica Gramp Moodle Community Manager

Moodle HQ - moodle.com [image: Moodle - Empowering educators to improve our world]

On Tue, 13 Dec 2022 at 15:33, David Mudrák @.***> wrote:

Yeah, you're right. Thanks Jessica.

On Tue, 13 Dec 2022, 01:49 Jessica Gramp, @.***> wrote:

If we do this the HTML won't validate though I don't think David:

https://stackoverflow.com/questions/2816833/can-a-span-be-closed-using-span

What about?

— Reply to this email directly, view it on GitHub < https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347587884 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAAU6R6NXDOS5RGIAKDLGJDWM7BX3ANCNFSM6AAAAAAS3ZJA6U

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347751558, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBNVTQYNWB6LBMMYRPJKEDWM77SPANCNFSM6AAAAAAS3ZJA6U . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/andrewhancox/moodle-filter_translations/issues/161#issuecomment-1347756442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJEYMRIE6QRX7PGGS5F2N3WNAAGJANCNFSM6AAAAAAS3ZJA6U. You are receiving this because you were mentioned.