mirror of
https://github.com/He4eT/oddkb.git
synced 2026-05-05 01:17:25 +00:00
Layout images generator
This commit is contained in:
parent
1cd1bf93f0
commit
4894240006
4 changed files with 182 additions and 0 deletions
30
preview_generator/preview_generator.js
Normal file
30
preview_generator/preview_generator.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Convert the keymap.c file to the "Raw data" for
|
||||
* http://www.keyboard-layout-editor.com/
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
const {buildRow} = require('./rows')
|
||||
const {cleanKeys, printLegends} = require('./legends')
|
||||
|
||||
const keymapFilePath = process.argv[2]
|
||||
const fileContent = fs.readFileSync(keymapFilePath, 'utf8')
|
||||
|
||||
const keymapToKLERawData = fileContent =>
|
||||
fileContent
|
||||
.split('\n')
|
||||
.map(row => row.split(','))
|
||||
.filter(key => key.length > 1)
|
||||
.map(cleanKeys)
|
||||
.map(printLegends)
|
||||
.map(buildRow)
|
||||
.map(JSON.stringify)
|
||||
|
||||
const result = keymapToKLERawData(fileContent)
|
||||
// .slice(0, 8)
|
||||
// .slice(8, 16)
|
||||
// .slice(16)
|
||||
|
||||
console.log(result.join(',\n'))
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue