Hi, I posted a topic in Wikimedia Developer Support a few days ago. Can someone answer my doubts?
Topic on Extension talk:Linter
Location tells you the start and end offset within the wikitext source where the linter error can be found.
How can I catch the error html? I queried it, the start is 2129 and the end is 2275. When I catch the html in my program, the program returns non-error html. There is my test code (written in PHP):
$start = 2129;
$end = 2275;
$obj = new HclearBot\APIRevisions( 3912458 ); // Where 3912458 is the page error
echo substr( $obj->getContent(), $start, $end - $start );
There is HclearBot\APIRevisions class for used to get revision..
The captured html is completely different from the html seen in the wikicode editor.
Also, note that the offsets are for wikitext strings in the page, not HTML.
The offsets are character offsets. So, you need to use a unicode compliant substr operation. Try mb_substr($obj->getContent, $start, $end, "utf-8")
.
https://zh.wikipedia.org/wiki/%E9%A6%96%E9%9F%B3%E4%BA%92%E6%8F%9B?action=parsermigration-edit shows you the problem visually.
You can see the problem here: ... You have <u>m<u>issed all my ...
Oh, yes. I just need this answer. Thank you.