File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // a parser for MC programs
2+
3+ // Page [num]
4+ // When [Event] Do [Action] [Loop]
5+
6+ // TODO: scripts reverse the tooltip
7+
8+ namespace microcode {
9+ // resolveTooltip to go from Tid to string (replace space by -)
10+ // reverseTooltip to go from string to tid
11+ }
Original file line number Diff line number Diff line change 3434 " host.ts" ,
3535 " interpreter.ts" ,
3636 " sensors.ts" ,
37+ " mcparser.ts" ,
3738 " exprparser.ts" ,
3839 " decimal.ts" ,
3940 " settings.ts"
Original file line number Diff line number Diff line change @@ -76,22 +76,21 @@ for (const lang of languages.filter(l => l !== "pxt")) {
7676 { encoding : "utf-8" }
7777 )
7878
79- // for (const fn of ["dialogs", "legal"]) {
80- // const dialogs = await (
81- // await fetch(
82- // `${cdn}content/${lang}/microcode/${fn}.html?timestamp=${timestamp}`
83- // )
84- // ).text()
85- // writeFileSync(`./_includes/${fn}-${lang}.html`, dialogs, {
86- // encoding: "utf-8",
87- // })
88- // }
89-
9079 // merge translations
9180 Object . keys ( tooltips )
9281 . filter ( k => ! translations [ k ] )
9382 . forEach ( k => ( translations [ k ] = tooltips [ k ] ) )
9483
84+ // this is for english only (for now)
85+ if ( lang == "en" ) {
86+ const reverseMap = Object . keys ( tooltips ) . filter ( k => tooltips [ k ] )
87+
88+ const tooltip2tid = `
89+ export function tooltip2tid(id: string): number {
90+ }
91+ `
92+ }
93+
9594 const ts = `// auto-generated, run 'node scripts/lochex.mjs' to refresh
9695namespace microcode {
9796 export const lang = "${ lang } "
@@ -109,6 +108,7 @@ ${Object.keys(translations)
109108 return res
110109 }
111110}`
111+
112112 writeFileSync ( "./tooltips.ts" , ts , { encoding : "utf8" } )
113113
114114 // build js
You can’t perform that action at this time.
0 commit comments