andyduke / styled_text_package

Text widget with formatted text using tags. Makes it easier to use formatted text in multilingual applications.
https://pub.dev/packages/styled_text
BSD 3-Clause "New" or "Revised" License
75 stars 48 forks source link

Consectuive interpreted tags within a String that are space-separated will lose the space #19

Closed Zabadam closed 3 years ago

Zabadam commented 3 years ago

Example

I have a description property that is a passed to a StyledText() widget.

One such description reads: "A finely crafted hat adorned with an inky black strand of <link npc='crow'>Crow</link> <link id='feather'>feather</link>. Well-suited for the hero that strikes from afar."

When rendered in my application, the String has lost the space between the consectuive <link> tags, resulting in: "A finely crafted hat adorned with an inky black strand of Crowfeather. Well-suited for the hero that strikes from afar."

Zabadam commented 3 years ago

As a workaround I have added a .replaceAll('&s;', ' ') check to e.value; employed in .JSON database thusly: "A finely crafted hat adorned with an inky black strand of <link npc='crow'>Crow</link>&s;<link id='feather'>feather</link>. Well-suited for the hero that strikes from afar." (no space between consecutive tags, only '&s;')

When rendered in my application, the String has an appropriate space between the consectuive tags because there is a third recognized symbol between them injecting it; resulting in: "A finely crafted hat adorned with an inky black strand of Crow feather. Well-suited for the hero that strikes from afar."

andyduke commented 3 years ago

@Zabadam At the moment the problem is in the xmlstream package which I am using to parse tags. I created a issue in the package's github, but temporarily as a workaround you can use &space; between tags: <b>bold</b>&space;<i>italic</i>

andyduke commented 3 years ago

@Zabadam A issue was fixed in xmlstream, I released a new version where the problem was fixed.