Conditional line breaks

With all excessive white spaces being removed, conditional line breaks in a paragraph need to be done using a markup. The implementation recognizes the two HTML line break markups <br> and <br />.

The example below adds text to a paragraph with excessive white spaces (being removed) and conditional line breaks (being translated into line breaks).

The lines 1 and 2 add a conditional line break as <br> and <br /> respectively. They appear as individual lines. The third line has an excessive line break, which will be removed, resulting in a single line.

1
2
3
4
5
6
7
AsciiParagraph ap = new AsciiParagraph();
ap.getContext().setAlignment(TextAlignment.LEFT).setWidth(35);

ap.addText("line 1<br>");
ap.addText("line 2<br/>");
ap.addText("line three \n still line three");
System.out.println(ap.render());

The resulting output:

line 1
line 2
line three still line three