clientcommands
clientcommands copied to clipboard
`/cwiki` sometimes outputs HTML comments
trafficstars
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.
<!--
NewPP limit report
Cached time: 20220718233438
Cache expiry: 1209600
Reduced expiry: false
Complications: []
CPU time usage: 0.084 seconds
Real time usage: 0.108 seconds
Preprocessor visited node count: 1063/1000000
Post?expand include size: 7700/2097152 bytes
Template argument size: 1395/2097152 bytes
Highest expansion depth: 16/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip post?expand size: 0/5000000 bytes
Lua time usage: 0.017/7.000 seconds
Lua memory usage: 1179029/52428800 bytes
ExtLoops count: 0/200
-->
<!--
Transclusion expansion time report (%,ms,calls,template)
100.00% 89.717 1 -total
54.48% 48.874 1 Template:Block
28.68% 25.729 2 Template:Only
19.55% 17.541 7 Template:Infobox_row
18.67% 16.750 2 Template:Tag
11.68% 10.477 2 Template:Delink
10.44% 9.371 4 Template:Editions
9.43% 8.461 1 Template:Blast_resistance_values
7.44% 6.673 1 Template:See_also
6.29% 5.647 1 Template:Hardness_values
-->
Inserting rawStr = rawStr.replaceAll("<!--(.*?)-->", "") here should fix it, can't do it right now though.
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.