ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.32k stars 246 forks source link

Copying from "raw data" area isn't actually valid JSON #150

Open dragon788 opened 8 years ago

dragon788 commented 8 years ago

I went to copy from the raw data area because it looked pretty good to submit a new layout via a pull request, but upon committing it was evident that Github didn't like the JSON that had been output, as none of the keys of the key/value pairs had been quoted. On a downloaded copy of the same data everything was OK, but it had excessive newlines when opened into Vim or Notepad++ (another issue).

dragon788 commented 8 years ago

My current vim regex to fix this is to paste the raw data area into gVim then hit colon to use an ex command and type/paste the following. %s/\(\w\)\+\:/"\1":/g

dragon788 commented 8 years ago

And then don't forget to fix the actual : on the keyboard layout! I'll have to fix my regex to see if its supposed to be text (ie following a " or \n in the data).

iandoug commented 8 years ago

The stuff in the raw data area is "internal" representation, IIRC, using json 'lite'. You should work with the downloaded Json, the excessive blank lines should be fixable. Are you using utf8 or utf16 (I had a similar issue with someone else's file in different project).