|mediawiki/services/parsoid : master||Implement REST API endpoint for wikitext to lint transform|
|Resolved||ssastry||T229015 Tracking: Direct live production traffic at Parsoid/PHP|
|Open||EvanProdromou||T221158 Parsoid REST API in PHP|
|Resolved||EvanProdromou||T221738 Parsoid REST API routes in MediaWiki|
|Resolved||BPirkle||T221175 POST /:domain/v3/transform/wikitext/to/lint/:title?/:revision?|
I'm new to Parsoid, so some clarification and context would be helpful.
- I see that linting can be enabled via $wgParsoidLinting in LocalSettings.php. Is it necessary to enable that for this API call to produce meaningful results, or should the API call (somehow) enable linting when this particular transformation is requested? In other words, is this API call useful on any Parsoid-enabled wiki, or just those configured with $wgParsoidLinting = true? Or is there a larger point that I'm missing?
- when I set "$wgParsoidLinting = true" in my LocalSettings.php, I got errors in src/Wt2Html/PP/Processors/Linter.php. Is this expected?
- I see placeholder code related to this API call in srv/parsoid/extension/src/Rest/Handle/ParsoidHandler.php, function ParsoidHandler::wt2html. This code throws an exception with a message that the wikitext to lint transform is not yet implemented. Is the scope of this task to use a (working) linting system to return the linting results, or is the scope of this task to first make the linting system functional, and then return the results?
- Is there developer-level documentation or Phab info I'm missing where I could have looked up the answers to the above myself? I searched and found various things, but none of it specifically related to the above. The closest thing I found was T228217, where "--linting Parse with linter enabled" was present and not crossed out in the big to-do list, but without context I'm not sure how to interpret that.
Finally, while I was typing the above, auto-correct tried to change "linting" to "listing", "lifting", and "tinting" before I gave in and added "linting" to my dictionary. Apologies if I missed correcting any "corrections".
I see that linting can be enabled via $wgParsoidLinting in LocalSettings.php
I don't recall seeing or writing anything like that, and codesearch doesn't know about it either. Maybe Subbu knows more.
when I set "$wgParsoidLinting = true" in my LocalSettings.php, I got errors in src/Wt2Html/PP/Processors/Linter.php. Is this expected?
To the extent that probably no one ever tested this feature of the PHP port before you, yes.
If this is going to be anything like adding the previous two handlers, you should expect some amount of Parsoid/PHP debugging / bugfixing.
I see placeholder code related to this API call in srv/parsoid/extension/src/Rest/Handle/ParsoidHandler.php, function ParsoidHandler::wt2html.
It was added instead of this line. Note that the whole $out / $parse thing doesn't exist in PHP land, and you'll probably have to figure out how to create a way to get linting data in the Parsoid class, or ask the parsing team to do so.
Is there developer-level documentation or Phab info I'm missing where I could have looked up the answers to the above myself?
Probably not, Parsoid/JS is not super well documented in the first place, and the PHP port has even less.
Closing this as the change has been merged.
It is worth nothing (and this is mentioned in the commit message) that the approach I used for passing data from the Parsoid class back to the REST API is non-ideal and should be cleaned up under another task after the Parsoid class interface is finalized.