aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/DocumentConverter.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-20 14:20:40 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-20 14:20:40 +0000
commitbba2f4d95240ea3569e253609e95cc94c5c8ef13 (patch)
tree1a510988da0f17f4a3222a0b2f62de4b2f1cf641 /src/main/java/org/zwobble/mammoth/DocumentConverter.java
parenta3eb5f0c3ee50afafc517c4a7e36501539489178 (diff)
Add strikethrough to style map
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/DocumentConverter.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/DocumentConverter.java14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/main/java/org/zwobble/mammoth/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
index 0ec6e98..c2adf4d 100644
--- a/src/main/java/org/zwobble/mammoth/DocumentConverter.java
+++ b/src/main/java/org/zwobble/mammoth/DocumentConverter.java
@@ -3,13 +3,10 @@ package org.zwobble.mammoth;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import org.zwobble.mammoth.documents.*;
import org.zwobble.mammoth.html.Html;
import org.zwobble.mammoth.html.HtmlNode;
-import org.zwobble.mammoth.styles.HtmlPath;
-import org.zwobble.mammoth.styles.HtmlPathElement;
import org.zwobble.mammoth.styles.StyleMap;
import org.zwobble.mammoth.util.MammothLists;
@@ -96,10 +93,10 @@ public class DocumentConverter {
public List<HtmlNode> visit(Run run) {
List<HtmlNode> nodes = convertChildrenToHtml(run);
if (run.isStrikethrough()) {
- nodes = list(Html.collapsibleElement("s", nodes));
+ nodes = styleMap.getStrikethrough().wrap(nodes);
}
if (run.isUnderline()) {
- nodes = wrapInPath(styleMap.getUnderline(), nodes);
+ nodes = styleMap.getUnderline().wrap(nodes);
}
if (run.getVerticalAlignment() == VerticalAlignment.SUBSCRIPT) {
nodes = list(Html.collapsibleElement("sub", nodes));
@@ -116,13 +113,6 @@ public class DocumentConverter {
return nodes;
}
- private List<HtmlNode> wrapInPath(HtmlPath path, List<HtmlNode> nodes) {
- for (HtmlPathElement element : Lists.reverse(path.getElements())) {
- nodes = list(Html.element(element.getTagName(), nodes));
- }
- return nodes;
- }
-
@Override
public List<HtmlNode> visit(Text text) {
if (text.getValue().isEmpty()) {