download all assets
This commit is contained in:
1 parent
b935bb97b9
commit
5d137dd4b5
52 files changed
+1874
-446
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()
|
||||
}
|
||||
Reference in new issue
Block a user