From 6a06bcfd58fd773742f722f956a021a2345db90a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 9 Dec 2018 18:26:27 +0100 Subject: [PATCH] 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. --- .../conversations/utils/ImStyleParser.java | 191 ++++++++++-------- 1 file changed, 107 insertions(+), 84 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java b/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java index c6982db86..873ab9f43 100644 --- a/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java +++ b/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java @@ -35,102 +35,125 @@ 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 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