Il 31/07/2015 21:08, C. Scott Ananian ha scritto:
I agree that we have not (to date) spent a lot of time
on APIs supporting
direct editing of the Parsoid DOM. I tend to do things directly using the
low-level DOM methods myself (and that's how I presented my Parsoid
tutorial at wikimania this year) but I can see the attractiveness of the
`mwparserfromhell` API in abstracting some of the details of the
representation.
Thankfully you can have it both ways! Over the past week I've cloned the
`mwparserfromhell` API, build on top of the Parsoid DOM. The initial
patches have been merged, but there's a little work to do to get the API
docs up on
docs.wikimedia.org properly. Once that's done I'll post here
with pointers.
Thanks!
Unfortunately, that still requires using Node.js and depending on the
parsoid package.
Were the mwparserfromhell-like 'AST' exposed by RESTBase directly,
there'd easily be lots of thin manipulation libraries in different
programming languages.
Eventually I'd like to put the pieces together and implement something like
a `pywikibot` clone based on this API and using the RESTBase APIs for
read/write access to the wiki. As has been mentioned, the RESTBase API for
saving edits is not yet quite complete (
https://phabricator.wikimedia.org/T101501); once that is done there should
be no problem connecting the dots. (In the meantime you can use the API I
just implemented to reserialize the wikitext and then use the standard PHP
APIs, but that's a little bit clunky.)
--scott
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l