aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-14 11:42:26 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-14 11:42:26 +0000
commit8bdef5495085e7258ca884bdcc0159c264181895 (patch)
treeac95ac3dafd6c747be7cbde8ca5788fa9844b2cd /src/main/java/org/zwobble
parent2c4946f27b559245d070a6d85ccfbea3d3051134 (diff)
Convert hyperlinks with href to HTML
Diffstat (limited to 'src/main/java/org/zwobble')
-rw-r--r--src/main/java/org/zwobble/mammoth/DocumentConverter.java5
1 files changed, 4 insertions, 1 deletions
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<HtmlNode> convertToHtml(Document document) {
@@ -89,7 +91,8 @@ public class DocumentConverter {
@Override
public List<HtmlNode> visit(Hyperlink hyperlink) {
- throw new UnsupportedOperationException();
+ Map<String, String> attributes = map("href", hyperlink.getHref().get());
+ return list(Html.element("a", attributes, convertChildrenToHtml(hyperlink)));
}
@Override