How do I have capital letters in a custom keyboard?

To preface this, the point of this keyboard is for it to be able to type in the layout of Colemak and be able to type special characters in Esperanto. The Esperanto portion works as intended (some letters get a hat on them when I type the letter and then x) but when I try to capitalize the characters the layout becomes QWERTY again. Is there any way to make it type in Colemak in both upper and lowercase?

I’m rather new to this community so please be patient with me. As always, thank you in advance!

Here is the code:

+ [K_Z] > 'z'
+ [K_X] > 'x'
+ [K_C] > 'c'
+ [K_V] > 'v'
+ [K_B] > 'b'
+ [K_N] > 'k'
+ [K_M] > 'm'
+ [K_COMMA] > ','
+ [K_PERIOD] > '.'
+ [K_SLASH] > '/'
+ [K_QUOTE] > U+0027
+ [K_COLON] > 'o'
+ [K_L] > 'i'
+ [K_K] > 'e'
+ [K_J] > 'n'
+ [K_H] > 'h'
+ [K_G] > 'd'
+ [K_F] > 't'
+ [K_D] > 's'
+ [K_S] > 'r'
+ [K_A] > 'a'
+ [K_Q] > 'w'
+ [K_W] > 'w'
+ [K_E] > 'f'
+ [K_R] > 'p'
+ [K_T] > 'g'
+ [K_Y] > 'j'
+ [K_U] > 'l'
+ [K_I] > 'u'
+ [K_O] > 'y'
+ [K_P] > ';'
+ [K_LBRKT] > '['
+ [K_RBRKT] > ']'
+ [K_BKSLASH] > '\'
+ [K_EQUAL] > '='
+ [K_HYPHEN] > '-'
+ [K_0] > '0'
+ [K_9] > '9'
+ [K_8] > '8'
+ [K_7] > '7'
+ [K_6] > '6'
+ [K_5] > '5'
+ [K_4] > '4'
+ [K_3] > '3'
+ [K_2] > '2'
+ [K_BKQUOTE] > '`'
+ [K_1] > '1'
store(eobase) 'C' 'c' 'G' 'g' 'H' 'h' 'J' 'j' 'S' 's' 'U' 'u'
store(eodia) U+0108 U+0109 U+011C U+011D U+0124 U+0125 U+0134 U+0135 U+015C U+015D U+016C U+016D

any(eobase) + 'x' > index(eodia, 1)
any(eobase) + 'X' > index(eodia, 1)

I think you’ll need a separate rule for the upper case, for example:

+ [SHIFT K_L] > 'I'

etc.

You may wish to use “store” and “any” to reduce the number of rules you need to write.

Oh thank you so much!