File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,18 @@ const categoryMap: { [key: string]: string } = {
6969 "Zs" : "Separator, Space"
7070}
7171
72+ const exampleMap : { [ key : string ] : string } = { } ;
73+
74+ function initExampleMap ( data : SearchEntry [ ] ) {
75+ for ( var loop = 0 ; loop <= 0x1F ; loop ++ ) {
76+ exampleMap [ String . fromCodePoint ( loop ) ] = String . fromCodePoint ( 0x2400 + loop ) ;
77+ }
78+ exampleMap [ "<" ] = "<" ;
79+ exampleMap [ ">" ] = ">" ;
80+ exampleMap [ "&" ] = "&" ;
81+ exampleMap [ "\"" ] = """ ;
82+ }
83+
7284// translates from a hex codepoint string to the actual character
7385function codeToString ( code : string ) :string {
7486 return String . fromCodePoint ( parseInt ( code , 16 ) ) ;
@@ -179,7 +191,9 @@ function fmtExample(cell: CellComponent) {
179191 if ( ! val ) {
180192 return "" ;
181193 }
182- return `<span style="font-size:2em;">${ val } </span>` ;
194+
195+ const mapped = exampleMap [ val ] || val ;
196+ return `<span style="font-size:2em;">${ mapped } </span>` ;
183197}
184198
185199function fmtTags ( cell : CellComponent ) {
@@ -362,6 +376,8 @@ async function main() {
362376 row . example = codeToString ( row . code ) ;
363377 }
364378
379+ initExampleMap ( data ) ;
380+
365381 console . log ( data [ 0 ] ) ;
366382
367383 const qs = new URLSearchParams ( window . location . search ) ;
You can’t perform that action at this time.
0 commit comments