Clickable URLs in HTML exporter. Closes #1696.

This commit is contained in:
Antonin Delpeuch 2018-08-07 10:27:45 +01:00
parent d271b430ec
commit c7c3fab8e4

View File

@ -33,6 +33,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.exporters; package com.google.refine.exporters;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
@ -348,6 +350,13 @@ abstract public class CustomizableTabularExporterUtilities {
if (text == null) { if (text == null) {
if (value instanceof String) { if (value instanceof String) {
text = (String) value; text = (String) value;
if(text.contains(":")) {
try {
link = new URL(text).toString();
} catch (MalformedURLException e) {
}
}
} else if (value instanceof OffsetDateTime) { } else if (value instanceof OffsetDateTime) {
text = ((OffsetDateTime) value).format(DateTimeFormatter.ISO_INSTANT); text = ((OffsetDateTime) value).format(DateTimeFormatter.ISO_INSTANT);
} else { } else {