EvoEsports / ManiaTemplates

A templating engine to use for ManiaLinks, an XML based markup language for the game Trackmania.
GNU General Public License v3.0
2 stars 0 forks source link

XML parsing fault when using the <=> operator in maniascript #29

Open snixtho opened 1 year ago

snixtho commented 1 year ago

It appears that the script tags after rendering is not surrounded by a comment. So when you use characters such as < and > it will return a fault as the server fails to parser the XML. For example, when using the <=> operator, it fails.

kdankert commented 1 year ago

It fails parsing the file when using < or >, but this is a limitation of the xml spec, which does not allow these characters inside of attribute values. Right now, xml escape characters have to be used. < and > should be replaced by < and > respectively.

kdankert commented 1 year ago

If we want to allow the characters inside of values, we will probably need a different xml parser or do some preprocessing before parsing the file, replacing those characters by their escape sequences.

snixtho commented 1 year ago

We just need to put the maniascript inside a comment, then it works. The template engine can do this automatically.

kdankert commented 1 year ago

Then we are talking about different things.

But doesn't this already cause an issue when trying to compile an template which has <script>a <=> b</script> in it?

You might want to use < or > in condition blocks as well, which causes this issue as well. That's is why we are using escape sequences currently. https://github.com/EvoEsports/ManiaTemplates/blob/b5e0abea15afc61ae00349ba38ded6a5db84cf4c/tests/ManiaTemplates.Tests/IntegrationTests/templates/nested-controls.mt#L7

snixtho commented 1 year ago

Then we are talking about different things.

But doesn't this already cause an issue when trying to compile an template which has <script>a <=> b</script> in it?

You might want to use < or > in condition blocks as well, which causes this issue as well. That's is why we are using escape sequences currently.

https://github.com/EvoEsports/ManiaTemplates/blob/b5e0abea15afc61ae00349ba38ded6a5db84cf4c/tests/ManiaTemplates.Tests/IntegrationTests/templates/nested-controls.mt#L7

The error im talking about happens on the game server, not in the engine. And things like <> is already escaped by the engine in attributes afaik.

The common technique for Maniascript is to essentially put it inside an XML comment.