Single Datatable Cell Value to Multiple Links?

In my application that aggregates data, I include a column with a list of urls to the source files the data for that row came from; the number of possible URLs is currently not bound. I can easily turn the text in the cell into a single link using a HTMLTemplateFormatter ( and a background color specified in another column in the same row ) with:

template_url = ""<div style="background:<%=Color%>;text-align:left";> <a href="<%= value %>“target=”_blank"><%= value %> </a> </div>""
formatter_url = HTMLTemplateFormatter(template=template_url)

If I have the value of the cell as, I get the expected link to
If I have the value of the cell as ~, I get the full string as a link to

Is there a way for me to split the value in the cell on a separator into multiple hrefs, such that the second example has 2 separate links going to the 2 separate destinations?

I am currently pre-encoding the URLs with %20 for space, etc. Is there a way to make the displayed version pretty?

I think you can do something, but it won’t be pretty. Underscore templates may contain arbitrary JS code, so consider:

template = _.template(
   "<% x=value.split('~'); for (var i=0; i<x.length; i++) {print(' ' + x[i].trim() + ' https://' + x[i].trim())} %>"

which yields:

Screen Shot 2019-12-16 at 3.34.06 PM

So, you could leverage that.