From 05ff9e63fb5ab95e20ebe403755ebfb1f8780c25 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 24 Feb 2016 08:32:15 +0000 Subject: Turn Mammoth into a non-static class --- .../org/zwobble/mammoth/internal/DocumentConverter.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/org/zwobble/mammoth/internal/DocumentConverter.java') diff --git a/src/main/java/org/zwobble/mammoth/internal/DocumentConverter.java b/src/main/java/org/zwobble/mammoth/internal/DocumentConverter.java index 5aa3c08..ab28651 100644 --- a/src/main/java/org/zwobble/mammoth/internal/DocumentConverter.java +++ b/src/main/java/org/zwobble/mammoth/internal/DocumentConverter.java @@ -24,8 +24,8 @@ import static org.zwobble.mammoth.internal.util.MammothLists.*; import static org.zwobble.mammoth.internal.util.MammothMaps.map; public class DocumentConverter { - public static Result> convertToHtml(String idPrefix, boolean preserveEmptyParagraphs, StyleMap styleMap, Document document) { - DocumentConverter documentConverter = new DocumentConverter(idPrefix, preserveEmptyParagraphs, styleMap); + public static Result> convertToHtml(Document document, DocumentToHtmlOptions options) { + DocumentConverter documentConverter = new DocumentConverter(options); return new Result<>( documentConverter.convertToHtml(document), documentConverter.warnings.build()); @@ -38,8 +38,8 @@ public class DocumentConverter { reference -> document.getNotes().findNote(reference.getNoteType(), reference.getNoteId()).get())); } - public static Result> convertToHtml(String idPrefix, boolean preserveEmptyParagraphs, StyleMap styleMap, DocumentElement element) { - DocumentConverter documentConverter = new DocumentConverter(idPrefix, preserveEmptyParagraphs, styleMap); + public static Result> convertToHtml(DocumentElement element, DocumentToHtmlOptions options) { + DocumentConverter documentConverter = new DocumentConverter(options); return new Result<>( documentConverter.convertToHtml(element), documentConverter.warnings.build()); @@ -51,10 +51,10 @@ public class DocumentConverter { private final List noteReferences = new ArrayList<>(); private final ImmutableList.Builder warnings = ImmutableList.builder(); - private DocumentConverter(String idPrefix, boolean preserveEmptyParagraphs, StyleMap styleMap) { - this.idPrefix = idPrefix; - this.preserveEmptyParagraphs = preserveEmptyParagraphs; - this.styleMap = styleMap; + private DocumentConverter(DocumentToHtmlOptions options) { + this.idPrefix = options.idPrefix(); + this.preserveEmptyParagraphs = options.shouldPreserveEmptyParagraphs(); + this.styleMap = options.styleMap(); } private List convertToHtml(Document document) { -- cgit v1.2.3