Skip to content

Commit

Permalink
#116 Keep line feed characters when displaying ReqIF text in diagrams.
Browse files Browse the repository at this point in the history
Fixes #116

Change-Id: I8ebdda2567ae538bf7a8b7c096f861a8d1395a8e
Signed-off-by: Tu Ton <minhtutonthat@gmail.com>
  • Loading branch information
minhtutonthat authored and pdulth committed Jan 22, 2021
1 parent cd1d122 commit 09a14e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ protected String evaluateExpression(Session session, Requirement requirement, St
resultBuilder.append(value);
}
String evaluationResult = resultBuilder.toString();
String sanytizedResult = LabelHelper.transformHTMLToText(evaluationResult);
String sanytizedResult = LabelHelper.transformHTMLToTextWithLineFeed(evaluationResult);

return reduceString(sanytizedResult, maxLength);
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ private LabelHelper() {
// Private constructor
}
public static String transformHTMLToText(String content) {
content = content.replaceAll("<[^>]*>", "").replaceAll("\r\n", " ").replaceAll("\n", " ").trim();
return transformHTMLToTextWithLineFeed(content).replace("\r\n", " ").replace("\n", " ").trim();
}

public static String transformHTMLToTextWithLineFeed(String content) {
content = content.replaceAll("<[^>]*>", "").trim();
// Decode special characters
content = URI.decode(content);
// Unescape HTML special character entities
Expand Down

0 comments on commit 09a14e5

Please sign in to comment.