[AstroPy] making a URL active in table.show_in_browser

Aldcroft, Thomas aldcroft at head.cfa.harvard.edu
Thu Oct 22 22:47:26 EDT 2015


On Thu, Oct 22, 2015 at 10:07 PM, Brendan Griffen <
brendan.f.griffen at gmail.com> wrote:

> Hi,
>
> I have a table which has a list of URLs. When I execute:
>
> table.show_in_browser(jsviewer = True)
>
> It does indeed launch in browser but the URLs are not active and are just
> displayed at a string.
>
> I tried to force the situation...
>
> urls.append('<a href="'+webLink+'">'+webLink+'</a>')
>
> Then I wrote that to the table, but that didn't work either.
>
> Is there a work around?
>

I recently had this problem as well.  This happens because the HTML writer
automatically escapes "<" and ">" (and other special HTML characters).  In
the current code I don't believe there is a way to disable this.

If you are lucky enough that your table doesn't include any other "<" or
">" characters, you can do an easy workaround: start with your second
attempt of putting in <a href="..."> links, then in the output HTML do a
global regular expression replacement of > with > and < with <.

- Tom



>
> Thanks.
> Brendan
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20151022/d3fd366b/attachment.html>


More information about the AstroPy mailing list