Hi,
Is there an option to get absolute URLs with action=parse ?
For instance, I would like to get "http://en.wikipedia.org/wiki/..." instead of "/wiki/..." in src and href attributes. I can parse the HTML returned by the API and transform URLs, but I wonder if there is an easier method.
Thanks, Marc Kerbiquet
2011/1/4 Marc Kerbiquet mkerbiquet@gmail.com:
Hi,
Is there an option to get absolute URLs with action=parse ?
For instance, I would like to get "http://en.wikipedia.org/wiki/..." instead of "/wiki/..." in src and href attributes. I can parse the HTML returned by the API and transform URLs, but I wonder if there is an easier method.
action=render does this:
http://en.wikipedia.org/w/index.php?title=Albert_Einstein&action=render
Having it in action=parse would be nice, but because of the way this stuff is written (checking whether the action parameter equals 'render' and adding it if so) that's probably tricky.
Roan Kattouw (Catrope)
On Tue, Jan 4, 2011 at 8:09 PM, Roan Kattouw roan.kattouw@gmail.com wrote:
2011/1/4 Marc Kerbiquet mkerbiquet@gmail.com:
Hi,
Is there an option to get absolute URLs with action=parse ?
For instance, I would like to get "http://en.wikipedia.org/wiki/..." instead of "/wiki/..." in src and href attributes. I can parse the HTML returned by the API and transform URLs, but I wonder if there is an easier method.
action=render does this:
http://en.wikipedia.org/w/index.php?title=Albert_Einstein&action=render
Having it in action=parse would be nice, but because of the way this stuff is written (checking whether the action parameter equals 'render' and adding it if so) that's probably tricky.
Roan Kattouw (Catrope)
Thanks, but I forgot to mention that I also use the 'text' attribute and the headhtml prop in a POST with action=parse. I use this command to implement a preview in an external editor (the text is not in the database yet).
It would be nice if it was possible to implement an option to get absolute urls but a simple replace does the trick as long as the page does not contain source HTML :-)
Cheers, Marc
Marc Kerbiquet wrote:
Thanks, but I forgot to mention that I also use the 'text' attribute and the headhtml prop in a POST with action=parse. I use this command to implement a preview in an external editor (the text is not in the database yet).
It would be nice if it was possible to implement an option to get absolute urls but a simple replace does the trick as long as the page does not contain source HTML :-)
Cheers, Marc
You can also make it the other way. Provide all your local URLs as absolute ones, and point the relatives to the wiki with <base href=
mediawiki-api@lists.wikimedia.org