Roan Kattouw | 4 Jan 2011 20:09
Picon

Re: Absolute URLs with action=parse

2011/1/4 Marc Kerbiquet <mkerbiquet <at> 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)
Marc Kerbiquet | 4 Jan 2011 20:55
Picon

Re: Absolute URLs with action=parse

On Tue, Jan 4, 2011 at 8:09 PM, Roan Kattouw <roan.kattouw <at> gmail.com> wrote:
> 2011/1/4 Marc Kerbiquet <mkerbiquet <at> 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 :-)
(Continue reading)

Platonides | 4 Jan 2011 21:55
Picon

Re: Absolute URLs with action=parse

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=
Marc Kerbiquet | 4 Jan 2011 22:28
Picon

Re: Absolute URLs with action=parse

> 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=

Thank you, that's exactly what I need.

Cheers,
Marc

Gmane