compile from wk

This commit is contained in:
polv committed 2022-04-03 08:41:43 +07:00
1 parent 14c722c529
commit 693b742c9e
12 files changed
+888

No files matched your search

@@ -0,0 +1,39 @@
import fs from 'fs'
import { radicals } from './beautify-radicals'
async function main() {
const map = radicals.load()
fs.writeFileSync(
'../../_radicals.md',
Object.entries(map)
.map(([k, v]) => {
const headers = [k]
if (v.meaning !== k) {
headers.push(v.meaning)
}
if (v.reading) {
headers.push(v.reading)
}
headers.push(String(v.level))
const rows = [`## ${headers.join(', ')}`, '']
if (v.image) {
rows.push(
`<img src="${v.image.src}" alt="${k}"${
v.image.width ? ` width="${v.image.width}"` : ''
}${v.image.height ? ` height="${v.image.height}"` : ''} />`,
''
)
}
return rows.join('\n')
})
.join('\n\n')
)
}
if (require.main === module) {
main()
}