mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #6064 from xyzmaker123/fix-parser
Fix bug with text rendering on trade step info
This commit is contained in:
commit
737faa6443
@ -46,9 +46,9 @@ public class SimpleMarkdownParser {
|
|||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
}
|
}
|
||||||
state = MarkdownParsingState.LINK_TEXT;
|
state = MarkdownParsingState.LINK_TEXT;
|
||||||
} else if (c == '(') {
|
} else if (c == '(' && state == MarkdownParsingState.LINK_TEXT) {
|
||||||
state = MarkdownParsingState.LINK_HREF;
|
state = MarkdownParsingState.LINK_HREF;
|
||||||
} else if (c == ')') {
|
} else if (c == ')' && state == MarkdownParsingState.LINK_HREF) {
|
||||||
state = MarkdownParsingState.TEXT;
|
state = MarkdownParsingState.TEXT;
|
||||||
items.add(new HyperlinkNode(sb.toString(), sb2.toString()));
|
items.add(new HyperlinkNode(sb.toString(), sb2.toString()));
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
|
@ -28,4 +28,16 @@ public class SimpleMarkdownParserTest {
|
|||||||
SimpleMarkdownParser.TextNode item2 = (SimpleMarkdownParser.TextNode) result.get(2);
|
SimpleMarkdownParser.TextNode item2 = (SimpleMarkdownParser.TextNode) result.get(2);
|
||||||
assertEquals(". \n\nIf you have any problems you can try to contact the trade peer in the trade chat.", item2.getText());
|
assertEquals(". \n\nIf you have any problems you can try to contact the trade peer in the trade chat.", item2.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParseWithBrackets() {
|
||||||
|
String text = "Take a look (here) for more";
|
||||||
|
|
||||||
|
List<? extends SimpleMarkdownParser.MarkdownNode> result = SimpleMarkdownParser.parse(text);
|
||||||
|
|
||||||
|
assertEquals(1, result.size());
|
||||||
|
|
||||||
|
SimpleMarkdownParser.TextNode item0 = (SimpleMarkdownParser.TextNode) result.get(0);
|
||||||
|
assertEquals("Take a look (here) for more", item0.getText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user