You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Plain text with normalized whitespace from AttributeValueXHTML
#92
I have verified that I am running the latest version of the reqifsharp
I have searched open and closed issues to ensure it has not already been reported
Description
AttributeValueXHTML.ExtractUnformattedTextFromValue() returns the text with the line breaks and indentation of the XHTML source, and with extra spaces around inline elements. Every consumer that shows the text in a list, a label or a CSV has to clean it up; the ReqIF Viewer now does this itself.
Proposal
An option or a second method that returns normalized text: whitespace runs collapsed to one space, no space added before punctuation that follows an inline element, trimmed; paragraph and list boundaries optionally kept as a line break.
Acceptance criteria
The example below gives "brew a cup in under 30 seconds."; the existing method keeps its behaviour.
Steps to Reproduce
varvalue=newAttributeValueXHTML{TheValue="<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"><xhtml:p>brew a cup in <xhtml:b>under 30 seconds</xhtml:b>.</xhtml:p></xhtml:div>"};Console.WriteLine($"[{value.ExtractUnformattedTextFromValue()}]");// [brew a cup in under 30 seconds .]
Activity
[Update] remove references to GitHub issues from code comments