From 8bdef5495085e7258ca884bdcc0159c264181895 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 14 Feb 2016 11:42:26 +0000 Subject: Convert hyperlinks with href to HTML --- src/main/java/org/zwobble/mammoth/DocumentConverter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java index be2f68e..e8d9059 100644 --- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java +++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java @@ -5,9 +5,11 @@ import org.zwobble.mammoth.html.Html; import org.zwobble.mammoth.html.HtmlNode; import java.util.List; +import java.util.Map; import static org.zwobble.mammoth.util.MammothLists.eagerFlatMap; import static org.zwobble.mammoth.util.MammothLists.list; +import static org.zwobble.mammoth.util.MammothMaps.map; public class DocumentConverter { public static List convertToHtml(Document document) { @@ -89,7 +91,8 @@ public class DocumentConverter { @Override public List visit(Hyperlink hyperlink) { - throw new UnsupportedOperationException(); + Map attributes = map("href", hyperlink.getHref().get()); + return list(Html.element("a", attributes, convertChildrenToHtml(hyperlink))); } @Override -- cgit v1.2.3