Earthcomputer / clientcommands

Adds useful client-side commands
Other
1.05k stars 116 forks source link

`/cwiki` sometimes outputs HTML comments #434

Closed James103 closed 2 years ago

James103 commented 2 years ago

Minecraft 1.19 Client Commands 2.7 Fabric API 0.57.0 Fabric loader 0.14.7

When running /cwiki, for some page title inputs (including air, stone, and zombie), the output contains HTML comments with what looks to be internal Mediawiki information. These HTML comments should be stripped before the output is printed.

Example output for cwiki air ``` §lAir§r is an invisible block used to define empty space where any other blocks could otherwise exist. §lCave air§r?[§oJava Edition only§r] is the underground air found in caves and some generated structures. §lVoid air§r?[§oJava Edition only§r] is used internally for blocks above (Y>319) and below (Y<-64) the world, and in unloaded chunks. ```
xpple commented 2 years ago

Inserting rawStr = rawStr.replaceAll("<!--(.*?)-->", "") here should fix it, can't do it right now though.

Earthcomputer commented 2 years ago

A better solution would be to modify HTML_TAG_PATTERN to match comments, which would be more consistent with where html comments are actually allowed.