Last modified: 2011-11-29 22:42:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T17567, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 15567 - action=parse should have an option to output DOM tree
action=parse should have an option to output DOM tree
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.14.x
All All
: Lowest enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-11 21:06 UTC by Roan Kattouw
Modified: 2011-11-29 22:42 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Roan Kattouw 2008-09-11 21:06:38 UTC
action=parse should have an option to output the parse tree (AKA DOM tree, intermediate step in parsing wikitext to HTML), so third-party applications that want to convert wikitext to another format (like PDF) can be made more reliable (currently, they just re-implement the MW parser, which isn't very reliable or efficient).
Comment 1 Niklas Laxström 2008-09-19 07:59:08 UTC
The parser does not generate a DOM tree.
Comment 2 Roan Kattouw 2008-09-19 09:27:59 UTC
(In reply to comment #1)
> The parser does not generate a DOM tree.
> 

The preprocessor does, though, doesn't it?
Comment 3 Niklas Laxström 2008-09-19 11:01:22 UTC
What the preprocessor produces is hardly usable for converting the markup to other formats, is it?
Comment 4 Roan Kattouw 2008-09-19 11:02:53 UTC
(In reply to comment #3)
> What the preprocessor produces is hardly usable for converting the markup to
> other formats, is it?
> 

It's gotta be better than letting converters parse the wikitext themselves.
Comment 5 Daniel Friesen 2008-09-19 14:09:16 UTC
Not really... The preprocessor only handles {{...}}'s and {{{...}}}'s, and doesn't distinguish between templates, magic variables, and parser functions. The actual dom tree is a long set of nodes which make very little sense to anything but the parser. And on top of that if the HASH preprocessor is enabled instead, then you have no DOM to output.

Creating a parser inspired by WikiText which would parse a page based on rules into a tree format which could be sent as XML or JSON and then backconverted into WikiText or parsed into HTML was one of my side-projects, XWT. But an idea like that is incompatible with normal WikiText, and is impossible to do with the current parser.
Comment 6 Bryan Tong Minh 2008-10-20 14:06:20 UTC
Later, when there is something like an intermediate DOM tree...
Comment 7 Brion Vibber 2011-11-29 22:42:11 UTC
action=expandtemplates can do this with the generatexml param.

https://www.mediawiki.org/wiki/API:Parsing_wikitext#expandtemplates

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links