diff options
| author | Michael Williamson <mike@zwobble.org> | 2020-11-06 18:54:59 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2020-11-06 18:54:59 +0000 |
| commit | d8ff620412641d5a94085df703a8321e5964ae33 (patch) | |
| tree | 0d743f5fc3517ed3803a399387e4950e2309852f /src/main/java/org/zwobble/mammoth/internal/styles | |
| parent | 999fbc8dc29b87a0f9c4497ec680915ac7ecae26 (diff) | |
Add style mapping for all caps
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/internal/styles')
3 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/org/zwobble/mammoth/internal/styles/StyleMap.java b/src/main/java/org/zwobble/mammoth/internal/styles/StyleMap.java index 2b1d19a..1b094fd 100644 --- a/src/main/java/org/zwobble/mammoth/internal/styles/StyleMap.java +++ b/src/main/java/org/zwobble/mammoth/internal/styles/StyleMap.java @@ -24,6 +24,7 @@ public class StyleMap { Optionals.first(high.italic, low.italic), Optionals.first(high.underline, low.underline), Optionals.first(high.strikethrough, low.strikethrough), + Optionals.first(high.allCaps, low.allCaps), Optionals.first(high.smallCaps, low.smallCaps), Optionals.first(high.commentReference, low.commentReference), Lists.eagerConcat(high.paragraphStyles, low.paragraphStyles), @@ -39,6 +40,7 @@ public class StyleMap { private final Optional<HtmlPath> italic; private final Optional<HtmlPath> underline; private final Optional<HtmlPath> strikethrough; + private final Optional<HtmlPath> allCaps; private final Optional<HtmlPath> smallCaps; private final Optional<HtmlPath> commentReference; private final List<StyleMapping<Paragraph>> paragraphStyles; @@ -51,6 +53,7 @@ public class StyleMap { Optional<HtmlPath> italic, Optional<HtmlPath> underline, Optional<HtmlPath> strikethrough, + Optional<HtmlPath> allCaps, Optional<HtmlPath> smallCaps, Optional<HtmlPath> commentReference, List<StyleMapping<Paragraph>> paragraphStyles, @@ -63,6 +66,7 @@ public class StyleMap { this.italic = italic; this.underline = underline; this.strikethrough = strikethrough; + this.allCaps = allCaps; this.smallCaps = smallCaps; this.commentReference = commentReference; this.paragraphStyles = paragraphStyles; @@ -92,6 +96,10 @@ public class StyleMap { return strikethrough; } + public Optional<HtmlPath> getAllCaps() { + return allCaps; + } + public Optional<HtmlPath> getSmallCaps() { return smallCaps; } diff --git a/src/main/java/org/zwobble/mammoth/internal/styles/StyleMapBuilder.java b/src/main/java/org/zwobble/mammoth/internal/styles/StyleMapBuilder.java index dbd4fa8..2d90219 100644 --- a/src/main/java/org/zwobble/mammoth/internal/styles/StyleMapBuilder.java +++ b/src/main/java/org/zwobble/mammoth/internal/styles/StyleMapBuilder.java @@ -12,6 +12,7 @@ import java.util.Optional; public class StyleMapBuilder { private Optional<HtmlPath> underline; private Optional<HtmlPath> strikethrough; + private Optional<HtmlPath> allCaps; private Optional<HtmlPath> smallCaps; private Optional<HtmlPath> bold; private Optional<HtmlPath> italic; @@ -25,6 +26,7 @@ public class StyleMapBuilder { this.bold = Optional.empty(); this.underline = Optional.empty(); this.strikethrough = Optional.empty(); + this.allCaps = Optional.empty(); this.smallCaps = Optional.empty(); this.italic = Optional.empty(); this.commentReference = Optional.empty(); @@ -50,6 +52,11 @@ public class StyleMapBuilder { return this; } + public StyleMapBuilder allCaps(HtmlPath path) { + this.allCaps = Optional.of(path); + return this; + } + public StyleMapBuilder smallCaps(HtmlPath path) { this.smallCaps = Optional.of(path); return this; @@ -86,6 +93,7 @@ public class StyleMapBuilder { italic, underline, strikethrough, + allCaps, smallCaps, commentReference, paragraphStyles, diff --git a/src/main/java/org/zwobble/mammoth/internal/styles/parsing/DocumentMatcherParser.java b/src/main/java/org/zwobble/mammoth/internal/styles/parsing/DocumentMatcherParser.java index f955431..fdd2797 100644 --- a/src/main/java/org/zwobble/mammoth/internal/styles/parsing/DocumentMatcherParser.java +++ b/src/main/java/org/zwobble/mammoth/internal/styles/parsing/DocumentMatcherParser.java @@ -30,6 +30,8 @@ public class DocumentMatcherParser { return StyleMapBuilder::underline; case "strike": return StyleMapBuilder::strikethrough; + case "all-caps": + return StyleMapBuilder::allCaps; case "small-caps": return StyleMapBuilder::smallCaps; case "comment-reference": |
