I suggest this as input format:
Code: Select all
\style TL
\color :black:pearl
\color P:black:pebble
\color R:black:red
Esc:R !:1: @:2: #:3: $:4: %:5: ^:6: &:7: *:8: (:9: ):0: _:-: +:=: Back\ \ Space:P200 \gap:50 Num:Lock:P /:P *:P -:P
\tabarrows:P150 Q: W: E: R: T: Y: U: I: O: P: {:[: }:]: \gap:150 \gap:50 7: 8: 9: +:P
\lock:P175S A: S: D: F: G: H: J: K: L: \::;: ":': |:\\: Return:PJRET \gap:50 4: 5: 6: &:P
\shift:P125 >:<: Z: X: C: V: B: N: M: <:,: >:.: ?:/: \shift:P275 \gap:50 1: 2: 3:
Control:P150 \gap: Alt:P150 :700 Alt\ \ Gr:P150 \gap: Control:P150 \gap:50 0:Insert:200 .:Del: Enter:P200V
It handles color, size, text placement style, custom legends, like shift arrow etc.
How it is parsed:
Just split up by space
You will get things like
Now put together the words which do not contain a colon (with the exception where : is preceded by \) until the last word contains a colon:
Now split each line by :
The last word (P150) is the color and size. If color is always 1 char, it is easy to split this up and look up color and size.
Any other words are text on the key cap. There could be arbitrarily many. Just place them according to the style (selected by \style).
In this case "Alt Gr" is the text.