From 6c6d3caea00810df9fb89de599386a93e8dbc4d4 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 14 Dec 2018 21:20:34 +0100 Subject: change message styling rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message styling purposly doesn’t require a whitespace after a closing tag to make something like ~un~believable work. However it also breaks _Programmierer_innen_ and other example where the tag is repeated as a non tag in the word. Therefor we change the rules that if a closing tag is followed by a higher order closing tag (a closing tag followed by an end block or white space) we ignore the first closing tag. But only if we don’t read another tag open. --- .../de/pixart/messenger/utils/ImStyleParser.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/de/pixart/messenger/utils/ImStyleParser.java b/src/main/java/de/pixart/messenger/utils/ImStyleParser.java index 9f008d76c..118f3179f 100644 --- a/src/main/java/de/pixart/messenger/utils/ImStyleParser.java +++ b/src/main/java/de/pixart/messenger/utils/ImStyleParser.java @@ -34,10 +34,12 @@ import java.util.Arrays; import java.util.List; public class ImStyleParser { + private final static List KEYWORDS = Arrays.asList('*', '_', '~', '`'); private final static List NO_SUB_PARSING_KEYWORDS = Arrays.asList('`'); private final static List BLOCK_KEYWORDS = Arrays.asList('`'); private final static boolean ALLOW_EMPTY = false; + private final static boolean PARSE_HIGHER_ORDER_END = true; public static List