Hello something really wierd happend (moodle 2.7)

this latex code: " `f(x)={(x^2-1,, -1<=x<0),(2x ,, 0<x<1),(1,, x=1),(-2x+4,, 1<x<2),(0,, 2<x<3):}`"

suppose to be like this image:

But instead I get it in Moodle with one raw and wrong like this:

Can anyone tell me why it happens and how can I fix that?