@@ -26,9 +26,9 @@ static class Converter
2626 {
2727 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
2828 span . ToLowerInvariant ( loweredValue ) ;
29- return loweredValue switch
29+ return loweredValue . Trim ( ) switch
3030 {
31- "left" => JustificationValues . Left ,
31+ "left" => JustificationValues . Left ,
3232 "right" => JustificationValues . Right ,
3333 "center" => JustificationValues . Center ,
3434 "justify" => JustificationValues . Both ,
@@ -43,7 +43,7 @@ static class Converter
4343 {
4444 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
4545 span . ToLowerInvariant ( loweredValue ) ;
46- return loweredValue switch
46+ return loweredValue . Trim ( ) switch
4747 {
4848 "top" => TableVerticalAlignmentValues . Top ,
4949 "middle" => TableVerticalAlignmentValues . Center ,
@@ -61,7 +61,7 @@ public static Unit ToFontSize(ReadOnlySpan<char> span)
6161
6262 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
6363 span . ToLowerInvariant ( loweredValue ) ;
64- var unit = loweredValue switch
64+ var unit = loweredValue . Trim ( ) switch
6565 {
6666 "1" or "xx-small" => new Unit ( UnitMetric . Point , 10 ) ,
6767 "2" or "x-small" => new Unit ( UnitMetric . Point , 15 ) ,
@@ -92,7 +92,7 @@ public static Unit ToFontSize(ReadOnlySpan<char> span)
9292
9393 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
9494 span . ToLowerInvariant ( loweredValue ) ;
95- return loweredValue switch
95+ return loweredValue . Trim ( ) switch
9696 {
9797 "small-caps" => FontVariant . SmallCaps ,
9898 "normal" => FontVariant . Normal ,
@@ -106,7 +106,7 @@ public static Unit ToFontSize(ReadOnlySpan<char> span)
106106
107107 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
108108 span . ToLowerInvariant ( loweredValue ) ;
109- return loweredValue switch
109+ return loweredValue . Trim ( ) switch
110110 {
111111 "italic" or "oblique" => FontStyle . Italic ,
112112 "normal" => FontStyle . Normal ,
@@ -120,7 +120,7 @@ public static Unit ToFontSize(ReadOnlySpan<char> span)
120120
121121 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
122122 span . ToLowerInvariant ( loweredValue ) ;
123- return loweredValue switch
123+ return loweredValue . Trim ( ) switch
124124 {
125125 "700" or "bold" => FontWeight . Bold ,
126126 "bolder" => FontWeight . Bolder ,
@@ -135,8 +135,9 @@ public static Unit ToFontSize(ReadOnlySpan<char> span)
135135
136136 // return the first font name
137137 Span < Range > tokens = stackalloc Range [ 1 ] ;
138- return span . SplitCompositeAttribute ( tokens , ',' ) switch {
139- 1 => span . Slice ( tokens [ 0 ] ) . ToString ( ) ,
138+ return span . SplitCompositeAttribute ( tokens , ',' ) switch
139+ {
140+ 1 => span . Slice ( tokens [ 0 ] ) . Trim ( ) . ToString ( ) ,
140141 _ => null
141142 } ;
142143 }
@@ -148,7 +149,7 @@ public static BorderValues ToBorderStyle(ReadOnlySpan<char> span)
148149
149150 Span < char > loweredValue = span . Length <= 128 ? stackalloc char [ span . Length ] : new char [ span . Length ] ;
150151 span . ToLowerInvariant ( loweredValue ) ;
151- return loweredValue switch
152+ return loweredValue . Trim ( ) switch
152153 {
153154 "dotted" => BorderValues . Dotted ,
154155 "dashed" => BorderValues . Dashed ,
@@ -177,7 +178,7 @@ public static ICollection<TextDecoration> ToTextDecoration(ReadOnlySpan<char> va
177178 var tokenCount = span . Split ( tokens , ' ' , StringSplitOptions . RemoveEmptyEntries ) ;
178179 for ( int i = 0 ; i < tokenCount ; i ++ )
179180 {
180- switch ( span . Slice ( tokens [ i ] ) )
181+ switch ( span . Slice ( tokens [ i ] ) . Trim ( ) )
181182 {
182183 case "underline" : decorations . Add ( TextDecoration . Underline ) ; break ;
183184 case "line-through" : decorations . Add ( TextDecoration . LineThrough ) ; break ;
0 commit comments