Skip to content

Commit

Permalink
handle NBSPs internally a bit cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 9, 2020
1 parent 90c1684 commit 321575f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ else if (CoreUtilities.toLowerCase(element).contains(CoreUtilities.toLowerCase(c
attribute.echoError("The tag ElementTag.pad_left[...] must have a value.");
return null;
}
String with = String.valueOf((char) 0x00A0);
String with = CoreUtilities.NBSP;
int length = attribute.getIntContext(1);

// <--[tag]
Expand Down Expand Up @@ -1481,7 +1481,7 @@ else if (CoreUtilities.toLowerCase(element).contains(CoreUtilities.toLowerCase(c
attribute.echoError("The tag ElementTag.pad_right[...] must have a value.");
return null;
}
String with = String.valueOf((char) 0x00A0);
String with = CoreUtilities.NBSP;
int length = attribute.getIntContext(1);

// <--[tag]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static String unEscape(String input) {
input = CoreUtilities.replace(input, "&fs", "/");
input = CoreUtilities.replace(input, "&ss", "§");
input = CoreUtilities.replace(input, "&ns", "#");
input = CoreUtilities.replace(input, "&sp", String.valueOf((char) 0x00A0));
input = CoreUtilities.replace(input, "&sp", CoreUtilities.NBSP);
input = CoreUtilities.replace(input, "&amp", "&");
return input;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@

public class CoreUtilities {

public static final char NBSP_Char = (char) 0x00A0;

public static final String NBSP = String.valueOf(NBSP_Char);

public static String clearNBSPs(String input) {
return input.replace(NBSP_Char, ' ');
}

public static TagContext noDebugContext;
public static TagContext basicContext;

Expand Down

0 comments on commit 321575f

Please sign in to comment.