Il 24/07/2015 06:35, C. Scott Ananian ha scritto:
Well, it's really just a different way of thinking about things.  Instead
of:
```
import mwparserfromhell
text = "I has a template! {{foo|bar|baz|eggs=spam}} See it?"
wikicode = mwparserfromhell.parse(text)
templates = wikicode.filter_templates()
```
you would write:
```
js> Parsoid = require('parsoid');
js> text = "I has a template! {{foo|bar|baz|eggs=spam}} See it?";
js> Parsoid.parse(text, { document: true }).then(function(res) {
       templates = res.out.querySelectorAll('[typeof~="mw:Transclusion"]');
       console.log(templates);
      }).done();
```

That said, it wouldn't be hard to clone the API of
http://mwparserfromhell.readthedocs.org/en/latest/api/mwparserfromhell.html

Parsoid's expressiveness seems to convey useless information, overlook important details, or duplicate them in different places. If I want to resize an image, am I supposed to change "data-file-width" and "data-file-height"? "width" and "height"? Or "src"? I think what I'm looking for is sort of an 'enhanced wikitext' rather than 'annotated HTML'.

and that would probably be a great addition to the parsoid package API.

HTML is just a tree structured data representation.  Think of it as XML if
it makes you happier.  It just happens to come with well-defined semantics
and lots of manipulation libraries.

I don't know about edits tagged as "VisualEditor".  That seems like that
should only be done by VE.

All edits made via visualeditoredit <https://www.mediawiki.org/w/api.php?action=help&modules=visualeditoredit> are tagged.

I take it you would like an easy work flow to
fetch a page, make edits, and then write the new revision back?

Right.

  mwparserfromhell doesn't actually seem to have that functionality

It is actually pretty easy to do with Pywikibot.
But since Parsoid happens to work server-side, it makes sense to request and send back the structured tree directly.

, but it
would also be nice to facilitate that use case if we can.
   --scott

​
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Thanks for your time.
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to